TwurpleAuthenticationGetting dataExamplesFAQMigration

createBotCommand

Definition

createBotCommand(commandName, handler, options)

Creates a simple bot command.

ParameterTypeRequiredDefaultDescription
commandNamestringnone

The name of the command.

handler(params: string[], context: BotCommandContext) => void | Promise<void>none

The execution handler that should be called when the command is sent.

optionsCreateBotCommandOptions<complex>see below
options.aliasesstring[]none

Alternative names for the command that can be used to call it.

options.cooldownCleanupRatenumbernone

The interval in which expired cooldown data should be cleared, in seconds. Defaults to 10 minutes.

options.globalCooldownnumbernone

The cooldown of the command for everyone, in seconds.

options.userCooldownnumbernone

The cooldown of the command per user, in seconds.

Return type: BotCommand