Skip to content

Commit

Permalink
Add ability to reload all commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyissillyyy committed May 22, 2024
1 parent ad647fe commit 6fdb314
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions commands/util/reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module.exports = class ReloadCommand extends Command {
{
key: 'command',
label: 'command',
type: 'command'
type: 'command',
default: ''
}
]
});
Expand All @@ -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.`);
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "151.4.0",
"version": "151.4.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"private": true,
Expand Down

0 comments on commit 6fdb314

Please sign in to comment.