Global

Type Definitions

ArgData

Data for arguments that go into a command

Properties:
Name Type Attributes Default Description
ArgData.name String

The name of the argument

ArgData.mand Boolean <optional>
false

Whether the argument is mandatory for the command to work or not

ArgData.delim String <optional>
' '

The delimiter (The character(s) that separate(s) it from the argument after it) for the argument

ArgData.type String <optional>
'string'

The type of argument

Example
Types: `string`  - A regular string
                                                  `number`  - A number is parsed from the supplied argument
                                                  `user`    - From a username or mention, the Eris.User instance is supplied to the action
                                                  `channel` - From a name or mention, the Eris.Channel instance is supplied to the action

AwaitAction(data) → {Array<CommandResults>|CommandResults|Array<String>|String}

The await action.

Parameters:
Name Type Description
data AwaitData

Data passed from the handler

Returns:
Array<CommandResults> | CommandResults | Array<String> | String -

Data to respond with

AwaitData

The object passed to a command action

Properties:
Name Type Description
AwaitData.agent Agent

The agent managing the bot

AwaitData.client Eris.Client

The Eris client

AwaitData.commands Map<String, Command>

The list of bot commands

AwaitData.replacers Map<String, Replacer>

The list of bot replacers

AwaitData.msg Eris.Message

The message sent by the user

AwaitData.args Array<String>

The arguments supplied by the user

AwaitData.attachments Object

User-supplied data that is passed to commands

AwaitData.triggerResponse Eris.Message

The bot's response to the message that initiated the await

BuildHelpReturnObject

An object returned by the agent's buildHelp method (Properties may vary based on what was supplied to the method)

Properties:
Name Type Description
embed Object | undefined

If embed data was supplied, the resulting help menu in a Discord embed format

reactInterface ReactInterface | undefined

If embed data was supplied and the help menu is more than one page, a react interface to scroll the help menu

pages Array<String>

The pages of the help menu. Only one is displayed in the embed and it's chosen by the page parameter (It's standard practice to build a new help menu for every command initiation)

CancelFunction(wait)

The code that runs once an await is cancelled

Parameters:
Name Type Description
wait Await

The await

CheckFunction(msg, content) → {Boolean}

The condition to be met for the await to trigger

Parameters:
Name Type Description
msg Eris.Message

The message object, but if a prefix is required, the message content will not include the prefix

content String

The message content (processed by command handler (DO NOT USE msg.content))

Returns:
Boolean -

Whether the message meets the await requirements

CommandAction(data) → {Array<CommandResults>|CommandResults|Array<String>|String}

The command action

Parameters:
Name Type Description
data CommandData

Data passed from the handler

Returns:
Array<CommandResults> | CommandResults | Array<String> | String -

Data to respond with

CommandData

The object passed to a command action

Properties:
Name Type Description
CommandData.agent Agent

The agent managing the bot

CommandData.client Eris.Client

The Eris client

CommandData.commands Map<String, Command>

The list of bot commands

CommandData.replacers Map<String, Replacer>

The list of bot replacers

CommandData.msg Eris.Message

The message sent by the user

CommandData.args Array<(String|Number|Eris.Channel|Eris.User)>

The arguments supplied by the user

CommandData.attachments Object

User-supplied data that is passed to commands

CommandHandlerResult

Result of a handled command

Properties:
Name Type Description
CommandHandlerResult.options Object

Additional options resulting from the command

Properties
Name Type Description
channels Array<String>

The IDs of the channels the responses were sent to

awaits Array<Await>

A list of actions that are awaited after the results are processed

reactInterface ReactInterface

A react interface that is bound to the resulting message

deleteAfter Number

How long until the response is deleted

CommandHandlerResult.responses Array<Eris.Message>

The resulting responses of the command

CommandHandlerResultList

Object returned by the handle method

Properties:
Name Type Description
CommandHandlerResultList.command Command | Await

The object of the command called

CommandHandlerResultList.results Array<CommandHandlerResult>

The results of every message sent

CommandResults

Object returned by a command action

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

The resulting message content sent by the bot

CommandResults.embed Eris.Embed <optional>

The resulting embed sent by the bot

CommandResults.file Buffer <optional>

The resulting file sent by the bot

CommandResults.options Object <optional>
{}

Options for the response message

Properties
Name Type Attributes Description
channels Array<String> | String <optional>

The channel IDs to send the resulting messages. By default, it's the same channel the executing message was sent

awaits Array<Await> | Await <optional>

An action or list of actions that are awaited after the results are processed

