aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info/botInfo.ts
diff options
context:
space:
mode:
authorTymanWasTaken <32660892+tymanwastaken@users.noreply.github.com>2021-05-28 21:54:50 -0600
committerTymanWasTaken <32660892+tymanwastaken@users.noreply.github.com>2021-05-28 21:54:50 -0600
commit2456dab3db0d8eaae515606b83a6c0c317d009b0 (patch)
treec20448112d43c1b4ffae1395584d9b202aeee3ed /src/commands/info/botInfo.ts
parent1e9e334097702c68d871365fc016aa096d03c491 (diff)
parent5b5f0bf5667b922037508dfa88e40a1f8a2671ec (diff)
downloadtanzanite-2456dab3db0d8eaae515606b83a6c0c317d009b0.tar.gz
tanzanite-2456dab3db0d8eaae515606b83a6c0c317d009b0.tar.bz2
tanzanite-2456dab3db0d8eaae515606b83a6c0c317d009b0.zip
fix conflicts
Diffstat (limited to 'src/commands/info/botInfo.ts')
-rw-r--r--src/commands/info/botInfo.ts55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
new file mode 100644
index 0000000..ebbd0c9
--- /dev/null
+++ b/src/commands/info/botInfo.ts
@@ -0,0 +1,55 @@
+import { MessageEmbed, Message, CommandInteraction } from 'discord.js';
+import { BushCommand } from '../../lib/extensions/BushCommand';
+import { duration } from 'moment';
+
+export default class BotInfoCommand extends BushCommand {
+ constructor() {
+ super('botinfo', {
+ aliases: ['botinfo'],
+ category: 'info',
+ description: {
+ content: 'Shows information about the bot',
+ usage: 'botinfo',
+ examples: ['botinfo']
+ }
+ });
+ }
+
+ private async generateEmbed(): Promise<MessageEmbed> {
+ const owners = (await this.client.util.mapIDs(this.client.ownerID)).map((u) => u.tag).join('\n');
+ const currentCommit = (await this.client.util.shell('git rev-parse HEAD')).stdout.replace('\n', '');
+ const repoUrl = (await this.client.util.shell('git remote get-url origin')).stdout.replace('\n', '');
+ const embed = new MessageEmbed()
+ .setTitle('Bot Info:')
+ .addFields([
+ {
+ name: 'Owners',
+ value: owners,
+ inline: true
+ },
+ {
+ name: 'Uptime',
+ value: this.client.util.capitalize(duration(this.client.uptime, 'milliseconds').humanize())
+ },
+ {
+ name: 'User count',
+ value: this.client.users.cache.size,
+ inline: true
+ },
+ {
+ name: 'Current commit',
+ value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`
+ }
+ ])
+ .setTimestamp();
+ return embed;
+ }
+
+ public async exec(message: Message): Promise<void> {
+ await message.util.send(await this.generateEmbed());
+ }
+
+ public async execSlash(message: CommandInteraction): Promise<void> {
+ await message.reply(await this.generateEmbed());
+ }
+}