AbstractCommand

AbstractCommand

A command managed by a CommandPlugin

Constructor

(abstract) new AbstractCommand()

Creates a new AbstractCommand

Members

(abstract) description :String

A description of the command

Type:
  • String

(abstract) name :String

The name of the command

Type:
  • String

Methods

(private) _sendMessage(channel, content, optionsopt) → {Promise.<Message>}

Parameters:
Name Type Attributes Description
channel Channel

The channel to create the message in

content String | Object

The content to be passed to Eris.Client#createMessage

options Object <optional>

Options for sending the message

Returns:

The sent message

Type
Promise.<Message>

awaitMessage(trigger, action, timeoutopt) → {Number}

Await a message, the trigger a function

Parameters:
Name Type Attributes Description
trigger function

A function that takes a Message and returns a Boolean

action function

A function to be executed when trigger returns true

timeout Number <optional>

Delete the await after this many milliseconds

Returns:

The unique id of the await

Type
Number

destroy() → {Promise}

Destroys/unloads the command

Returns:

Resolves with no value

Type
Promise

escapeMarkdown(text) → {String}

Escape any discord markdown present in a string

Parameters:
Name Type Description
text String

The text to escape

Returns:

The escaped text

Type
String

load(parent) → {Promise}

Loads the command

Parameters:
Name Type Description
parent AbstractCommandPlugin

The plugin managing this command

Returns:

Resolves with this

Type
Promise

sendMessage(message, content, optionsopt) → {Promise.<Message>}

See:

Send a message to discord

Parameters:
Name Type Attributes Description
message Message

The message to respond to

content String | Object

The content to be passed to Eris.Client#createMessage

options Object <optional>

Options for sending the message

Properties
Name Type Attributes Default Description
deleteTrigger Boolean <optional>
false

Delete the message that triggered the command

deleteAfter Number <optional>
0

Delete the created message after this many milliseconds

DM Boolean <optional>
false

Send in a Direct Message

file Object <optional>

The file to be sent with the message. Format as shown in the Eris docs

paginate Boolean <optional>

Split the message at 2000 character intervals. Used to send log messages that would normally fail

Returns:

The sent message, or nothing if pagination is true

Type
Promise.<Message>

userOnCooldown(userID, waitTime) → {Boolean}

Check if a user is on cooldown

Parameters:
Name Type Description
userID String

The id of the user to check for

waitTime Number

If not on cooldown, put them on cooldown for this many milliseconds

Returns:

If the user is still on cooldown

Type
Boolean