import { Message, MessageEmbed } from 'discord.js'; import { duration } from 'moment'; import { BushCommand } from '../../lib/extensions/discord-akairo/BushCommand'; export default class BotInfoCommand extends BushCommand { public constructor() { super('botinfo', { aliases: ['botinfo'], category: 'info', description: { content: 'Shows information about the bot', usage: 'botinfo', examples: ['botinfo'] }, slash: true, clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'], userPermissions: ['SEND_MESSAGES'] }); } public async exec(message: Message): Promise { 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.toString(), inline: true }, { name: 'Current commit', value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})` } ]) .setTimestamp(); await message.util.reply({ embeds: [embed] }); } }