diff --git a/src/structures/ApplicationCommand.js b/src/structures/ApplicationCommand.js index 6061714..4bc2fbb 100644 --- a/src/structures/ApplicationCommand.js +++ b/src/structures/ApplicationCommand.js @@ -858,7 +858,7 @@ class ApplicationCommand extends Base { this.client.removeListener(Events.APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE, handler); this.client.decrementMaxListeners(); resolve(value); - }, 15_000).unref(); + }, this.client.options.interactionTimeout).unref(); this.client.incrementMaxListeners(); this.client.on(Events.APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE, handler); }); @@ -896,7 +896,7 @@ class ApplicationCommand extends Base { this.client.removeListener('interactionResponse', handler); this.client.decrementMaxListeners(); reject(new Error('INTERACTION_TIMEOUT')); - }, 15_000).unref(); + }, this.client.options.interactionTimeout).unref(); this.client.incrementMaxListeners(); this.client.on('interactionResponse', handler); }); @@ -987,7 +987,7 @@ class ApplicationCommand extends Base { this.client.removeListener('interactionResponse', handler); this.client.decrementMaxListeners(); reject(new Error('INTERACTION_TIMEOUT')); - }, 15_000).unref(); + }, this.client.options.interactionTimeout).unref(); this.client.incrementMaxListeners(); this.client.on('interactionResponse', handler); }); diff --git a/src/util/Options.js b/src/util/Options.js index f3fd0d9..49b89f5 100644 --- a/src/util/Options.js +++ b/src/util/Options.js @@ -39,9 +39,10 @@ const { randomUA } = require('../util/Constants'); * @property {boolean} [readyStatus=true] Sync state with Discord Client * @property {boolean} [autoCookie=true] Automatically add Cookies to Request on startup * @property {boolean} [patchVoice=false] Automatically patch @discordjs/voice module (support for call) - * @property {string} [captchaService=null] Captcha service to use for solving captcha + * @property {string} [captchaService=null] Captcha service to use for solving captcha {@link captchaServices} * @property {string} [captchaKey=null] Captcha service key * @property {string} [password=null] Your Discord account password + * @property {string} [interactionTimeout=15000] The amount of time in milliseconds to wait for an interaction response, before rejecting * @property {boolean} [autoRedeemNitro=false] Automaticlly redeems nitro codes * @property {string} [proxy] Proxy to use for the WebSocket + REST connection (proxy-agent uri type) {@link https://www.npmjs.com/package/proxy-agent}. * @property {boolean} [DMSync=false] Automatically synchronize call status (DM and group) at startup (event synchronization) [Warning: May cause rate limit to gateway) @@ -156,6 +157,7 @@ class Options extends null { DMSync: false, patchVoice: false, password: null, + interactionTimeout: 15_000, waitGuildTimeout: 15_000, messageCreateEventGuildTimeout: 100, shardCount: 1, diff --git a/typings/index.d.ts b/typings/index.d.ts index 06977f4..6797bc9 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -4716,6 +4716,7 @@ export interface ClientOptions { proxy?: string; captchaService?: string; captchaKey?: string; + interactionTimeout?: number; } // end copy