Constructor
new Client(token, options)
Create a client instance.
Parameters:
Name |
Type |
Description |
token |
string
|
The token used to log into the bot. |
options |
Object
|
Options to start the client with. This object is also passed to Eris.
If there are a aghanim.config.js/json in project root, that will be loaded instead object passed to constructor.
See Eris Client constructor options https://abal.moe/Eris/docs/Client
Properties
Name |
Type |
Attributes |
Default |
Description |
prefix |
string
|
<optional>
|
''
|
The prefix the bot will respond to in
guilds for which there is no other confguration. (Currently everywhere) |
allowMention |
boolean
|
<optional>
|
false
|
Whether or not the bot can respond
to messages starting with a mention of the bot. |
ignoreBots |
boolean
|
<optional>
|
true
|
Whether or not the bot ignoresBots. Default: true |
ignoreSelf |
boolean
|
<optional>
|
true
|
Whether or not the bot ignores self. Default: true |
helpMessage |
string
|
<optional>
|
'**Help**'
|
Title for default command help Message |
helpMessageAfterCategories |
string
|
<optional>
|
'**Note**: Use \`${options.prefix}help <category>\` to see the commands'
|
Message after categories in default command help message are shown |
helpDM |
boolean
|
<optional>
|
true
|
Active direct message to default command help |
helpEnable |
boolean
|
<optional>
|
true
|
Enable/disable default command help |
|
- Source:
Extends
Members
app
Properties:
Name |
Type |
Description |
|
object
|
The OAuth application information returned by
Discord. Present some time after the ready event. |
description |
string
|
Discord App description |
name |
string
|
Discord App name |
owner |
string
|
Discord App owner
Properties
Name |
Type |
Description |
id |
string
|
Owner ID |
username |
string
|
Owner username |
discriminator |
string
|
Owner discriminator |
avatar |
string
|
Owner avatar |
|
bot_public |
boolean
|
If app is public |
bot_require_code_grant |
boolean
|
- |
id |
string
|
Discord App id |
icon |
string
|
Discord App icon |
- Source:
categories
Properties:
Type |
Description |
Array.<Category>
|
Categories for commands. |
- Source:
commands
Properties:
Type |
Description |
Array.<Command>
|
An array of commands the bot will respond to. |
- Source:
components
Properties:
Type |
Description |
Object.<Component>
|
Components. |
- Source:
ignoreBots
Properties:
Type |
Description |
boolean
|
Whether or not the bot ignores messages
sent from bot accounts. Defaults to true. |
- Default Value:
- Source:
ignoreSelf
Properties:
Type |
Description |
boolean
|
Ignore self |
- Default Value:
- Source:
interactionCommandCategories
Properties:
Type |
Description |
Array.<Category>
|
Categories for commands. |
- Source:
interactionCommands
Properties:
Type |
Description |
Array.<Command>
|
An array of commands the bot will respond to. |
- Source:
mentionPrefixRegExp
Properties:
Type |
Description |
RegExp
|
The RegExp used to tell whether or not a message starts
with a mention of the bot. Only present after the 'ready' event. |
- Source:
owner
Owner description
Properties:
Name |
Type |
Description |
id |
string
|
Owner ID |
username |
string
|
Owner username |
discriminator |
string
|
Owner discriminator |
avatar |
string
|
Owner avatar |
send |
Ownersend
|
Send a message to Owner |
- Source:
prefix
Properties:
Type |
Description |
string
|
The prefix the bot will respond to in guilds
for which there is no other confguration. |
- Source:
setup
Properties:
Type |
Description |
Object
|
Setup |
- Source:
Methods
addCategory(name, help, options)
Parameters:
Name |
Type |
Description |
name |
string
|
Name for Category |
help |
string
|
Help Message |
options |
object
|
Options
Properties
Name |
Type |
Description |
hide |
object
|
Options |
restrict |
object
|
Options |
|
- Source:
addCommand(command) → {Command}
Register a command to the client.
Parameters:
Name |
Type |
Description |
command |
Command
|
object
|
The command to add to the bot. |
- Source:
Returns:
- Command added
-
Type
-
Command
addCommandDir(dirname)
Load all the JS files in a directory and attempt to load them each as commands.
Parameters:
Name |
Type |
Description |
dirname |
string
|
The location of the directory. |
- Source:
addCommandFile(filename) → {Command}
Load a command exported from a file.
Parameters:
Name |
Type |
Description |
filename |
string
|
The location of the file. |
- Source:
Returns:
- Command added.
-
Type
-
Command
addCommandRequirement(requirement)
Define a requirement that can be added by commands
Parameters:
- Source:
addCommandRequirementDir(dirname)
Add command requirements from a directory
Parameters:
Name |
Type |
Description |
dirname |
string
|
Path to load command requirements |
- Source:
addCommandRequirementFile(filename) → {CommandRequirement}
Add command requirement from file
Parameters:
Name |
Type |
Description |
filename |
string
|
Path to file |
- Source:
Returns:
CommandRequirement added
-
Type
-
CommandRequirement
addComponent(component) → {Component}
Add a Component
Parameters:
- Source:
Returns:
- Component added
-
Type
-
Component
addComponentDir(dirname)
Add components from a directory
Parameters:
Name |
Type |
Description |
dirname |
string
|
Path to load components |
- Source:
addComponentFile(filename) → {Component}
Add component from file
Parameters:
Name |
Type |
Description |
filename |
string
|
Path to file |
- Source:
Returns:
Component added
-
Type
-
Component
addInteractionCommandDir(dirname)
Load all the JS files in a directory and attempt to load them each as commands.
Parameters:
Name |
Type |
Description |
dirname |
string
|
The location of the directory. |
- Source:
addInteractionCommandFile(filename) → {Command}
Load a command exported from a file.
Parameters:
Name |
Type |
Description |
filename |
string
|
The location of the file. |
- Source:
Returns:
- Command added.
-
Type
-
Command
createCommandArgs(msg) → {parseCommand}
Create args object and find command. Returns both.
Parameters:
Name |
Type |
Description |
msg |
Eris.message
|
Eris Message object |
- Source:
Returns:
-
-
Type
-
parseCommand
extendCommandArgs(args, msg, client)
Extend default args object.
Parameters:
Name |
Type |
Description |
args |
args
|
Args object. |
msg |
msg
|
Eris Message. |
client |
Client
|
Client instance. |
- Source:
getCommandByName(command, subcommand) → {Command|undefined}
Checks the list of registered commands and returns one whch is known by a
given name, either as the command's name or an alias of the command.
Parameters:
Name |
Type |
Description |
command |
string
|
The name of the command to look for. |
subcommand |
string
|
The name of the subcommand to look for. |
- Source:
Returns:
-
Type
-
Command
|
undefined
getCommandsOfCategories(categories) → {Array.<Command>|undefined}
Get Commands from a Category
Parameters:
Name |
Type |
Description |
categories |
string
|
Array.<string>
|
Category or list of these to search commands |
- Source:
Returns:
- Array of
Command (include childs commands aka subcommands)
-
Type
-
Array.<Command>
|
undefined
(async) handleInteractionCreate(interaction) → {*}
Given a message, see if there is a command and process it if so.
Parameters:
Name |
Type |
Description |
interaction |
Object
|
The interaction object recieved from Eris. |
- Source:
Returns:
- Returns
-
Type
-
*
(async) handleMessage(msg) → {*}
Given a message, see if there is a command and process it if so.
Parameters:
Name |
Type |
Description |
msg |
Object
|
The message object recieved from Eris. |
- Source:
Returns:
- Returns
-
Type
-
*
reloadCommands()
Reloads all commands that were loaded via `addCommandFile` and
`addCommandDir`. Useful for development to hot-reload commands as you work
on them.
- Source:
reloadComponents()
Reloads all components that were loaded via `addComponentFile` and
`addCommponentDir`. Useful for development to hot-reload commands as you work
on them.
- Source:
triggerMessageCreate(msg, client) → {boolean}
If returns true, allow default commands management and messageCreate Components functions.
Parameters:
Name |
Type |
Description |
msg |
Eris.message
|
Eris Message object |
client |
Client
|
Client instance |
- Source:
Returns:
- true = allow, false = omit
-
Type
-
boolean
Events
aghanim:command-interaction:error
Fired when an interaction command had an error
Parameters:
Name |
Type |
Description |
interaction |
object
|
Error |
client |
Client
|
Client instance |
interactionCommand |
Command
|
Interaction command |
- Source:
aghanim:command-interaction:executed
Fired when an interaction command runner was executed
Parameters:
Name |
Type |
Description |
interaction |
object
|
Error |
client |
Client
|
Client instance |
interactionCommand |
Command
|
Interaction command |
- Source:
aghanim:command-interaction:executing
Fired when an interaction command runner go to be executed
Parameters:
Name |
Type |
Description |
interaction |
object
|
Error |
client |
Client
|
Client instance |
interactionCommand |
Command
|
Interaction command |
- Source:
aghanim:command-interaction:triggered
Fired when an interaction command is triggered
Parameters:
Name |
Type |
Description |
interaction |
object
|
Error |
client |
Client
|
Client instance |
interactionCommand |
Command
|
Interaction command |
- Source:
aghanim:command-interaction:triggered-not-found
Fired when an interaction command is triggered but the runner was not found
Parameters:
Name |
Type |
Description |
interaction |
object
|
Error |
client |
Client
|
Client instance |
interactionCommand |
Command
|
Interaction command |
- Source:
aghanim:command:error
Fired when a command got an error executing the run function
Parameters:
Name |
Type |
Description |
err |
object
|
Error |
msg |
object
|
Eris Message object |
args |
args
|
Args object |
client |
Client
|
Client instance |
command |
Command
|
Command |
- Source:
aghanim:command:error
Fired when a command got an error executing the run function
Parameters:
Name |
Type |
Description |
err |
object
|
Error |
msg |
object
|
Eris Message object |
args |
args
|
Args object |
client |
Client
|
Client instance |
command |
Command
|
Command |
- Source:
aghanim:command:executed
Fired after a command is executed. Don't cant stop command of running
Parameters:
Name |
Type |
Description |
msg |
object
|
Eris Message object |
args |
args
|
Args object |
client |
Client
|
Client instance |
command |
Command
|
Command |
- Source:
aghanim:command:prereq
Fired before a command is executed. Can't stop command of running
Parameters:
Name |
Type |
Description |
msg |
object
|
Eris Message object |
args |
args
|
Args object |
client |
Client
|
Client instance |
command |
Command
|
Command |
- Source:
aghanim:command:prerun
Fired before a command is executed. Can't stop command of running
Parameters:
Name |
Type |
Description |
msg |
object
|
Eris Message object |
args |
args
|
Args object |
client |
Client
|
Client instance |
command |
Command
|
Command |
- Source:
aghanim:component:error
Fired when a component get an error to be executed
Parameters:
Name |
Type |
Description |
err |
object
|
Error |
eventname |
string
|
Name of Eris event |
client |
Client
|
Client instance |
component |
Component
|
Component |
- Source:
aghanim:error
Fired when there are an error
Parameters:
Name |
Type |
Description |
err |
object
|
Error |
client |
Client
|
Client instance |
- Source: