Class: Command

Command()

The command class encapsulates a command stored in a plugin's commandContainer.

Constructor

new Command()

Source:

Members

handler :Command#commandHandler

The handler to be executed when the command is recognized.
Type:
Source:

identifier :String

The identifier that triggers the command.
Type:
  • String
Source:

options :Command#options

Additional options controlling when the handler is triggered.
Type:
Source:

Methods

setHandler(handler)

Set the handler to be invoked when the command is recognized.
Parameters:
Name Type Description
handler Command#commandHandler the handler to be invoked
Source:

setIdentifier(identifier)

Set the identifier for this command. The handler function will be triggered by a message beginning with the command prefix and the identifier: `${prefix}${identifier}`
Parameters:
Name Type Description
identifier String
Source:

setOptions(options)

Set additional options controlling when the handler is triggered.
Parameters:
Name Type Description
options Command#options options to filter invocation of the handler
Source:

Type Definitions

commandHandler(args, message)

Handler to be executed when a command is recognized.
Parameters:
Name Type Description
args Array.<String> additional parameters for the command
message Message the message that was received
Source:

options

Type:
  • Object
Properties:
Name Type Description
options.requiredChannelType 'direct' | 'guild' requires the message to be sent either as a direct message or in a guild channel
options.handleBotMsgs Boolean true if the handler should trigger on bot messages
options.elevated Boolean true if the command requires adminstrator privileges
Source: