Skip to content

Command Handler

This will load the commands in your command directory.

Setup: Command Handler

...
// Initialize a Handler for structured command handling
const handler = new Handler(
{
client: client,
readyLog: true
},
{
// Additional Handler configuration options go here
},
__dirname
);
handler.loadCommands('/folder-name') // needs to be a folder

Make sure to create a commands folder in the root directory, meaning where your index.js file is located. Once that is done, we start creating files inside of that folder.
These files can be named what you want, however you need to add the .js syntax after the name, to turn it into a Javascript file. Let’s, once again, create a ping command.

Structure

module.exports = [{
name: "ping",
code: `
My ping is $ping ms!
`
}]