Set Uses Command

This commit is contained in:
Dragon Fire
2020-11-09 16:00:32 -05:00
parent 988146aeec
commit 356724a5d7
3 changed files with 59 additions and 2 deletions
+2 -1
View File
@@ -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)
+56
View File
@@ -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.`);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "119.40.1",
"version": "119.41.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {