mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
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:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user