@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 37.8 kB
Source Map (JSON)
{"version":3,"sources":["../../../../../src/lib/utils/application-commands/ApplicationCommandRegistry.ts"],"names":[],"mappings":";;;;;;;;;;AA8BO,IAAM,2BAAA,GAAN,MAAM,2BAA2B,CAAA;AAAA,EA2DhC,YAAY,WAAqB,EAAA;AAjDxC;AAAA;AAAA;AAAA;AAAA,IAAgB,IAAA,CAAA,iBAAA,uBAAwB,GAAY,EAAA;AAMpD;AAAA;AAAA;AAAA;AAAA,IAAgB,IAAA,CAAA,mBAAA,uBAA0B,GAAY,EAAA;AAKtD;AAAA;AAAA;AAAA,IAAgB,IAAA,CAAA,eAAA,uBAAsB,GAAY,EAAA;AAOlD;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAO,eAAiC,GAAA,IAAA;AAKxC;AAAA;AAAA;AAAA,IAAgB,IAAA,CAAA,yBAAA,uBAAgC,GAAY,EAAA;AAK5D;AAAA;AAAA;AAAA,IAAgB,IAAA,CAAA,2BAAA,uBAAkC,GAAY,EAAA;AAO9D;AAAA;AAAA;AAAA;AAAA;AAAA,IAAgB,IAAA,CAAA,eAAA,GAAkB,IAAI,UAA2B,EAAA;AAKjE;AAAA;AAAA;AAAA,IAAgB,IAAA,CAAA,4BAAA,GAA+B,IAAI,UAAgC,EAAA;AAKnF;AAAA;AAAA;AAAA,IAAgB,IAAA,CAAA,8BAAA,GAAiC,IAAI,UAAgC,EAAA;AAErF,IAAA,IAAA,CAAiB,WAA8B,EAAC;AAG/C,IAAA,IAAA,CAAK,WAAc,GAAA,WAAA;AAAA;AACpB,EAEA,IAAW,OAAqD,GAAA;AAC/D,IAAA,OAAO,UAAU,MAAO,CAAA,GAAA,CAAI,UAAU,CAAE,CAAA,GAAA,CAAI,KAAK,WAAW,CAAA;AAAA;AAC7D,EAEO,wBAAA,CACN,SAOA,OACC,EAAA;AACD,IAAM,MAAA,SAAA,GAAY,0BAA0B,OAAO,CAA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AkB,EAAA;AACnD,IAAU,SAAA,CAAA,MAAA,CAAO,MAAM,CAA8B,2BAAA,EAAA,IAAA,CAAK,WAAW,CAAK,EAAA,EAAA,OAAO,CAAI,CAAA,EAAA,GAAG,KAAK,CAAA;AAAA;AAE/F,CAAA;AA3iBwC,MAAA,CAAA,2BAAA,EAAA,4BAAA,CAAA;AAAjC,IAAM,0BAAN,GAAA","file":"ApplicationCommandRegistry.mjs","sourcesContent":["import type {\n\tContextMenuCommandBuilder,\n\tSlashCommandBuilder,\n\tSlashCommandOptionsOnlyBuilder,\n\tSlashCommandSubcommandsOnlyBuilder\n} from '@discordjs/builders';\nimport { container } from '@sapphire/pieces';\nimport { isNullishOrEmpty } from '@sapphire/utilities';\nimport {\n\tApplicationCommandType,\n\ttype RESTPostAPIChatInputApplicationCommandsJSONBody,\n\ttype RESTPostAPIContextMenuApplicationCommandsJSONBody\n} from 'discord-api-types/v10';\nimport {\n\tCollection,\n\ttype ApplicationCommand,\n\ttype ApplicationCommandManager,\n\ttype ChatInputApplicationCommandData,\n\ttype MessageApplicationCommandData,\n\ttype UserApplicationCommandData\n} from 'discord.js';\nimport type { Args } from '../../parsers/Args';\nimport type { Command } from '../../structures/Command';\nimport type { CommandOptions } from '../../types/CommandTypes';\nimport { InternalRegistryAPIType, RegisterBehavior } from '../../types/Enums';\nimport { allGuildIdsToFetchCommandsFor, getDefaultBehaviorWhenNotIdentical, getDefaultGuildIds } from './ApplicationCommandRegistries';\nimport type { CommandDifference } from './compute-differences/_shared';\nimport { getCommandDifferences, getCommandDifferencesFast } from './computeDifferences';\nimport { convertApplicationCommandToApiData, normalizeChatInputCommand, normalizeContextMenuCommand } from './normalizeInputs';\n\nexport class ApplicationCommandRegistry {\n\t/**\n\t * The piece this registry is for.\n\t */\n\tpublic readonly commandName: string;\n\n\t/**\n\t * A set of all chat input command names and ids that point to this registry.\n\t * You should not use this field directly, but instead use {@link ApplicationCommandRegistry.globalChatInputCommandIds}\n\t */\n\tpublic readonly chatInputCommands = new Set<string>();\n\n\t/**\n\t * A set of all context menu command names and ids that point to this registry.\n\t * You should not use this field directly, but instead use {@link ApplicationCommandRegistry.globalContextMenuCommandIds}\n\t */\n\tpublic readonly contextMenuCommands = new Set<string>();\n\n\t/**\n\t * The guild ids that we need to fetch the commands for.\n\t */\n\tpublic readonly guildIdsToFetch = new Set<string>();\n\n\t/**\n\t * The global slash command id for this command.\n\t * @deprecated This field will only show the first global command id registered for this registry.\n\t * Use {@link ApplicationCommandRegistry.globalChatInputCommandIds} instead.\n\t */\n\tpublic globalCommandId: string | null = null;\n\n\t/**\n\t * A set of all registered and valid global chat input command ids that point to this registry.\n\t */\n\tpublic readonly globalChatInputCommandIds = new Set<string>();\n\n\t/**\n\t * A set of all registered and valid global context menu command ids that point to this registry.\n\t */\n\tpublic readonly globalContextMenuCommandIds = new Set<string>();\n\n\t/**\n\t * The guild command ids for this command.\n\t * @deprecated This field will only show the first guild command id registered for this registry per guild.\n\t * Use {@link ApplicationCommandRegistry.guildIdToChatInputCommandIds} and {@link ApplicationCommandRegistry.guildIdToContextMenuCommandIds} instead.\n\t */\n\tpublic readonly guildCommandIds = new Collection<string, string>();\n\n\t/**\n\t * A map of guild ids to a set of registered and valid chat input command ids that point to this registry.\n\t */\n\tpublic readonly guildIdToChatInputCommandIds = new Collection<string, Set<string>>();\n\n\t/**\n\t * A map of guild ids to a set of registered and valid context menu command ids that point to this registry.\n\t */\n\tpublic readonly guildIdToContextMenuCommandIds = new Collection<string, Set<string>>();\n\n\tprivate readonly apiCalls: InternalAPICall[] = [];\n\n\tpublic constructor(commandName: string) {\n\t\tthis.commandName = commandName;\n\t}\n\n\tpublic get command(): Command<Args, CommandOptions> | undefined {\n\t\treturn container.stores.get('commands').get(this.commandName);\n\t}\n\n\tpublic registerChatInputCommand(\n\t\tcommand:\n\t\t\t| ChatInputApplicationCommandData\n\t\t\t| SlashCommandBuilder\n\t\t\t| SlashCommandSubcommandsOnlyBuilder\n\t\t\t| SlashCommandOptionsOnlyBuilder\n\t\t\t| Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>\n\t\t\t| ((builder: SlashCommandBuilder) => unknown),\n\t\toptions?: ApplicationCommandRegistryRegisterOptions\n\t) {\n\t\tconst builtData = normalizeChatInputCommand(command);\n\n\t\tthis.chatInputCommands.add(builtData.name);\n\n\t\tconst guildIdsToRegister = this.getGuildIdsToRegister(options);\n\n\t\tconst registerOptions = {\n\t\t\tregisterCommandIfMissing: true,\n\t\t\tbehaviorWhenNotIdentical: getDefaultBehaviorWhenNotIdentical(),\n\t\t\tguildIds: guildIdsToRegister,\n\t\t\t...(options ?? {})\n\t\t};\n\n\t\tthis.apiCalls.push({\n\t\t\tbuiltData,\n\t\t\tregisterOptions,\n\t\t\ttype: InternalRegistryAPIType.ChatInput\n\t\t});\n\n\t\tif (options?.idHints) {\n\t\t\tfor (const hint of options.idHints) {\n\t\t\t\tthis.chatInputCommands.add(hint);\n\t\t\t}\n\t\t}\n\n\t\tthis.processGuildIds(guildIdsToRegister);\n\n\t\treturn this;\n\t}\n\n\tpublic registerContextMenuCommand(\n\t\tcommand:\n\t\t\t| UserApplicationCommandData\n\t\t\t| MessageApplicationCommandData\n\t\t\t| ContextMenuCommandBuilder\n\t\t\t| ((builder: ContextMenuCommandBuilder) => unknown),\n\t\toptions?: ApplicationCommandRegistryRegisterOptions\n\t) {\n\t\tconst builtData = normalizeContextMenuCommand(command);\n\n\t\tthis.contextMenuCommands.add(builtData.name);\n\n\t\tconst guildIdsToRegister = this.getGuildIdsToRegister(options);\n\n\t\tconst registerOptions = {\n\t\t\tregisterCommandIfMissing: true,\n\t\t\tbehaviorWhenNotIdentical: getDefaultBehaviorWhenNotIdentical(),\n\t\t\tguildIds: guildIdsToRegister,\n\t\t\t...(options ?? {})\n\t\t};\n\n\t\tthis.apiCalls.push({\n\t\t\tbuiltData,\n\t\t\tregisterOptions,\n\t\t\ttype: InternalRegistryAPIType.ContextMenu\n\t\t});\n\n\t\tif (options?.idHints) {\n\t\t\tfor (const hint of options.idHints) {\n\t\t\t\tthis.contextMenuCommands.add(hint);\n\t\t\t}\n\t\t}\n\n\t\tthis.processGuildIds(guildIdsToRegister);\n\n\t\treturn this;\n\t}\n\n\tpublic addChatInputCommandNames(...names: string[] | string[][]) {\n\t\tconst flattened = names.flat(Infinity) as string[];\n\n\t\tfor (const command of flattened) {\n\t\t\tthis.debug(`Registering name \"${command}\" to internal chat input map`);\n\t\t\tthis.warn(\n\t\t\t\t`Registering the chat input command \"${command}\" using a name is not recommended.`,\n\t\t\t\t'Please use the \"addChatInputCommandIds\" method instead with a command id.'\n\t\t\t);\n\t\t\tthis.chatInputCommands.add(command);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tpublic addContextMenuCommandNames(...names: string[] | string[][]) {\n\t\tconst flattened = names.flat(Infinity) as string[];\n\n\t\tfor (const command of flattened) {\n\t\t\tthis.debug(`Registering name \"${command}\" to internal context menu map`);\n\t\t\tthis.warn(\n\t\t\t\t`Registering the context menu command \"${command}\" using a name is not recommended.`,\n\t\t\t\t'Please use the \"addContextMenuCommandIds\" method instead with a command id.'\n\t\t\t);\n\t\t\tthis.contextMenuCommands.add(command);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tpublic addChatInputCommandIds(...commandIds: string[] | string[][]) {\n\t\tconst flattened = commandIds.flat(Infinity) as string[];\n\n\t\tfor (const entry of flattened) {\n\t\t\ttry {\n\t\t\t\tBigInt(entry);\n\t\t\t\tthis.debug(`Registering id \"${entry}\" to internal chat input map`);\n\t\t\t} catch {\n\t\t\t\t// Don't be silly, save yourself the headaches and do as we say\n\t\t\t\tthis.debug(`Registering name \"${entry}\" to internal chat input map`);\n\t\t\t\tthis.warn(\n\t\t\t\t\t`Registering the chat input command \"${entry}\" using a name *and* trying to bypass this warning by calling \"addChatInputCommandIds\" is not recommended.`,\n\t\t\t\t\t'Please use the \"addChatInputCommandIds\" method with a valid command id instead.'\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.chatInputCommands.add(entry);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tpublic addContextMenuCommandIds(...commandIds: string[] | string[][]) {\n\t\tconst flattened = commandIds.flat(Infinity) as string[];\n\n\t\tfor (const entry of flattened) {\n\t\t\ttry {\n\t\t\t\tBigInt(entry);\n\t\t\t\tthis.debug(`Registering id \"${entry}\" to internal context menu map`);\n\t\t\t} catch {\n\t\t\t\tthis.debug(`Registering name \"${entry}\" to internal context menu map`);\n\t\t\t\t// Don't be silly, save yourself the headaches and do as we say\n\t\t\t\tthis.warn(\n\t\t\t\t\t`Registering the context menu command \"${entry}\" using a name *and* trying to bypass this warning by calling \"addContextMenuCommandIds\" is not recommended.`,\n\t\t\t\t\t'Please use the \"addContextMenuCommandIds\" method with a valid command id instead.'\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.contextMenuCommands.add(entry);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tprotected async runAPICalls(\n\t\tapplicationCommands: ApplicationCommandManager,\n\t\tglobalCommands: Collection<string, ApplicationCommand>,\n\t\tguildCommands: Map<string, Collection<string, ApplicationCommand>>\n\t) {\n\t\t// Early return for no API calls\n\t\tif (this.apiCalls.length === 0) {\n\t\t\t// If we have no API calls to do then we simply return (can happen if the registry is used directly)\n\t\t\tthis.trace('No API calls to run, and no command to register');\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (getDefaultBehaviorWhenNotIdentical() === RegisterBehavior.BulkOverwrite) {\n\t\t\tthrow new RangeError(\n\t\t\t\t`\"runAPICalls\" was called for \"${this.commandName}\" but the defaultBehaviorWhenNotIdentical is \"BulkOverwrite\". This should not happen.`\n\t\t\t);\n\t\t}\n\n\t\tthis.debug(`Preparing to process ${this.apiCalls.length} possible command registrations / updates...`);\n\n\t\tconst results = await Promise.allSettled(\n\t\t\tthis.apiCalls.map((call) => this.handleAPICall(applicationCommands, globalCommands, guildCommands, call))\n\t\t);\n\n\t\tconst errored = results.filter((result) => result.status === 'rejected') as PromiseRejectedResult[];\n\n\t\tif (errored.length) {\n\t\t\tthis.error(`Received ${errored.length} errors while processing command registrations / updates`);\n\n\t\t\tfor (const error of errored) {\n\t\t\t\tthis.error(error.reason.stack ?? error.reason);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected handleIdAddition(type: InternalRegistryAPIType, id: string, guildId?: string | null) {\n\t\tswitch (type) {\n\t\t\tcase InternalRegistryAPIType.ChatInput: {\n\t\t\t\tthis.addChatInputCommandIds(id);\n\n\t\t\t\tif (guildId) {\n\t\t\t\t\tthis.guildIdToChatInputCommandIds.ensure(guildId, () => new Set()).add(id);\n\t\t\t\t} else {\n\t\t\t\t\tthis.globalChatInputCommandIds.add(id);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase InternalRegistryAPIType.ContextMenu: {\n\t\t\t\tthis.addContextMenuCommandIds(id);\n\n\t\t\t\tif (guildId) {\n\t\t\t\t\tthis.guildIdToContextMenuCommandIds.ensure(guildId, () => new Set()).add(id);\n\t\t\t\t} else {\n\t\t\t\t\tthis.globalContextMenuCommandIds.add(id);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Old field handling\n\t\tif (guildId) {\n\t\t\t// Old, wrongly typed field (thx kyra for spotting >_>)\n\t\t\tif (!this.guildCommandIds.has(guildId)) {\n\t\t\t\tthis.guildCommandIds.set(guildId, id);\n\t\t\t}\n\t\t} else {\n\t\t\t// First come, first serve (thx kyra for spotting >_>)\n\t\t\tthis.globalCommandId ??= id;\n\t\t}\n\t}\n\n\tprivate getGuildIdsToRegister(options?: ApplicationCommandRegistryRegisterOptions) {\n\t\tlet guildIdsToRegister: ApplicationCommandRegistry.RegisterOptions['guildIds'] = undefined;\n\n\t\tif (!isNullishOrEmpty(options?.guildIds)) {\n\t\t\tguildIdsToRegister = options!.guildIds;\n\t\t} else if (!isNullishOrEmpty(getDefaultGuildIds())) {\n\t\t\tguildIdsToRegister = getDefaultGuildIds();\n\t\t}\n\n\t\treturn guildIdsToRegister;\n\t}\n\n\tprivate processGuildIds(guildIdsToRegister: ApplicationCommandRegistry.RegisterOptions['guildIds']) {\n\t\tif (!isNullishOrEmpty(guildIdsToRegister)) {\n\t\t\tfor (const id of guildIdsToRegister) {\n\t\t\t\tthis.guildIdsToFetch.add(id);\n\t\t\t\tallGuildIdsToFetchCommandsFor.add(id);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async handleAPICall(\n\t\tcommandsManager: ApplicationCommandManager,\n\t\tglobalCommands: Collection<string, ApplicationCommand>,\n\t\tallGuildsCommands: Map<string, Collection<string, ApplicationCommand>>,\n\t\tapiCall: InternalAPICall\n\t) {\n\t\tconst { builtData, registerOptions } = apiCall;\n\t\tconst commandName = builtData.name;\n\t\tconst behaviorIfNotEqual = registerOptions.behaviorWhenNotIdentical ?? getDefaultBehaviorWhenNotIdentical();\n\n\t\tconst findCallback = (entry: ApplicationCommand) => {\n\t\t\t// If the command is a chat input command, we need to check if the entry is a chat input command\n\t\t\tif (apiCall.type === InternalRegistryAPIType.ChatInput && entry.type !== ApplicationCommandType.ChatInput) return false;\n\t\t\t// If the command is a context menu command, we need to check if the entry is a context menu command of the same type\n\t\t\tif (apiCall.type === InternalRegistryAPIType.ContextMenu) {\n\t\t\t\t// If its a chat input command, it doesn't match\n\t\t\t\tif (entry.type === ApplicationCommandType.ChatInput) return false;\n\t\t\t\t// Check the command type (must match)\n\t\t\t\tif (apiCall.builtData.type !== entry.type) return false;\n\t\t\t}\n\n\t\t\t// Find the command by name or by id hint (mostly useful for context menus)\n\t\t\tconst isInIdHint = registerOptions.idHints?.includes(entry.id);\n\t\t\treturn typeof isInIdHint === 'boolean' ? isInIdHint || entry.name === commandName : entry.name === commandName;\n\t\t};\n\n\t\tlet type: string;\n\n\t\tswitch (apiCall.type) {\n\t\t\tcase InternalRegistryAPIType.ChatInput:\n\t\t\t\ttype = 'chat input';\n\t\t\t\tbreak;\n\t\t\tcase InternalRegistryAPIType.ContextMenu:\n\t\t\t\tswitch (apiCall.builtData.type) {\n\t\t\t\t\tcase ApplicationCommandType.Message:\n\t\t\t\t\t\ttype = 'message context menu';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase ApplicationCommandType.User:\n\t\t\t\t\t\ttype = 'user context menu';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\ttype = 'unknown-type context menu';\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\ttype = 'unknown';\n\t\t}\n\n\t\tif (!registerOptions.guildIds?.length) {\n\t\t\tconst globalCommand = globalCommands.find(findCallback);\n\n\t\t\tif (globalCommand) {\n\t\t\t\tthis.debug(`Checking if command \"${commandName}\" is identical with global ${type} command with id \"${globalCommand.id}\"`);\n\t\t\t\tthis.handleIdAddition(apiCall.type, globalCommand.id);\n\t\t\t\tawait this.handleCommandPresent(globalCommand, builtData, behaviorIfNotEqual, null);\n\t\t\t} else if (registerOptions.registerCommandIfMissing ?? true) {\n\t\t\t\tthis.debug(`Creating new global ${type} command with name \"${commandName}\"`);\n\t\t\t\tawait this.createMissingCommand(commandsManager, builtData, type);\n\t\t\t} else {\n\t\t\t\tthis.debug(`Doing nothing about missing global ${type} command with name \"${commandName}\"`);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const guildId of registerOptions.guildIds) {\n\t\t\tconst guildCommands = allGuildsCommands.get(guildId);\n\n\t\t\tif (!guildCommands) {\n\t\t\t\tthis.debug(`There are no commands for guild with id \"${guildId}\". Will create ${type} command \"${commandName}\".`);\n\t\t\t\tawait this.createMissingCommand(commandsManager, builtData, type, guildId);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst existingGuildCommand = guildCommands.find(findCallback);\n\n\t\t\tif (existingGuildCommand) {\n\t\t\t\tthis.debug(`Checking if guild ${type} command \"${commandName}\" is identical to command \"${existingGuildCommand.id}\"`);\n\t\t\t\tthis.handleIdAddition(apiCall.type, existingGuildCommand.id, guildId);\n\t\t\t\tawait this.handleCommandPresent(existingGuildCommand, builtData, behaviorIfNotEqual, guildId);\n\t\t\t} else if (registerOptions.registerCommandIfMissing ?? true) {\n\t\t\t\tthis.debug(`Creating new guild ${type} command with name \"${commandName}\" for guild \"${guildId}\"`);\n\t\t\t\tawait this.createMissingCommand(commandsManager, builtData, type, guildId);\n\t\t\t} else {\n\t\t\t\tthis.debug(`Doing nothing about missing guild ${type} command with name \"${commandName}\" for guild \"${guildId}\"`);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async handleCommandPresent(\n\t\tapplicationCommand: ApplicationCommand,\n\t\tapiData: InternalAPICall['builtData'],\n\t\tbehaviorIfNotEqual: RegisterBehavior,\n\t\tguildId: string | null\n\t) {\n\t\tif (behaviorIfNotEqual === RegisterBehavior.BulkOverwrite) {\n\t\t\tthis.debug(\n\t\t\t\t`Command \"${this.commandName}\" has the behaviorIfNotEqual set to \"BulkOverwrite\" which is invalid. Using defaultBehaviorWhenNotIdentical instead`\n\t\t\t);\n\n\t\t\tbehaviorIfNotEqual = getDefaultBehaviorWhenNotIdentical();\n\n\t\t\tif (behaviorIfNotEqual === RegisterBehavior.BulkOverwrite) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid behaviorIfNotEqual value (\"BulkOverwrite\") for command \"${this.commandName}\", and defaultBehaviorWhenNotIdentical is also \"BulkOverwrite\". This should not happen.`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tlet differences: CommandDifference[] = [];\n\n\t\tif (behaviorIfNotEqual === RegisterBehavior.VerboseOverwrite) {\n\t\t\tconst now = Date.now();\n\n\t\t\t// Step 0: compute differences\n\t\t\tdifferences = [...getCommandDifferences(convertApplicationCommandToApiData(applicationCommand), apiData, guildId !== null)];\n\n\t\t\tconst later = Date.now() - now;\n\t\t\tthis.debug(`Took ${later}ms to process differences via computing differences`);\n\n\t\t\t// Step 1: if there are no differences, return\n\t\t\tif (!differences.length) {\n\t\t\t\tthis.debug(\n\t\t\t\t\t`${guildId ? 'Guild command' : 'Command'} \"${apiData.name}\" is identical to command \"${applicationCommand.name}\" (${\n\t\t\t\t\t\tapplicationCommand.id\n\t\t\t\t\t})`\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Run the fast path even if the user wants to just log if the command has a difference\n\t\tif (behaviorIfNotEqual === RegisterBehavior.Overwrite || behaviorIfNotEqual === RegisterBehavior.LogToConsole) {\n\t\t\tconst now = Date.now();\n\n\t\t\t// Step 0: compute differences\n\t\t\tconst areThereDifferences = getCommandDifferencesFast(convertApplicationCommandToApiData(applicationCommand), apiData, guildId !== null);\n\n\t\t\tconst later = Date.now() - now;\n\t\t\tthis.debug(`Took ${later}ms to process differences via fast compute differences`);\n\n\t\t\t// Step 1: if there are no differences, return\n\t\t\tif (!areThereDifferences) {\n\t\t\t\tthis.debug(\n\t\t\t\t\t`${guildId ? 'Guild command' : 'Command'} \"${apiData.name}\" is identical to command \"${applicationCommand.name}\" (${\n\t\t\t\t\t\tapplicationCommand.id\n\t\t\t\t\t})`\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tthis.logCommandDifferencesFound(applicationCommand, behaviorIfNotEqual === RegisterBehavior.LogToConsole, differences);\n\n\t\t// Step 2: if the behavior is to log to console, only log the differences\n\t\tif (behaviorIfNotEqual === RegisterBehavior.LogToConsole) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Step 3: if the behavior is to update, update the command\n\t\ttry {\n\t\t\tawait applicationCommand.edit(apiData as ChatInputApplicationCommandData);\n\t\t\tthis.debug(`Updated command ${applicationCommand.name} (${applicationCommand.id}) with new api data`);\n\t\t} catch (error) {\n\t\t\tthis.error(`Failed to update command ${applicationCommand.name} (${applicationCommand.id})`, error);\n\t\t}\n\t}\n\n\tprivate logCommandDifferencesFound(applicationCommand: ApplicationCommand, logAsWarn: boolean, differences: CommandDifference[]) {\n\t\tconst finalMessage: string[] = [];\n\t\tconst pad = ' '.repeat(5);\n\n\t\tfor (const difference of differences) {\n\t\t\tfinalMessage.push(\n\t\t\t\t[\n\t\t\t\t\t`└── At path: ${difference.key}`, //\n\t\t\t\t\t`${pad}├── Received: ${difference.original}`,\n\t\t\t\t\t`${pad}└── Expected: ${difference.expected}`,\n\t\t\t\t\t''\n\t\t\t\t].join('\\n')\n\t\t\t);\n\t\t}\n\n\t\tconst finalMessageNewLine = finalMessage.length ? '\\n' : '';\n\t\tconst header = `Found differences for command \"${applicationCommand.name}\" (${applicationCommand.id}) versus provided api data.${finalMessageNewLine}`;\n\n\t\tlogAsWarn ? this.warn(header, ...finalMessage) : this.debug(header, ...finalMessage);\n\t}\n\n\tprivate async createMissingCommand(\n\t\tcommandsManager: ApplicationCommandManager,\n\t\tapiData: InternalAPICall['builtData'],\n\t\ttype: string,\n\t\tguildId?: string\n\t) {\n\t\ttry {\n\t\t\tconst result = await commandsManager.create(apiData, guildId);\n\n\t\t\tthis.info(\n\t\t\t\t`Successfully created ${type}${guildId ? ' guild' : ''} command \"${apiData.name}\" with id \"${\n\t\t\t\t\tresult.id\n\t\t\t\t}\". You should add the id to the \"idHints\" property of the register method you used!`\n\t\t\t);\n\n\t\t\tswitch (apiData.type) {\n\t\t\t\tcase undefined:\n\t\t\t\tcase ApplicationCommandType.ChatInput: {\n\t\t\t\t\tthis.handleIdAddition(InternalRegistryAPIType.ChatInput, result.id, guildId);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase ApplicationCommandType.Message:\n\t\t\t\tcase ApplicationCommandType.User: {\n\t\t\t\t\tthis.handleIdAddition(InternalRegistryAPIType.ContextMenu, result.id, guildId);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tthis.error(\n\t\t\t\t`Failed to register${guildId ? ' guild' : ''} application command with name \"${apiData.name}\"${\n\t\t\t\t\tguildId ? ` for guild \"${guildId}\"` : ''\n\t\t\t\t}`,\n\t\t\t\terr\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate info(message: string, ...other: unknown[]) {\n\t\tcontainer.logger.info(`ApplicationCommandRegistry[${this.commandName}] ${message}`, ...other);\n\t}\n\n\tprivate error(message: string, ...other: unknown[]) {\n\t\tcontainer.logger.error(`ApplicationCommandRegistry[${this.commandName}] ${message}`, ...other);\n\t}\n\n\tprivate warn(message: string, ...other: unknown[]) {\n\t\tcontainer.logger.warn(`ApplicationCommandRegistry[${this.commandName}] ${message}`, ...other);\n\t}\n\n\tprivate debug(message: string, ...other: unknown[]) {\n\t\tcontainer.logger.debug(`ApplicationCommandRegistry[${this.commandName}] ${message}`, ...other);\n\t}\n\n\tprivate trace(message: string, ...other: unknown[]) {\n\t\tcontainer.logger.trace(`ApplicationCommandRegistry[${this.commandName}] ${message}`, ...other);\n\t}\n}\n\nexport namespace ApplicationCommandRegistry {\n\texport interface RegisterOptions {\n\t\t/**\n\t\t * If this is specified, the application commands will only be registered for these guild ids.\n\t\t */\n\t\tguildIds?: string[];\n\t\t/**\n\t\t * If we should register the command when it is missing\n\t\t * @default true\n\t\t */\n\t\tregisterCommandIfMissing?: boolean;\n\t\t/**\n\t\t * Specifies what we should do when the command is present, but not identical with the data you provided\n\t\t * @default `ApplicationCommandRegistries.getDefaultBehaviorWhenNotIdentical()`\n\t\t */\n\t\tbehaviorWhenNotIdentical?: Exclude<RegisterBehavior, RegisterBehavior.BulkOverwrite>;\n\t\t/**\n\t\t * Specifies a list of command ids that we should check in the event of a name mismatch\n\t\t * @default []\n\t\t */\n\t\tidHints?: string[];\n\t}\n}\n\nexport type ApplicationCommandRegistryRegisterOptions = ApplicationCommandRegistry.RegisterOptions;\n\ntype InternalRegisterOptions = Omit<ApplicationCommandRegistry.RegisterOptions, 'behaviorWhenNotIdentical'> & {\n\tbehaviorWhenNotIdentical?: RegisterBehavior;\n};\n\nexport type InternalAPICall =\n\t| {\n\t\t\tbuiltData: RESTPostAPIChatInputApplicationCommandsJSONBody;\n\t\t\tregisterOptions: InternalRegisterOptions;\n\t\t\ttype: InternalRegistryAPIType.ChatInput;\n\t }\n\t| {\n\t\t\tbuiltData: RESTPostAPIContextMenuApplicationCommandsJSONBody;\n\t\t\tregisterOptions: InternalRegisterOptions;\n\t\t\ttype: InternalRegistryAPIType.ContextMenu;\n\t };\n"]}