mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 15:57:43 +02:00
Add ability to reload all commands
This commit is contained in:
+10
-2
@@ -15,7 +15,8 @@ module.exports = class ReloadCommand extends Command {
|
||||
{
|
||||
key: 'command',
|
||||
label: 'command',
|
||||
type: 'command'
|
||||
type: 'command',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -24,10 +25,17 @@ module.exports = class ReloadCommand extends Command {
|
||||
run(msg, { command }) {
|
||||
this.client.exportCommandLeaderboard();
|
||||
this.client.exportLastRun();
|
||||
command.reload();
|
||||
if (command) {
|
||||
command.reload();
|
||||
} else {
|
||||
for (const cmd of this.client.registry.commands.values()) {
|
||||
cmd.reload();
|
||||
}
|
||||
}
|
||||
this.client.importCommandLeaderboard();
|
||||
this.client.importLastRun();
|
||||
this.client.registry.commands.get('cloc').cache = null;
|
||||
if (!command) return msg.say('Reloaded all commands.');
|
||||
return msg.say(`Reloaded the \`${command.name}\` command.`);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user