From 356724a5d7b75576c6bf6082d57dac55c397cba6 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Mon, 9 Nov 2020 16:00:32 -0500 Subject: [PATCH] Set Uses Command --- README.md | 3 ++- commands/util/set-uses.js | 56 +++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 commands/util/set-uses.js diff --git a/README.md b/README.md index 43715ea1..bfb00c2f 100644 --- a/README.md +++ b/README.md @@ -260,7 +260,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 556 +Total: 557 ### Utility: @@ -292,6 +292,7 @@ Total: 556 * **ip:** Responds with the IP address the bot's server is running on. (Owner-Only) * **reload:** Reloads a command or command group. (Owner-Only) * **report-respond:** Responds to a submitted report. (Owner-Only) +* **set-uses:** Changes command usage stats. (Owner-Only) * **shutdown:** Shuts down the bot. (Owner-Only) * **webhook:** Posts a message to the webhook defined in the bot owner's `process.env`. (Owner-Only) diff --git a/commands/util/set-uses.js b/commands/util/set-uses.js new file mode 100644 index 00000000..7cd854f4 --- /dev/null +++ b/commands/util/set-uses.js @@ -0,0 +1,56 @@ +const Command = require('../../structures/Command'); +const modes = ['add', 'subtract', 'exact']; +const modeDesc = { + add: 'Added', + subtract: 'Subtracted', + exact: 'Set' +}; +const conj = { + add: 'to', + subtract: 'from', + exact: 'as' +}; + +module.exports = class SetUsesCommand extends Command { + constructor(client) { + super(client, { + name: 'set-uses', + group: 'util', + memberName: 'set-uses', + description: 'Changes command usage stats.', + details: 'Only the bot owner(s) may use this command.', + ownerOnly: true, + guarded: true, + args: [ + { + key: 'mode', + prompt: 'Do you want to add, subtract, or set exact?', + type: 'string', + oneOf: modes, + parse: mode => mode.toLowerCase() + }, + { + key: 'command', + prompt: 'What command do you want to modify?', + type: 'command' + }, + { + key: 'num', + label: 'number', + prompt: 'How much do you want to change the usage?', + type: 'integer', + min: 1 + } + ] + }); + } + + async run(msg, { mode, command, num }) { + switch (mode) { + case 'add': command.uses += num; break; + case 'subtract': command.uses -= num; break; + case 'exact': command.uses = num; break; + } + return msg.say(`${modeDesc[mode]} **${num}** ${conj[mode]} the uses of the \`${command.name}\` command.`); + } +}; diff --git a/package.json b/package.json index 3c67a39e..5a49bc41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.40.1", + "version": "119.41.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {