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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
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<Message> {
// @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);
}
}
|