diff --git a/src/client/websocket/handlers/INTERACTION_CREATE.js b/src/client/websocket/handlers/INTERACTION_CREATE.js index da1c1d6..0007962 100644 --- a/src/client/websocket/handlers/INTERACTION_CREATE.js +++ b/src/client/websocket/handlers/INTERACTION_CREATE.js @@ -7,10 +7,10 @@ const { Events } = require('../../../util/Constants'); * @property {Snowflake} nonce nonce in POST /interactions */ -module.exports = (client, packet) => { +module.exports = (client, { d: data }) => { if (client.user.bot) { - client.actions.InteractionCreate.handle(packet.d); + client.actions.InteractionCreate.handle(data); } else { - client.emit(Events.INTERACTION_CREATE, packet.d); + client.emit(Events.INTERACTION_CREATE, data); } }; diff --git a/src/structures/ApplicationCommand.js b/src/structures/ApplicationCommand.js index d398a2f..3928744 100644 --- a/src/structures/ApplicationCommand.js +++ b/src/structures/ApplicationCommand.js @@ -907,7 +907,11 @@ class ApplicationCommand extends Base { const timeout = setTimeout(() => { this.client.removeListener('interactionResponse', handler); this.client.decrementMaxListeners(); - reject(new Error('INTERACTION_TIMEOUT')); + reject( + new Error('INTERACTION_TIMEOUT', { + cause: data, + }), + ); }, this.client.options.interactionTimeout).unref(); this.client.incrementMaxListeners(); this.client.on('interactionResponse', handler); @@ -998,7 +1002,11 @@ class ApplicationCommand extends Base { const timeout = setTimeout(() => { this.client.removeListener('interactionResponse', handler); this.client.decrementMaxListeners(); - reject(new Error('INTERACTION_TIMEOUT')); + reject( + new Error('INTERACTION_TIMEOUT', { + cause: data, + }), + ); }, this.client.options.interactionTimeout).unref(); this.client.incrementMaxListeners(); this.client.on('interactionResponse', handler); diff --git a/src/structures/MessageButton.js b/src/structures/MessageButton.js index 8033ffa..835d115 100644 --- a/src/structures/MessageButton.js +++ b/src/structures/MessageButton.js @@ -173,7 +173,7 @@ class MessageButton extends BaseMessageComponent { async click(message) { const nonce = SnowflakeUtil.generate(); if (!(message instanceof Message())) throw new Error('[UNKNOWN_MESSAGE] Please pass a valid Message'); - if (!this.customId || this.style == 5 || this.disabled) return false; // Button URL, Disabled + if (!this.customId || this.style == MessageButtonStyles.LINK || this.disabled) return false; const data = { type: InteractionTypes.MESSAGE_COMPONENT, nonce, @@ -216,7 +216,11 @@ class MessageButton extends BaseMessageComponent { const timeout = setTimeout(() => { message.client.removeListener('interactionResponse', handler); message.client.decrementMaxListeners(); - reject(new Error('INTERACTION_TIMEOUT')); + reject( + new Error('INTERACTION_TIMEOUT', { + cause: data, + }), + ); }, message.client.options.interactionTimeout).unref(); message.client.incrementMaxListeners(); message.client.on('interactionResponse', handler); diff --git a/src/structures/MessageSelectMenu.js b/src/structures/MessageSelectMenu.js index 919ccb4..a656d88 100644 --- a/src/structures/MessageSelectMenu.js +++ b/src/structures/MessageSelectMenu.js @@ -396,7 +396,11 @@ class MessageSelectMenu extends BaseMessageComponent { const timeout = setTimeout(() => { message.client.removeListener('interactionResponse', handler); message.client.decrementMaxListeners(); - reject(new Error('INTERACTION_TIMEOUT')); + reject( + new Error('INTERACTION_TIMEOUT', { + cause: data, + }), + ); }, message.client.options.interactionTimeout).unref(); message.client.incrementMaxListeners(); message.client.on('interactionResponse', handler);