Closed chilaxree closed 2 years ago
fs.readdirSync('./commands').forEach(dir => {
const commandFiles = fs.readdirSync(`./commands/${dir}/`).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const jsfile = require(`./commands/${dir}/${file}`);
bot.commands.set(jsfile.help.name, jsfile);
}
})
fs.readdirSync('./commands').forEach(dir => { const commandFiles = fs.readdirSync(`./commands/${dir}/`).filter(file => file.endsWith('.js')); for (const file of commandFiles) { const jsfile = require(`./commands/${dir}/${file}`); bot.commands.set(jsfile.help.name, jsfile); } })
That code will load command files that are inside a sub-folders inside the commands folder but not command files that are inside the main commands folder. I might be implementing something that will load command files from the main folder and sub-folders at a later date
implemented code in ab4688b56aaebed847499290ef459b22a774660e and it should do this and allow command files in the main commands directory aswell
I wanna organize my commands into sub-folders but the command handler wont see my commands. is there a way to do it?