CommandRegistry

export declare class CommandRegistry

Constructor

constructor(client: IgloClient): this;

Paramaters

nametypeoptionaldescription
clientIgloClientNo-

Properties

client: IgloClient

Methods

checkLocalization(discord, command, objectKey)

private
function checkLocalization(discord: Record<string, "null" | string>, command: Record<string, "null" | string>, objectKey: string): Differences

Paramaters

nametypeoptionaldescription
discordRecord<string, null | string>No-
commandRecord<string, null | string>No-
objectKeystringNo-

Description

getCommandData(command)

private
function getCommandData(command: Command<IgloClient>): ApplicationCommandData

Paramaters

nametypeoptionaldescription
commandCommand<IgloClient>No-

Description

Returns an object with all the necessary data to register a command

getDifferences(discord, commands)

private
function getDifferences(discord: Collection<string, ApplicationCommand>, commands: Collection<string, Command<IgloClient>>): Generator<{ command: { command: Command<IgloClient>, differences: Differences }, discord: ApplicationCommand }, void, unknown>

Paramaters

nametypeoptionaldescription
discordCollection<string, ApplicationCommand>No-
commandsCollection<string, Command<IgloClient>>No-

Description

getRegisteredCommand()

private
function getRegisteredCommand(): Promise<Collection<string, ApplicationCommand>>

Description

Gets the already registered commands from Discord

isDifferent(discord, command)

private
function isDifferent(discord: ApplicationCommand, command: Command<IgloClient>): Differences

Paramaters

nametypeoptionaldescription
discordApplicationCommandNothe Discord ApplicationCommand
commandCommand<IgloClient>Nothe bot Command

Description

Returns a object key or null depending on if the objects are different or not

isOptionDifferent(discord, command, index)

private
function isOptionDifferent(discord: ApplicationCommandOption, command: ApplicationCommandOption, index: number): Differences

Paramaters

nametypeoptionaldescription
discordApplicationCommandOptionNo-
commandApplicationCommandOptionNo-
indexnumberNo-

Description

optionsAreDifferent(discord, command)

private
function optionsAreDifferent(discord: Array<ApplicationCommandOption>, command: Array<ApplicationCommandOption>): Differences

Paramaters

nametypeoptionaldescription
discordArray<ApplicationCommandOption>No-
commandArray<ApplicationCommandOption>No-

Description

start()

function start(): Promise<void>

Description

Sync the commands from the bot with the commands registered with Discord

updateCommand(discord, command)

private
function updateCommand(discord: ApplicationCommand, command: Command<IgloClient>): Promise<void>

Paramaters

nametypeoptionaldescription
discordApplicationCommandNo-
commandCommand<IgloClient>No-

Description