new CommandDispatcher(bot: Bot)
Methods
.checkLimiter(dm: boolean, message: Message, command: Command) → boolean
Check of the command caller has roles that pass the command
limiter set by the guild admins if the command is called
within a guild
Parameters:
Name | Type | Description |
---|---|---|
dm |
|
Whether the message is a DM |
message |
|
Discord.js message object |
command |
|
Command found by the dispatcher |
.checkPermissions(dm: boolean, message: Message, command: Command) → Array<PermissionResolvable>
Get a list of missing permissions for the command caller for the
given command, if any
Parameters:
Name | Type | Description |
---|---|---|
dm |
|
Whether the message is a DM |
message |
|
Discord.js message object |
command |
|
Command found by the dispatcher |
.commandNotFoundError(message: Message) → Promise<Message>
Send a 'command not found' error message to the channel
Parameters:
Name | Type | Description |
---|---|---|
message |
|
Discord.js message object |
.dispatch(command: Command, message: Message, args: Array<args>, mentions: Array<User>, original: string) → Promise<*>
Pass the necessary items to the found Command's
Command#action
method
Parameters:
Name | Type | Description |
---|---|---|
command |
|
The command found by the dispatcher |
message |
|
Discord.js message object |
args |
|
An array containing the args parsed from the command calling message |
mentions |
|
An array containing the Discord.js User objects parsed from the mentions contained in a message |
original |
|
The original raw content of the message that called the command |
.failedLimiterError(message: Message, command: Command) → Promise<Message>
Send a 'missing roles for role-limited command' error
message to the channel
Parameters:
Name | Type | Description |
---|---|---|
message |
|
Discord.js message object |
command |
|
Command found by the dispatcher |
.guildOnlyError(message: Message) → Promise<Message>
Send a 'guild only' error message to the channel
Parameters:
Name | Type | Description |
---|---|---|
message |
|
Discord.js message object |
.handleMessage(message: Message) → *
Determine if message is a valid command call and send to
CommandDispatcher#dispatch
Parameters:
Name | Type | Description |
---|---|---|
message |
|
Discord.js message object |
.hasRoles(dm: boolean, message: Message, command: Command) → boolean
Checks if the command caller has roles for the given command
Parameters:
Name | Type | Description |
---|---|---|
dm |
|
Whether the message is a DM |
message |
|
Discord.js message object |
command |
|
Command found by the dispatcher |
.missingPermissionsError(missing: Array<PermissionResolvable>, message: Message) → Promise<Message>
Send a 'missing permissions' error message to the channel
Parameters:
Name | Type | Description |
---|---|---|
missing |
|
Array of missing permissions |
message |
|
Discord.js message object |
.missingRolesError(message: Message, command: Command) → Promise<Message>
Send a 'missing roles' error message to the channel
Parameters:
Name | Type | Description |
---|---|---|
message |
|
Discord.js message object |
command |
|
Command found by the dispatcher |
.processContent(message: Message) → Object
Processes message content, finding the command to execute and creating an
object containing the found command, mentions, args, processed content, and
if the message is a DM
Parameters:
Name | Type | Description |
---|---|---|
message |
|
Discord.js message object |