new SingleCommand(cmd, handler [, opts] [, subCmds])
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
cmd |
string | Array.<string> | All commands the handler will fire on. | |
handler |
commandHandler | The event handler when the command has been triggered. | |
opts |
CommandSetting |
<optional> |
The options for this command. |
subCmds |
SingleCommand | Array.<SingleCommand> |
<optional> |
Sub commands that use this command as a fallback. Command names must be separated by white space in order to trigger the sub command. |
- Source:
Members
-
aliases :Array.<string>
-
All versions of this command that may be used to trigger the same handler.
Type:
- Array.<string>
- Source:
-
options :Command~CommandSetting
-
The current options and settings for this command.
Type:
- Source:
-
<readonly, nullable> parentName :string
-
The name of the parent command if this is a subcommand.
Type:
- string
- Source:
-
subCmds :object.<SingleCommand>
-
Sub commands for this single command. Triggered by commands separated by whitespace. Object mapped by subcommand name, similar to Command~cmds.
Type:
- object.<SingleCommand>
- Source:
Methods
-
getFullName()
-
Get the full name for this command including parent command.
- Source:
Returns:
This command's name prefixed with the parent command's name.- Type
- string
-
getName()
-
Get the primary key for this object. The first or only value passed in for `cmd`, and may be used to show the user the command that this object stores information about.
- Source:
Returns:
The command string.- Type
- string
-
getUserOptions()
-
Fetches the user options for this command, taking into account this could be a subcommand.
- Source:
Returns:
The settings for this command or sub-command mapped by guild ids.- Type
- object.<CommandSetting>
-
trigger(msg)
-
The function to call when this command has been triggered.
Parameters:
Name Type Description msg
Discord~Message The message that is triggering this command. - Source:
-
updateParentName(to)
-
Update the parent name for this command and all child commands.
Parameters:
Name Type Description to
string The parent name to set. - Source: