djs-selfbot-v13 3.1.7 → 3.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +18 -45
  3. package/package.json +8 -37
  4. package/src/client/BaseClient.js +2 -3
  5. package/src/client/Client.js +187 -539
  6. package/src/client/actions/Action.js +18 -13
  7. package/src/client/actions/ActionsManager.js +7 -1
  8. package/src/client/actions/AutoModerationActionExecution.js +1 -0
  9. package/src/client/actions/AutoModerationRuleCreate.js +1 -0
  10. package/src/client/actions/AutoModerationRuleDelete.js +1 -0
  11. package/src/client/actions/AutoModerationRuleUpdate.js +1 -0
  12. package/src/client/actions/MessageCreate.js +0 -4
  13. package/src/client/actions/PresenceUpdate.js +17 -16
  14. package/src/client/websocket/WebSocketManager.js +11 -31
  15. package/src/client/websocket/WebSocketShard.js +39 -38
  16. package/src/client/websocket/handlers/CALL_CREATE.js +3 -3
  17. package/src/client/websocket/handlers/CALL_DELETE.js +2 -2
  18. package/src/client/websocket/handlers/CALL_UPDATE.js +2 -2
  19. package/src/client/websocket/handlers/CHANNEL_RECIPIENT_ADD.js +16 -13
  20. package/src/client/websocket/handlers/CHANNEL_RECIPIENT_REMOVE.js +11 -11
  21. package/src/client/websocket/handlers/GUILD_CREATE.js +7 -0
  22. package/src/client/websocket/handlers/INTERACTION_MODAL_CREATE.js +1 -0
  23. package/src/client/websocket/handlers/READY.js +47 -137
  24. package/src/client/websocket/handlers/RELATIONSHIP_ADD.js +7 -5
  25. package/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +6 -4
  26. package/src/client/websocket/handlers/RELATIONSHIP_UPDATE.js +32 -9
  27. package/src/client/websocket/handlers/USER_GUILD_SETTINGS_UPDATE.js +2 -8
  28. package/src/client/websocket/handlers/USER_NOTE_UPDATE.js +1 -1
  29. package/src/client/websocket/handlers/USER_REQUIRED_ACTION_UPDATE.js +78 -0
  30. package/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js +1 -5
  31. package/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js +12 -0
  32. package/src/client/websocket/handlers/index.js +15 -20
  33. package/src/errors/Messages.js +24 -69
  34. package/src/index.js +12 -43
  35. package/src/managers/ApplicationCommandManager.js +9 -12
  36. package/src/managers/ApplicationCommandPermissionsManager.js +3 -11
  37. package/src/managers/ChannelManager.js +3 -4
  38. package/src/managers/ClientUserSettingManager.js +161 -279
  39. package/src/managers/GuildBanManager.js +1 -1
  40. package/src/managers/GuildChannelManager.js +2 -0
  41. package/src/managers/GuildForumThreadManager.js +22 -28
  42. package/src/managers/GuildMemberManager.js +40 -216
  43. package/src/managers/GuildSettingManager.js +22 -15
  44. package/src/managers/MessageManager.js +42 -44
  45. package/src/managers/PermissionOverwriteManager.js +1 -1
  46. package/src/managers/ReactionUserManager.js +5 -5
  47. package/src/managers/RelationshipManager.js +81 -74
  48. package/src/managers/ThreadManager.js +12 -45
  49. package/src/managers/ThreadMemberManager.js +1 -1
  50. package/src/managers/UserManager.js +6 -10
  51. package/src/managers/UserNoteManager.js +53 -0
  52. package/src/rest/APIRequest.js +42 -20
  53. package/src/rest/DiscordAPIError.js +17 -16
  54. package/src/rest/RESTManager.js +1 -21
  55. package/src/rest/RequestHandler.js +35 -21
  56. package/src/structures/ApplicationCommand.js +19 -456
  57. package/src/structures/ApplicationRoleConnectionMetadata.js +3 -0
  58. package/src/structures/AutoModerationRule.js +5 -5
  59. package/src/structures/AutocompleteInteraction.js +1 -0
  60. package/src/structures/BaseGuildTextChannel.js +10 -12
  61. package/src/structures/BaseGuildVoiceChannel.js +16 -18
  62. package/src/structures/{Call.js → CallState.js} +17 -12
  63. package/src/structures/CategoryChannel.js +2 -0
  64. package/src/structures/Channel.js +2 -3
  65. package/src/structures/ClientPresence.js +12 -8
  66. package/src/structures/ClientUser.js +117 -336
  67. package/src/structures/ContextMenuInteraction.js +1 -1
  68. package/src/structures/DMChannel.js +29 -92
  69. package/src/structures/ForumChannel.js +0 -10
  70. package/src/structures/GroupDMChannel.js +387 -0
  71. package/src/structures/Guild.js +135 -271
  72. package/src/structures/GuildAuditLogs.js +0 -5
  73. package/src/structures/GuildChannel.js +16 -2
  74. package/src/structures/GuildMember.js +27 -145
  75. package/src/structures/Interaction.js +1 -62
  76. package/src/structures/Invite.js +35 -52
  77. package/src/structures/Message.js +228 -202
  78. package/src/structures/MessageAttachment.js +11 -0
  79. package/src/structures/MessageButton.js +1 -67
  80. package/src/structures/MessageEmbed.js +1 -1
  81. package/src/structures/MessageMentions.js +3 -2
  82. package/src/structures/MessagePayload.js +4 -46
  83. package/src/structures/MessageReaction.js +1 -1
  84. package/src/structures/MessageSelectMenu.js +1 -252
  85. package/src/structures/Modal.js +75 -180
  86. package/src/structures/Presence.js +2 -2
  87. package/src/structures/RichPresence.js +14 -34
  88. package/src/structures/Role.js +18 -2
  89. package/src/structures/SelectMenuInteraction.js +2 -151
  90. package/src/structures/Team.js +0 -49
  91. package/src/structures/TextInputComponent.js +0 -70
  92. package/src/structures/ThreadChannel.js +0 -19
  93. package/src/structures/User.js +117 -345
  94. package/src/structures/UserContextMenuInteraction.js +2 -2
  95. package/src/structures/VoiceState.js +74 -39
  96. package/src/structures/WebEmbed.js +38 -52
  97. package/src/structures/Webhook.js +17 -11
  98. package/src/structures/interfaces/Application.js +146 -23
  99. package/src/structures/interfaces/TextBasedChannel.js +411 -256
  100. package/src/util/ApplicationFlags.js +1 -1
  101. package/src/util/AttachmentFlags.js +38 -0
  102. package/src/util/Constants.js +106 -284
  103. package/src/util/Formatters.js +16 -2
  104. package/src/util/InviteFlags.js +29 -0
  105. package/src/util/LimitedCollection.js +1 -1
  106. package/src/util/Options.js +48 -68
  107. package/src/util/Permissions.js +5 -0
  108. package/src/util/PurchasedFlags.js +2 -0
  109. package/src/util/RemoteAuth.js +221 -356
  110. package/src/util/RoleFlags.js +37 -0
  111. package/src/util/Sweepers.js +1 -1
  112. package/src/util/Util.js +76 -36
  113. package/typings/enums.d.ts +18 -73
  114. package/typings/index.d.ts +873 -1225
  115. package/typings/rawDataTypes.d.ts +68 -9
  116. package/src/client/actions/InteractionCreate.js +0 -115
  117. package/src/client/websocket/handlers/APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE.js +0 -23
  118. package/src/client/websocket/handlers/GUILD_APPLICATION_COMMANDS_UPDATE.js +0 -11
  119. package/src/client/websocket/handlers/GUILD_MEMBER_LIST_UPDATE.js +0 -55
  120. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +0 -0
  121. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +0 -0
  122. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.js +0 -0
  123. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +0 -0
  124. package/src/client/websocket/handlers/INTERACTION_CREATE.js +0 -16
  125. package/src/client/websocket/handlers/INTERACTION_FAILURE.js +0 -18
  126. package/src/client/websocket/handlers/INTERACTION_SUCCESS.js +0 -30
  127. package/src/client/websocket/handlers/MESSAGE_ACK.js +0 -16
  128. package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +0 -0
  129. package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +0 -0
  130. package/src/managers/DeveloperPortalManager.js +0 -104
  131. package/src/managers/GuildApplicationCommandManager.js +0 -28
  132. package/src/managers/GuildFolderManager.js +0 -24
  133. package/src/managers/SessionManager.js +0 -57
  134. package/src/rest/CaptchaSolver.js +0 -132
  135. package/src/structures/ClientApplication.js +0 -204
  136. package/src/structures/DeveloperPortalApplication.js +0 -520
  137. package/src/structures/GuildFolder.js +0 -75
  138. package/src/structures/InteractionResponse.js +0 -114
  139. package/src/structures/PartialGroupDMChannel.js +0 -433
  140. package/src/structures/Session.js +0 -81
  141. package/src/util/Voice.js +0 -1456
  142. package/src/util/arRPC/index.js +0 -229
  143. package/src/util/arRPC/process/detectable.json +0 -1
  144. package/src/util/arRPC/process/index.js +0 -102
  145. package/src/util/arRPC/process/native/index.js +0 -5
  146. package/src/util/arRPC/process/native/linux.js +0 -37
  147. package/src/util/arRPC/process/native/win32.js +0 -25
  148. package/src/util/arRPC/transports/ipc.js +0 -281
  149. package/src/util/arRPC/transports/websocket.js +0 -128
