discord.js 15.0.0-dev.1745367189-42ce11622 → 15.0.0-dev.1745539999-8e4e319c2
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 +4 -4
- package/src/client/actions/InteractionCreate.js +4 -0
- package/src/index.js +2 -0
- package/src/managers/ApplicationCommandManager.js +1 -0
- package/src/structures/ApplicationCommand.js +21 -3
- package/src/structures/BaseInteraction.js +10 -0
- package/src/structures/CommandInteraction.js +1 -0
- package/src/structures/MessageComponentInteraction.js +1 -0
- package/src/structures/ModalSubmitInteraction.js +1 -0
- package/src/structures/PrimaryEntryPointCommandInteraction.js +11 -0
- package/src/structures/interfaces/InteractionResponses.js +26 -0
- package/src/util/APITypes.js +5 -0
- package/typings/index.d.mts +64 -18
- package/typings/index.d.ts +64 -18
- package/typings/index.test-d.ts +112 -0
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.1745539999-8e4e319c2",
|
|
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
|
"tslib": "^2.8.1",
|
|
61
61
|
"undici": "7.8.0",
|
|
62
62
|
"@discordjs/builders": "^1.9.0",
|
|
63
|
-
"@discordjs/collection": "^2.1.1",
|
|
64
63
|
"@discordjs/formatters": "^0.5.0",
|
|
65
64
|
"@discordjs/rest": "^2.4.0",
|
|
66
65
|
"@discordjs/util": "^1.1.1",
|
|
66
|
+
"@discordjs/collection": "^2.1.1",
|
|
67
67
|
"@discordjs/ws": "^2.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"turbo": "^2.5.0",
|
|
85
85
|
"typescript": "~5.8.3",
|
|
86
86
|
"@discordjs/api-extractor": "^7.38.1",
|
|
87
|
-
"@discordjs/
|
|
88
|
-
"@discordjs/
|
|
87
|
+
"@discordjs/docgen": "^0.12.1",
|
|
88
|
+
"@discordjs/scripts": "^0.1.0"
|
|
89
89
|
},
|
|
90
90
|
"engines": {
|
|
91
91
|
"node": ">=22.12.0"
|
|
@@ -9,6 +9,7 @@ const { ChatInputCommandInteraction } = require('../../structures/ChatInputComma
|
|
|
9
9
|
const { MentionableSelectMenuInteraction } = require('../../structures/MentionableSelectMenuInteraction.js');
|
|
10
10
|
const { MessageContextMenuCommandInteraction } = require('../../structures/MessageContextMenuCommandInteraction.js');
|
|
11
11
|
const { ModalSubmitInteraction } = require('../../structures/ModalSubmitInteraction.js');
|
|
12
|
+
const { PrimaryEntryPointCommandInteraction } = require('../../structures/PrimaryEntryPointCommandInteraction.js');
|
|
12
13
|
const { RoleSelectMenuInteraction } = require('../../structures/RoleSelectMenuInteraction.js');
|
|
13
14
|
const { StringSelectMenuInteraction } = require('../../structures/StringSelectMenuInteraction.js');
|
|
14
15
|
const { UserContextMenuCommandInteraction } = require('../../structures/UserContextMenuCommandInteraction.js');
|
|
@@ -38,6 +39,9 @@ class InteractionCreateAction extends Action {
|
|
|
38
39
|
if (channel && !channel.isTextBased()) return;
|
|
39
40
|
InteractionClass = MessageContextMenuCommandInteraction;
|
|
40
41
|
break;
|
|
42
|
+
case ApplicationCommandType.PrimaryEntryPoint:
|
|
43
|
+
InteractionClass = PrimaryEntryPointCommandInteraction;
|
|
44
|
+
break;
|
|
41
45
|
default:
|
|
42
46
|
client.emit(
|
|
43
47
|
Events.Debug,
|
package/src/index.js
CHANGED
|
@@ -186,6 +186,8 @@ exports.PartialGroupDMChannel = require('./structures/PartialGroupDMChannel.js')
|
|
|
186
186
|
exports.PermissionOverwrites = require('./structures/PermissionOverwrites.js').PermissionOverwrites;
|
|
187
187
|
exports.Poll = require('./structures/Poll.js').Poll;
|
|
188
188
|
exports.PollAnswer = require('./structures/PollAnswer.js').PollAnswer;
|
|
189
|
+
exports.PrimaryEntryPointCommandInteraction =
|
|
190
|
+
require('./structures/PrimaryEntryPointCommandInteraction.js').PrimaryEntryPointCommandInteraction;
|
|
189
191
|
exports.Presence = require('./structures/Presence.js').Presence;
|
|
190
192
|
exports.ReactionCollector = require('./structures/ReactionCollector.js').ReactionCollector;
|
|
191
193
|
exports.ReactionEmoji = require('./structures/ReactionEmoji.js').ReactionEmoji;
|
|
@@ -162,6 +162,18 @@ class ApplicationCommand extends Base {
|
|
|
162
162
|
this.contexts ??= null;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
if ('handler' in data) {
|
|
166
|
+
/**
|
|
167
|
+
* Determines whether the interaction is handled by the app's interactions handler or by Discord.
|
|
168
|
+
* <info>Only available for {@link ApplicationCommandType.PrimaryEntryPoint} commands on
|
|
169
|
+
* applications with the {@link ApplicationFlags.Embedded} flag (i.e, those that have an Activity)</info>
|
|
170
|
+
* @type {?EntryPointCommandHandlerType}
|
|
171
|
+
*/
|
|
172
|
+
this.handler = data.handler;
|
|
173
|
+
} else {
|
|
174
|
+
this.handler ??= null;
|
|
175
|
+
}
|
|
176
|
+
|
|
165
177
|
if ('version' in data) {
|
|
166
178
|
/**
|
|
167
179
|
* Autoincrementing version identifier updated during substantial record changes
|
|
@@ -204,14 +216,19 @@ class ApplicationCommand extends Base {
|
|
|
204
216
|
* @property {string} name The name of the command, must be in all lowercase if type is
|
|
205
217
|
* {@link ApplicationCommandType.ChatInput}
|
|
206
218
|
* @property {Object<Locale, string>} [nameLocalizations] The localizations for the command name
|
|
207
|
-
* @property {string} description The description of the command,
|
|
219
|
+
* @property {string} description The description of the command,
|
|
220
|
+
* if type is {@link ApplicationCommandType.ChatInput} or {@link ApplicationCommandType.PrimaryEntryPoint}
|
|
208
221
|
* @property {boolean} [nsfw] Whether the command is age-restricted
|
|
209
222
|
* @property {Object<Locale, string>} [descriptionLocalizations] The localizations for the command description,
|
|
210
|
-
* if type is {@link ApplicationCommandType.ChatInput}
|
|
223
|
+
* if type is {@link ApplicationCommandType.ChatInput} or {@link ApplicationCommandType.PrimaryEntryPoint}
|
|
211
224
|
* @property {ApplicationCommandType} [type=ApplicationCommandType.ChatInput] The type of the command
|
|
212
225
|
* @property {ApplicationCommandOptionData[]} [options] Options for the command
|
|
213
226
|
* @property {?PermissionResolvable} [defaultMemberPermissions] The bitfield used to determine the default permissions
|
|
214
227
|
* a member needs in order to run the command
|
|
228
|
+
* @property {ApplicationIntegrationType[]} [integrationTypes] Installation contexts where the command is available
|
|
229
|
+
* @property {InteractionContextType[]} [contexts] Interaction contexts where the command can be used
|
|
230
|
+
* @property {EntryPointCommandHandlerType} [handler] Whether the interaction is handled by the app's
|
|
231
|
+
* interactions handler or by Discord.
|
|
215
232
|
*/
|
|
216
233
|
|
|
217
234
|
/**
|
|
@@ -395,7 +412,8 @@ class ApplicationCommand extends Base {
|
|
|
395
412
|
this.descriptionLocalizations ?? {},
|
|
396
413
|
) ||
|
|
397
414
|
!isEqual(command.integrationTypes ?? command.integration_types ?? [], this.integrationTypes ?? []) ||
|
|
398
|
-
!isEqual(command.contexts ?? [], this.contexts ?? [])
|
|
415
|
+
!isEqual(command.contexts ?? [], this.contexts ?? []) ||
|
|
416
|
+
('handler' in command && command.handler !== this.handler)
|
|
399
417
|
) {
|
|
400
418
|
return false;
|
|
401
419
|
}
|
|
@@ -224,6 +224,16 @@ class BaseInteraction extends Base {
|
|
|
224
224
|
);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Indicates whether this interaction is a {@link PrimaryEntryPointCommandInteraction}
|
|
229
|
+
* @returns {boolean}
|
|
230
|
+
*/
|
|
231
|
+
isPrimaryEntryPointCommand() {
|
|
232
|
+
return (
|
|
233
|
+
this.type === InteractionType.ApplicationCommand && this.commandType === ApplicationCommandType.PrimaryEntryPoint
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
227
237
|
/**
|
|
228
238
|
* Indicates whether this interaction is a {@link MessageComponentInteraction}
|
|
229
239
|
* @returns {boolean}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { CommandInteraction } = require('./CommandInteraction.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a primary entry point command interaction.
|
|
7
|
+
* @extends {CommandInteraction}
|
|
8
|
+
*/
|
|
9
|
+
class PrimaryEntryPointCommandInteraction extends CommandInteraction {}
|
|
10
|
+
|
|
11
|
+
exports.PrimaryEntryPointCommandInteraction = PrimaryEntryPointCommandInteraction;
|
|
@@ -51,6 +51,12 @@ class InteractionResponses {
|
|
|
51
51
|
* @property {boolean} [withResponse] Whether to return an {@link InteractionCallbackResponse} as the response
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Options for launching activity in response to a {@link BaseInteraction}
|
|
56
|
+
* @typedef {Object} LaunchActivityOptions
|
|
57
|
+
* @property {boolean} [withResponse] Whether to return an {@link InteractionCallbackResponse} as the response
|
|
58
|
+
*/
|
|
59
|
+
|
|
54
60
|
/**
|
|
55
61
|
* Options for showing a modal in response to a {@link BaseInteraction}
|
|
56
62
|
* @typedef {Object} ShowModalOptions
|
|
@@ -265,6 +271,25 @@ class InteractionResponses {
|
|
|
265
271
|
return options.withResponse ? new InteractionCallbackResponse(this.client, response) : undefined;
|
|
266
272
|
}
|
|
267
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Launches this application's activity, if enabled
|
|
276
|
+
* @param {LaunchActivityOptions} [options={}] Options for launching the activity
|
|
277
|
+
* @returns {Promise<InteractionCallbackResponse|undefined>}
|
|
278
|
+
*/
|
|
279
|
+
async launchActivity({ withResponse } = {}) {
|
|
280
|
+
if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
|
|
281
|
+
const response = await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
|
|
282
|
+
query: makeURLSearchParams({ with_response: withResponse ?? false }),
|
|
283
|
+
body: {
|
|
284
|
+
type: InteractionResponseType.LaunchActivity,
|
|
285
|
+
},
|
|
286
|
+
auth: false,
|
|
287
|
+
});
|
|
288
|
+
this.replied = true;
|
|
289
|
+
|
|
290
|
+
return withResponse ? new InteractionCallbackResponse(this.client, response) : undefined;
|
|
291
|
+
}
|
|
292
|
+
|
|
268
293
|
/**
|
|
269
294
|
* Shows a modal component
|
|
270
295
|
* @param {ModalBuilder|ModalComponentData|APIModalInteractionResponseCallbackData} modal The modal to show
|
|
@@ -328,6 +353,7 @@ class InteractionResponses {
|
|
|
328
353
|
'followUp',
|
|
329
354
|
'deferUpdate',
|
|
330
355
|
'update',
|
|
356
|
+
'launchActivity',
|
|
331
357
|
'showModal',
|
|
332
358
|
'awaitModalSubmit',
|
|
333
359
|
];
|
package/src/util/APITypes.js
CHANGED
|
@@ -325,6 +325,11 @@
|
|
|
325
325
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/EntitlementType}
|
|
326
326
|
*/
|
|
327
327
|
|
|
328
|
+
/**
|
|
329
|
+
* @external EntryPointCommandHandlerType
|
|
330
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/EntryPointCommandHandlerType}
|
|
331
|
+
*/
|
|
332
|
+
|
|
328
333
|
/**
|
|
329
334
|
* @external ForumLayoutType
|
|
330
335
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ForumLayoutType}
|
package/typings/index.d.mts
CHANGED
|
@@ -159,6 +159,7 @@ import {
|
|
|
159
159
|
VoiceChannelEffectSendAnimationType,
|
|
160
160
|
GatewayVoiceChannelEffectSendDispatchData,
|
|
161
161
|
RESTAPIPoll,
|
|
162
|
+
EntryPointCommandHandlerType,
|
|
162
163
|
} from 'discord-api-types/v10';
|
|
163
164
|
import { ChildProcess } from 'node:child_process';
|
|
164
165
|
import { Stream } from 'node:stream';
|
|
@@ -406,6 +407,7 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
406
407
|
public get manager(): ApplicationCommandManager;
|
|
407
408
|
public id: Snowflake;
|
|
408
409
|
public integrationTypes: ApplicationIntegrationType[] | null;
|
|
410
|
+
public handler: EntryPointCommandHandlerType | null;
|
|
409
411
|
public name: string;
|
|
410
412
|
public nameLocalizations: LocalizationMap | null;
|
|
411
413
|
public nameLocalized: string | null;
|
|
@@ -508,23 +510,6 @@ export type BooleanCache<Cached extends CacheType> = Cached extends 'cached' ? t
|
|
|
508
510
|
export abstract class CommandInteraction<Cached extends CacheType = CacheType> extends BaseInteraction<Cached> {
|
|
509
511
|
public type: InteractionType.ApplicationCommand;
|
|
510
512
|
public get command(): ApplicationCommand | ApplicationCommand<{ guild: GuildResolvable }> | null;
|
|
511
|
-
public options: Omit<
|
|
512
|
-
CommandInteractionOptionResolver<Cached>,
|
|
513
|
-
| 'getMessage'
|
|
514
|
-
| 'getFocused'
|
|
515
|
-
| 'getMentionable'
|
|
516
|
-
| 'getRole'
|
|
517
|
-
| 'getUser'
|
|
518
|
-
| 'getMember'
|
|
519
|
-
| 'getAttachment'
|
|
520
|
-
| 'getNumber'
|
|
521
|
-
| 'getInteger'
|
|
522
|
-
| 'getString'
|
|
523
|
-
| 'getChannel'
|
|
524
|
-
| 'getBoolean'
|
|
525
|
-
| 'getSubcommandGroup'
|
|
526
|
-
| 'getSubcommand'
|
|
527
|
-
>;
|
|
528
513
|
public channelId: Snowflake;
|
|
529
514
|
public commandId: Snowflake;
|
|
530
515
|
public commandName: string;
|
|
@@ -557,6 +542,13 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
557
542
|
public reply(
|
|
558
543
|
options: string | MessagePayload | InteractionReplyOptions,
|
|
559
544
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
545
|
+
public launchActivity(
|
|
546
|
+
options: LaunchActivityOptions & { withResponse: true },
|
|
547
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
|
548
|
+
public launchActivity(options?: LaunchActivityOptions & { withResponse?: false }): Promise<undefined>;
|
|
549
|
+
public launchActivity(
|
|
550
|
+
options?: LaunchActivityOptions,
|
|
551
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
560
552
|
public showModal(
|
|
561
553
|
modal:
|
|
562
554
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
@@ -1156,6 +1148,23 @@ export class CommandInteractionOptionResolver<Cached extends CacheType = CacheTy
|
|
|
1156
1148
|
}
|
|
1157
1149
|
|
|
1158
1150
|
export class ContextMenuCommandInteraction<Cached extends CacheType = CacheType> extends CommandInteraction<Cached> {
|
|
1151
|
+
public options: Omit<
|
|
1152
|
+
CommandInteractionOptionResolver<Cached>,
|
|
1153
|
+
| 'getMessage'
|
|
1154
|
+
| 'getFocused'
|
|
1155
|
+
| 'getMentionable'
|
|
1156
|
+
| 'getRole'
|
|
1157
|
+
| 'getUser'
|
|
1158
|
+
| 'getMember'
|
|
1159
|
+
| 'getAttachment'
|
|
1160
|
+
| 'getNumber'
|
|
1161
|
+
| 'getInteger'
|
|
1162
|
+
| 'getString'
|
|
1163
|
+
| 'getChannel'
|
|
1164
|
+
| 'getBoolean'
|
|
1165
|
+
| 'getSubcommandGroup'
|
|
1166
|
+
| 'getSubcommand'
|
|
1167
|
+
>;
|
|
1159
1168
|
public commandType: ApplicationCommandType.Message | ApplicationCommandType.User;
|
|
1160
1169
|
public targetId: Snowflake;
|
|
1161
1170
|
public inGuild(): this is ContextMenuCommandInteraction<'raw' | 'cached'>;
|
|
@@ -1164,6 +1173,15 @@ export class ContextMenuCommandInteraction<Cached extends CacheType = CacheType>
|
|
|
1164
1173
|
private resolveContextMenuOptions(data: APIApplicationCommandInteractionData): CommandInteractionOption<Cached>[];
|
|
1165
1174
|
}
|
|
1166
1175
|
|
|
1176
|
+
export class PrimaryEntryPointCommandInteraction<
|
|
1177
|
+
Cached extends CacheType = CacheType,
|
|
1178
|
+
> extends CommandInteraction<Cached> {
|
|
1179
|
+
public commandType: ApplicationCommandType.PrimaryEntryPoint;
|
|
1180
|
+
public inGuild(): this is PrimaryEntryPointCommandInteraction<'raw' | 'cached'>;
|
|
1181
|
+
public inCachedGuild(): this is PrimaryEntryPointCommandInteraction<'cached'>;
|
|
1182
|
+
public inRawGuild(): this is PrimaryEntryPointCommandInteraction<'raw'>;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1167
1185
|
// tslint:disable-next-line no-empty-interface
|
|
1168
1186
|
export interface DMChannel
|
|
1169
1187
|
extends Omit<
|
|
@@ -1779,6 +1797,7 @@ export type Interaction<Cached extends CacheType = CacheType> =
|
|
|
1779
1797
|
| ChatInputCommandInteraction<Cached>
|
|
1780
1798
|
| MessageContextMenuCommandInteraction<Cached>
|
|
1781
1799
|
| UserContextMenuCommandInteraction<Cached>
|
|
1800
|
+
| PrimaryEntryPointCommandInteraction<Cached>
|
|
1782
1801
|
| SelectMenuInteraction<Cached>
|
|
1783
1802
|
| ButtonInteraction<Cached>
|
|
1784
1803
|
| AutocompleteInteraction<Cached>
|
|
@@ -1828,6 +1847,7 @@ export class BaseInteraction<Cached extends CacheType = CacheType> extends Base
|
|
|
1828
1847
|
public isChatInputCommand(): this is ChatInputCommandInteraction<Cached>;
|
|
1829
1848
|
public isCommand(): this is CommandInteraction<Cached>;
|
|
1830
1849
|
public isContextMenuCommand(): this is ContextMenuCommandInteraction<Cached>;
|
|
1850
|
+
public isPrimaryEntryPointCommand(): this is PrimaryEntryPointCommandInteraction<Cached>;
|
|
1831
1851
|
public isMessageComponent(): this is MessageComponentInteraction<Cached>;
|
|
1832
1852
|
public isMessageContextMenuCommand(): this is MessageContextMenuCommandInteraction<Cached>;
|
|
1833
1853
|
public isModalSubmit(): this is ModalSubmitInteraction<Cached>;
|
|
@@ -2199,6 +2219,13 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|
|
2199
2219
|
public update(
|
|
2200
2220
|
options: string | MessagePayload | InteractionUpdateOptions,
|
|
2201
2221
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
2222
|
+
public launchActivity(
|
|
2223
|
+
options: LaunchActivityOptions & { withResponse: true },
|
|
2224
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
|
2225
|
+
public launchActivity(options?: LaunchActivityOptions & { withResponse?: false }): Promise<undefined>;
|
|
2226
|
+
public launchActivity(
|
|
2227
|
+
options?: LaunchActivityOptions,
|
|
2228
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
2202
2229
|
public showModal(
|
|
2203
2230
|
modal:
|
|
2204
2231
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
@@ -2437,6 +2464,13 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|
|
2437
2464
|
public deferUpdate(
|
|
2438
2465
|
options?: InteractionDeferUpdateOptions,
|
|
2439
2466
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
2467
|
+
public launchActivity(
|
|
2468
|
+
options: LaunchActivityOptions & { withResponse: true },
|
|
2469
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
|
2470
|
+
public launchActivity(options?: LaunchActivityOptions & { withResponse?: false }): Promise<undefined>;
|
|
2471
|
+
public launchActivity(
|
|
2472
|
+
options?: LaunchActivityOptions,
|
|
2473
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
2440
2474
|
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
|
2441
2475
|
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
|
2442
2476
|
public inRawGuild(): this is ModalSubmitInteraction<'raw'>;
|
|
@@ -4576,10 +4610,18 @@ export interface ChatInputApplicationCommandData extends BaseApplicationCommandD
|
|
|
4576
4610
|
options?: readonly ApplicationCommandOptionData[];
|
|
4577
4611
|
}
|
|
4578
4612
|
|
|
4613
|
+
export interface PrimaryEntryPointCommandData extends BaseApplicationCommandData {
|
|
4614
|
+
description?: string;
|
|
4615
|
+
descriptionLocalizations?: LocalizationMap;
|
|
4616
|
+
type: ApplicationCommandType.PrimaryEntryPoint;
|
|
4617
|
+
handler?: EntryPointCommandHandlerType;
|
|
4618
|
+
}
|
|
4619
|
+
|
|
4579
4620
|
export type ApplicationCommandData =
|
|
4580
4621
|
| UserApplicationCommandData
|
|
4581
4622
|
| MessageApplicationCommandData
|
|
4582
|
-
| ChatInputApplicationCommandData
|
|
4623
|
+
| ChatInputApplicationCommandData
|
|
4624
|
+
| PrimaryEntryPointCommandData;
|
|
4583
4625
|
|
|
4584
4626
|
export interface ApplicationCommandChannelOptionData extends BaseApplicationCommandOptionsData {
|
|
4585
4627
|
type: CommandOptionChannelResolvableType;
|
|
@@ -6605,6 +6647,10 @@ export interface ShowModalOptions {
|
|
|
6605
6647
|
withResponse?: boolean;
|
|
6606
6648
|
}
|
|
6607
6649
|
|
|
6650
|
+
export interface LaunchActivityOptions {
|
|
6651
|
+
withResponse?: boolean;
|
|
6652
|
+
}
|
|
6653
|
+
|
|
6608
6654
|
export { Snowflake };
|
|
6609
6655
|
|
|
6610
6656
|
export type StageInstanceResolvable = StageInstance | Snowflake;
|
package/typings/index.d.ts
CHANGED
|
@@ -159,6 +159,7 @@ import {
|
|
|
159
159
|
VoiceChannelEffectSendAnimationType,
|
|
160
160
|
GatewayVoiceChannelEffectSendDispatchData,
|
|
161
161
|
RESTAPIPoll,
|
|
162
|
+
EntryPointCommandHandlerType,
|
|
162
163
|
} from 'discord-api-types/v10';
|
|
163
164
|
import { ChildProcess } from 'node:child_process';
|
|
164
165
|
import { Stream } from 'node:stream';
|
|
@@ -406,6 +407,7 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
406
407
|
public get manager(): ApplicationCommandManager;
|
|
407
408
|
public id: Snowflake;
|
|
408
409
|
public integrationTypes: ApplicationIntegrationType[] | null;
|
|
410
|
+
public handler: EntryPointCommandHandlerType | null;
|
|
409
411
|
public name: string;
|
|
410
412
|
public nameLocalizations: LocalizationMap | null;
|
|
411
413
|
public nameLocalized: string | null;
|
|
@@ -508,23 +510,6 @@ export type BooleanCache<Cached extends CacheType> = Cached extends 'cached' ? t
|
|
|
508
510
|
export abstract class CommandInteraction<Cached extends CacheType = CacheType> extends BaseInteraction<Cached> {
|
|
509
511
|
public type: InteractionType.ApplicationCommand;
|
|
510
512
|
public get command(): ApplicationCommand | ApplicationCommand<{ guild: GuildResolvable }> | null;
|
|
511
|
-
public options: Omit<
|
|
512
|
-
CommandInteractionOptionResolver<Cached>,
|
|
513
|
-
| 'getMessage'
|
|
514
|
-
| 'getFocused'
|
|
515
|
-
| 'getMentionable'
|
|
516
|
-
| 'getRole'
|
|
517
|
-
| 'getUser'
|
|
518
|
-
| 'getMember'
|
|
519
|
-
| 'getAttachment'
|
|
520
|
-
| 'getNumber'
|
|
521
|
-
| 'getInteger'
|
|
522
|
-
| 'getString'
|
|
523
|
-
| 'getChannel'
|
|
524
|
-
| 'getBoolean'
|
|
525
|
-
| 'getSubcommandGroup'
|
|
526
|
-
| 'getSubcommand'
|
|
527
|
-
>;
|
|
528
513
|
public channelId: Snowflake;
|
|
529
514
|
public commandId: Snowflake;
|
|
530
515
|
public commandName: string;
|
|
@@ -557,6 +542,13 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|
|
557
542
|
public reply(
|
|
558
543
|
options: string | MessagePayload | InteractionReplyOptions,
|
|
559
544
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
545
|
+
public launchActivity(
|
|
546
|
+
options: LaunchActivityOptions & { withResponse: true },
|
|
547
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
|
548
|
+
public launchActivity(options?: LaunchActivityOptions & { withResponse?: false }): Promise<undefined>;
|
|
549
|
+
public launchActivity(
|
|
550
|
+
options?: LaunchActivityOptions,
|
|
551
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
560
552
|
public showModal(
|
|
561
553
|
modal:
|
|
562
554
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
@@ -1156,6 +1148,23 @@ export class CommandInteractionOptionResolver<Cached extends CacheType = CacheTy
|
|
|
1156
1148
|
}
|
|
1157
1149
|
|
|
1158
1150
|
export class ContextMenuCommandInteraction<Cached extends CacheType = CacheType> extends CommandInteraction<Cached> {
|
|
1151
|
+
public options: Omit<
|
|
1152
|
+
CommandInteractionOptionResolver<Cached>,
|
|
1153
|
+
| 'getMessage'
|
|
1154
|
+
| 'getFocused'
|
|
1155
|
+
| 'getMentionable'
|
|
1156
|
+
| 'getRole'
|
|
1157
|
+
| 'getUser'
|
|
1158
|
+
| 'getMember'
|
|
1159
|
+
| 'getAttachment'
|
|
1160
|
+
| 'getNumber'
|
|
1161
|
+
| 'getInteger'
|
|
1162
|
+
| 'getString'
|
|
1163
|
+
| 'getChannel'
|
|
1164
|
+
| 'getBoolean'
|
|
1165
|
+
| 'getSubcommandGroup'
|
|
1166
|
+
| 'getSubcommand'
|
|
1167
|
+
>;
|
|
1159
1168
|
public commandType: ApplicationCommandType.Message | ApplicationCommandType.User;
|
|
1160
1169
|
public targetId: Snowflake;
|
|
1161
1170
|
public inGuild(): this is ContextMenuCommandInteraction<'raw' | 'cached'>;
|
|
@@ -1164,6 +1173,15 @@ export class ContextMenuCommandInteraction<Cached extends CacheType = CacheType>
|
|
|
1164
1173
|
private resolveContextMenuOptions(data: APIApplicationCommandInteractionData): CommandInteractionOption<Cached>[];
|
|
1165
1174
|
}
|
|
1166
1175
|
|
|
1176
|
+
export class PrimaryEntryPointCommandInteraction<
|
|
1177
|
+
Cached extends CacheType = CacheType,
|
|
1178
|
+
> extends CommandInteraction<Cached> {
|
|
1179
|
+
public commandType: ApplicationCommandType.PrimaryEntryPoint;
|
|
1180
|
+
public inGuild(): this is PrimaryEntryPointCommandInteraction<'raw' | 'cached'>;
|
|
1181
|
+
public inCachedGuild(): this is PrimaryEntryPointCommandInteraction<'cached'>;
|
|
1182
|
+
public inRawGuild(): this is PrimaryEntryPointCommandInteraction<'raw'>;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1167
1185
|
// tslint:disable-next-line no-empty-interface
|
|
1168
1186
|
export interface DMChannel
|
|
1169
1187
|
extends Omit<
|
|
@@ -1779,6 +1797,7 @@ export type Interaction<Cached extends CacheType = CacheType> =
|
|
|
1779
1797
|
| ChatInputCommandInteraction<Cached>
|
|
1780
1798
|
| MessageContextMenuCommandInteraction<Cached>
|
|
1781
1799
|
| UserContextMenuCommandInteraction<Cached>
|
|
1800
|
+
| PrimaryEntryPointCommandInteraction<Cached>
|
|
1782
1801
|
| SelectMenuInteraction<Cached>
|
|
1783
1802
|
| ButtonInteraction<Cached>
|
|
1784
1803
|
| AutocompleteInteraction<Cached>
|
|
@@ -1828,6 +1847,7 @@ export class BaseInteraction<Cached extends CacheType = CacheType> extends Base
|
|
|
1828
1847
|
public isChatInputCommand(): this is ChatInputCommandInteraction<Cached>;
|
|
1829
1848
|
public isCommand(): this is CommandInteraction<Cached>;
|
|
1830
1849
|
public isContextMenuCommand(): this is ContextMenuCommandInteraction<Cached>;
|
|
1850
|
+
public isPrimaryEntryPointCommand(): this is PrimaryEntryPointCommandInteraction<Cached>;
|
|
1831
1851
|
public isMessageComponent(): this is MessageComponentInteraction<Cached>;
|
|
1832
1852
|
public isMessageContextMenuCommand(): this is MessageContextMenuCommandInteraction<Cached>;
|
|
1833
1853
|
public isModalSubmit(): this is ModalSubmitInteraction<Cached>;
|
|
@@ -2199,6 +2219,13 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|
|
2199
2219
|
public update(
|
|
2200
2220
|
options: string | MessagePayload | InteractionUpdateOptions,
|
|
2201
2221
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
2222
|
+
public launchActivity(
|
|
2223
|
+
options: LaunchActivityOptions & { withResponse: true },
|
|
2224
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
|
2225
|
+
public launchActivity(options?: LaunchActivityOptions & { withResponse?: false }): Promise<undefined>;
|
|
2226
|
+
public launchActivity(
|
|
2227
|
+
options?: LaunchActivityOptions,
|
|
2228
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
2202
2229
|
public showModal(
|
|
2203
2230
|
modal:
|
|
2204
2231
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
|
@@ -2437,6 +2464,13 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|
|
2437
2464
|
public deferUpdate(
|
|
2438
2465
|
options?: InteractionDeferUpdateOptions,
|
|
2439
2466
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
2467
|
+
public launchActivity(
|
|
2468
|
+
options: LaunchActivityOptions & { withResponse: true },
|
|
2469
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
|
2470
|
+
public launchActivity(options?: LaunchActivityOptions & { withResponse?: false }): Promise<undefined>;
|
|
2471
|
+
public launchActivity(
|
|
2472
|
+
options?: LaunchActivityOptions,
|
|
2473
|
+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
|
2440
2474
|
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
|
2441
2475
|
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
|
2442
2476
|
public inRawGuild(): this is ModalSubmitInteraction<'raw'>;
|
|
@@ -4576,10 +4610,18 @@ export interface ChatInputApplicationCommandData extends BaseApplicationCommandD
|
|
|
4576
4610
|
options?: readonly ApplicationCommandOptionData[];
|
|
4577
4611
|
}
|
|
4578
4612
|
|
|
4613
|
+
export interface PrimaryEntryPointCommandData extends BaseApplicationCommandData {
|
|
4614
|
+
description?: string;
|
|
4615
|
+
descriptionLocalizations?: LocalizationMap;
|
|
4616
|
+
type: ApplicationCommandType.PrimaryEntryPoint;
|
|
4617
|
+
handler?: EntryPointCommandHandlerType;
|
|
4618
|
+
}
|
|
4619
|
+
|
|
4579
4620
|
export type ApplicationCommandData =
|
|
4580
4621
|
| UserApplicationCommandData
|
|
4581
4622
|
| MessageApplicationCommandData
|
|
4582
|
-
| ChatInputApplicationCommandData
|
|
4623
|
+
| ChatInputApplicationCommandData
|
|
4624
|
+
| PrimaryEntryPointCommandData;
|
|
4583
4625
|
|
|
4584
4626
|
export interface ApplicationCommandChannelOptionData extends BaseApplicationCommandOptionsData {
|
|
4585
4627
|
type: CommandOptionChannelResolvableType;
|
|
@@ -6605,6 +6647,10 @@ export interface ShowModalOptions {
|
|
|
6605
6647
|
withResponse?: boolean;
|
|
6606
6648
|
}
|
|
6607
6649
|
|
|
6650
|
+
export interface LaunchActivityOptions {
|
|
6651
|
+
withResponse?: boolean;
|
|
6652
|
+
}
|
|
6653
|
+
|
|
6608
6654
|
export { Snowflake };
|
|
6609
6655
|
|
|
6610
6656
|
export type StageInstanceResolvable = StageInstance | Snowflake;
|
package/typings/index.test-d.ts
CHANGED
|
@@ -204,6 +204,7 @@ import {
|
|
|
204
204
|
SendableChannels,
|
|
205
205
|
PollData,
|
|
206
206
|
InteractionCallbackResponse,
|
|
207
|
+
PrimaryEntryPointCommandInteraction,
|
|
207
208
|
GuildScheduledEventRecurrenceRuleOptions,
|
|
208
209
|
ThreadOnlyChannel,
|
|
209
210
|
PartialPoll,
|
|
@@ -1884,6 +1885,11 @@ client.on('interactionCreate', async interaction => {
|
|
|
1884
1885
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.deferUpdate({ withResponse: true }));
|
|
1885
1886
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
1886
1887
|
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
|
1888
|
+
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.launchActivity({ withResponse: true }));
|
|
1889
|
+
expectType<Promise<undefined>>(interaction.launchActivity({ withResponse: false }));
|
|
1890
|
+
expectType<Promise<InteractionCallbackResponse<true> | undefined>>(
|
|
1891
|
+
interaction.launchActivity({ withResponse: booleanValue }),
|
|
1892
|
+
);
|
|
1887
1893
|
} else if (interaction.inRawGuild()) {
|
|
1888
1894
|
expectAssignable<MessageComponentInteraction>(interaction);
|
|
1889
1895
|
expectType<APIButtonComponent | APISelectMenuComponent>(interaction.component);
|
|
@@ -1910,6 +1916,11 @@ client.on('interactionCreate', async interaction => {
|
|
|
1910
1916
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.deferUpdate({ withResponse: true }));
|
|
1911
1917
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
1912
1918
|
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
|
1919
|
+
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.launchActivity({ withResponse: true }));
|
|
1920
|
+
expectType<Promise<undefined>>(interaction.launchActivity({ withResponse: false }));
|
|
1921
|
+
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
|
1922
|
+
interaction.launchActivity({ withResponse: booleanValue }),
|
|
1923
|
+
);
|
|
1913
1924
|
} else if (interaction.inGuild()) {
|
|
1914
1925
|
expectAssignable<MessageComponentInteraction>(interaction);
|
|
1915
1926
|
expectType<MessageActionRowComponent | APIButtonComponent | APISelectMenuComponent>(interaction.component);
|
|
@@ -1936,6 +1947,11 @@ client.on('interactionCreate', async interaction => {
|
|
|
1936
1947
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
|
1937
1948
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
1938
1949
|
expectType<Promise<Message>>(interaction.followUp({ content: 'a' }));
|
|
1950
|
+
expectType<Promise<InteractionCallbackResponse>>(interaction.launchActivity({ withResponse: true }));
|
|
1951
|
+
expectType<Promise<undefined>>(interaction.launchActivity({ withResponse: false }));
|
|
1952
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
1953
|
+
interaction.launchActivity({ withResponse: booleanValue }),
|
|
1954
|
+
);
|
|
1939
1955
|
}
|
|
1940
1956
|
}
|
|
1941
1957
|
|
|
@@ -1982,6 +1998,11 @@ client.on('interactionCreate', async interaction => {
|
|
|
1982
1998
|
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
|
1983
1999
|
expectType<Promise<Message<true>>>(interaction.fetchReply());
|
|
1984
2000
|
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
|
2001
|
+
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.launchActivity({ withResponse: true }));
|
|
2002
|
+
expectType<Promise<undefined>>(interaction.launchActivity({ withResponse: false }));
|
|
2003
|
+
expectType<Promise<InteractionCallbackResponse<true> | undefined>>(
|
|
2004
|
+
interaction.launchActivity({ withResponse: booleanValue }),
|
|
2005
|
+
);
|
|
1985
2006
|
} else if (interaction.inRawGuild()) {
|
|
1986
2007
|
expectAssignable<ContextMenuCommandInteraction>(interaction);
|
|
1987
2008
|
expectType<null>(interaction.guild);
|
|
@@ -1999,6 +2020,11 @@ client.on('interactionCreate', async interaction => {
|
|
|
1999
2020
|
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
|
2000
2021
|
expectType<Promise<Message<false>>>(interaction.fetchReply());
|
|
2001
2022
|
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
|
2023
|
+
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.launchActivity({ withResponse: true }));
|
|
2024
|
+
expectType<Promise<undefined>>(interaction.launchActivity({ withResponse: false }));
|
|
2025
|
+
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
|
2026
|
+
interaction.launchActivity({ withResponse: booleanValue }),
|
|
2027
|
+
);
|
|
2002
2028
|
} else if (interaction.inGuild()) {
|
|
2003
2029
|
expectAssignable<ContextMenuCommandInteraction>(interaction);
|
|
2004
2030
|
expectType<Guild | null>(interaction.guild);
|
|
@@ -2016,6 +2042,11 @@ client.on('interactionCreate', async interaction => {
|
|
|
2016
2042
|
expectType<Promise<Message>>(interaction.editReply({ content: 'a' }));
|
|
2017
2043
|
expectType<Promise<Message>>(interaction.fetchReply());
|
|
2018
2044
|
expectType<Promise<Message>>(interaction.followUp({ content: 'a' }));
|
|
2045
|
+
expectType<Promise<InteractionCallbackResponse>>(interaction.launchActivity({ withResponse: true }));
|
|
2046
|
+
expectType<Promise<undefined>>(interaction.launchActivity({ withResponse: false }));
|
|
2047
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
2048
|
+
interaction.launchActivity({ withResponse: booleanValue }),
|
|
2049
|
+
);
|
|
2019
2050
|
}
|
|
2020
2051
|
}
|
|
2021
2052
|
|
|
@@ -2184,6 +2215,84 @@ client.on('interactionCreate', async interaction => {
|
|
|
2184
2215
|
interaction.options.getMessage('name');
|
|
2185
2216
|
}
|
|
2186
2217
|
|
|
2218
|
+
if (
|
|
2219
|
+
interaction.type === InteractionType.ApplicationCommand &&
|
|
2220
|
+
interaction.commandType === ApplicationCommandType.PrimaryEntryPoint
|
|
2221
|
+
) {
|
|
2222
|
+
expectType<PrimaryEntryPointCommandInteraction>(interaction);
|
|
2223
|
+
|
|
2224
|
+
// @ts-expect-error No options on primary entry point commands
|
|
2225
|
+
interaction.options;
|
|
2226
|
+
if (interaction.inCachedGuild()) {
|
|
2227
|
+
expectAssignable<PrimaryEntryPointCommandInteraction>(interaction);
|
|
2228
|
+
expectAssignable<Guild>(interaction.guild);
|
|
2229
|
+
expectAssignable<CommandInteraction<'cached'>>(interaction);
|
|
2230
|
+
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
2231
|
+
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.deferReply({ withResponse: true }));
|
|
2232
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
2233
|
+
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
|
2234
|
+
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
|
2235
|
+
expectType<Promise<InteractionCallbackResponse<true> | undefined>>(
|
|
2236
|
+
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
|
2237
|
+
);
|
|
2238
|
+
expectType<Promise<InteractionCallbackResponse<true> | undefined>>(
|
|
2239
|
+
interaction.deferReply({ withResponse: booleanValue }),
|
|
2240
|
+
);
|
|
2241
|
+
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
|
2242
|
+
expectType<Promise<Message<true>>>(interaction.fetchReply());
|
|
2243
|
+
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
|
2244
|
+
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.launchActivity({ withResponse: true }));
|
|
2245
|
+
expectType<Promise<undefined>>(interaction.launchActivity({ withResponse: false }));
|
|
2246
|
+
expectType<Promise<InteractionCallbackResponse<true> | undefined>>(
|
|
2247
|
+
interaction.launchActivity({ withResponse: booleanValue }),
|
|
2248
|
+
);
|
|
2249
|
+
} else if (interaction.inRawGuild()) {
|
|
2250
|
+
expectAssignable<PrimaryEntryPointCommandInteraction>(interaction);
|
|
2251
|
+
expectType<null>(interaction.guild);
|
|
2252
|
+
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
2253
|
+
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.deferReply({ withResponse: true }));
|
|
2254
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
2255
|
+
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
|
2256
|
+
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
|
2257
|
+
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
|
2258
|
+
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
|
2259
|
+
);
|
|
2260
|
+
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
|
2261
|
+
interaction.deferReply({ withResponse: booleanValue }),
|
|
2262
|
+
);
|
|
2263
|
+
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
|
2264
|
+
expectType<Promise<Message<false>>>(interaction.fetchReply());
|
|
2265
|
+
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
|
2266
|
+
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.launchActivity({ withResponse: true }));
|
|
2267
|
+
expectType<Promise<undefined>>(interaction.launchActivity({ withResponse: false }));
|
|
2268
|
+
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
|
2269
|
+
interaction.launchActivity({ withResponse: booleanValue }),
|
|
2270
|
+
);
|
|
2271
|
+
} else if (interaction.inGuild()) {
|
|
2272
|
+
expectAssignable<PrimaryEntryPointCommandInteraction>(interaction);
|
|
2273
|
+
expectType<Guild | null>(interaction.guild);
|
|
2274
|
+
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
|
2275
|
+
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
|
2276
|
+
expectType<Promise<undefined>>(interaction.deferReply());
|
|
2277
|
+
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
|
2278
|
+
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
|
2279
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
2280
|
+
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
|
2281
|
+
);
|
|
2282
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
2283
|
+
interaction.deferReply({ withResponse: booleanValue }),
|
|
2284
|
+
);
|
|
2285
|
+
expectType<Promise<Message>>(interaction.editReply({ content: 'a' }));
|
|
2286
|
+
expectType<Promise<Message>>(interaction.fetchReply());
|
|
2287
|
+
expectType<Promise<Message>>(interaction.followUp({ content: 'a' }));
|
|
2288
|
+
expectType<Promise<InteractionCallbackResponse>>(interaction.launchActivity({ withResponse: true }));
|
|
2289
|
+
expectType<Promise<undefined>>(interaction.launchActivity({ withResponse: false }));
|
|
2290
|
+
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
|
2291
|
+
interaction.launchActivity({ withResponse: booleanValue }),
|
|
2292
|
+
);
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2187
2296
|
if (interaction.isRepliable()) {
|
|
2188
2297
|
expectAssignable<RepliableInteraction>(interaction);
|
|
2189
2298
|
interaction.reply('test');
|
|
@@ -2212,6 +2321,7 @@ client.on('interactionCreate', async interaction => {
|
|
|
2212
2321
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.deferUpdate({ withResponse: true }));
|
|
2213
2322
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
2214
2323
|
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
|
2324
|
+
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.launchActivity({ withResponse: true }));
|
|
2215
2325
|
} else if (interaction.inRawGuild()) {
|
|
2216
2326
|
expectAssignable<ModalSubmitInteraction>(interaction);
|
|
2217
2327
|
expectType<null>(interaction.guild);
|
|
@@ -2223,6 +2333,7 @@ client.on('interactionCreate', async interaction => {
|
|
|
2223
2333
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.deferUpdate({ withResponse: true }));
|
|
2224
2334
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
2225
2335
|
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
|
2336
|
+
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.launchActivity({ withResponse: true }));
|
|
2226
2337
|
} else if (interaction.inGuild()) {
|
|
2227
2338
|
expectAssignable<ModalSubmitInteraction>(interaction);
|
|
2228
2339
|
expectType<Guild | null>(interaction.guild);
|
|
@@ -2234,6 +2345,7 @@ client.on('interactionCreate', async interaction => {
|
|
|
2234
2345
|
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
|
2235
2346
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
|
2236
2347
|
expectType<Promise<Message>>(interaction.followUp({ content: 'a' }));
|
|
2348
|
+
expectType<Promise<InteractionCallbackResponse>>(interaction.launchActivity({ withResponse: true }));
|
|
2237
2349
|
}
|
|
2238
2350
|
}
|
|
2239
2351
|
});
|