reactInterface ReactInterface <optional>

A react interface that is bound to the resulting message

deleteAfter Number <optional>

The number of milliseconds to wait before deleting the response

GuildData

Properties:
Name Type Description
guildID Object

The ID of the guild mapped to its data

Properties
Name Type Description
permissions PermissionList

The authority levels of roles in a guild

prefix String

The custom server-side prefix for the guild

Middleware(msg, member, command)

Parameters:
Name Type Description
msg Eris.Message

The message

member Eris.Member

The subject member of the guild

command Command | ReactCommand

The command

Normalized

Normalized message content

Properties:
Name Type Description
content String

The processed content

prefixed Boolean

Whether the content was prefixed or not (Bot mention counts) (Always returns true if message channel is DM channel)

PermissionList

A list of permissions for each role of a guild

Properties:
Name Type Description
roleID Number

The ID of the role mapped with its authority level

PostMessageFunction(msg, results)

A function that runs after every message whether it triggers a command or not

Parameters:
Name Type Description
msg Eris.Message

The message that triggered the command

results CommandHandlerResults

The results of the command

PostPermissionFunction(guild, role, level, oldLevel)

A function that runs after a permission is changed

Parameters:
Name Type Description
guild String

The ID of the guild

role String

The ID of the role being altered

level Number

The new authority level of the role

oldLevel Number

The old authority level of the role

PostPrefixFunction(guild, prefix, oldPrefix)

A function that runs after a guild prefix is changed

Parameters:
Name Type Description
guild String

The ID of the guild

prefix String

The new prefix

oldPrefix String

The old prefix of the guild

PostReactionFunction(msg, emoji, user, results)

A function that runs after every reaction whether it triggers a react command or not

Parameters:
Name Type Description
msg Eris.Message

The message reacted on

emoji Object

The data of the emoji reacted with

user Eris.User

The user who reacted

results ReactionHandlerResults

The results of the react command

Prefix

PrefixList

A list of prefixes for each guild supplied to the Agent. It is mapped with a guild's ID equalling its prefix

Properties:
Name Type Description
guildID Prefix
Example
{ '463886367496339458': '>' }

reactCommandAction(data) → {Array<CommandResults>|CommandResults|Array<String>|String}

The react command action

Parameters:
Name Type Description
data ReactCommandData

Data passed from the handler

Returns:
Array<CommandResults> | CommandResults | Array<String> | String -

Data to respond with

ReactCommandData

The object passed to a react command action

Properties:
Name Type Description
ReactCommandData.agent Agent

The agent managing the bot

ReactCommandData.client Eris.Client

The Eris client

ReactCommandData.reactCommands Map<String, ReactCommand>

The list of bot react commands

ReactCommandData.msg Eris.Message

The message reacted on

ReactCommandData.emoji String

The emoji reacted with

ReactCommandData.user Eris.User

The user who reacted

ReactCommandData.attachments Object

User-supplied data that is passed to commands

ReactCommandData.parentInterface ReactInterface

If the react command was a button, the interface it was a part of

ReactionHandlerResult

Result of a handled react command

Properties:
Name Type Description
ReactionHandlerResult.options Object

Additional options resulting from the react command

Properties
Name Type Description
channels Array<String>

The ID of the channel the response was sent to

awaits Array<Await>

A list of actions that are awaited after the results are processed

reactInterface ReactInterface

A react interface that is bound to the resulting message

deleteAfter Number

How long until the response is deleted

ReactionHandlerResult.responses Array<Eris.Message>

The resulting responses of the react command

ReactionHandlerResultList

Object returned by the handle method

Properties:
Name Type Description
ReactionHandlerResultList.command Command

The command that was triggered

ReactionHandlerResultList.parentInterface ReactInterface

If the command was an interface button, the interface it was a part of

ReactionHandlerResultList.results Array<ReactionHandlerResult>

The results of every message sent

ReplacerAction(data) → {String}

The replacer action

Parameters:
Name Type Description
data Object

The data passed to the replacer

Returns:
String -

The content to inject

Properties:
Name Type Description
data.content String

The content of the message

data.capture String

What was captured in the replacer braces

data.args Array<(String|Number|Eris.User|Eris.Channel)>

The arguments provided for the replacer

StatusMessageFunction(editStatus, agent, shard)

The status for the bot. It's a callback function for each shard

Parameters:
Name Type Description
editStatus Eris.Shard.editStatus

The setStatus function from the Eris client

agent Agent

The agent

shard Number

The Eris shard the status is being applied to