Add ability to reload all commands

This commit is contained in:
Dragon Fire
2024-05-21 20:55:48 -04:00
parent ad647fe74b
commit 6fdb314bfa
2 changed files with 11 additions and 3 deletions
+10 -2
View File
@@ -15,7 +15,8 @@ module.exports = class ReloadCommand extends Command {
{ {
key: 'command', key: 'command',
label: 'command', label: 'command',
type: 'command' type: 'command',
default: ''
} }
] ]
}); });
@@ -24,10 +25,17 @@ module.exports = class ReloadCommand extends Command {
run(msg, { command }) { run(msg, { command }) {
this.client.exportCommandLeaderboard(); this.client.exportCommandLeaderboard();
this.client.exportLastRun(); 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.importCommandLeaderboard();
this.client.importLastRun(); this.client.importLastRun();
this.client.registry.commands.get('cloc').cache = null; this.client.registry.commands.get('cloc').cache = null;
if (!command) return msg.say('Reloaded all commands.');
return msg.say(`Reloaded the \`${command.name}\` command.`); return msg.say(`Reloaded the \`${command.name}\` command.`);
} }
}; };
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiao", "name": "xiao",
"version": "151.4.0", "version": "151.4.1",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Xiao.js", "main": "Xiao.js",
"private": true, "private": true,