diff --git a/commands/util/disable.js b/commands/util/disable.js new file mode 100644 index 00000000..4a5cdcee --- /dev/null +++ b/commands/util/disable.js @@ -0,0 +1,29 @@ +const Command = require('../../framework/Command'); + +module.exports = class DisableCommand extends Command { + constructor(client) { + super(client, { + name: 'disable', + aliases: ['disable-command', 'disable-cmd'], + group: 'util', + memberName: 'disable', + description: 'Disables a command.', + details: 'Only the bot owner(s) may use this command.', + ownerOnly: true, + guarded: true, + args: [ + { + key: 'command', + type: 'command' + } + ] + }); + } + + run(msg, { command }) { + if (!command._enabled) return msg.say(`The \`${command.name}\` command is already disabled.`); + if (command.guarded) return msg.say(`The \`${command.name}\` command cannot be disabled.`); + command.disable(); + return msg.say(`Disabled the \`${command.name}\` command.`); + } +}; diff --git a/commands/util/enable.js b/commands/util/enable.js new file mode 100644 index 00000000..038d7624 --- /dev/null +++ b/commands/util/enable.js @@ -0,0 +1,28 @@ +const Command = require('../../framework/Command'); + +module.exports = class EnableCommand extends Command { + constructor(client) { + super(client, { + name: 'enable', + aliases: ['enable-command', 'enable-cmd'], + group: 'util', + memberName: 'enable', + description: 'Enables a command.', + details: 'Only the bot owner(s) may use this command.', + ownerOnly: true, + guarded: true, + args: [ + { + key: 'command', + type: 'command' + } + ] + }); + } + + run(msg, { command }) { + if (command._enabled) return msg.say(`The \`${command.name}\` command is already enabled.`); + command.enable(); + return msg.say(`Enabled the \`${command.name}\` command.`); + } +}; diff --git a/commands/util/eval.js b/commands/util/eval.js index b48e1c28..a906f1d5 100644 --- a/commands/util/eval.js +++ b/commands/util/eval.js @@ -19,6 +19,7 @@ module.exports = class EvalCommand extends Command { description: 'Executes JavaScript code.', details: 'Only the bot owner(s) may use this command.', ownerOnly: true, + guarded: true, args: [ { key: 'script', diff --git a/commands/util/load.js b/commands/util/load.js index 9f0eab14..bccf6e20 100644 --- a/commands/util/load.js +++ b/commands/util/load.js @@ -10,6 +10,7 @@ module.exports = class LoadCommand extends Command { memberName: 'load', description: 'Loads a new command.', details: 'Only the bot owner(s) may use this command.', + guarded: true, ownerOnly: true, args: [ { diff --git a/commands/util/reload.js b/commands/util/reload.js index 0325e6c3..38fb4663 100644 --- a/commands/util/reload.js +++ b/commands/util/reload.js @@ -27,6 +27,7 @@ module.exports = class ReloadCommand extends Command { command.reload(); this.client.importCommandLeaderboard(); this.client.importLastRun(); + this.client.registry.commands.get('cloc').cache = null; return msg.say(`Reloaded the \`${command.name}\` command.`); } }; diff --git a/commands/util/unload.js b/commands/util/unload.js index 30e03a2c..21b7799f 100644 --- a/commands/util/unload.js +++ b/commands/util/unload.js @@ -9,6 +9,7 @@ module.exports = class UnloadCommand extends Command { memberName: 'unload', description: 'Unloads a command.', details: 'Only the bot owner(s) may use this command.', + guarded: true, ownerOnly: true, args: [ { diff --git a/commands/util/update-env.js b/commands/util/update-env.js index 90813521..3f426088 100644 --- a/commands/util/update-env.js +++ b/commands/util/update-env.js @@ -10,7 +10,8 @@ module.exports = class UpdateEnvCommand extends Command { memberName: 'update-env', description: 'Updates the bot\'s environment variables.', details: 'Only the bot owner(s) may use this command.', - ownerOnly: true + ownerOnly: true, + guarded: true }); }