From 5e32895d643dbc45ea4acf64a1cb69558a68bef1 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Tue, 30 Jun 2020 10:18:33 -0400 Subject: [PATCH] generate fun information command --- README.md | 5 ++-- commands/util/generate-fun-information.js | 30 +++++++++++++++++++++++ package.json | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 commands/util/generate-fun-information.js diff --git a/README.md b/README.md index 7704f8d3..22484bc1 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ don't grant that permission. ## Fun Information - 500+ Commands -- 25,000+ lines of JavaScript +- 26,000+ lines of JavaScript - 61,000+ lines of JSON data - 3 years of development - 4,000+ commits @@ -232,7 +232,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 510 +Total: 511 ### Utility: @@ -256,6 +256,7 @@ Total: 510 * **command-leaderboard-import:** Imports a command leaderboard JSON file. (Owner-Only) * **generate-commands:** Generates the commands list for Xiao's README. (Owner-Only) * **generate-credit:** Generates the credit list for Xiao's README. (Owner-Only) +* **generate-fun-information:** Generates the "Fun Information" for Xiao's README. (Owner-Only) * **generate-process-env:** Generates a backup list of Xiao's `process.env`. (Owner-Only) * **ip:** Responds with the IP address the bot's server is running on. (Owner-Only) * **shutdown:** Shuts down the bot. (Owner-Only) diff --git a/commands/util/generate-fun-information.js b/commands/util/generate-fun-information.js new file mode 100644 index 00000000..571521bc --- /dev/null +++ b/commands/util/generate-fun-information.js @@ -0,0 +1,30 @@ +const Command = require('../../structures/Command'); +const { stripIndents } = require('common-tags'); +const { formatNumber } = require('../../util/Util'); + +module.exports = class GenerateFunInformationCommand extends Command { + constructor(client) { + super(client, { + name: 'generate-fun-information', + aliases: ['gen-fun-information', 'generate-fun-info', 'gen-fun-info', 'generate-fun', 'gen-fun'], + group: 'util', + memberName: 'generate-fun-information', + description: 'Generates the "Fun Information" for Xiao\'s README.', + details: 'Only the bot owner(s) may use this command.', + ownerOnly: true, + guarded: true + }); + } + + async run(msg) { + const cloc = await this.client.registry.commands.get('cloc').cloc(); + const text = stripIndents` + - ${formatNumber(Math.floor(this.client.registry.commands.size / 100) * 100)}+ commands + - ${formatNumber(Math.floor(cloc.JavaScript.code / 1000) * 1000)}+ lines of JavaScript + - ${formatNumber(Math.floor(cloc.JSON.code / 1000) * 1000)}+ lines of JSON data + - ${new Date().getFullYear() - 2017} years of development + `; + await msg.direct({ files: [{ attachment: Buffer.from(text), name: 'fun-information.txt' }] }); + return msg.say('📬 Sent `fun-information.txt` to your DMs!'); + } +}; diff --git a/package.json b/package.json index 72c22cac..b3e9cef9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "117.6.0", + "version": "117.7.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {