Setting up Commands
Follow the folder structure and create sub folders inside your command folder. Name these sub-folders as a category name for your command files. In order for commands to run when placed inside their respective sub-folders of the command folder, you need to set the properties for each command.
Usage
Here is a sample command example with the filename of "ping.js" and it's the command properties:
Properties
name
This is the command name
Type: string
description
The is the description of the command and its functionality
Type: string
aliases
The is the different abbreviation (aliases) of the command that you can use to call and execute the command
Type: Array<String>
guildOnly
This is set the command if its can only be used within a server or can be used within direct message with the bot
Type: Boolean
Default: false
permissions
This is the permission level value of who can execute the command. If set to 0, any user can run this command, 5 is the server owner and 10 is only the bot owner can run the command. For more details, please refer to the config file on the permission levels.
Type: Number
minArgs
This is the minimum arguments required to execute the command
Type: Number
maxArgs
This is the maximum arguments required to execute the command
Type: Number
Default: 0
execute(message, args, client, level)
This a function that is invoked when the command is called to be executed
Property | Type | Required | Description |
---|---|---|---|
message | true | This is message object that represent a message on discord. | |
args | Array<string> | false | This is arguments array that is required and sent by the user when the command gets executed. |
client | false | This is the discord client object. | |
level | Number | false | This is the user's permission level. |
returns;
Last updated