From 490a15a96b5c5e9b50327e0d62af5a4ae2e8cfda Mon Sep 17 00:00:00 2001 From: Riccardo Fano Date: Fri, 26 Apr 2024 21:08:00 +0200 Subject: [PATCH] Use embed to format bot reply --- src/commands/ask.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/commands/ask.ts b/src/commands/ask.ts index a6ee6dd..f327852 100644 --- a/src/commands/ask.ts +++ b/src/commands/ask.ts @@ -1,9 +1,8 @@ import { ApplicationCommandOptionType, CommandInteraction, + EmbedBuilder, InteractionResponse, - blockQuote, - bold, escapeMarkdown, } from 'discord.js' import { Discord, Slash, SlashChoice, SlashOption } from 'discordx' @@ -54,7 +53,13 @@ class Ask { try { const answer = await this.fetchAnswer(question, units) - return interaction.reply(`### ${escapeMarkdown(question)}\n${blockQuote(answer)}`) + const capitalizedAnswer = answer.charAt(0).toUpperCase() + answer.slice(1) + const embed = new EmbedBuilder() + .setColor('#FBAB00') // MasterMind's color + .setTitle(escapeMarkdown(question)) + .setDescription(capitalizedAnswer) + + return await interaction.reply({ embeds: [embed] }) } catch (err) { console.error(err) return interaction.reply({ content: 'There was a problem communicating with Wolfram Alpha.', ephemeral: true })