8000 refactor!: Remove deprecations by Jiralite · Pull Request #10647 · discordjs/discord.js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor!: Remove deprecations #10647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
24 changes: 0 additions & 24 deletions packages/discord.js/src/structures/ApplicationCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
*/

/**
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 ?? {},
Expand Down
27 changes: 0 additions & 27 deletions packages/discord.js/src/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>>;
Expand Down Expand Up @@ -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>;
Expand Down Expand Up @@ -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[];
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/typings/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
Loading 3D3E
0