forked from Naval-Base/haruna
/
stats.ts
46 lines (43 loc) · 1.56 KB
/
stats.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { Command } from 'discord-akairo';
import { Message, MessageEmbed } from 'discord.js';
import { stripIndents } from 'common-tags';
import * as moment from 'moment';
import 'moment-duration-format';
export default class StatsCommand extends Command {
public constructor() {
super('stats', {
aliases: ['stats'],
description: {
content: 'Displays statistics about the bot.'
},
category: 'util',
clientPermissions: ['EMBED_LINKS'],
ratelimit: 2
});
}
public async exec(message: Message): Promise<Message | Message[]> {
const embed = new MessageEmbed()
.setColor(3447003)
.setDescription(`**${this.client.user!.username} Statistics**`)
.addField('❯ Uptime', moment.duration(this.client.uptime!).format('d[d ]h[h ]m[m ]s[s]'), true)
.addField('❯ Memory Usage', `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true)
.addField(
'❯ General Stats',
stripIndents`
• Guilds: ${this.client.guilds.size}
• Channels: ${this.client.channels.size}
`,
true
)
.addField('❯ Version', `[${process.env.VERSION!}](https://github.com/Naval-Base/haruna/commit/${process.env.VERSION!})`, true)
.addField('❯ Source Code', '[View Here](https://github.com/Naval-Base/haruna)', true)
.addField(
'❯ Library',
'[discord.js](https://discord.js.org)[-akairo](https://github.com/1Computer1/discord-akairo)',
true
)
.setThumbnail(this.client.user!.displayAvatarURL())
.setFooter(`© 2018 ${this.client.users.get(this.client.config.owner!)!.tag}`);
return message.util!.send(embed);
}
}