mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
feat: interactions (#5448)
Co-authored-by: izexi <43889168+izexi@users.noreply.github.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Advaith <advaithj1@gmail.com> Co-authored-by: Shiaupiau <stu43005@gmail.com> Co-authored-by: monbrey <rsm999@uowmail.edu.au> Co-authored-by: Tiemen <ThaTiemsz@users.noreply.github.com> Co-authored-by: Carter <carter@elhnet.net>
This commit is contained in:
23
src/client/websocket/handlers/INTERACTION_CREATE.js
Normal file
23
src/client/websocket/handlers/INTERACTION_CREATE.js
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
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');
|
||||
|
||||
const interaction = new CommandInteraction(client, data);
|
||||
|
||||
/**
|
||||
* Emitted when an interaction is created.
|
||||
* @event Client#interaction
|
||||
* @param {Interaction} interaction The interaction which was created
|
||||
*/
|
||||
client.emit(Events.INTERACTION_CREATE, interaction);
|
||||
return;
|
||||
}
|
||||
|
||||
client.emit(Events.DEBUG, `[INTERACTION] Received interaction with unknown type: ${data.type}`);
|
||||
};
|
||||
Reference in New Issue
Block a user