@@ -3,7 +3,6 @@
3
3
  const { Buffer } = require('node:buffer');
4
4
  const BaseMessageComponent = require('./BaseMessageComponent');
5
5
  const MessageEmbed = require('./MessageEmbed');
6
- const WebEmbed = require('./WebEmbed');
7
6
  const { RangeError } = require('../errors');
8
7
  const ActivityFlags = require('../util/ActivityFlags');
9
8
  const DataResolver = require('../util/DataResolver');
@@ -42,7 +41,6 @@ class MessagePayload {
42
41
  * @property {Buffer|string|Stream} attachment The original attachment that generated this file
43
42
  * @property {string} name The name of this file
44
43
  * @property {Buffer|Stream} file The file to be sent to the API
45
- * @extends {APIAttachment}
46
44
  */
47
45
 
48
46
  /**
@@ -52,15 +50,6 @@ class MessagePayload {
52
50
  this.files = null;
53
51
  }
54
52
 
55
- /**
56
- * Whether or not using new API to upload files
57
- * @type {boolean}
58
- * @readonly
59
- */
60
- get usingNewAttachmentAPI() {
61
- return Boolean(this.options?.usingNewAttachmentAPI);
62
- }
63
-
64
53
  /**
65
54
  * Whether or not the target is a {@link Webhook} or a {@link WebhookClient}
66
55
  * @type {boolean}
@@ -133,12 +122,12 @@ class MessagePayload {
133
122
  * Resolves data.
134
123
  * @returns {MessagePayload}
135
124
  */
136
- async resolveData() {
125
+ resolveData() {
137
126
  if (this.data) return this;
138
127
  const isInteraction = this.isInteraction;
139
128
  const isWebhook = this.isWebhook;
140
129
 
141
- let content = this.makeContent();
130
+ const content = this.makeContent();
142
131
  const tts = Boolean(this.options.tts);
143
132
 
144
133
  let nonce;
@@ -208,37 +197,6 @@ class MessagePayload {
208
197
  this.options.attachments = attachments;
209
198
  }
210
199
 
211
- if (this.options.embeds) {
212
- if (!Array.isArray(this.options.embeds)) {
213
- this.options.embeds = [this.options.embeds];
214
- }
215
-
216
- const webembeds = this.options.embeds.filter(e => e instanceof WebEmbed);
217
- this.options.embeds = this.options.embeds.filter(e => !(e instanceof WebEmbed));
218
-
219
- if (webembeds.length > 0) {
220
- if (!content) content = '';
221
- // Add hidden embed link
222
- content += `\n${WebEmbed.hiddenEmbed} \n`;
223
- if (webembeds.length > 1) {
224
- console.warn('[WARN] Multiple webembeds are not supported, this will be ignored.');
225
- }
226
- // Const embed = webembeds[0];
227
- for (const webE of webembeds) {
228
- const data = await webE.toMessage();
229
- content += `\n${data}`;
230
- }
231
- }
232
- // Check content
233
- if (typeof content == 'string' && content.length > 2000) {
234
- console.warn('[WARN] Content is longer than 2000 characters.');
235
- }
236
- if (typeof content == 'string' && content.length > 4000) {
237
- // Max length if user has nitro boost
238
- throw new RangeError('MESSAGE_EMBED_LINK_LENGTH');
239
- }
240
- }
241
-
242
200
  // Activity
243
201
  let activity;
244
202
  if (
@@ -247,7 +205,7 @@ class MessagePayload {
247
205
  this.options.activity.type
248
206
  ) {
249
207
  const type = ActivityFlags.resolve(this.options.activity.type);
250
- const sessionId = this.target.client.session_id;
208
+ const sessionId = this.target.client.sessionId;
251
209
  const partyId = this.options.activity.partyId;
252
210
  activity = {
253
211
  type,
@@ -348,7 +306,7 @@ module.exports = MessagePayload;
348
306
 
349
307
  /**
350
308
  * A target for a message.
351
- * @typedef {TextBasedChannels|DMChannel|User|GuildMember|Webhook|WebhookClient|Interaction|InteractionWebhook|
309
+ * @typedef {TextBasedChannels|User|GuildMember|Webhook|WebhookClient|Interaction|InteractionWebhook|
352
310
  * Message|MessageManager} MessageTarget
353
311
  */
354
312
 
@@ -31,7 +31,7 @@ class MessageReaction {
31
31
  this.me = data.me || data.me_burst;
32
32
 
33
33
  /**
34
- * Super reaction
34
+ * Is super reaction
35
35
  * @type {boolean}
36
36
  */
37
37
  this.isBurst = Boolean(data.me_burst || data.burst);
@@ -1,16 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const { setTimeout } = require('node:timers');
4
3
  const BaseMessageComponent = require('./BaseMessageComponent');
5
- const {
6
- ChannelTypes,
7
- MessageComponentTypes,
8
- SelectMenuComponentTypes,
9
- InteractionTypes,
10
- } = require('../util/Constants');
11
- const SnowflakeUtil = require('../util/SnowflakeUtil');
12
- const { lazy } = require('../util/Util');
13
- const Message = lazy(() => require('./Message').Message);
4
+ const { ChannelTypes, MessageComponentTypes } = require('../util/Constants');
14
5
  const Util = require('../util/Util');
15
6
 
16
7
  /**
@@ -103,130 +94,6 @@ class MessageSelectMenu extends BaseMessageComponent {
103
94
  ) ?? [];
104
95
  }
105
96
 
106
- /**
107
- * Adds the channel types to the select menu
108
- * @param {...ChannelType[]} channelTypes Added channel types
109
- * @returns {MessageSelectMenu}
110
- */
111
- addChannelTypes(...channelTypes) {
112
- if (!channelTypes.every(channelType => ChannelTypes[channelType])) {
113
- throw new TypeError('INVALID_TYPE', 'channelTypes', 'Rest<ChannelTypes[]>');
114
- }
115
- this.channelTypes.push(
116
- ...channelTypes.map(channelType => (typeof channelType === 'string' ? channelType : ChannelTypes[channelType])),
117
- );
118
- return this;
119
- }
120
-
121
- /**
122
- * Sets the channel types of the select menu
123
- * @param {...ChannelType[]} channelTypes An array of new channel types
124
- * @returns {MessageSelectMenu}
125
- */
126
- setChannelTypes(...channelTypes) {
127
- if (!channelTypes.every(channelType => ChannelTypes[channelType])) {
128
- throw new TypeError('INVALID_TYPE', 'channelTypes', 'Rest<ChannelTypes[]>');
129
- }
130
- this.channelTypes = channelTypes.map(channelType =>
131
- typeof channelType === 'string' ? channelType : ChannelTypes[channelType],
132
- );
133
- return this;
134
- }
135
-
136
- /**
137
- * Sets the custom id of this select menu
138
- * @param {string} customId A unique string to be sent in the interaction when clicked
139
- * @returns {MessageSelectMenu}
140
- */
141
- setCustomId(customId) {
142
- this.customId = Util.verifyString(customId, RangeError, 'SELECT_MENU_CUSTOM_ID');
143
- return this;
144
- }
145
-
146
- /**
147
- * Sets the interactive status of the select menu
148
- * @param {boolean} [disabled=true] Whether this select menu should be disabled
149
- * @returns {MessageSelectMenu}
150
- */
151
- setDisabled(disabled = true) {
152
- this.disabled = disabled;
153
- return this;
154
- }
155
-
156
- /**
157
- * Sets the maximum number of selections allowed for this select menu
158
- * @param {number} maxValues Number of selections to be allowed
159
- * @returns {MessageSelectMenu}
160
- */
161
- setMaxValues(maxValues) {
162
- this.maxValues = maxValues;
163
- return this;
164
- }
165
-
166
- /**
167
- * Sets the minimum number of selections required for this select menu
168
- * <info>This will default the maxValues to the number of options, unless manually set</info>
169
- * @param {number} minValues Number of selections to be required
170
- * @returns {MessageSelectMenu}
171
- */
172
- setMinValues(minValues) {
173
- this.minValues = minValues;
174
- return this;
175
- }
176
-
177
- /**
178
- * Sets the placeholder of this select menu
179
- * @param {string} placeholder Custom placeholder text to display when nothing is selected
180
- * @returns {MessageSelectMenu}
181
- */
182
- setPlaceholder(placeholder) {
183
- this.placeholder = Util.verifyString(placeholder, RangeError, 'SELECT_MENU_PLACEHOLDER');
184
- return this;
185
- }
186
-
187
- /**
188
- * Sets the type of the select menu
189
- * @param {SelectMenuComponentType} type Type of the select menu
190
- * @returns {MessageSelectMenu}
191
- */
192
- setType(type) {
193
- if (!SelectMenuComponentTypes[type]) throw new TypeError('INVALID_TYPE', 'type', 'SelectMenuComponentType');
194
- this.type = BaseMessageComponent.resolveType(type);
195
- return this;
196
- }
197
-
198
- /**
199
- * Adds options to the select menu.
200
- * @param {...MessageSelectOptionData|MessageSelectOptionData[]} options The options to add
201
- * @returns {MessageSelectMenu}
202
- */
203
- addOptions(...options) {
204
- this.options.push(...this.constructor.normalizeOptions(options));
205
- return this;
206
- }
207
-
208
- /**
209
- * Sets the options of the select menu.
210
- * @param {...MessageSelectOptionData|MessageSelectOptionData[]} options The options to set
211
- * @returns {MessageSelectMenu}
212
- */
213
- setOptions(...options) {
214
- this.spliceOptions(0, this.options.length, options);
215
- return this;
216
- }
217
-
218
- /**
219
- * Removes, replaces, and inserts options in the select menu.
220
- * @param {number} index The index to start at
221
- * @param {number} deleteCount The number of options to remove
222
- * @param {...MessageSelectOptionData|MessageSelectOptionData[]} [options] The replacing option objects
223
- * @returns {MessageSelectMenu}
224
- */
225
- spliceOptions(index, deleteCount, ...options) {
226
- this.options.splice(index, deleteCount, ...this.constructor.normalizeOptions(...options));
227
- return this;
228
- }
229
-
230
97
  /**
231
98
  * Transforms the select menu into a plain object
232
99
  * @returns {APIMessageSelectMenu} The raw data of this select menu
@@ -268,124 +135,6 @@ class MessageSelectMenu extends BaseMessageComponent {
268
135
  static normalizeOptions(...options) {
269
136
  return options.flat(Infinity).map(option => this.normalizeOption(option));
270
137
  }
271
-
272
- // Add
273
- /**
274
- * Mesage select menu
275
- * @param {Message} message The message this select menu is for
276
- * @param {Array<any>} values The values of the select menu
277
- * @returns {Promise<InteractionResponse>}
278
- */
279
- async select(message, values) {
280
- if (!(message instanceof Message())) throw new Error('[UNKNOWN_MESSAGE] Please pass a valid Message');
281
- if (!Array.isArray(values)) throw new TypeError('[INVALID_VALUES] Please pass an array of values');
282
- if (!this.customId || this.disabled) {
283
- throw new Error('[INVALID_MENU] Menu does not contain Id or has been disabled');
284
- } // Disabled or null customID
285
- if (values.length < this.minValues) {
286
- throw new RangeError(`[SELECT_MENU_MIN_VALUES] The minimum number of values is ${this.minValues}`);
287
- }
288
- if (values.length > this.maxValues) {
289
- throw new RangeError(`[SELECT_MENU_MAX_VALUES] The maximum number of values is ${this.maxValues}`);
290
- }
291
- const parseValues = value => {
292
- switch (this.type) {
293
- case 'SELECT_MENU':
294
- case 'STRING_SELECT': {
295
- if (typeof value !== 'string') throw new TypeError('[INVALID_VALUE] Please pass a string value');
296
- const value_ = this.options.find(obj => obj.value === value || obj.label === value);
297
- if (!value_) throw new Error('[INVALID_VALUE] Please pass a valid value');
298
- return value_.value;
299
- }
300
- case 'USER_SELECT': {
301
- const userId = this.client.users.resolveId(value);
302
- if (!userId) throw new Error('[INVALID_VALUE] Please pass a valid user');
303
- return userId;
304
- }
305
- case 'ROLE_SELECT': {
306
- const roleId = this.client.roles.resolveId(value);
307
- if (!roleId) throw new Error('[INVALID_VALUE] Please pass a valid role');
308
- return roleId;
309
- }
310
- case 'MENTIONABLE_SELECT': {
311
- const mentionableId = this.client.users.resolveId(value) || this.client.roles.resolveId(value);
312
- if (!mentionableId) throw new Error('[INVALID_VALUE] Please pass a valid mentionable');
313
- return mentionableId;
314
- }
315
- case 'CHANNEL_SELECT': {
316
- const channel = this.client.channels.resolve(value);
317
- if (!channel) throw new Error('[INVALID_VALUE] Please pass a valid channel');
318
- if (!this.channelTypes.includes(channel.type)) {
319
- throw new Error(
320
- `[INVALID_VALUE] Please pass a valid channel type (Got: ${channel.type}, allow: ${this.channelTypes.join(
321
- ', ',
322
- )})`,
323
- );
324
- }
325
- return channel.id;
326
- }
327
- default: {
328
- throw new Error(`[INVALID_TYPE] Please pass a valid select menu type (Got ${this.type})`);
329
- }
330
- }
331
- };
332
-
333
- const nonce = SnowflakeUtil.generate();
334
- const data = {
335
- type: InteractionTypes.MESSAGE_COMPONENT,
336
- guild_id: message.guild?.id ?? null,
337
- channel_id: message.channel.id,
338
- message_id: message.id,
339
- application_id: message.applicationId ?? message.author.id,
340
- session_id: message.client.session_id,
341
- message_flags: message.flags.bitfield,
342
- data: {
343
- component_type: MessageComponentTypes[this.type],
344
- custom_id: this.customId,
345
- type: MessageComponentTypes[this.type],
346
- values: values?.length ? values.map(parseValues) : [],
347
- },
348
- nonce,
349
- };
350
-
351
- await message.client.api.interactions.post({
352
- data,
353
- });
354
- message.client._interactionCache.set(nonce, {
355
- channelId: message.channelId,
356
- guildId: message.guildId,
357
- metadata: data,
358
- });
359
- return new Promise((resolve, reject) => {
360
- const handler = data => {
361
- timeout.refresh();
362
- if (data.metadata?.nonce !== nonce) return;
363
- clearTimeout(timeout);
364
- message.client.removeListener('interactionResponse', handler);
365
- message.client.decrementMaxListeners();
366
- if (data.status) {
367
- resolve(data.metadata);
368
- } else {
369
- reject(
370
- new Error('INTERACTION_ERROR', {
371
- cause: data,
372
- }),
373
- );
374
- }
375
- };
376
- const timeout = setTimeout(() => {
377
- message.client.removeListener('interactionResponse', handler);
378
- message.client.decrementMaxListeners();
379
- reject(
380
- new Error('INTERACTION_TIMEOUT', {
381
- cause: data,
382
- }),
383
- );
384
- }, message.client.options.interactionTimeout).unref();
385
- message.client.incrementMaxListeners();
386
- message.client.on('interactionResponse', handler);
387
- });
388
- }
389
138
  }
390
139
 
391
140
  module.exports = MessageSelectMenu;