initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
const included = require("../../requires")
|
||||
|
||||
// Here you can add functions that will be run at each startup of the bot
|
||||
|
||||
module.exports = {
|
||||
name:"reloadCommands",
|
||||
async function(msg, args){
|
||||
commands.clear()
|
||||
var path = `${__dirname}/../../functions`
|
||||
var folders = fs.readdirSync(path).filter(function (file) {
|
||||
return fs.statSync(path+'/'+file).isDirectory();
|
||||
});
|
||||
folders.forEach(element => {
|
||||
var commandFiles = fs.readdirSync(`${path}/${element}`).filter(file => file.endsWith('.js') && !file.startsWith("index"));
|
||||
for (const file of commandFiles) {
|
||||
delete require.cache[require.resolve(`${path}/${element}/${file}`)];
|
||||
try {
|
||||
const command = require(`${path}/${element}/${file}`);
|
||||
commands.set(command.name, command);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
console.log(`Reloading ${commands.size} modules done`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user