refactor!: Remove deprecations (#10647)

refactor: remove deprecations

BREAKING CHANGE: `ApplicationCommand#dmPermission` has been removed. Use `ApplicationCommand#contexts` instead.
BREAKING CHANGE: `ApplicationCommandData#dmPermission` has been removed. Use `ApplicationCommandData#contexts` instead.
BREAKING CHANGE: `ApplicationCommandData#setDMPermission` has been removed.
BREAKING CHANGE: `Message#setcon` has been removed. Use `Message#interactionMetadata` instead.
This commit is contained in:
Jiralite
2024-12-09 13:15:57 +00:00
committed by GitHub
parent 310563ba07
commit 5d00332b8c
5 changed files with 0 additions and 67 deletions

View File

@@ -258,7 +258,6 @@ class ApplicationCommandManager extends CachedManager {
type: command.type,
options: command.options?.map(option => ApplicationCommand.transformOption(option)),
default_member_permissions,
dm_permission: command.dmPermission ?? command.dm_permission,
integration_types: command.integrationTypes ?? command.integration_types,
contexts: command.contexts,
};

View File

@@ -140,18 +140,6 @@ class ApplicationCommand extends Base {
this.defaultMemberPermissions ??= null;
}
if ('dm_permission' in data) {
/**
* Whether the command can be used in DMs
* <info>This property is always `null` on guild commands</info>
* @type {?boolean}
* @deprecated Use {@link ApplicationCommand#contexts} instead.
*/
this.dmPermission = data.dm_permission;
} else {
this.dmPermission ??= null;
}
if ('integration_types' in data) {
/**
* Installation context(s) where the command is available
@@ -224,7 +212,6 @@ class ApplicationCommand extends Base {
* @property {ApplicationCommandOptionData[]} [options] Options for the command
* @property {?PermissionResolvable} [defaultMemberPermissions] The bitfield used to determine the default permissions
* a member needs in order to run the command
* @property {boolean} [dmPermission] Whether the command is enabled in DMs
*/
/**
@@ -341,15 +328,6 @@ class ApplicationCommand extends Base {
return this.edit({ defaultMemberPermissions });
}
/**
* Edits the DM permission of this ApplicationCommand
* @param {boolean} [dmPermission=true] Whether the command can be used in DMs
* @returns {Promise<ApplicationCommand>}
*/
setDMPermission(dmPermission = true) {
return this.edit({ dmPermission });
}
/**
* Edits the options of this ApplicationCommand
* @param {ApplicationCommandOptionData[]} options The options to set for this command
@@ -386,7 +364,6 @@ class ApplicationCommand extends Base {
if (command.id && this.id !== command.id) return false;
let defaultMemberPermissions = null;
let dmPermission = command.dmPermission ?? command.dm_permission;
if ('default_member_permissions' in command) {
defaultMemberPermissions = command.default_member_permissions
@@ -412,7 +389,6 @@ class ApplicationCommand extends Base {
// TODO: remove ?? 0 on each when nullable
(command.options?.length ?? 0) !== (this.options?.length ?? 0) ||
defaultMemberPermissions !== (this.defaultMemberPermissions?.bitfield ?? null) ||
(dmPermission !== undefined && dmPermission !== this.dmPermission) ||
!isEqual(command.nameLocalizations ?? command.name_localizations ?? {}, this.nameLocalizations ?? {}) ||
!isEqual(
command.descriptionLocalizations ?? command.description_localizations ?? {},

View File

@@ -413,33 +413,6 @@ class Message extends Base {
this.interactionMetadata ??= null;
}
/**
* Partial data of the interaction that a message is a reply to
* @typedef {Object} MessageInteraction
* @property {Snowflake} id The interaction's id
* @property {InteractionType} type The type of the interaction
* @property {string} commandName The name of the interaction's application command,
* as well as the subcommand and subcommand group, where applicable
* @property {User} user The user that invoked the interaction
* @deprecated Use {@link Message#interactionMetadata} instead.
*/
if (data.interaction) {
/**
* Partial data of the interaction that this message is a reply to
* @type {?MessageInteraction}
* @deprecated Use {@link Message#interactionMetadata} instead.
*/
this.interaction = {
id: data.interaction.id,
type: data.interaction.type,
commandName: data.interaction.name,
user: this.client.users._add(data.interaction.user),
};
} else {
this.interaction ??= null;
}
if (data.poll) {
/**
* The poll that was sent with the message

View File

@@ -429,8 +429,6 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
public description: string;
public descriptionLocalizations: LocalizationMap | null;
public descriptionLocalized: string | null;
/** @deprecated Use {@link ApplicationCommand.contexts} instead */
public dmPermission: boolean | null;
public guild: Guild | null;
public guildId: Snowflake | null;
public get manager(): ApplicationCommandManager;
@@ -460,7 +458,6 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
public setDefaultMemberPermissions(
defaultMemberPermissions: PermissionResolvable | null,
): Promise<ApplicationCommand<PermissionsFetchType>>;
public setDMPermission(dmPermission?: boolean): Promise<ApplicationCommand<PermissionsFetchType>>;
public setOptions(
options: readonly ApplicationCommandOptionData[],
): Promise<ApplicationCommand<PermissionsFetchType>>;
@@ -2207,8 +2204,6 @@ export class Message<InGuild extends boolean = boolean> extends Base {
public get guild(): If<InGuild, Guild>;
public get hasThread(): boolean;
public id: Snowflake;
/** @deprecated Use {@link Message.interactionMetadata} instead. */
public interaction: MessageInteraction | null;
public interactionMetadata: MessageInteractionMetadata | null;
public get member(): GuildMember | null;
public mentions: MessageMentions<InGuild>;
@@ -4694,7 +4689,6 @@ export type AllowedThreadTypeForTextChannel = ChannelType.PublicThread | Channel
export interface BaseApplicationCommandData {
name: string;
nameLocalizations?: LocalizationMap;
dmPermission?: boolean;
defaultMemberPermissions?: PermissionResolvable | null;
nsfw?: boolean;
contexts?: readonly InteractionContextType[];
@@ -6338,14 +6332,6 @@ export interface MessageInteractionMetadata {
triggeringInteractionMetadata: MessageInteractionMetadata | null;
}
/** @deprecated Use {@link MessageInteractionMetadata} instead. */
export interface MessageInteraction {
id: Snowflake;
type: InteractionType;
commandName: string;
user: User;
}
export interface MessageMentionsHasOptions {
ignoreDirect?: boolean;
ignoreRoles?: boolean;

View File

@@ -705,7 +705,6 @@ client.on('clientReady', async client => {
await client.application?.commands.edit(globalCommandId, { defaultMemberPermissions: null });
await globalCommand?.edit({ defaultMemberPermissions: null });
await globalCommand?.setDefaultMemberPermissions(null);
await guildCommandFromGlobal?.edit({ dmPermission: false });
// @ts-expect-error
await client.guilds.cache.get(testGuildId)?.commands.fetch(guildCommandId, { guildId: testGuildId });