discord.js 15.0.0-dev.1736101740-9a400730f → 15.0.0-dev.1736727169-101bef1c5
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.
- package/package.json +3 -3
- package/src/index.js +0 -1
- package/src/structures/IntegrationApplication.js +0 -10
- package/src/structures/InteractionCollector.js +3 -33
- package/src/structures/Message.js +0 -1
- package/src/structures/interfaces/InteractionResponses.js +12 -19
- package/typings/index.d.mts +65 -45
- package/typings/index.d.ts +65 -45
- package/typings/index.test-d.ts +161 -0
- package/src/structures/InteractionResponse.js +0 -102
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "discord.js",
|
|
4
|
-
"version": "15.0.0-dev.
|
|
4
|
+
"version": "15.0.0-dev.1736727169-101bef1c5",
|
|
5
5
|
"description": "A powerful library for interacting with the Discord API",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"types": "./typings/index.d.ts",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"lodash.snakecase": "4.1.1",
|
|
61
61
|
"tslib": "^2.8.1",
|
|
62
62
|
"undici": "6.21.0",
|
|
63
|
+
"@discordjs/formatters": "^0.5.0",
|
|
63
64
|
"@discordjs/rest": "^2.4.0",
|
|
64
65
|
"@discordjs/util": "^1.1.1",
|
|
65
|
-
"@discordjs/ws": "^2.0.0"
|
|
66
|
-
"@discordjs/formatters": "^0.5.0"
|
|
66
|
+
"@discordjs/ws": "^2.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@favware/cliff-jumper": "^4.1.0",
|
package/src/index.js
CHANGED
|
@@ -148,7 +148,6 @@ exports.InteractionCallbackResource = require('./structures/InteractionCallbackR
|
|
|
148
148
|
exports.InteractionCallbackResponse = require('./structures/InteractionCallbackResponse');
|
|
149
149
|
exports.BaseInteraction = require('./structures/BaseInteraction');
|
|
150
150
|
exports.InteractionCollector = require('./structures/InteractionCollector');
|
|
151
|
-
exports.InteractionResponse = require('./structures/InteractionResponse');
|
|
152
151
|
exports.InteractionWebhook = require('./structures/InteractionWebhook');
|
|
153
152
|
exports.Invite = require('./structures/Invite');
|
|
154
153
|
exports.InviteGuild = require('./structures/InviteGuild');
|
|
@@ -50,16 +50,6 @@ class IntegrationApplication extends Application {
|
|
|
50
50
|
this.rpcOrigins ??= [];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
if ('hook' in data) {
|
|
54
|
-
/**
|
|
55
|
-
* Whether the application can be default hooked by the client
|
|
56
|
-
* @type {?boolean}
|
|
57
|
-
*/
|
|
58
|
-
this.hook = data.hook;
|
|
59
|
-
} else {
|
|
60
|
-
this.hook ??= null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
53
|
if ('cover_image' in data) {
|
|
64
54
|
/**
|
|
65
55
|
* The hash of the application's cover image
|
|
@@ -14,8 +14,6 @@ const Events = require('../util/Events');
|
|
|
14
14
|
* @property {number} [maxComponents] The maximum number of components to collect
|
|
15
15
|
* @property {number} [maxUsers] The maximum number of users to interact
|
|
16
16
|
* @property {Message|APIMessage} [message] The message to listen to interactions from
|
|
17
|
-
* @property {InteractionResponse} [interactionResponse] The interaction response to listen
|
|
18
|
-
* to message component interactions from
|
|
19
17
|
*/
|
|
20
18
|
|
|
21
19
|
/**
|
|
@@ -40,30 +38,20 @@ class InteractionCollector extends Collector {
|
|
|
40
38
|
* The message from which to collect interactions, if provided
|
|
41
39
|
* @type {?Snowflake}
|
|
42
40
|
*/
|
|
43
|
-
this.messageId = options.message?.id ??
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The message interaction id from which to collect interactions, if provided
|
|
47
|
-
* @type {?Snowflake}
|
|
48
|
-
*/
|
|
49
|
-
this.messageInteractionId = options.interactionResponse?.id ?? null;
|
|
41
|
+
this.messageId = options.message?.id ?? null;
|
|
50
42
|
|
|
51
43
|
/**
|
|
52
44
|
* The channel from which to collect interactions, if provided
|
|
53
45
|
* @type {?Snowflake}
|
|
54
46
|
*/
|
|
55
47
|
this.channelId =
|
|
56
|
-
options.
|
|
57
|
-
options.message?.channelId ??
|
|
58
|
-
options.message?.channel_id ??
|
|
59
|
-
this.client.channels.resolveId(options.channel);
|
|
48
|
+
options.message?.channelId ?? options.message?.channel_id ?? this.client.channels.resolveId(options.channel);
|
|
60
49
|
|
|
61
50
|
/**
|
|
62
51
|
* The guild from which to collect interactions, if provided
|
|
63
52
|
* @type {?Snowflake}
|
|
64
53
|
*/
|
|
65
54
|
this.guildId =
|
|
66
|
-
options.interactionResponse?.interaction.guildId ??
|
|
67
55
|
options.message?.guildId ??
|
|
68
56
|
options.message?.guild_id ??
|
|
69
57
|
this.client.guilds.resolveId(options.channel?.guild) ??
|
|
@@ -99,7 +87,7 @@ class InteractionCollector extends Collector {
|
|
|
99
87
|
if (messages.has(this.messageId)) this.stop('messageDelete');
|
|
100
88
|
};
|
|
101
89
|
|
|
102
|
-
if (this.messageId
|
|
90
|
+
if (this.messageId) {
|
|
103
91
|
this._handleMessageDeletion = this._handleMessageDeletion.bind(this);
|
|
104
92
|
this.client.on(Events.MessageDelete, this._handleMessageDeletion);
|
|
105
93
|
this.client.on(Events.MessageBulkDelete, bulkDeleteListener);
|
|
@@ -151,13 +139,6 @@ class InteractionCollector extends Collector {
|
|
|
151
139
|
if (this.interactionType && interaction.type !== this.interactionType) return null;
|
|
152
140
|
if (this.componentType && interaction.componentType !== this.componentType) return null;
|
|
153
141
|
if (this.messageId && interaction.message?.id !== this.messageId) return null;
|
|
154
|
-
if (
|
|
155
|
-
this.messageInteractionId &&
|
|
156
|
-
interaction.message?.interactionMetadata?.id &&
|
|
157
|
-
interaction.message.interactionMetadata.id !== this.messageInteractionId
|
|
158
|
-
) {
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
142
|
if (this.channelId && interaction.channelId !== this.channelId) return null;
|
|
162
143
|
if (this.guildId && interaction.guildId !== this.guildId) return null;
|
|
163
144
|
|
|
@@ -178,13 +159,6 @@ class InteractionCollector extends Collector {
|
|
|
178
159
|
if (this.type && interaction.type !== this.type) return null;
|
|
179
160
|
if (this.componentType && interaction.componentType !== this.componentType) return null;
|
|
180
161
|
if (this.messageId && interaction.message?.id !== this.messageId) return null;
|
|
181
|
-
if (
|
|
182
|
-
this.messageInteractionId &&
|
|
183
|
-
interaction.message?.interactionMetadata?.id &&
|
|
184
|
-
interaction.message.interactionMetadata.id !== this.messageInteractionId
|
|
185
|
-
) {
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
162
|
if (this.channelId && interaction.channelId !== this.channelId) return null;
|
|
189
163
|
if (this.guildId && interaction.guildId !== this.guildId) return null;
|
|
190
164
|
|
|
@@ -223,10 +197,6 @@ class InteractionCollector extends Collector {
|
|
|
223
197
|
if (message.id === this.messageId) {
|
|
224
198
|
this.stop('messageDelete');
|
|
225
199
|
}
|
|
226
|
-
|
|
227
|
-
if (message.interactionMetadata?.id === this.messageInteractionId) {
|
|
228
|
-
this.stop('messageDelete');
|
|
229
|
-
}
|
|
230
200
|
}
|
|
231
201
|
|
|
232
202
|
/**
|
|
@@ -644,7 +644,6 @@ class Message extends Base {
|
|
|
644
644
|
* @property {ComponentType} [componentType] The type of component interaction to collect
|
|
645
645
|
* @property {number} [idle] Time to wait without another message component interaction before ending the collector
|
|
646
646
|
* @property {boolean} [dispose] Whether to remove the message component interaction after collecting
|
|
647
|
-
* @property {InteractionResponse} [interactionResponse] The interaction response to collect interactions from
|
|
648
647
|
*/
|
|
649
648
|
|
|
650
649
|
/**
|
|
@@ -7,7 +7,6 @@ const { DiscordjsError, ErrorCodes } = require('../../errors');
|
|
|
7
7
|
const MessageFlagsBitField = require('../../util/MessageFlagsBitField');
|
|
8
8
|
const InteractionCallbackResponse = require('../InteractionCallbackResponse');
|
|
9
9
|
const InteractionCollector = require('../InteractionCollector');
|
|
10
|
-
const InteractionResponse = require('../InteractionResponse');
|
|
11
10
|
const MessagePayload = require('../MessagePayload');
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -61,7 +60,7 @@ class InteractionResponses {
|
|
|
61
60
|
/**
|
|
62
61
|
* Defers the reply to this interaction.
|
|
63
62
|
* @param {InteractionDeferReplyOptions} [options] Options for deferring the reply to this interaction
|
|
64
|
-
* @returns {Promise<
|
|
63
|
+
* @returns {Promise<InteractionCallbackResponse|undefined>}
|
|
65
64
|
* @example
|
|
66
65
|
* // Defer the reply to this interaction
|
|
67
66
|
* interaction.deferReply()
|
|
@@ -92,16 +91,14 @@ class InteractionResponses {
|
|
|
92
91
|
this.deferred = true;
|
|
93
92
|
this.ephemeral = resolvedFlags.has(MessageFlags.Ephemeral);
|
|
94
93
|
|
|
95
|
-
return options.withResponse
|
|
96
|
-
? new InteractionCallbackResponse(this.client, response)
|
|
97
|
-
: new InteractionResponse(this);
|
|
94
|
+
return options.withResponse ? new InteractionCallbackResponse(this.client, response) : undefined;
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
/**
|
|
101
98
|
* Creates a reply to this interaction.
|
|
102
99
|
* <info>Use the `withResponse` option to get the interaction callback response.</info>
|
|
103
100
|
* @param {string|MessagePayload|InteractionReplyOptions} options The options for the reply
|
|
104
|
-
* @returns {Promise<
|
|
101
|
+
* @returns {Promise<InteractionCallbackResponse|undefined>}
|
|
105
102
|
* @example
|
|
106
103
|
* // Reply to the interaction and fetch the response
|
|
107
104
|
* interaction.reply({ content: 'Pong!', withResponse: true })
|
|
@@ -137,9 +134,7 @@ class InteractionResponses {
|
|
|
137
134
|
this.ephemeral = Boolean(data.flags & MessageFlags.Ephemeral);
|
|
138
135
|
this.replied = true;
|
|
139
136
|
|
|
140
|
-
return options.withResponse
|
|
141
|
-
? new InteractionCallbackResponse(this.client, response)
|
|
142
|
-
: new InteractionResponse(this);
|
|
137
|
+
return options.withResponse ? new InteractionCallbackResponse(this.client, response) : undefined;
|
|
143
138
|
}
|
|
144
139
|
|
|
145
140
|
/**
|
|
@@ -203,15 +198,17 @@ class InteractionResponses {
|
|
|
203
198
|
* @param {string|MessagePayload|InteractionReplyOptions} options The options for the reply
|
|
204
199
|
* @returns {Promise<Message>}
|
|
205
200
|
*/
|
|
206
|
-
followUp(options) {
|
|
201
|
+
async followUp(options) {
|
|
207
202
|
if (!this.deferred && !this.replied) return Promise.reject(new DiscordjsError(ErrorCodes.InteractionNotReplied));
|
|
208
|
-
|
|
203
|
+
const msg = await this.webhook.send(options);
|
|
204
|
+
this.replied = true;
|
|
205
|
+
return msg;
|
|
209
206
|
}
|
|
210
207
|
|
|
211
208
|
/**
|
|
212
209
|
* Defers an update to the message to which the component was attached.
|
|
213
210
|
* @param {InteractionDeferUpdateOptions} [options] Options for deferring the update to this interaction
|
|
214
|
-
* @returns {Promise<
|
|
211
|
+
* @returns {Promise<InteractionCallbackResponse|undefined>}
|
|
215
212
|
* @example
|
|
216
213
|
* // Defer updating and reset the component's loading state
|
|
217
214
|
* interaction.deferUpdate()
|
|
@@ -229,15 +226,13 @@ class InteractionResponses {
|
|
|
229
226
|
});
|
|
230
227
|
this.deferred = true;
|
|
231
228
|
|
|
232
|
-
return options.withResponse
|
|
233
|
-
? new InteractionCallbackResponse(this.client, response)
|
|
234
|
-
: new InteractionResponse(this, this.message?.interactionMetadata?.id);
|
|
229
|
+
return options.withResponse ? new InteractionCallbackResponse(this.client, response) : undefined;
|
|
235
230
|
}
|
|
236
231
|
|
|
237
232
|
/**
|
|
238
233
|
* Updates the original message of the component on which the interaction was received on.
|
|
239
234
|
* @param {string|MessagePayload|InteractionUpdateOptions} options The options for the updated message
|
|
240
|
-
* @returns {Promise<
|
|
235
|
+
* @returns {Promise<InteractionCallbackResponse|undefined>}
|
|
241
236
|
* @example
|
|
242
237
|
* // Remove the components from the message
|
|
243
238
|
* interaction.update({
|
|
@@ -267,9 +262,7 @@ class InteractionResponses {
|
|
|
267
262
|
});
|
|
268
263
|
this.replied = true;
|
|
269
264
|
|
|
270
|
-
return options.withResponse
|
|
271
|
-
? new InteractionCallbackResponse(this.client, response)
|
|
272
|
-
: new InteractionResponse(this, this.message.interactionMetadata?.id);
|
|
265
|
+
return options.withResponse ? new InteractionCallbackResponse(this.client, response) : undefined;
|
|
273
266
|
}
|
|
274
267
|
|
|
275
268
|
/**
|
package/typings/index.d.mts
CHANGED
|
@@ -568,7 +568,8 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
568
568
|
public deferReply(
|
|
569
569
|
options: InteractionDeferReplyOptions & { withResponse: true },
|
|
570
570
|
): Promise<InteractionCallbackResponse>;
|
|
571
|
-
public deferReply(options?: InteractionDeferReplyOptions): Promise<
|
|
571
|
+
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
572
|
+
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
572
573
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
|
573
574
|
public editReply(
|
|
574
575
|
options: string | MessagePayload | InteractionEditReplyOptions,
|
|
@@ -576,9 +577,10 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
576
577
|
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
|
577
578
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
|
578
579
|
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
580
|
+
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
579
581
|
public reply(
|
|
580
582
|
options: string | MessagePayload | InteractionReplyOptions,
|
|
581
|
-
): Promise<
|
|
583
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
582
584
|
public showModal(
|
|
583
585
|
modal:
|
|
584
586
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
@@ -591,8 +593,15 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
591
593
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
592
594
|
| ModalComponentData
|
|
593
595
|
| APIModalInteractionResponseCallbackData,
|
|
594
|
-
options?: ShowModalOptions,
|
|
596
|
+
options?: ShowModalOptions & { withResponse: false },
|
|
595
597
|
): Promise<undefined>;
|
|
598
|
+
public showModal(
|
|
599
|
+
modal:
|
|
600
|
+
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
601
|
+
| ModalComponentData
|
|
602
|
+
| APIModalInteractionResponseCallbackData,
|
|
603
|
+
options?: ShowModalOptions,
|
|
604
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
596
605
|
public awaitModalSubmit(
|
|
597
606
|
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
|
598
607
|
): Promise<ModalSubmitInteraction<Cached>>;
|
|
@@ -602,24 +611,6 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
602
611
|
): CommandInteractionOption<Cached>;
|
|
603
612
|
}
|
|
604
613
|
|
|
605
|
-
export class InteractionResponse<Cached extends boolean = boolean> {
|
|
606
|
-
private constructor(interaction: Interaction, id?: Snowflake);
|
|
607
|
-
public interaction: Interaction<WrapBooleanCache<Cached>>;
|
|
608
|
-
public client: Client;
|
|
609
|
-
public id: Snowflake;
|
|
610
|
-
public get createdAt(): Date;
|
|
611
|
-
public get createdTimestamp(): number;
|
|
612
|
-
public awaitMessageComponent<ComponentType extends MessageComponentType>(
|
|
613
|
-
options?: AwaitMessageCollectorOptionsParams<ComponentType, Cached>,
|
|
614
|
-
): Promise<MappedInteractionTypes<Cached>[ComponentType]>;
|
|
615
|
-
public createMessageComponentCollector<ComponentType extends MessageComponentType>(
|
|
616
|
-
options?: MessageCollectorOptionsParams<ComponentType, Cached>,
|
|
617
|
-
): InteractionCollector<MappedInteractionTypes<Cached>[ComponentType]>;
|
|
618
|
-
public delete(): Promise<void>;
|
|
619
|
-
public edit(options: string | MessagePayload | WebhookMessageEditOptions): Promise<Message>;
|
|
620
|
-
public fetch(): Promise<Message>;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
614
|
export abstract class BaseGuild extends Base {
|
|
624
615
|
protected constructor(client: Client<true>, data: RawBaseGuildData);
|
|
625
616
|
public get createdAt(): Date;
|
|
@@ -1903,7 +1894,6 @@ export class IntegrationApplication extends Application {
|
|
|
1903
1894
|
public termsOfServiceURL: string | null;
|
|
1904
1895
|
public privacyPolicyURL: string | null;
|
|
1905
1896
|
public rpcOrigins: string[];
|
|
1906
|
-
public hook: boolean | null;
|
|
1907
1897
|
public cover: string | null;
|
|
1908
1898
|
public verifyKey: string | null;
|
|
1909
1899
|
}
|
|
@@ -2034,7 +2024,6 @@ export class InteractionCollector<Interaction extends CollectedInteraction> exte
|
|
|
2034
2024
|
private _handleGuildDeletion(guild: Guild): void;
|
|
2035
2025
|
|
|
2036
2026
|
public channelId: Snowflake | null;
|
|
2037
|
-
public messageInteractionId: Snowflake | null;
|
|
2038
2027
|
public componentType: ComponentType | null;
|
|
2039
2028
|
public guildId: Snowflake | null;
|
|
2040
2029
|
public interactionType: InteractionType | null;
|
|
@@ -2338,11 +2327,13 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|
|
2338
2327
|
public deferReply(
|
|
2339
2328
|
options: InteractionDeferReplyOptions & { withResponse: true },
|
|
2340
2329
|
): Promise<InteractionCallbackResponse>;
|
|
2341
|
-
public deferReply(options?: InteractionDeferReplyOptions): Promise<
|
|
2330
|
+
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
2331
|
+
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2342
2332
|
public deferUpdate(
|
|
2343
2333
|
options: InteractionDeferUpdateOptions & { withResponse: true },
|
|
2344
2334
|
): Promise<InteractionCallbackResponse>;
|
|
2345
|
-
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<
|
|
2335
|
+
public deferUpdate(options?: InteractionDeferUpdateOptions & { withResponse: false }): Promise<undefined>;
|
|
2336
|
+
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2346
2337
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
|
2347
2338
|
public editReply(
|
|
2348
2339
|
options: string | MessagePayload | InteractionEditReplyOptions,
|
|
@@ -2350,13 +2341,15 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|
|
2350
2341
|
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
|
2351
2342
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
|
2352
2343
|
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
2344
|
+
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
2353
2345
|
public reply(
|
|
2354
2346
|
options: string | MessagePayload | InteractionReplyOptions,
|
|
2355
|
-
): Promise<
|
|
2347
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
2356
2348
|
public update(options: InteractionUpdateOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
2349
|
+
public update(options: InteractionUpdateOptions & { withResponse: false }): Promise<undefined>;
|
|
2357
2350
|
public update(
|
|
2358
2351
|
options: string | MessagePayload | InteractionUpdateOptions,
|
|
2359
|
-
): Promise<
|
|
2352
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
2360
2353
|
public showModal(
|
|
2361
2354
|
modal:
|
|
2362
2355
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
@@ -2369,8 +2362,15 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|
|
2369
2362
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
2370
2363
|
| ModalComponentData
|
|
2371
2364
|
| APIModalInteractionResponseCallbackData,
|
|
2372
|
-
options?: ShowModalOptions,
|
|
2365
|
+
options?: ShowModalOptions & { withResponse: false },
|
|
2373
2366
|
): Promise<undefined>;
|
|
2367
|
+
public showModal(
|
|
2368
|
+
modal:
|
|
2369
|
+
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
2370
|
+
| ModalComponentData
|
|
2371
|
+
| APIModalInteractionResponseCallbackData,
|
|
2372
|
+
options?: ShowModalOptions,
|
|
2373
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
2374
2374
|
public awaitModalSubmit(
|
|
2375
2375
|
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
|
2376
2376
|
): Promise<ModalSubmitInteraction<Cached>>;
|
|
@@ -2539,9 +2539,8 @@ export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = C
|
|
|
2539
2539
|
message: Message<BooleanCache<Cached>>;
|
|
2540
2540
|
channelId: Snowflake;
|
|
2541
2541
|
update(options: InteractionUpdateOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
2542
|
-
update(
|
|
2543
|
-
|
|
2544
|
-
): Promise<InteractionResponse<BooleanCache<Cached>>>;
|
|
2542
|
+
update(options: InteractionUpdateOptions & { withResponse: false }): Promise<undefined>;
|
|
2543
|
+
update(options: string | MessagePayload | InteractionUpdateOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2545
2544
|
inGuild(): this is ModalMessageModalSubmitInteraction<'raw' | 'cached'>;
|
|
2546
2545
|
inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
|
|
2547
2546
|
inRawGuild(): this is ModalMessageModalSubmitInteraction<'raw'>;
|
|
@@ -2559,9 +2558,10 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|
|
2559
2558
|
public replied: boolean;
|
|
2560
2559
|
public readonly webhook: InteractionWebhook;
|
|
2561
2560
|
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
2561
|
+
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
2562
2562
|
public reply(
|
|
2563
2563
|
options: string | MessagePayload | InteractionReplyOptions,
|
|
2564
|
-
): Promise<
|
|
2564
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
2565
2565
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
|
2566
2566
|
public editReply(
|
|
2567
2567
|
options: string | MessagePayload | InteractionEditReplyOptions,
|
|
@@ -2569,13 +2569,15 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|
|
2569
2569
|
public deferReply(
|
|
2570
2570
|
options: InteractionDeferReplyOptions & { withResponse: true },
|
|
2571
2571
|
): Promise<InteractionCallbackResponse>;
|
|
2572
|
-
public deferReply(options?: InteractionDeferReplyOptions): Promise<
|
|
2572
|
+
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
2573
|
+
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2573
2574
|
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
|
2574
2575
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
|
2575
2576
|
public deferUpdate(
|
|
2576
2577
|
options: InteractionDeferUpdateOptions & { withResponse: true },
|
|
2577
2578
|
): Promise<InteractionCallbackResponse>;
|
|
2578
|
-
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<
|
|
2579
|
+
public deferUpdate(options?: InteractionDeferUpdateOptions & { withResponse: false }): Promise<undefined>;
|
|
2580
|
+
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2579
2581
|
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
|
2580
2582
|
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
|
2581
2583
|
public inRawGuild(): this is ModalSubmitInteraction<'raw'>;
|
|
@@ -6067,18 +6069,37 @@ export interface GuildScheduledEventCreateOptions {
|
|
|
6067
6069
|
recurrenceRule?: GuildScheduledEventRecurrenceRuleOptions;
|
|
6068
6070
|
}
|
|
6069
6071
|
|
|
6070
|
-
export
|
|
6072
|
+
export type GuildScheduledEventRecurrenceRuleOptions =
|
|
6073
|
+
| BaseGuildScheduledEventRecurrenceRuleOptions<
|
|
6074
|
+
GuildScheduledEventRecurrenceRuleFrequency.Yearly,
|
|
6075
|
+
{
|
|
6076
|
+
byMonth: readonly GuildScheduledEventRecurrenceRuleMonth[];
|
|
6077
|
+
byMonthDay: readonly number[];
|
|
6078
|
+
}
|
|
6079
|
+
>
|
|
6080
|
+
| BaseGuildScheduledEventRecurrenceRuleOptions<
|
|
6081
|
+
GuildScheduledEventRecurrenceRuleFrequency.Monthly,
|
|
6082
|
+
{
|
|
6083
|
+
byNWeekday: readonly GuildScheduledEventRecurrenceRuleNWeekday[];
|
|
6084
|
+
}
|
|
6085
|
+
>
|
|
6086
|
+
| BaseGuildScheduledEventRecurrenceRuleOptions<
|
|
6087
|
+
GuildScheduledEventRecurrenceRuleFrequency.Weekly | GuildScheduledEventRecurrenceRuleFrequency.Daily,
|
|
6088
|
+
{
|
|
6089
|
+
byWeekday: readonly GuildScheduledEventRecurrenceRuleWeekday[];
|
|
6090
|
+
}
|
|
6091
|
+
>;
|
|
6092
|
+
|
|
6093
|
+
type BaseGuildScheduledEventRecurrenceRuleOptions<
|
|
6094
|
+
Frequency extends GuildScheduledEventRecurrenceRuleFrequency,
|
|
6095
|
+
Extra extends {},
|
|
6096
|
+
> = {
|
|
6071
6097
|
startAt: DateResolvable;
|
|
6072
|
-
endAt
|
|
6073
|
-
|
|
6098
|
+
endAt?: DateResolvable;
|
|
6099
|
+
count?: number;
|
|
6074
6100
|
interval: number;
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
byMonth: readonly GuildScheduledEventRecurrenceRuleMonth[];
|
|
6078
|
-
byMonthDay: readonly number[];
|
|
6079
|
-
byYearDay: readonly number[];
|
|
6080
|
-
count: number;
|
|
6081
|
-
}
|
|
6101
|
+
frequency: Frequency;
|
|
6102
|
+
} & Extra;
|
|
6082
6103
|
|
|
6083
6104
|
export interface GuildScheduledEventEditOptions<
|
|
6084
6105
|
Status extends GuildScheduledEventStatus,
|
|
@@ -6195,7 +6216,6 @@ export interface InteractionCollectorOptions<
|
|
|
6195
6216
|
maxComponents?: number;
|
|
6196
6217
|
maxUsers?: number;
|
|
6197
6218
|
message?: CacheTypeReducer<Cached, Message, APIMessage>;
|
|
6198
|
-
interactionResponse?: InteractionResponse<BooleanCache<Cached>>;
|
|
6199
6219
|
}
|
|
6200
6220
|
|
|
6201
6221
|
export interface InteractionDeferReplyOptions {
|
package/typings/index.d.ts
CHANGED
|
@@ -568,7 +568,8 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
568
568
|
public deferReply(
|
|
569
569
|
options: InteractionDeferReplyOptions & { withResponse: true },
|
|
570
570
|
): Promise<InteractionCallbackResponse>;
|
|
571
|
-
public deferReply(options?: InteractionDeferReplyOptions): Promise<
|
|
571
|
+
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
572
|
+
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
572
573
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
|
573
574
|
public editReply(
|
|
574
575
|
options: string | MessagePayload | InteractionEditReplyOptions,
|
|
@@ -576,9 +577,10 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
576
577
|
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
|
577
578
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
|
578
579
|
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
580
|
+
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
579
581
|
public reply(
|
|
580
582
|
options: string | MessagePayload | InteractionReplyOptions,
|
|
581
|
-
): Promise<
|
|
583
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
582
584
|
public showModal(
|
|
583
585
|
modal:
|
|
584
586
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
@@ -591,8 +593,15 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
591
593
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
592
594
|
| ModalComponentData
|
|
593
595
|
| APIModalInteractionResponseCallbackData,
|
|
594
|
-
options?: ShowModalOptions,
|
|
596
|
+
options?: ShowModalOptions & { withResponse: false },
|
|
595
597
|
): Promise<undefined>;
|
|
598
|
+
public showModal(
|
|
599
|
+
modal:
|
|
600
|
+
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
601
|
+
| ModalComponentData
|
|
602
|
+
| APIModalInteractionResponseCallbackData,
|
|
603
|
+
options?: ShowModalOptions,
|
|
604
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
596
605
|
public awaitModalSubmit(
|
|
597
606
|
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
|
598
607
|
): Promise<ModalSubmitInteraction<Cached>>;
|
|
@@ -602,24 +611,6 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
602
611
|
): CommandInteractionOption<Cached>;
|
|
603
612
|
}
|
|
604
613
|
|
|
605
|
-
export class InteractionResponse<Cached extends boolean = boolean> {
|
|
606
|
-
private constructor(interaction: Interaction, id?: Snowflake);
|
|
607
|
-
public interaction: Interaction<WrapBooleanCache<Cached>>;
|
|
608
|
-
public client: Client;
|
|
609
|
-
public id: Snowflake;
|
|
610
|
-
public get createdAt(): Date;
|
|
611
|
-
public get createdTimestamp(): number;
|
|
612
|
-
public awaitMessageComponent<ComponentType extends MessageComponentType>(
|
|
613
|
-
options?: AwaitMessageCollectorOptionsParams<ComponentType, Cached>,
|
|
614
|
-
): Promise<MappedInteractionTypes<Cached>[ComponentType]>;
|
|
615
|
-
public createMessageComponentCollector<ComponentType extends MessageComponentType>(
|
|
616
|
-
options?: MessageCollectorOptionsParams<ComponentType, Cached>,
|
|
617
|
-
): InteractionCollector<MappedInteractionTypes<Cached>[ComponentType]>;
|
|
618
|
-
public delete(): Promise<void>;
|
|
619
|
-
public edit(options: string | MessagePayload | WebhookMessageEditOptions): Promise<Message>;
|
|
620
|
-
public fetch(): Promise<Message>;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
614
|
export abstract class BaseGuild extends Base {
|
|
624
615
|
protected constructor(client: Client<true>, data: RawBaseGuildData);
|
|
625
616
|
public get createdAt(): Date;
|
|
@@ -1903,7 +1894,6 @@ export class IntegrationApplication extends Application {
|
|
|
1903
1894
|
public termsOfServiceURL: string | null;
|
|
1904
1895
|
public privacyPolicyURL: string | null;
|
|
1905
1896
|
public rpcOrigins: string[];
|
|
1906
|
-
public hook: boolean | null;
|
|
1907
1897
|
public cover: string | null;
|
|
1908
1898
|
public verifyKey: string | null;
|
|
1909
1899
|
}
|
|
@@ -2034,7 +2024,6 @@ export class InteractionCollector<Interaction extends CollectedInteraction> exte
|
|
|
2034
2024
|
private _handleGuildDeletion(guild: Guild): void;
|
|
2035
2025
|
|
|
2036
2026
|
public channelId: Snowflake | null;
|
|
2037
|
-
public messageInteractionId: Snowflake | null;
|
|
2038
2027
|
public componentType: ComponentType | null;
|
|
2039
2028
|
public guildId: Snowflake | null;
|
|
2040
2029
|
public interactionType: InteractionType | null;
|
|
@@ -2338,11 +2327,13 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|
|
2338
2327
|
public deferReply(
|
|
2339
2328
|
options: InteractionDeferReplyOptions & { withResponse: true },
|
|
2340
2329
|
): Promise<InteractionCallbackResponse>;
|
|
2341
|
-
public deferReply(options?: InteractionDeferReplyOptions): Promise<
|
|
2330
|
+
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
2331
|
+
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2342
2332
|
public deferUpdate(
|
|
2343
2333
|
options: InteractionDeferUpdateOptions & { withResponse: true },
|
|
2344
2334
|
): Promise<InteractionCallbackResponse>;
|
|
2345
|
-
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<
|
|
2335
|
+
public deferUpdate(options?: InteractionDeferUpdateOptions & { withResponse: false }): Promise<undefined>;
|
|
2336
|
+
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2346
2337
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
|
2347
2338
|
public editReply(
|
|
2348
2339
|
options: string | MessagePayload | InteractionEditReplyOptions,
|
|
@@ -2350,13 +2341,15 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|
|
2350
2341
|
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
|
2351
2342
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
|
2352
2343
|
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
2344
|
+
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
2353
2345
|
public reply(
|
|
2354
2346
|
options: string | MessagePayload | InteractionReplyOptions,
|
|
2355
|
-
): Promise<
|
|
2347
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
2356
2348
|
public update(options: InteractionUpdateOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
2349
|
+
public update(options: InteractionUpdateOptions & { withResponse: false }): Promise<undefined>;
|
|
2357
2350
|
public update(
|
|
2358
2351
|
options: string | MessagePayload | InteractionUpdateOptions,
|
|
2359
|
-
): Promise<
|
|
2352
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
2360
2353
|
public showModal(
|
|
2361
2354
|
modal:
|
|
2362
2355
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
@@ -2369,8 +2362,15 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|
|
2369
2362
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
2370
2363
|
| ModalComponentData
|
|
2371
2364
|
| APIModalInteractionResponseCallbackData,
|
|
2372
|
-
options?: ShowModalOptions,
|
|
2365
|
+
options?: ShowModalOptions & { withResponse: false },
|
|
2373
2366
|
): Promise<undefined>;
|
|
2367
|
+
public showModal(
|
|
2368
|
+
modal:
|
|
2369
|
+
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
2370
|
+
| ModalComponentData
|
|
2371
|
+
| APIModalInteractionResponseCallbackData,
|
|
2372
|
+
options?: ShowModalOptions,
|
|
2373
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
2374
2374
|
public awaitModalSubmit(
|
|
2375
2375
|
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
|
2376
2376
|
): Promise<ModalSubmitInteraction<Cached>>;
|
|
@@ -2539,9 +2539,8 @@ export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = C
|
|
|
2539
2539
|
message: Message<BooleanCache<Cached>>;
|
|
2540
2540
|
channelId: Snowflake;
|
|
2541
2541
|
update(options: InteractionUpdateOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
2542
|
-
update(
|
|
2543
|
-
|
|
2544
|
-
): Promise<InteractionResponse<BooleanCache<Cached>>>;
|
|
2542
|
+
update(options: InteractionUpdateOptions & { withResponse: false }): Promise<undefined>;
|
|
2543
|
+
update(options: string | MessagePayload | InteractionUpdateOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2545
2544
|
inGuild(): this is ModalMessageModalSubmitInteraction<'raw' | 'cached'>;
|
|
2546
2545
|
inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
|
|
2547
2546
|
inRawGuild(): this is ModalMessageModalSubmitInteraction<'raw'>;
|
|
@@ -2559,9 +2558,10 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|
|
2559
2558
|
public replied: boolean;
|
|
2560
2559
|
public readonly webhook: InteractionWebhook;
|
|
2561
2560
|
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
|
2561
|
+
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
2562
2562
|
public reply(
|
|
2563
2563
|
options: string | MessagePayload | InteractionReplyOptions,
|
|
2564
|
-
): Promise<
|
|
2564
|
+
): Promise<InteractionCallbackResponse | undefined>;
|
|
2565
2565
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
|
2566
2566
|
public editReply(
|
|
2567
2567
|
options: string | MessagePayload | InteractionEditReplyOptions,
|
|
@@ -2569,13 +2569,15 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|
|
2569
2569
|
public deferReply(
|
|
2570
2570
|
options: InteractionDeferReplyOptions & { withResponse: true },
|
|
2571
2571
|
): Promise<InteractionCallbackResponse>;
|
|
2572
|
-
public deferReply(options?: InteractionDeferReplyOptions): Promise<
|
|
2572
|
+
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
|
2573
|
+
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2573
2574
|
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
|
2574
2575
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
|
2575
2576
|
public deferUpdate(
|
|
2576
2577
|
options: InteractionDeferUpdateOptions & { withResponse: true },
|
|
2577
2578
|
): Promise<InteractionCallbackResponse>;
|
|
2578
|
-
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<
|
|
2579
|
+
public deferUpdate(options?: InteractionDeferUpdateOptions & { withResponse: false }): Promise<undefined>;
|
|
2580
|
+
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionCallbackResponse | undefined>;
|
|
2579
2581
|
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
|
2580
2582
|
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
|
2581
2583
|
public inRawGuild(): this is ModalSubmitInteraction<'raw'>;
|
|
@@ -6067,18 +6069,37 @@ export interface GuildScheduledEventCreateOptions {
|
|
|
6067
6069
|
recurrenceRule?: GuildScheduledEventRecurrenceRuleOptions;
|
|
6068
6070
|
}
|
|
6069
6071
|
|
|
6070
|
-
export
|
|
6072
|
+
export type GuildScheduledEventRecurrenceRuleOptions =
|
|
6073
|
+
| BaseGuildScheduledEventRecurrenceRuleOptions<
|
|
6074
|
+
GuildScheduledEventRecurrenceRuleFrequency.Yearly,
|
|
6075
|
+
{
|
|
6076
|
+
byMonth: readonly GuildScheduledEventRecurrenceRuleMonth[];
|
|
6077
|
+
byMonthDay: readonly number[];
|
|
6078
|
+
}
|
|
6079
|
+
>
|
|
6080
|
+
| BaseGuildScheduledEventRecurrenceRuleOptions<
|
|
6081
|
+
GuildScheduledEventRecurrenceRuleFrequency.Monthly,
|
|
6082
|
+
{
|
|
6083
|
+
byNWeekday: readonly GuildScheduledEventRecurrenceRuleNWeekday[];
|
|
6084
|
+
}
|
|
6085
|
+
>
|
|
6086
|
+
| BaseGuildScheduledEventRecurrenceRuleOptions<
|
|
6087
|
+
GuildScheduledEventRecurrenceRuleFrequency.Weekly | GuildScheduledEventRecurrenceRuleFrequency.Daily,
|
|
6088
|
+
{
|
|
6089
|
+
byWeekday: readonly GuildScheduledEventRecurrenceRuleWeekday[];
|
|
6090
|
+
}
|
|
6091
|
+
>;
|
|
6092
|
+
|
|
6093
|
+
type BaseGuildScheduledEventRecurrenceRuleOptions<
|
|
6094
|
+
Frequency extends GuildScheduledEventRecurrenceRuleFrequency,
|
|
6095
|
+
Extra extends {},
|
|
6096
|
+
> = {
|
|
6071
6097
|
startAt: DateResolvable;
|
|
6072
|
-
endAt
|
|
6073
|
-
|
|
6098
|
+
endAt?: DateResolvable;
|
|
6099
|
+
count?: number;
|
|
6074
6100
|
interval: number;
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
byMonth: readonly GuildScheduledEventRecurrenceRuleMonth[];
|
|
6078
|
-
byMonthDay: readonly number[];
|
|
6079
|
-
byYearDay: readonly number[];
|
|
6080
|
-
count: number;
|
|
6081
|
-
}
|
|
6101
|
+
frequency: Frequency;
|
|
6102
|
+
} & Extra;
|
|
6082
6103
|
|
|
6083
6104
|
export interface GuildScheduledEventEditOptions<
|
|
6084
6105
|
Status extends GuildScheduledEventStatus,
|
|
@@ -6195,7 +6216,6 @@ export interface InteractionCollectorOptions<
|
|
|
6195
6216
|
maxComponents?: number;
|
|
6196
6217
|
maxUsers?: number;
|
|
6197
6218
|
message?: CacheTypeReducer<Cached, Message, APIMessage>;
|
|
6198
|
-
interactionResponse?: InteractionResponse<BooleanCache<Cached>>;
|
|
6199
6219
|
}
|
|
6200
6220
|
|
|
6201
6221
|
export interface InteractionDeferReplyOptions {
|
package/typings/index.test-d.ts
CHANGED
|
@@ -33,6 +33,9 @@ import {
|
|
|
33
33
|
APIMentionableSelectComponent,
|
|
34
34
|
APIModalInteractionResponseCallbackData,
|
|
35
35
|
WebhookType,
|
|
36
|
+
GuildScheduledEventRecurrenceRuleFrequency,
|
|
37
|
+
GuildScheduledEventRecurrenceRuleMonth,
|
|
38
|
+
GuildScheduledEventRecurrenceRuleWeekday,
|
|
36
39
|
} from 'discord-api-types/v10';
|
|
37
40
|
import {
|
|
38
41
|
ApplicationCommand,
|
|
@@ -209,6 +212,7 @@ import {
|
|
|
209
212
|
SendableChannels,
|
|
210
213
|
PollData,
|
|
211
214
|
InteractionCallbackResponse,
|
|
215
|
+
GuildScheduledEventRecurrenceRuleOptions,
|
|
212
216
|
} from '.';
|
|
213
217
|
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
|
214
218
|
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
|
@@ -1787,10 +1791,20 @@ client.on('interactionCreate', async interaction => {
|
|
|
1787
1791
|
expectType<Guild>(interaction.guild);
|
|
1788
1792
|
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
1789
1793
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
1794
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
1795
|
+
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
|
1796
|
+
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
|
1797
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1798
|
+
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
|
1799
|
+
);
|
|
1800
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1801
|
+
interaction.deferReply({ withResponse: booleanValue }),
|
|
1802
|
+
);
|
|
1790
1803
|
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
|
1791
1804
|
expectType<Promise<Message<true>>>(interaction.fetchReply());
|
|
1792
1805
|
expectType<Promise<InteractionCallbackResponse>>(interaction.update({ content: 'a', withResponse: true }));
|
|
1793
1806
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
|
1807
|
+
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
1794
1808
|
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
|
1795
1809
|
} else if (interaction.inRawGuild()) {
|
|
1796
1810
|
expectAssignable<MessageComponentInteraction>(interaction);
|
|
@@ -1799,10 +1813,24 @@ client.on('interactionCreate', async interaction => {
|
|
|
1799
1813
|
expectType<null>(interaction.guild);
|
|
1800
1814
|
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
1801
1815
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
1816
|
+
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
|
1817
|
+
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
|
1818
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
1819
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1820
|
+
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
|
1821
|
+
);
|
|
1822
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1823
|
+
interaction.deferReply({ withResponse: booleanValue }),
|
|
1824
|
+
);
|
|
1802
1825
|
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
|
1803
1826
|
expectType<Promise<Message<false>>>(interaction.fetchReply());
|
|
1804
1827
|
expectType<Promise<InteractionCallbackResponse>>(interaction.update({ content: 'a', withResponse: true }));
|
|
1828
|
+
expectType<Promise<undefined>>(interaction.update({ content: 'a', withResponse: false }));
|
|
1829
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1830
|
+
interaction.update({ content: 'a', withResponse: booleanValue }),
|
|
1831
|
+
);
|
|
1805
1832
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
|
1833
|
+
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
1806
1834
|
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
|
1807
1835
|
} else if (interaction.inGuild()) {
|
|
1808
1836
|
expectAssignable<MessageComponentInteraction>(interaction);
|
|
@@ -1811,10 +1839,24 @@ client.on('interactionCreate', async interaction => {
|
|
|
1811
1839
|
expectType<Guild | null>(interaction.guild);
|
|
1812
1840
|
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
1813
1841
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
1842
|
+
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
|
1843
|
+
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
|
1844
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
1845
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1846
|
+
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
|
1847
|
+
);
|
|
1848
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1849
|
+
interaction.deferReply({ withResponse: booleanValue }),
|
|
1850
|
+
);
|
|
1814
1851
|
expectType<Promise<Message>>(interaction.editReply({ content: 'a' }));
|
|
1815
1852
|
expectType<Promise<Message>>(interaction.fetchReply());
|
|
1816
1853
|
expectType<Promise<InteractionCallbackResponse>>(interaction.update({ content: 'a', withResponse: true }));
|
|
1854
|
+
expectType<Promise<undefined>>(interaction.update({ content: 'a', withResponse: false }));
|
|
1855
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1856
|
+
interaction.update({ content: 'a', withResponse: booleanValue }),
|
|
1857
|
+
);
|
|
1817
1858
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
|
1859
|
+
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
1818
1860
|
expectType<Promise<Message>>(interaction.followUp({ content: 'a' }));
|
|
1819
1861
|
}
|
|
1820
1862
|
}
|
|
@@ -1850,6 +1892,15 @@ client.on('interactionCreate', async interaction => {
|
|
|
1850
1892
|
expectAssignable<CommandInteraction<'cached'>>(interaction);
|
|
1851
1893
|
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
1852
1894
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
1895
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
1896
|
+
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
|
1897
|
+
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
|
1898
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1899
|
+
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
|
1900
|
+
);
|
|
1901
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1902
|
+
interaction.deferReply({ withResponse: booleanValue }),
|
|
1903
|
+
);
|
|
1853
1904
|
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
|
1854
1905
|
expectType<Promise<Message<true>>>(interaction.fetchReply());
|
|
1855
1906
|
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
|
@@ -1858,6 +1909,15 @@ client.on('interactionCreate', async interaction => {
|
|
|
1858
1909
|
expectType<null>(interaction.guild);
|
|
1859
1910
|
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
1860
1911
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
1912
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
1913
|
+
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
|
1914
|
+
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
|
1915
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1916
|
+
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
|
1917
|
+
);
|
|
1918
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1919
|
+
interaction.deferReply({ withResponse: booleanValue }),
|
|
1920
|
+
);
|
|
1861
1921
|
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
|
1862
1922
|
expectType<Promise<Message<false>>>(interaction.fetchReply());
|
|
1863
1923
|
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
|
@@ -1866,6 +1926,15 @@ client.on('interactionCreate', async interaction => {
|
|
|
1866
1926
|
expectType<Guild | null>(interaction.guild);
|
|
1867
1927
|
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
1868
1928
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
1929
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
1930
|
+
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
|
1931
|
+
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
|
1932
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1933
|
+
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
|
1934
|
+
);
|
|
1935
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1936
|
+
interaction.deferReply({ withResponse: booleanValue }),
|
|
1937
|
+
);
|
|
1869
1938
|
expectType<Promise<Message>>(interaction.editReply({ content: 'a' }));
|
|
1870
1939
|
expectType<Promise<Message>>(interaction.fetchReply());
|
|
1871
1940
|
expectType<Promise<Message>>(interaction.followUp({ content: 'a' }));
|
|
@@ -2059,27 +2128,33 @@ client.on('interactionCreate', async interaction => {
|
|
|
2059
2128
|
expectType<Guild>(interaction.guild);
|
|
2060
2129
|
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
2061
2130
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
2131
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
2062
2132
|
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
|
2063
2133
|
expectType<Promise<Message<true>>>(interaction.fetchReply());
|
|
2064
2134
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
|
2135
|
+
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
2065
2136
|
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
|
2066
2137
|
} else if (interaction.inRawGuild()) {
|
|
2067
2138
|
expectAssignable<ModalSubmitInteraction>(interaction);
|
|
2068
2139
|
expectType<null>(interaction.guild);
|
|
2069
2140
|
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
2070
2141
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
2142
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
2071
2143
|
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
|
2072
2144
|
expectType<Promise<Message<false>>>(interaction.fetchReply());
|
|
2073
2145
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
|
2146
|
+
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
2074
2147
|
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
|
2075
2148
|
} else if (interaction.inGuild()) {
|
|
2076
2149
|
expectAssignable<ModalSubmitInteraction>(interaction);
|
|
2077
2150
|
expectType<Guild | null>(interaction.guild);
|
|
2078
2151
|
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
2079
2152
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
2153
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
2080
2154
|
expectType<Promise<Message>>(interaction.editReply({ content: 'a' }));
|
|
2081
2155
|
expectType<Promise<Message>>(interaction.fetchReply());
|
|
2082
2156
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
|
2157
|
+
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
2083
2158
|
expectType<Promise<Message>>(interaction.followUp({ content: 'a' }));
|
|
2084
2159
|
}
|
|
2085
2160
|
}
|
|
@@ -2596,3 +2671,89 @@ client.on('interactionCreate', interaction => {
|
|
|
2596
2671
|
|
|
2597
2672
|
declare const guildScheduledEventManager: GuildScheduledEventManager;
|
|
2598
2673
|
await guildScheduledEventManager.edit(snowflake, { recurrenceRule: null });
|
|
2674
|
+
|
|
2675
|
+
{
|
|
2676
|
+
expectNotAssignable<GuildScheduledEventRecurrenceRuleOptions>({
|
|
2677
|
+
startAt: new Date(),
|
|
2678
|
+
frequency: GuildScheduledEventRecurrenceRuleFrequency.Yearly,
|
|
2679
|
+
interval: 1,
|
|
2680
|
+
byMonth: [GuildScheduledEventRecurrenceRuleMonth.May],
|
|
2681
|
+
byMonthDay: [4],
|
|
2682
|
+
// Invalid property
|
|
2683
|
+
byWeekday: [GuildScheduledEventRecurrenceRuleWeekday.Monday],
|
|
2684
|
+
});
|
|
2685
|
+
|
|
2686
|
+
expectNotAssignable<GuildScheduledEventRecurrenceRuleOptions>({
|
|
2687
|
+
startAt: new Date(),
|
|
2688
|
+
frequency: GuildScheduledEventRecurrenceRuleFrequency.Yearly,
|
|
2689
|
+
interval: 1,
|
|
2690
|
+
byMonth: [GuildScheduledEventRecurrenceRuleMonth.May],
|
|
2691
|
+
byMonthDay: [4],
|
|
2692
|
+
// Invalid property
|
|
2693
|
+
byNWeekday: [{ n: 1, day: GuildScheduledEventRecurrenceRuleWeekday.Monday }],
|
|
2694
|
+
});
|
|
2695
|
+
|
|
2696
|
+
expectAssignable<GuildScheduledEventRecurrenceRuleOptions>({
|
|
2697
|
+
startAt: new Date(),
|
|
2698
|
+
frequency: GuildScheduledEventRecurrenceRuleFrequency.Yearly,
|
|
2699
|
+
interval: 1,
|
|
2700
|
+
byMonth: [GuildScheduledEventRecurrenceRuleMonth.May],
|
|
2701
|
+
byMonthDay: [4],
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
{
|
|
2706
|
+
expectAssignable<GuildScheduledEventRecurrenceRuleOptions>({
|
|
2707
|
+
startAt: new Date(),
|
|
2708
|
+
frequency: GuildScheduledEventRecurrenceRuleFrequency.Monthly,
|
|
2709
|
+
interval: 1,
|
|
2710
|
+
byNWeekday: [{ n: 1, day: GuildScheduledEventRecurrenceRuleWeekday.Monday }],
|
|
2711
|
+
});
|
|
2712
|
+
|
|
2713
|
+
expectNotAssignable<GuildScheduledEventRecurrenceRuleOptions>({
|
|
2714
|
+
startAt: new Date(),
|
|
2715
|
+
frequency: GuildScheduledEventRecurrenceRuleFrequency.Monthly,
|
|
2716
|
+
interval: 1,
|
|
2717
|
+
byNWeekday: [{ n: 1, day: GuildScheduledEventRecurrenceRuleWeekday.Monday }],
|
|
2718
|
+
// Invalid property
|
|
2719
|
+
byWeekday: [GuildScheduledEventRecurrenceRuleWeekday.Monday],
|
|
2720
|
+
});
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
{
|
|
2724
|
+
expectAssignable<GuildScheduledEventRecurrenceRuleOptions>({
|
|
2725
|
+
startAt: new Date(),
|
|
2726
|
+
frequency: GuildScheduledEventRecurrenceRuleFrequency.Weekly,
|
|
2727
|
+
interval: 1,
|
|
2728
|
+
byWeekday: [GuildScheduledEventRecurrenceRuleWeekday.Monday],
|
|
2729
|
+
});
|
|
2730
|
+
|
|
2731
|
+
expectNotAssignable<GuildScheduledEventRecurrenceRuleOptions>({
|
|
2732
|
+
startAt: new Date(),
|
|
2733
|
+
frequency: GuildScheduledEventRecurrenceRuleFrequency.Weekly,
|
|
2734
|
+
interval: 1,
|
|
2735
|
+
byWeekday: [GuildScheduledEventRecurrenceRuleWeekday.Monday],
|
|
2736
|
+
// Invalid property
|
|
2737
|
+
byNWeekday: [{ n: 1, day: GuildScheduledEventRecurrenceRuleWeekday.Monday }],
|
|
2738
|
+
});
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
{
|
|
2742
|
+
expectNotAssignable<GuildScheduledEventRecurrenceRuleOptions>({
|
|
2743
|
+
startAt: new Date(),
|
|
2744
|
+
frequency: GuildScheduledEventRecurrenceRuleFrequency.Daily,
|
|
2745
|
+
interval: 1,
|
|
2746
|
+
byWeekday: [GuildScheduledEventRecurrenceRuleWeekday.Monday],
|
|
2747
|
+
// Invalid property
|
|
2748
|
+
byNWeekday: [{ n: 1, day: GuildScheduledEventRecurrenceRuleWeekday.Monday }],
|
|
2749
|
+
});
|
|
2750
|
+
|
|
2751
|
+
expectNotAssignable<GuildScheduledEventRecurrenceRuleOptions>({
|
|
2752
|
+
startAt: new Date(),
|
|
2753
|
+
frequency: GuildScheduledEventRecurrenceRuleFrequency.Daily,
|
|
2754
|
+
interval: 1,
|
|
2755
|
+
byWeekday: [GuildScheduledEventRecurrenceRuleWeekday.Monday],
|
|
2756
|
+
// Invalid property
|
|
2757
|
+
byMonth: [GuildScheduledEventRecurrenceRuleMonth.May],
|
|
2758
|
+
});
|
|
2759
|
+
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
|
4
|
-
const { InteractionType } = require('discord-api-types/v10');
|
|
5
|
-
const { DiscordjsError, ErrorCodes } = require('../errors');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Represents an interaction's response
|
|
9
|
-
*/
|
|
10
|
-
class InteractionResponse {
|
|
11
|
-
constructor(interaction, id) {
|
|
12
|
-
/**
|
|
13
|
-
* The interaction associated with the interaction response
|
|
14
|
-
* @type {BaseInteraction}
|
|
15
|
-
*/
|
|
16
|
-
this.interaction = interaction;
|
|
17
|
-
/**
|
|
18
|
-
* The id of the original interaction response
|
|
19
|
-
* @type {Snowflake}
|
|
20
|
-
*/
|
|
21
|
-
this.id = id ?? interaction.id;
|
|
22
|
-
this.client = interaction.client;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The timestamp the interaction response was created at
|
|
27
|
-
* @type {number}
|
|
28
|
-
* @readonly
|
|
29
|
-
*/
|
|
30
|
-
get createdTimestamp() {
|
|
31
|
-
return DiscordSnowflake.timestampFrom(this.id);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The time the interaction response was created at
|
|
36
|
-
* @type {Date}
|
|
37
|
-
* @readonly
|
|
38
|
-
*/
|
|
39
|
-
get createdAt() {
|
|
40
|
-
return new Date(this.createdTimestamp);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Collects a single component interaction that passes the filter.
|
|
45
|
-
* The Promise will reject if the time expires.
|
|
46
|
-
* @param {AwaitMessageComponentOptions} [options={}] Options to pass to the internal collector
|
|
47
|
-
* @returns {Promise<MessageComponentInteraction>}
|
|
48
|
-
*/
|
|
49
|
-
awaitMessageComponent(options = {}) {
|
|
50
|
-
const _options = { ...options, max: 1 };
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
const collector = this.createMessageComponentCollector(_options);
|
|
53
|
-
collector.once('end', (interactions, reason) => {
|
|
54
|
-
const interaction = interactions.first();
|
|
55
|
-
if (interaction) resolve(interaction);
|
|
56
|
-
else reject(new DiscordjsError(ErrorCodes.InteractionCollectorError, reason));
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Creates a message component interaction collector
|
|
63
|
-
* @param {MessageComponentCollectorOptions} [options={}] Options to send to the collector
|
|
64
|
-
* @returns {InteractionCollector}
|
|
65
|
-
*/
|
|
66
|
-
createMessageComponentCollector(options = {}) {
|
|
67
|
-
return new InteractionCollector(this.client, {
|
|
68
|
-
...options,
|
|
69
|
-
interactionResponse: this,
|
|
70
|
-
interactionType: InteractionType.MessageComponent,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Fetches the response as a {@link Message} object.
|
|
76
|
-
* @returns {Promise<Message>}
|
|
77
|
-
*/
|
|
78
|
-
fetch() {
|
|
79
|
-
return this.interaction.fetchReply();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Deletes the response.
|
|
84
|
-
* @returns {Promise<void>}
|
|
85
|
-
*/
|
|
86
|
-
delete() {
|
|
87
|
-
return this.interaction.deleteReply();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Edits the response.
|
|
92
|
-
* @param {string|MessagePayload|WebhookMessageEditOptions} options The new options for the response.
|
|
93
|
-
* @returns {Promise<Message>}
|
|
94
|
-
*/
|
|
95
|
-
edit(options) {
|
|
96
|
-
return this.interaction.editReply(options);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// eslint-disable-next-line import/order
|
|
101
|
-
const InteractionCollector = require('./InteractionCollector');
|
|
102
|
-
module.exports = InteractionResponse;
|