From 2a11f936ef7fb082b0e58b5fd139ba0eb318ca23 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Mon, 1 Jun 2020 23:43:30 -0400 Subject: [PATCH] Uses Command --- README.md | 3 ++- commands/util/command-leaderboard.js | 2 +- commands/util/uses.js | 27 +++++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 commands/util/uses.js diff --git a/README.md b/README.md index 970f8c1f..75550cf0 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 451 +Total: 452 ### Utility: @@ -244,6 +244,7 @@ Total: 451 * **ping:** Checks the bot's ping to the Discord server. * **report:** Reports something to the bot owner(s). * **shutdown:** Shuts down the bot. (Owner-Only) +* **uses:** Responds with a command's usage stats. ### Discord Information: diff --git a/commands/util/command-leaderboard.js b/commands/util/command-leaderboard.js index 5ab0dba5..609f10b0 100644 --- a/commands/util/command-leaderboard.js +++ b/commands/util/command-leaderboard.js @@ -36,7 +36,7 @@ module.exports = class CommandLeaderboardCommand extends Command { let previousPts = null; let positionsMoved = 1; return this.client.registry.commands - .filter(command => command.uses !== undefined && !command.unknown && !command.hidden) + .filter(command => command.uses !== undefined) .sort((a, b) => b.uses - a.uses) .map(command => { if (previousPts === command.uses) { diff --git a/commands/util/uses.js b/commands/util/uses.js new file mode 100644 index 00000000..00bf0169 --- /dev/null +++ b/commands/util/uses.js @@ -0,0 +1,27 @@ +const Command = require('../../structures/Command'); +const { MessageEmbed } = require('discord.js'); +const { embedURL } = require('../../util/Util'); + +module.exports = class UsesCommand extends Command { + constructor(client) { + super(client, { + name: 'uses', + group: 'util', + memberName: 'uses', + description: 'Responds with a command\'s usage stats.', + guarded: true, + args: [ + { + key: 'command', + prompt: 'Which command would you like to view the uses of?', + type: 'command' + } + ] + }); + } + + run(msg, { command }) { + if (command.uses === undefined) return msg.say('This command\'s usage stats aren\'t being tracked.'); + return msg.say(`The \`${command.name}\` command has been used **${command.uses}** times.`); + } +}; diff --git a/package.json b/package.json index 34306e37..96000a37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "115.1.5", + "version": "115.2.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {