remove unloaded commands from cache
This commit is contained in:
parent
41c3b51ed6
commit
e0fb1c5ed7
1 changed files with 5 additions and 7 deletions
|
@ -60,17 +60,15 @@ class CommandHandler {
|
||||||
command = this.client.commands.get(this.client.aliases.get(name));
|
command = this.client.commands.get(this.client.aliases.get(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!command) {
|
if (!command) return `\`${name}\` does not exist as a command or an alias.`;
|
||||||
return `\`${name}\` does not exist as a command or an alias.`;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.client.logger.debug(`Unloading command ${category}/${name}`);
|
this.client.logger.debug(`Unloading command ${category}/${name}`);
|
||||||
|
|
||||||
if (command.shutdown) {
|
for (const alias of command.conf.aliases) this.client.aliases.delete(alias);
|
||||||
await command.shutdown(this.client);
|
this.client.commands.delete(command.help.name);
|
||||||
}
|
|
||||||
delete require.cache[require.resolve(path)];
|
delete require.cache[require.resolve(path)];
|
||||||
return false;
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unloadAll () {
|
unloadAll () {
|
||||||
|
|
Loading…
Reference in a new issue