Skip to main content

Class: ApplicationCommandRegistry

Constructors

new ApplicationCommandRegistry()

new ApplicationCommandRegistry(commandName: string): ApplicationCommandRegistry

Parameters

ParameterType
commandNamestring

Returns

ApplicationCommandRegistry

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:90

Properties

apiCalls

private readonly apiCalls: InternalAPICall[] = []

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:88


chatInputCommands

readonly chatInputCommands: Set<string>

A set of all chat input command names and ids that point to this registry. You should not use this field directly, but instead use ApplicationCommandRegistry.globalChatInputCommandIds

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:41


commandName

readonly commandName: string

The piece this registry is for.

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:35


contextMenuCommands

readonly contextMenuCommands: Set<string>

A set of all context menu command names and ids that point to this registry. You should not use this field directly, but instead use ApplicationCommandRegistry.globalContextMenuCommandIds

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:47


globalChatInputCommandIds

readonly globalChatInputCommandIds: Set<string>

A set of all registered and valid global chat input command ids that point to this registry.

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:64


globalCommandId

globalCommandId: null | string = null

The global slash command id for this command.

Deprecated

This field will only show the first global command id registered for this registry. Use ApplicationCommandRegistry.globalChatInputCommandIds instead.

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:59


globalContextMenuCommandIds

readonly globalContextMenuCommandIds: Set<string>

A set of all registered and valid global context menu command ids that point to this registry.

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:69


guildCommandIds

readonly guildCommandIds: Collection<string, string>

The guild command ids for this command.

Deprecated

This field will only show the first guild command id registered for this registry per guild. Use ApplicationCommandRegistry.guildIdToChatInputCommandIds and ApplicationCommandRegistry.guildIdToContextMenuCommandIds instead.

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:76


guildIdToChatInputCommandIds

readonly guildIdToChatInputCommandIds: Collection<string, Set<string>>

A map of guild ids to a set of registered and valid chat input command ids that point to this registry.

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:81


guildIdToContextMenuCommandIds

readonly guildIdToContextMenuCommandIds: Collection<string, Set<string>>

A map of guild ids to a set of registered and valid context menu command ids that point to this registry.

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:86


guildIdsToFetch

readonly guildIdsToFetch: Set<string>

The guild ids that we need to fetch the commands for.

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:52

Accessors

command

get command(): undefined | Command <Args, CommandOptions>

Returns

undefined | Command <Args, CommandOptions>

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:94

Methods

addChatInputCommandIds()

addChatInputCommandIds(...commandIds: string[] | string[][]): ApplicationCommandRegistry

Parameters

ParameterType
...commandIdsstring[] | string[][]

Returns

ApplicationCommandRegistry

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:206


addChatInputCommandNames()

addChatInputCommandNames(...names: string[] | string[][]): ApplicationCommandRegistry

Parameters

ParameterType
...namesstring[] | string[][]

Returns

ApplicationCommandRegistry

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:176


addContextMenuCommandIds()

addContextMenuCommandIds(...commandIds: string[] | string[][]): ApplicationCommandRegistry

Parameters

ParameterType
...commandIdsstring[] | string[][]

Returns

ApplicationCommandRegistry

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:227


addContextMenuCommandNames()

addContextMenuCommandNames(...names: string[] | string[][]): ApplicationCommandRegistry

Parameters

ParameterType
...namesstring[] | string[][]

Returns

ApplicationCommandRegistry

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:191


createMissingCommand()

private createMissingCommand(commandsManager: ApplicationCommandManager <ApplicationCommand<object>, object, null>, apiData: RESTPostAPIChatInputApplicationCommandsJSONBody | RESTPostAPIContextMenuApplicationCommandsJSONBody, type: string, guildId?: string): Promise<void>

Parameters

ParameterType
commandsManagerApplicationCommandManager <ApplicationCommand<object>, object, null>
apiDataRESTPostAPIChatInputApplicationCommandsJSONBody | RESTPostAPIContextMenuApplicationCommandsJSONBody
typestring
guildId?string

Returns

Promise<void>

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:530


debug()

private debug(message: string, ...other: unknown[]): void

Parameters

ParameterType
messagestring
...otherunknown[]

Returns

void

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:579


error()

private error(message: string, ...other: unknown[]): void

Parameters

ParameterType
messagestring
...otherunknown[]

Returns

void

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:571


getGuildIdsToRegister()

