feat(MessageComponents): clickybois (MessageButton, MessageActionRow, associated Collectors) (#5674)

Co-authored-by: Vicente <33096355+Vicente015@users.noreply.github.com>
Co-authored-by: Shubham Parihar <shubhamparihar391@gmail.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: BannerBomb <BannerBomb55@gmail.com>
Co-authored-by: Arechi <22101241+Arechii@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
monbrey
2021-06-05 01:49:46 +10:00
committed by GitHub
parent df9b67894a
commit cbd7f2b9aa
19 changed files with 1190 additions and 158 deletions

View File

@@ -4,20 +4,31 @@ const { Events, InteractionTypes } = require('../../../util/Constants');
let Structures;
module.exports = (client, { d: data }) => {
if (data.type === InteractionTypes.APPLICATION_COMMAND) {
if (!Structures) Structures = require('../../../util/Structures');
const CommandInteraction = Structures.get('CommandInteraction');
let interaction;
switch (data.type) {
case InteractionTypes.APPLICATION_COMMAND: {
if (!Structures) Structures = require('../../../util/Structures');
const CommandInteraction = Structures.get('CommandInteraction');
const interaction = new CommandInteraction(client, data);
interaction = new CommandInteraction(client, data);
break;
}
case InteractionTypes.MESSAGE_COMPONENT: {
if (!Structures) Structures = require('../../../util/Structures');
const MessageComponentInteraction = Structures.get('MessageComponentInteraction');
/**
* Emitted when an interaction is created.
* @event Client#interaction
* @param {Interaction} interaction The interaction which was created
*/
client.emit(Events.INTERACTION_CREATE, interaction);
return;
interaction = new MessageComponentInteraction(client, data);
break;
}
default:
client.emit(Events.DEBUG, `[INTERACTION] Received interaction with unknown type: ${data.type}`);
return;
}
client.emit(Events.DEBUG, `[INTERACTION] Received interaction with unknown type: ${data.type}`);
/**
* Emitted when an interaction is created.
* @event Client#interaction
* @param {Interaction} interaction The interaction which was created
*/
client.emit(Events.INTERACTION_CREATE, interaction);
};