I'm trying to make my command handler that allows to have files inside folders. For example, I'd have a folder named ./commands/moderation or maybe one named ./commands/fun, etc. How can I do it?
My code looks like this but it only handles JavaScript files inside my ./commands folder.
for (const file of commandFiles) {
const command = require(`./commands/${file}`)
client.commands.set(command.name, command)
}
// ...
if (!client.commands.has(command)) return;
try {
client.commands.get(command).execute(message, args);
}
// ...