fix up unloadAll function
This commit is contained in:
parent
e0fb1c5ed7
commit
688d3e82ae
1 changed files with 3 additions and 5 deletions
|
@ -49,7 +49,7 @@ class CommandHandler {
|
||||||
this.client.logger.info(`Loaded a total of ${this.client.commands.size} commands.`);
|
this.client.logger.info(`Loaded a total of ${this.client.commands.size} commands.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async unload (name, category) {
|
unload (name, category) {
|
||||||
const path = this.client.path + '/commands/' + category + '/' + name + '.js';
|
const path = this.client.path + '/commands/' + category + '/' + name + '.js';
|
||||||
|
|
||||||
let command;
|
let command;
|
||||||
|
@ -78,10 +78,8 @@ class CommandHandler {
|
||||||
const commandFiles = fs.readdirSync('./commands/' + dir + '/');
|
const commandFiles = fs.readdirSync('./commands/' + dir + '/');
|
||||||
commandFiles.filter((cmd) => cmd.split('.').pop() === 'js').forEach((cmd) => {
|
commandFiles.filter((cmd) => cmd.split('.').pop() === 'js').forEach((cmd) => {
|
||||||
cmd = cmd.substring(0, cmd.length - 3);
|
cmd = cmd.substring(0, cmd.length - 3);
|
||||||
const resp = this.unload(cmd, dir);
|
const res = this.unload(cmd, dir);
|
||||||
if (resp) {
|
if (res) this.client.logger.error(res);
|
||||||
this.client.logger.error(resp);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue