TwurpleAuthenticationGetting dataExamplesFAQMigration

BotCommand

A base class to implement bot commands with advanced command matching.

Overview

For basic commands, it is recommended to use the createBotCommand helper instead.

Properties

aliases

Type: string[]

Additional names for the command.

name

Type: string

The main name of the command.

Methods

canExecute(channelId, userId)

ParameterTypeRequiredDefaultDescription
channelIdstringnonenone
userIdstringnonenone
Return type: boolean

execute(params, context)

Handles the command execution.

ParameterTypeRequiredDefaultDescription
paramsstring[]none

The parameters returned by the matcher.

contextBotCommandContextnone

The command context.

Return type: void | Promise<void>

match(line, prefix)

Checks whether a message matches this command, and if it does, returns the parameters to pass to the execution handler.

ParameterTypeRequiredDefaultDescription
linestringnone

The text of the message.

prefixstringnone

The command prefix set in the bot configuration.

Return type: string[] | null