Setup Events Path

To setup commands, you must provide the eventsPath property when creating a new instance of CommandHandler.

index.js
const { Client, IntentsBitField } = require('discord.js');
const { CommandHandler } = require('djs-commander');
const path = require('path');

const client = new Client({
  intents: [IntentsBitField.Flags.Guilds], // Your bot's intents
});

new CommandHandler({
  client, // Discord.js client object | Required by default
  eventsPath: path.join(__dirname, 'events'), // Your events directory
});

client.login('YOUR_TOKEN_HERE');

Different Events Folder

As with the commands path, your eventsPath can lead to a folder with any name anywhere. For example, if I have my events saved inside a folder called bot-events, I would define eventsPath like this.

eventsPath: path.join(__dirname, 'bot-events')

Last updated