From 0a44b05db83948857afbe18471e7a867da47177a Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Thu, 16 Jun 2022 08:58:54 +0100 Subject: [PATCH] fix(ApplicationCommand): Remove `autocomplete` check at the top level and correctly check for `dmPermission` (#8100) --- packages/discord.js/src/structures/ApplicationCommand.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/discord.js/src/structures/ApplicationCommand.js b/packages/discord.js/src/structures/ApplicationCommand.js index 4f330d625..70db0cb0c 100644 --- a/packages/discord.js/src/structures/ApplicationCommand.js +++ b/packages/discord.js/src/structures/ApplicationCommand.js @@ -352,6 +352,7 @@ 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 @@ -370,13 +371,12 @@ class ApplicationCommand extends Base { command.name !== this.name || ('description' in command && command.description !== this.description) || ('version' in command && command.version !== this.version) || - ('autocomplete' in command && command.autocomplete !== this.autocomplete) || (command.type && command.type !== this.type) || // Future proof for options being nullable // TODO: remove ?? 0 on each when nullable (command.options?.length ?? 0) !== (this.options?.length ?? 0) || defaultMemberPermissions !== (this.defaultMemberPermissions?.bitfield ?? null) || - command.dmPermission !== this.dmPermission || + (typeof dmPermission !== 'undefined' && dmPermission !== this.dmPermission) || !isEqual(command.nameLocalizations ?? command.name_localizations ?? {}, this.nameLocalizations ?? {}) || !isEqual( command.descriptionLocalizations ?? command.description_localizations ?? {},