BaseHandler(data)

A base handler containing handler utilities

new BaseHandler(data)

Construct a Handler

Parameters:
Name Type Description
data Object

The handler data

Properties:
Name Type Attributes Default Description
data.agent Agent <optional>

The agent managing the bot

data.client Eris.Client

The Eris client

data.options Object <optional>
{}

Additional options for the command handler

Properties
Name Type Attributes Description
_app Object <optional>

The Discord bot app info (If not supplied, the app is gotten automatically)

Members

private _agent : Agent

The agent managing the bot

private _app : Object

The Discord app of the bot

private _client : Eris

The Eris client

Methods

private _getApp() → {Promise<Object>}

Get the bot's app data and store it in this.app

Returns:
Promise<Object> -

The app data

async, private _sendResponse(channel, msgData) → {Promise<Eris.Message>}

Send a response to Discord

Parameters:
Name Type Description
channel Eris.TextChannel

The channel to send the response to

msgData Object

The data for the response message

Returns:
Promise<Eris.Message> -

The resulting response or a returned error of minor reasons why the response failed

Properties:
Name Type Attributes Description
msgData.content String <optional>

The response content

msgData.embed Object <optional>

The response embed

msgData.file Object <optional>

The response file

Properties
Name Type Attributes Description
name String <optional>

The name of the file

file Buffer <optional>

The file content

validateChannel(channel) → {Boolean}

Check that a channel is valid to send a message to (Minimizes bad requests and reduces ratelimiting)

Parameters:
Name Type Description
channel Eris.Channel

The channel to verify

Returns:
Boolean -

Whether a message can be sent to the channel or not