Command

Command

Parent class of every command. Defines the general api to be used by each command.

Constructor

new Command(fileName, params)

Parameters:
Name Type Description
fileName string Key by which to access the command name from the definition file. Command name defaults to the Filename
params Object Additional parameters.
Properties:
Name Type Description
name String The name of the command
params Object Additional paramters passed with the command
responses Object The responses for this specific command
Version:
  • 1.0
Author:
  • Maksim Sandybekov
Source:

Methods

execute(message, args)

Executes the main logic of the command
Parameters:
Name Type Description
message * A discord.js message object representing a request.
args * Arguments passed in addition to the command call
Source:

getCommand() → {Object}

Creates and returns a object representation of the command. Used to init discord.js commands.
Source:

getResponse(name) → {string}

Returns a command specific response for a user, additionally supplied arguments besides name are used to replace template sequeuence of the string.
Parameters:
Name Type Description
name string The key of the response. Used to access the responses for the calling command.
Source:
Examples
getResponse("enqueueFirst", userId);
getResponse("success", userId, memberId);