CommandHandler
The CommandHandler namespace is the principle namespace you have to use throughout your project to access every features of the module.
CommandHandler
is a namespace because it simplifies places where you want to have all the functions/variables that the CommandHandler offers, without importing it in every command/event/other.
It also prevents you from creating/launching multiple CommandHandler from one process.
Creating your CommandHandler
In order to initialize your CommandHandler, you have to use the create
function with the needed options.
By default prefixes
will be !
and the mention of your bot.
The owners
property is only used for the Tag.ownerOnly
tag with the default message
event.
Launching the CommandHandler
To launch the CommandHandler, use the launch
method and put the token of your bot, you can also put here clientOptions
, you can see here an example of this :
Presence
You have two options for setting the presence of your bot.
You can set the
presence
property as the presence you want as a PresenceData.You can set the
presences
property as an array of presences as PresenceDatas. If you use it, by default it will cycle between presences, you can disable this behavior by setting the propertycycleBetweenPresences
tofalse
and it will thus use the first presence you set. You can also change the duration between cycles using thecycleDuration
property that take a number as seconds, and is set by default to 60.
Loading Commands & Events
The CommandHandler will automatically load and handle your commands & events, if they are all in the correct path you put.
But you can still use the .loadXs(directory)
and .loadX(directory, name)
functions of the CommandHandler namespace at any time (but it's recommended to use them before launching the CommandHandler.
The CommandHandler class is extending the EventEmitter
class, which means that there are events that can be hooked. Click on the title of the section to see the list of events.
Last updated