Add enable and disable commands

This commit is contained in:
Dragon Fire
2024-03-30 01:02:07 -04:00
parent cc4f592695
commit 4d88d529df
7 changed files with 63 additions and 1 deletions
+29
View File
@@ -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.`);
}
};
+28
View File
@@ -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.`);
}
};
+1
View File
@@ -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',
+1
View File
@@ -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: [
{
+1
View File
@@ -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.`);
}
};
+1
View File
@@ -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: [
{
+2 -1
View File
@@ -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
});
}