summaryrefslogtreecommitdiff
path: root/server/src/commands/bot/Info.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-07-23 23:24:17 -0700
committer8cy <[email protected]>2020-07-23 23:24:17 -0700
commitbb511abc03bb66848947e37a999502b813c77269 (patch)
tree612c010fc8317e1cdf11471a18aad0270819d33e /server/src/commands/bot/Info.ts
parentfix: if clear amount equal or over 100, round down to 99 (diff)
downloaddep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz
dep-core-bb511abc03bb66848947e37a999502b813c77269.zip
goodbye old uwufier :cry:
Diffstat (limited to 'server/src/commands/bot/Info.ts')
-rw-r--r--server/src/commands/bot/Info.ts61
1 files changed, 61 insertions, 0 deletions
diff --git a/server/src/commands/bot/Info.ts b/server/src/commands/bot/Info.ts
new file mode 100644
index 0000000..cda8f7a
--- /dev/null
+++ b/server/src/commands/bot/Info.ts
@@ -0,0 +1,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}sin`,
+ `${this.client.users.resolve(owners[0]).avatarURL()}`);
+ return msg.channel.send(embed);
+ }
+} \ No newline at end of file