From 4d63c4af57a7391dd61106b79874b8e83c14971a Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Sun, 16 May 2021 22:23:12 -0400 Subject: change all existing slash commands to have no repeating code, add help slash command --- src/commands/info/botinfo.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/commands/info/botinfo.ts') diff --git a/src/commands/info/botinfo.ts b/src/commands/info/botinfo.ts index 306c142..8f5f055 100644 --- a/src/commands/info/botinfo.ts +++ b/src/commands/info/botinfo.ts @@ -1,4 +1,4 @@ -import { MessageEmbed, Message } from 'discord.js'; +import { MessageEmbed, Message, CommandInteraction } from 'discord.js'; import { BotCommand } from '../../lib/extensions/BotCommand'; import { duration } from 'moment'; @@ -14,7 +14,7 @@ export default class BotInfoCommand extends BotCommand { }); } - public async exec(message: Message): Promise { + private async generateEmbed(): Promise { const owners = (await this.client.util.mapIDs(this.client.ownerID)) .map((u) => u.tag) .join('\n'); @@ -52,6 +52,14 @@ export default class BotInfoCommand extends BotCommand { } ]) .setTimestamp(); - await message.util.send(embed); + return embed; + } + + public async exec(message: Message): Promise { + await message.util.send(await this.generateEmbed()); + } + + public async execSlash(message: CommandInteraction): Promise { + await message.reply(await this.generateEmbed()); } } -- cgit