-
Notifications
You must be signed in to change notification settings - Fork 1
4) Adding Prefixed Commands
First create a file that ends with .js
extension located in the directory you specified in the config.json
's prefixCommands.directory
property.
Now you can just add your in-file config and start coding!
This should be defined in your in-file config.
This will be used while handling the command.
Example situation: If your prefix is !
and your command's name is hello
whenever someone types !hello
to a text channel that your bot can see this command file will be triggered.
This is an optional property and false
by default.
If you want your command to get triggered by using it adds this property.
This is an optional property and false
by default.
If you want your command to be run in DMs add this property.
This is an optional property and false
by default.
If you want your command to be run by bots add this property.
This stops your command and can have limitless arguments which won't matter.
This is a Discord.Message
instance which caused your command.
This is a Discord.Channel
instance where the message was sent.
This is a Discord.Guild
instance or undefined
if you enabled dmAllowed
and used the command in a DM channel.
This is the prefix. Example: !
This is the language got from the guild of the message. Example: en_US
An array
of string
which represent the arguments of the command.
This is a NodeJS.Global.PrefixCommand
instance which represents the current command. You can get in-file config properties using it: command.getConfigValue("name")