From 9aee8c80067530b178612f1261c38b83683f266d Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Mon, 17 May 2021 14:06:24 -0400 Subject: probably works idk what all I did --- src/commands/info/help.ts | 57 +++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 27 deletions(-) (limited to 'src/commands/info/help.ts') diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index cdddb51..116669c 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -3,6 +3,7 @@ import { BotCommand } from '../../lib/extensions/BotCommand'; import { stripIndent } from 'common-tags'; import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteraction } from 'discord.js'; +import { SlashCommandOption } from '../../lib/extensions/Util'; export default class HelpCommand extends BotCommand { constructor() { @@ -57,29 +58,29 @@ export default class HelpCommand extends BotCommand { ); } return embed; - } - - const embed = new MessageEmbed() - .setColor([155, 200, 200]) - .setTitle( - `\`${command.description.usage ? command.description.usage : ''}\`` - ) - .addField( - 'Description', - `${command.description.content ? command.description.content : ''} ${ - command.ownerOnly ? '\n__Owner Only__' : '' - }` - ); + } else { + const embed = new MessageEmbed() + .setColor([155, 200, 200]) + .setTitle( + `\`${command.description.usage ? command.description.usage : ''}\`` + ) + .addField( + 'Description', + `${command.description.content ? command.description.content : ''} ${ + command.ownerOnly ? '\n__Owner Only__' : '' + }` + ); - if (command.aliases.length > 1) - embed.addField('Aliases', `\`${command.aliases.join('` `')}\``, true); - if (command.description.examples && command.description.examples.length) - embed.addField( - 'Examples', - `\`${command.description.examples.join('`\n`')}\``, - true - ); - return embed; + if (command.aliases.length > 1) + embed.addField('Aliases', `\`${command.aliases.join('` `')}\``, true); + if (command.description.examples && command.description.examples.length) + embed.addField( + 'Examples', + `\`${command.description.examples.join('`\n`')}\``, + true + ); + return embed; + } } public async exec( @@ -89,13 +90,15 @@ export default class HelpCommand extends BotCommand { await message.util.send(this.generateEmbed(command)); } - public async execSlash(message: CommandInteraction): Promise { - const command = message.options.find((o) => o.name === 'command')?.value as - | string - | undefined; + public async execSlash( + message: CommandInteraction, + { command }: { command: SlashCommandOption } + ): Promise { if (command) { await message.reply( - this.generateEmbed(this.handler.findCommand(command) as BotCommand) + this.generateEmbed( + this.handler.findCommand(command.value) as BotCommand + ) ); } else { await message.reply(this.generateEmbed()); -- cgit