feat: right-clickybois (context menu support for ApplicationCommand and CommandInteraction) (#6176)

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
This commit is contained in:
monbrey
2021-08-11 08:56:12 +10:00
committed by GitHub
parent 779e14ef61
commit 0266f28096
12 changed files with 328 additions and 180 deletions

View File

@@ -3,8 +3,9 @@
const Action = require('./Action');
const ButtonInteraction = require('../../structures/ButtonInteraction');
const CommandInteraction = require('../../structures/CommandInteraction');
const ContextMenuInteraction = require('../../structures/ContextMenuInteraction');
const SelectMenuInteraction = require('../../structures/SelectMenuInteraction');
const { Events, InteractionTypes, MessageComponentTypes } = require('../../util/Constants');
const { Events, InteractionTypes, MessageComponentTypes, ApplicationCommandTypes } = require('../../util/Constants');
let deprecationEmitted = false;
@@ -18,7 +19,21 @@ class InteractionCreateAction extends Action {
let InteractionType;
switch (data.type) {
case InteractionTypes.APPLICATION_COMMAND:
InteractionType = CommandInteraction;
switch (data.data.type) {
case ApplicationCommandTypes.CHAT_INPUT:
InteractionType = CommandInteraction;
break;
case ApplicationCommandTypes.USER:
case ApplicationCommandTypes.MESSAGE:
InteractionType = ContextMenuInteraction;
break;
default:
client.emit(
Events.DEBUG,
`[INTERACTION] Received application command interaction with unknown type: ${data.data.type}`,
);
return;
}
break;
case InteractionTypes.MESSAGE_COMPONENT:
switch (data.data.component_type) {