Command Handler

You can use the command handler if you want the main file to be clean of bot commands.

๐Ÿ’ก

Put this in your main file...

const fs = require("fs");
const path = "./pathToDir/";
var reader = fs.readdirSync(path).filter((file) => file.endsWith(".js"));
for (const file of reader) {
const command = require(path + file);
bot.command({
name: command.name,
aliases: command.aliases,
code: command.code,
});
}
๐Ÿ’ก

in your command file...

module.exports = {
name: "commandName",
aliases: ["Aliases1"],
code: `command code`
}