From d3770103e1e59571b95d6a4406f3bd6cf44f25ca Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Mon, 10 Feb 2025 21:46:58 -0800 Subject: [PATCH] fix: show button to get help --- src/utils/replyToError.ts | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/utils/replyToError.ts b/src/utils/replyToError.ts index acb2f66..5a4d101 100644 --- a/src/utils/replyToError.ts +++ b/src/utils/replyToError.ts @@ -3,11 +3,14 @@ * @license Naomi's Public License * @author Naomi Carrigan */ -import { i18n } from "./i18n.js"; -import type { - ChatInputCommandInteraction, - MessageContextMenuCommandInteraction, +import { + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, + type ChatInputCommandInteraction, + type MessageContextMenuCommandInteraction, } from "discord.js"; +import { i18n } from "./i18n.js"; /** * Responds to an interaction with a generic error message. @@ -20,9 +23,20 @@ export const replyToError = async( | MessageContextMenuCommandInteraction, locale: string, ): Promise => { + const button = new ButtonBuilder(). + setLabel(i18n("button.support", locale)). + setStyle(ButtonStyle.Link). + setURL("https://chat.nhcarrigan.com"); + const row = new ActionRowBuilder().addComponents(button); if (interaction.deferred || interaction.replied) { - await interaction.editReply(i18n("command-error", locale)); + await interaction.editReply({ + components: [ row ], + content: i18n("command-error", locale), + }); return; } - await interaction.reply(i18n("command-error", locale)); + await interaction.reply({ + components: [ row ], + content: i18n("command-error", locale), + }); };