fix(ApplicationCommand): Remove autocomplete check at the top level and correctly check for dmPermission (#8100)

This commit is contained in:
Jiralite
2022-06-16 08:58:54 +01:00
committed by GitHub
parent b4e28a8ff6
commit 0a44b05db8

View File

@@ -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 ?? {},