mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add enable and disable commands
This commit is contained in:
@@ -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.`);
|
||||
}
|
||||
};
|
||||
@@ -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.`);
|
||||
}
|
||||
};
|
||||
@@ -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',
|
||||
|
||||
@@ -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: [
|
||||
{
|
||||
|
||||
@@ -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.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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: [
|
||||
{
|
||||
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user