generate fun information command

This commit is contained in:
Dragon Fire
2020-06-30 10:18:33 -04:00
parent a53e021e17
commit 5e32895d64
3 changed files with 34 additions and 3 deletions
+30
View File
@@ -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!');
}
};