From 2e4c0a37c7edabf1508f6610f89e5f6e528caad4 Mon Sep 17 00:00:00 2001 From: zuzuvelas Date: Fri, 26 Apr 2024 11:37:30 -0600 Subject: [PATCH 1/3] adjust the formatting on ask output --- src/commands/ask.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/commands/ask.ts b/src/commands/ask.ts index 6fcb531..7c8df6f 100644 --- a/src/commands/ask.ts +++ b/src/commands/ask.ts @@ -1,4 +1,11 @@ -import { ApplicationCommandOptionType, CommandInteraction, InteractionResponse, escapeMarkdown } from 'discord.js' +import { + ApplicationCommandOptionType, + CommandInteraction, + InteractionResponse, + escapeMarkdown, + bold, + quote +} from 'discord.js' import { Discord, SimpleCommand, @@ -50,7 +57,7 @@ class Ask { try { const answer = await this.fetchAnswer(question, units) - return command.message.reply({ content: answer, allowedMentions: { repliedUser: false } }) + return command.message.reply({ content: quote(answer), allowedMentions: { repliedUser: false } }) } catch (err) { console.error(err) return command.message.reply({ @@ -87,7 +94,11 @@ class Ask { try { const answer = await this.fetchAnswer(question, units) - return interaction.reply(`[${escapeMarkdown(question)}] ${answer}`) + return interaction.reply( + `### ${escapeMarkdown(question)} + ${quote(answer)} + ` + ) } catch (err) { console.error(err) return interaction.reply('There was a problem communicating with Wolfram Alpha.') From d76506253f1dc6b0c5d2dd62b5a95bbac877d81a Mon Sep 17 00:00:00 2001 From: zuzuvelas Date: Fri, 26 Apr 2024 11:40:22 -0600 Subject: [PATCH 2/3] Fix prettier lint --- src/commands/ask.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/commands/ask.ts b/src/commands/ask.ts index 7c8df6f..0c5c0d8 100644 --- a/src/commands/ask.ts +++ b/src/commands/ask.ts @@ -4,7 +4,7 @@ import { InteractionResponse, escapeMarkdown, bold, - quote + quote, } from 'discord.js' import { Discord, @@ -96,8 +96,7 @@ class Ask { const answer = await this.fetchAnswer(question, units) return interaction.reply( `### ${escapeMarkdown(question)} - ${quote(answer)} - ` + ${quote(answer)}` ) } catch (err) { console.error(err) From 9097582ef357e6a1cd3457b9090977616c6e082a Mon Sep 17 00:00:00 2001 From: zuzuvelas Date: Fri, 26 Apr 2024 12:02:56 -0600 Subject: [PATCH 3/3] Block quote over quote formatting to account for new lines --- src/commands/ask.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/ask.ts b/src/commands/ask.ts index 0c5c0d8..aec9d30 100644 --- a/src/commands/ask.ts +++ b/src/commands/ask.ts @@ -4,7 +4,7 @@ import { InteractionResponse, escapeMarkdown, bold, - quote, + quote, blockQuote, } from 'discord.js' import { Discord, @@ -96,7 +96,7 @@ class Ask { const answer = await this.fetchAnswer(question, units) return interaction.reply( `### ${escapeMarkdown(question)} - ${quote(answer)}` + ${blockQuote(answer)}` ) } catch (err) { console.error(err)