private getGuildIdsToRegister(options?: RegisterOptions): undefined | string[]

Parameters

ParameterType
options?RegisterOptions

Returns

undefined | string[]

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:320


handleAPICall()

private handleAPICall(commandsManager: ApplicationCommandManager <ApplicationCommand<object>, object, null>, globalCommands: Collection<string, ApplicationCommand<object>>, allGuildsCommands: Map<string, Collection<string, ApplicationCommand<object>>>, apiCall: InternalAPICall): Promise<void>

Parameters

ParameterType
commandsManagerApplicationCommandManager <ApplicationCommand<object>, object, null>
globalCommandsCollection<string, ApplicationCommand<object>>
allGuildsCommandsMap<string, Collection<string, ApplicationCommand<object>>>
apiCallInternalAPICall

Returns

Promise<void>

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:341


handleCommandPresent()

private handleCommandPresent(applicationCommand: ApplicationCommand<object>, apiData: RESTPostAPIChatInputApplicationCommandsJSONBody | RESTPostAPIContextMenuApplicationCommandsJSONBody, behaviorIfNotEqual: RegisterBehavior, guildId: null | string): Promise<void>

Parameters

ParameterType
applicationCommandApplicationCommand<object>
apiDataRESTPostAPIChatInputApplicationCommandsJSONBody | RESTPostAPIContextMenuApplicationCommandsJSONBody
behaviorIfNotEqualRegisterBehavior
guildIdnull | string

Returns

Promise<void>

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:430


handleIdAddition()

protected handleIdAddition(type: InternalRegistryAPIType, id: string, guildId?: null | string): void

Parameters

ParameterType
typeInternalRegistryAPIType
idstring
guildId?null | string

Returns

void

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:284


info()

private info(message: string, ...other: unknown[]): void

Parameters

ParameterType
messagestring
...otherunknown[]

Returns

void

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:567


logCommandDifferencesFound()

private logCommandDifferencesFound(applicationCommand: ApplicationCommand<object>, logAsWarn: boolean, differences: CommandDifference[]): void

Parameters

ParameterType
applicationCommandApplicationCommand<object>
logAsWarnboolean
differencesCommandDifference[]

Returns

void

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:509


processGuildIds()

private processGuildIds(guildIdsToRegister: undefined | string[]): void

Parameters

ParameterType
guildIdsToRegisterundefined | string[]

Returns

void

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:332


registerChatInputCommand()

registerChatInputCommand(command: SlashCommandBuilder | SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandsOnlyBuilder | ChatInputApplicationCommandData | Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup"> | (builder: SlashCommandBuilder) => unknown, options?: RegisterOptions): ApplicationCommandRegistry

Parameters

ParameterType
commandSlashCommandBuilder | SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandsOnlyBuilder | ChatInputApplicationCommandData | Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup"> | (builder: SlashCommandBuilder) => unknown
options?RegisterOptions

Returns

ApplicationCommandRegistry

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:98


registerContextMenuCommand()

registerContextMenuCommand(command: ContextMenuCommandBuilder | UserApplicationCommandData | MessageApplicationCommandData | (builder: ContextMenuCommandBuilder) => unknown, options?: RegisterOptions): ApplicationCommandRegistry

Parameters

ParameterType
commandContextMenuCommandBuilder | UserApplicationCommandData | MessageApplicationCommandData | (builder: ContextMenuCommandBuilder) => unknown
options?RegisterOptions

Returns

ApplicationCommandRegistry

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:138


runAPICalls()

protected runAPICalls(applicationCommands: ApplicationCommandManager <ApplicationCommand<object>, object, null>, globalCommands: Collection<string, ApplicationCommand<object>>, guildCommands: Map<string, Collection<string, ApplicationCommand<object>>>): Promise<void>

Parameters

ParameterType
applicationCommandsApplicationCommandManager <ApplicationCommand<object>, object, null>
globalCommandsCollection<string, ApplicationCommand<object>>
guildCommandsMap<string, Collection<string, ApplicationCommand<object>>>

Returns

Promise<void>

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:248


trace()

private trace(message: string, ...other: unknown[]): void

Parameters

ParameterType
messagestring
...otherunknown[]

Returns

void

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:583


warn()

private warn(message: string, ...other: unknown[]): void

Parameters

ParameterType
messagestring
...otherunknown[]

Returns

void

Source

projects/framework/src/lib/utils/application-commands/ApplicationCommandRegistry.ts:575