mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 14:18:36 +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.',
|
description: 'Executes JavaScript code.',
|
||||||
details: 'Only the bot owner(s) may use this command.',
|
details: 'Only the bot owner(s) may use this command.',
|
||||||
ownerOnly: true,
|
ownerOnly: true,
|
||||||
|
guarded: true,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'script',
|
key: 'script',
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ module.exports = class LoadCommand extends Command {
|
|||||||
memberName: 'load',
|
memberName: 'load',
|
||||||
description: 'Loads a new command.',
|
description: 'Loads a new command.',
|
||||||
details: 'Only the bot owner(s) may use this command.',
|
details: 'Only the bot owner(s) may use this command.',
|
||||||
|
guarded: true,
|
||||||
ownerOnly: true,
|
ownerOnly: true,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ module.exports = class ReloadCommand extends Command {
|
|||||||
command.reload();
|
command.reload();
|
||||||
this.client.importCommandLeaderboard();
|
this.client.importCommandLeaderboard();
|
||||||
this.client.importLastRun();
|
this.client.importLastRun();
|
||||||
|
this.client.registry.commands.get('cloc').cache = null;
|
||||||
return msg.say(`Reloaded the \`${command.name}\` command.`);
|
return msg.say(`Reloaded the \`${command.name}\` command.`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ module.exports = class UnloadCommand extends Command {
|
|||||||
memberName: 'unload',
|
memberName: 'unload',
|
||||||
description: 'Unloads a command.',
|
description: 'Unloads a command.',
|
||||||
details: 'Only the bot owner(s) may use this command.',
|
details: 'Only the bot owner(s) may use this command.',
|
||||||
|
guarded: true,
|
||||||
ownerOnly: true,
|
ownerOnly: true,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ module.exports = class UpdateEnvCommand extends Command {
|
|||||||
memberName: 'update-env',
|
memberName: 'update-env',
|
||||||
description: 'Updates the bot\'s environment variables.',
|
description: 'Updates the bot\'s environment variables.',
|
||||||
details: 'Only the bot owner(s) may use this command.',
|
details: 'Only the bot owner(s) may use this command.',
|
||||||
ownerOnly: true
|
ownerOnly: true,
|
||||||
|
guarded: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user