From 2ad21b53feab9428033ffea430425bc20d5f19dc Mon Sep 17 00:00:00 2001 From: Jeroen Claassens Date: Sat, 23 Mar 2024 19:02:58 +0100 Subject: [PATCH] fix: resolved issue with registerOptions not picking up default options correctly (#738) --- .../ApplicationCommandRegistry.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/lib/utils/application-commands/ApplicationCommandRegistry.ts b/src/lib/utils/application-commands/ApplicationCommandRegistry.ts index 4ff4fae7d..8e4811a79 100644 --- a/src/lib/utils/application-commands/ApplicationCommandRegistry.ts +++ b/src/lib/utils/application-commands/ApplicationCommandRegistry.ts @@ -108,13 +108,16 @@ export class ApplicationCommandRegistry { const guildIdsToRegister = this.getGuildIdsToRegister(options); + const registerOptions = { + registerCommandIfMissing: true, + behaviorWhenNotIdentical: getDefaultBehaviorWhenNotIdentical(), + guildIds: guildIdsToRegister, + ...(options ?? {}) + }; + this.apiCalls.push({ builtData, - registerOptions: options ?? { - registerCommandIfMissing: true, - behaviorWhenNotIdentical: getDefaultBehaviorWhenNotIdentical(), - guildIds: guildIdsToRegister - }, + registerOptions, type: InternalRegistryAPIType.ChatInput }); @@ -143,13 +146,16 @@ export class ApplicationCommandRegistry { const guildIdsToRegister = this.getGuildIdsToRegister(options); + const registerOptions = { + registerCommandIfMissing: true, + behaviorWhenNotIdentical: getDefaultBehaviorWhenNotIdentical(), + guildIds: guildIdsToRegister, + ...(options ?? {}) + }; + this.apiCalls.push({ builtData, - registerOptions: options ?? { - registerCommandIfMissing: true, - behaviorWhenNotIdentical: getDefaultBehaviorWhenNotIdentical(), - guildIds: guildIdsToRegister - }, + registerOptions, type: InternalRegistryAPIType.ContextMenu });