discord.js 15.0.0-dev.1733703214-af4018c25 → 15.0.0-dev.1733789592-5d00332b8
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/managers/ApplicationCommandManager.js +0 -1
- package/src/structures/ApplicationCommand.js +0 -24
- package/src/structures/GuildChannel.js +9 -4
- package/src/structures/Message.js +0 -27
- package/typings/index.d.mts +1 -14
- package/typings/index.d.ts +1 -14
- package/typings/index.test-d.ts +1 -1
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.1733789592-5d00332b8",
|
|
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",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"undici": "6.21.0",
|
|
63
63
|
"@discordjs/formatters": "^0.5.0",
|
|
64
64
|
"@discordjs/rest": "^2.4.0",
|
|
65
|
-
"@discordjs/
|
|
66
|
-
"@discordjs/
|
|
65
|
+
"@discordjs/ws": "^2.0.0",
|
|
66
|
+
"@discordjs/util": "^1.1.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@favware/cliff-jumper": "^4.1.0",
|
|
@@ -258,7 +258,6 @@ class ApplicationCommandManager extends CachedManager {
|
|
|
258
258
|
type: command.type,
|
|
259
259
|
options: command.options?.map(option => ApplicationCommand.transformOption(option)),
|
|
260
260
|
default_member_permissions,
|
|
261
|
-
dm_permission: command.dmPermission ?? command.dm_permission,
|
|
262
261
|
integration_types: command.integrationTypes ?? command.integration_types,
|
|
263
262
|
contexts: command.contexts,
|
|
264
263
|
};
|
|
@@ -140,18 +140,6 @@ class ApplicationCommand extends Base {
|
|
|
140
140
|
this.defaultMemberPermissions ??= null;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
if ('dm_permission' in data) {
|
|
144
|
-
/**
|
|
145
|
-
* Whether the command can be used in DMs
|
|
146
|
-
* <info>This property is always `null` on guild commands</info>
|
|
147
|
-
* @type {?boolean}
|
|
148
|
-
* @deprecated Use {@link ApplicationCommand#contexts} instead.
|
|
149
|
-
*/
|
|
150
|
-
this.dmPermission = data.dm_permission;
|
|
151
|
-
} else {
|
|
152
|
-
this.dmPermission ??= null;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
143
|
if ('integration_types' in data) {
|
|
156
144
|
/**
|
|
157
145
|
* Installation context(s) where the command is available
|
|
@@ -224,7 +212,6 @@ class ApplicationCommand extends Base {
|
|
|
224
212
|
* @property {ApplicationCommandOptionData[]} [options] Options for the command
|
|
225
213
|
* @property {?PermissionResolvable} [defaultMemberPermissions] The bitfield used to determine the default permissions
|
|
226
214
|
* a member needs in order to run the command
|
|
227
|
-
* @property {boolean} [dmPermission] Whether the command is enabled in DMs
|
|
228
215
|
*/
|
|
229
216
|
|
|
230
217
|
/**
|
|
@@ -341,15 +328,6 @@ class ApplicationCommand extends Base {
|
|
|
341
328
|
return this.edit({ defaultMemberPermissions });
|
|
342
329
|
}
|
|
343
330
|
|
|
344
|
-
/**
|
|
345
|
-
* Edits the DM permission of this ApplicationCommand
|
|
346
|
-
* @param {boolean} [dmPermission=true] Whether the command can be used in DMs
|
|
347
|
-
* @returns {Promise<ApplicationCommand>}
|
|
348
|
-
*/
|
|
349
|
-
setDMPermission(dmPermission = true) {
|
|
350
|
-
return this.edit({ dmPermission });
|
|
351
|
-
}
|
|
352
|
-
|
|
353
331
|
/**
|
|
354
332
|
* Edits the options of this ApplicationCommand
|
|
355
333
|
* @param {ApplicationCommandOptionData[]} options The options to set for this command
|
|
@@ -386,7 +364,6 @@ class ApplicationCommand extends Base {
|
|
|
386
364
|
if (command.id && this.id !== command.id) return false;
|
|
387
365
|
|
|
388
366
|
let defaultMemberPermissions = null;
|
|
389
|
-
let dmPermission = command.dmPermission ?? command.dm_permission;
|
|
390
367
|
|
|
391
368
|
if ('default_member_permissions' in command) {
|
|
392
369
|
defaultMemberPermissions = command.default_member_permissions
|
|
@@ -412,7 +389,6 @@ class ApplicationCommand extends Base {
|
|
|
412
389
|
// TODO: remove ?? 0 on each when nullable
|
|
413
390
|
(command.options?.length ?? 0) !== (this.options?.length ?? 0) ||
|
|
414
391
|
defaultMemberPermissions !== (this.defaultMemberPermissions?.bitfield ?? null) ||
|
|
415
|
-
(dmPermission !== undefined && dmPermission !== this.dmPermission) ||
|
|
416
392
|
!isEqual(command.nameLocalizations ?? command.name_localizations ?? {}, this.nameLocalizations ?? {}) ||
|
|
417
393
|
!isEqual(
|
|
418
394
|
command.descriptionLocalizations ?? command.description_localizations ?? {},
|
|
@@ -316,7 +316,7 @@ class GuildChannel extends BaseChannel {
|
|
|
316
316
|
/**
|
|
317
317
|
* Options used to set the parent of a channel.
|
|
318
318
|
* @typedef {Object} SetParentOptions
|
|
319
|
-
* @property {boolean} [lockPermissions=
|
|
319
|
+
* @property {boolean} [lockPermissions=false] Whether to lock the permissions to what the parent's permissions are
|
|
320
320
|
* @property {string} [reason] The reason for modifying the parent of the channel
|
|
321
321
|
*/
|
|
322
322
|
|
|
@@ -327,11 +327,16 @@ class GuildChannel extends BaseChannel {
|
|
|
327
327
|
* @returns {Promise<GuildChannel>}
|
|
328
328
|
* @example
|
|
329
329
|
* // Add a parent to a channel
|
|
330
|
-
* message.channel.setParent('355908108431917066'
|
|
331
|
-
* .then(channel => console.log(`New parent of ${
|
|
330
|
+
* message.channel.setParent('355908108431917066')
|
|
331
|
+
* .then(channel => console.log(`New parent of ${channel.name}: ${channel.parent.name}`))
|
|
332
|
+
* .catch(console.error);
|
|
333
|
+
* @example
|
|
334
|
+
* // Move a channel and sync its permissions with the parent
|
|
335
|
+
* message.channel.setParent('355908108431917066', { lockPermissions: true })
|
|
336
|
+
* .then(channel => console.log(`Moved ${message.channel.name} to ${channel.parent.name}`))
|
|
332
337
|
* .catch(console.error);
|
|
333
338
|
*/
|
|
334
|
-
setParent(channel, { lockPermissions =
|
|
339
|
+
setParent(channel, { lockPermissions = false, reason } = {}) {
|
|
335
340
|
return this.edit({
|
|
336
341
|
parent: channel ?? null,
|
|
337
342
|
lockPermissions,
|
|
@@ -413,33 +413,6 @@ class Message extends Base {
|
|
|
413
413
|
this.interactionMetadata ??= null;
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
/**
|
|
417
|
-
* Partial data of the interaction that a message is a reply to
|
|
418
|
-
* @typedef {Object} MessageInteraction
|
|
419
|
-
* @property {Snowflake} id The interaction's id
|
|
420
|
-
* @property {InteractionType} type The type of the interaction
|
|
421
|
-
* @property {string} commandName The name of the interaction's application command,
|
|
422
|
-
* as well as the subcommand and subcommand group, where applicable
|
|
423
|
-
* @property {User} user The user that invoked the interaction
|
|
424
|
-
* @deprecated Use {@link Message#interactionMetadata} instead.
|
|
425
|
-
*/
|
|
426
|
-
|
|
427
|
-
if (data.interaction) {
|
|
428
|
-
/**
|
|
429
|
-
* Partial data of the interaction that this message is a reply to
|
|
430
|
-
* @type {?MessageInteraction}
|
|
431
|
-
* @deprecated Use {@link Message#interactionMetadata} instead.
|
|
432
|
-
*/
|
|
433
|
-
this.interaction = {
|
|
434
|
-
id: data.interaction.id,
|
|
435
|
-
type: data.interaction.type,
|
|
436
|
-
commandName: data.interaction.name,
|
|
437
|
-
user: this.client.users._add(data.interaction.user),
|
|
438
|
-
};
|
|
439
|
-
} else {
|
|
440
|
-
this.interaction ??= null;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
416
|
if (data.poll) {
|
|
444
417
|
/**
|
|
445
418
|
* The poll that was sent with the message
|
package/typings/index.d.mts
CHANGED
|
@@ -429,8 +429,6 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
429
429
|
public description: string;
|
|
430
430
|
public descriptionLocalizations: LocalizationMap | null;
|
|
431
431
|
public descriptionLocalized: string | null;
|
|
432
|
-
/** @deprecated Use {@link ApplicationCommand.contexts} instead */
|
|
433
|
-
public dmPermission: boolean | null;
|
|
434
432
|
public guild: Guild | null;
|
|
435
433
|
public guildId: Snowflake | null;
|
|
436
434
|
public get manager(): ApplicationCommandManager;
|
|
@@ -460,7 +458,6 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
460
458
|
public setDefaultMemberPermissions(
|
|
461
459
|
defaultMemberPermissions: PermissionResolvable | null,
|
|
462
460
|
): Promise<ApplicationCommand<PermissionsFetchType>>;
|
|
463
|
-
public setDMPermission(dmPermission?: boolean): Promise<ApplicationCommand<PermissionsFetchType>>;
|
|
464
461
|
public setOptions(
|
|
465
462
|
options: readonly ApplicationCommandOptionData[],
|
|
466
463
|
): Promise<ApplicationCommand<PermissionsFetchType>>;
|
|
@@ -2207,8 +2204,6 @@ export class Message<InGuild extends boolean = boolean> extends Base {
|
|
|
2207
2204
|
public get guild(): If<InGuild, Guild>;
|
|
2208
2205
|
public get hasThread(): boolean;
|
|
2209
2206
|
public id: Snowflake;
|
|
2210
|
-
/** @deprecated Use {@link Message.interactionMetadata} instead. */
|
|
2211
|
-
public interaction: MessageInteraction | null;
|
|
2212
2207
|
public interactionMetadata: MessageInteractionMetadata | null;
|
|
2213
2208
|
public get member(): GuildMember | null;
|
|
2214
2209
|
public mentions: MessageMentions<InGuild>;
|
|
@@ -4694,7 +4689,6 @@ export type AllowedThreadTypeForTextChannel = ChannelType.PublicThread | Channel
|
|
|
4694
4689
|
export interface BaseApplicationCommandData {
|
|
4695
4690
|
name: string;
|
|
4696
4691
|
nameLocalizations?: LocalizationMap;
|
|
4697
|
-
dmPermission?: boolean;
|
|
4698
4692
|
defaultMemberPermissions?: PermissionResolvable | null;
|
|
4699
4693
|
nsfw?: boolean;
|
|
4700
4694
|
contexts?: readonly InteractionContextType[];
|
|
@@ -6214,6 +6208,7 @@ export interface InteractionDeferUpdateOptions {
|
|
|
6214
6208
|
|
|
6215
6209
|
export interface InteractionReplyOptions extends BaseMessageOptionsWithPoll {
|
|
6216
6210
|
tts?: boolean;
|
|
6211
|
+
withResponse?: boolean;
|
|
6217
6212
|
flags?: BitFieldResolvable<
|
|
6218
6213
|
Extract<MessageFlagsString, 'Ephemeral' | 'SuppressEmbeds' | 'SuppressNotifications'>,
|
|
6219
6214
|
MessageFlags.Ephemeral | MessageFlags.SuppressEmbeds | MessageFlags.SuppressNotifications
|
|
@@ -6337,14 +6332,6 @@ export interface MessageInteractionMetadata {
|
|
|
6337
6332
|
triggeringInteractionMetadata: MessageInteractionMetadata | null;
|
|
6338
6333
|
}
|
|
6339
6334
|
|
|
6340
|
-
/** @deprecated Use {@link MessageInteractionMetadata} instead. */
|
|
6341
|
-
export interface MessageInteraction {
|
|
6342
|
-
id: Snowflake;
|
|
6343
|
-
type: InteractionType;
|
|
6344
|
-
commandName: string;
|
|
6345
|
-
user: User;
|
|
6346
|
-
}
|
|
6347
|
-
|
|
6348
6335
|
export interface MessageMentionsHasOptions {
|
|
6349
6336
|
ignoreDirect?: boolean;
|
|
6350
6337
|
ignoreRoles?: boolean;
|
package/typings/index.d.ts
CHANGED
|
@@ -429,8 +429,6 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
429
429
|
public description: string;
|
|
430
430
|
public descriptionLocalizations: LocalizationMap | null;
|
|
431
431
|
public descriptionLocalized: string | null;
|
|
432
|
-
/** @deprecated Use {@link ApplicationCommand.contexts} instead */
|
|
433
|
-
public dmPermission: boolean | null;
|
|
434
432
|
public guild: Guild | null;
|
|
435
433
|
public guildId: Snowflake | null;
|
|
436
434
|
public get manager(): ApplicationCommandManager;
|
|
@@ -460,7 +458,6 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
460
458
|
public setDefaultMemberPermissions(
|
|
461
459
|
defaultMemberPermissions: PermissionResolvable | null,
|
|
462
460
|
): Promise<ApplicationCommand<PermissionsFetchType>>;
|
|
463
|
-
public setDMPermission(dmPermission?: boolean): Promise<ApplicationCommand<PermissionsFetchType>>;
|
|
464
461
|
public setOptions(
|
|
465
462
|
options: readonly ApplicationCommandOptionData[],
|
|
466
463
|
): Promise<ApplicationCommand<PermissionsFetchType>>;
|
|
@@ -2207,8 +2204,6 @@ export class Message<InGuild extends boolean = boolean> extends Base {
|
|
|
2207
2204
|
public get guild(): If<InGuild, Guild>;
|
|
2208
2205
|
public get hasThread(): boolean;
|
|
2209
2206
|
public id: Snowflake;
|
|
2210
|
-
/** @deprecated Use {@link Message.interactionMetadata} instead. */
|
|
2211
|
-
public interaction: MessageInteraction | null;
|
|
2212
2207
|
public interactionMetadata: MessageInteractionMetadata | null;
|
|
2213
2208
|
public get member(): GuildMember | null;
|
|
2214
2209
|
public mentions: MessageMentions<InGuild>;
|
|
@@ -4694,7 +4689,6 @@ export type AllowedThreadTypeForTextChannel = ChannelType.PublicThread | Channel
|
|
|
4694
4689
|
export interface BaseApplicationCommandData {
|
|
4695
4690
|
name: string;
|
|
4696
4691
|
nameLocalizations?: LocalizationMap;
|
|
4697
|
-
dmPermission?: boolean;
|
|
4698
4692
|
defaultMemberPermissions?: PermissionResolvable | null;
|
|
4699
4693
|
nsfw?: boolean;
|
|
4700
4694
|
contexts?: readonly InteractionContextType[];
|
|
@@ -6214,6 +6208,7 @@ export interface InteractionDeferUpdateOptions {
|
|
|
6214
6208
|
|
|
6215
6209
|
export interface InteractionReplyOptions extends BaseMessageOptionsWithPoll {
|
|
6216
6210
|
tts?: boolean;
|
|
6211
|
+
withResponse?: boolean;
|
|
6217
6212
|
flags?: BitFieldResolvable<
|
|
6218
6213
|
Extract<MessageFlagsString, 'Ephemeral' | 'SuppressEmbeds' | 'SuppressNotifications'>,
|
|
6219
6214
|
MessageFlags.Ephemeral | MessageFlags.SuppressEmbeds | MessageFlags.SuppressNotifications
|
|
@@ -6337,14 +6332,6 @@ export interface MessageInteractionMetadata {
|
|
|
6337
6332
|
triggeringInteractionMetadata: MessageInteractionMetadata | null;
|
|
6338
6333
|
}
|
|
6339
6334
|
|
|
6340
|
-
/** @deprecated Use {@link MessageInteractionMetadata} instead. */
|
|
6341
|
-
export interface MessageInteraction {
|
|
6342
|
-
id: Snowflake;
|
|
6343
|
-
type: InteractionType;
|
|
6344
|
-
commandName: string;
|
|
6345
|
-
user: User;
|
|
6346
|
-
}
|
|
6347
|
-
|
|
6348
6335
|
export interface MessageMentionsHasOptions {
|
|
6349
6336
|
ignoreDirect?: boolean;
|
|
6350
6337
|
ignoreRoles?: boolean;
|
package/typings/index.test-d.ts
CHANGED
|
@@ -705,7 +705,6 @@ client.on('clientReady', async client => {
|
|
|
705
705
|
await client.application?.commands.edit(globalCommandId, { defaultMemberPermissions: null });
|
|
706
706
|
await globalCommand?.edit({ defaultMemberPermissions: null });
|
|
707
707
|
await globalCommand?.setDefaultMemberPermissions(null);
|
|
708
|
-
await guildCommandFromGlobal?.edit({ dmPermission: false });
|
|
709
708
|
|
|
710
709
|
// @ts-expect-error
|
|
711
710
|
await client.guilds.cache.get(testGuildId)?.commands.fetch(guildCommandId, { guildId: testGuildId });
|
|
@@ -2041,6 +2040,7 @@ client.on('interactionCreate', async interaction => {
|
|
|
2041
2040
|
if (interaction.isRepliable()) {
|
|
2042
2041
|
expectAssignable<RepliableInteraction>(interaction);
|
|
2043
2042
|
interaction.reply('test');
|
|
2043
|
+
interaction.reply({ withResponse: false });
|
|
2044
2044
|
}
|
|
2045
2045
|
|
|
2046
2046
|
if (
|