From 6fdb314bfa948e0b4131c479cd4886579b2b03e0 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Tue, 21 May 2024 20:55:48 -0400 Subject: [PATCH] Add ability to reload all commands --- commands/util/reload.js | 12 ++++++++++-- package.json | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/commands/util/reload.js b/commands/util/reload.js index 38fb4663..4f010712 100644 --- a/commands/util/reload.js +++ b/commands/util/reload.js @@ -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.`); } }; diff --git a/package.json b/package.json index 1a6110d2..cb015e56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "151.4.0", + "version": "151.4.1", "description": "Your personal server companion.", "main": "Xiao.js", "private": true,