import { Command, version as akairoversion } from 'discord-akairo'; import { Message, version as djsversion } from 'discord.js'; import { stripIndents } from 'common-tags'; import * as moment from 'moment'; import 'moment-duration-format'; import { colour, owners } from '../../Config'; export default class InfoBot extends Command { public constructor() { super('info', { aliases: ['info', 'stats', 'uptime'], category: 'bot', description: { content: 'Provides some information/ stats on the bot.', usage: '', examples: [ '' ] }, ratelimit: 3 }); } public async exec(msg: Message): Promise { // @ts-ignore const duration = moment.duration(this.client.uptime!).format(' D[d] H[h] m[m] s[s]'); const embed = this.client.util.embed() .setTitle(`${this.client.user!.username} Stats`) .setColor(colour) .setThumbnail(this.client.user!.displayAvatarURL()) .addField(`\`⏰\` Uptime`, duration, true) .addField(`\`💾\`Memory Usage`, `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB`, true) .addField( `\`📊\` General Stats`, // • Servers: ${this.client.guilds.cache.size.toLocaleString('en-US')} stripIndents` • Channels: ${this.client.channels.cache.size.toLocaleString('en-US')} • Users: ${this.client.guilds.cache .reduce((prev, val) => prev + val.memberCount, 0) .toLocaleString('en-US')} `, true) /* .addField( '`👴` Reaction Role Stats', stripIndents` • Current: ${this.client.settings.cache.reactions.filter(r => r.active).size} • Lifetime: ${this.client.settings.cache.reactions.size} `, true, ) */ .addField( '`📚` Library Info', stripIndents` [\`Akairo Framework\`](https://discord-akairo.github.io/#/): ${akairoversion} [\`Discord.js\`](https://discord.js.org/#/): ${djsversion} `, true) .addField('`👧` Lead Developer', (await this.client.fetchApplication()).owner!.toString(), true) .setFooter(`For more information about ${this.client.users.resolve(owners[0]).tag}, use ${this.client.commandHandler.prefix}fuwn`, `${this.client.users.resolve(owners[0]).avatarURL()}`); return msg.channel.send(embed); } }