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 Dec 4, 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 and json file with the subgroup folder's name for metadata. Files and directory names should never have a whitespace.
The commands are structured as is:
commands
L example.js
L subgroup
L subgroup.json
L subgroupedcommand.js
- You can run a command from the root with
example
- You can run a command from a subgroup with
subgroup subgroupedcommand
From example.js
module.exports = {
name: 'Example',
help: 'Example Command',
args: [''],
preq: [''],
perm: [''],
run: (bot, msg, args) => {
msg.channel.send('Hello World!');
}
}
Key | Value Type | Value Description |
---|---|---|
name |
String | Name to be displayed. |
help |
String | Help text to be displayed. |
args |
String Array | Arguments to be displayed. |
preq |
String Array | Prerequisites required to run command. |
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
{
name: 'Example Subgroup',
desc: 'Meaningful description'
}
Key | Value Type | Value Description |
---|---|---|
name |
String | Name to be displayed. |
desc |
String | Description text to be displayed. |