This repository has been archived by the owner on Jul 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commands
Nitrous edited this page Nov 21, 2017
·
14 revisions
To create a new command, make a new JavaScript file under commands
directory with the file name being the command's name. To create a new subgroup, make a new directory with the directory's name being the subgroup's name.
From example.js
module.exports = {
help: 'Example Command',
args: ['pong', 'pang'],
preq: ['DMChatOnly', 'ServerOnly', 'BotOwnerOnly', 'HasElevatedPerms', 'ServerOwnerOnly'],
perm: ["MANAGE_CHANNELS"],
run: (bot, msg, args) => {
msg.channel.send('Hello World!');
}
}
Key | Value Type | Value Description |
---|---|---|
help |
String | Help text to be displayed. |
args |
String Array | Arguments to be displayed. |
preq |
String Array | Prerequisites required to run command. List of [[Commands |
perm |
String Array | Permissions required to run command. Uses discord.js Permission Flags. |
run |
Function | The command's run action. |
Prerequisite Flag | Description |
---|---|
DMChatOnly |
Run command only in Direct Messages. |
ServerOnly |
Run command only in Guild Channels. |
BotOwnerOnly |
Run command only for bot owner as defined in config.js
|
HasElevatedPerms |
Run command only for users who have Permission Flags under perm
|
ServerOwnerOnly |
Run command only for guild owner. |
The run action receives 3 arguments:
-
bot
- The bot instance being run -
msg
- The Message Object -
args
- The arguments in String Array being passed down from a command