fix: show button to get help
All checks were successful
Node.js CI / Lint and Test (push) Successful in 40s

This commit is contained in:
Naomi Carrigan 2025-02-10 21:46:58 -08:00
parent d24fd57bf9
commit d3770103e1
Signed by: naomi
SSH Key Fingerprint: SHA256:rca1iUI2OhAM6n4FIUaFcZcicmri0jgocqKiTTAfrt8

View File

@ -3,11 +3,14 @@
* @license Naomi's Public License * @license Naomi's Public License
* @author Naomi Carrigan * @author Naomi Carrigan
*/ */
import { i18n } from "./i18n.js"; import {
import type { ActionRowBuilder,
ChatInputCommandInteraction, ButtonBuilder,
MessageContextMenuCommandInteraction, ButtonStyle,
type ChatInputCommandInteraction,
type MessageContextMenuCommandInteraction,
} from "discord.js"; } from "discord.js";
import { i18n } from "./i18n.js";
/** /**
* Responds to an interaction with a generic error message. * Responds to an interaction with a generic error message.
@ -20,9 +23,20 @@ export const replyToError = async(
| MessageContextMenuCommandInteraction, | MessageContextMenuCommandInteraction,
locale: string, locale: string,
): Promise<void> => { ): Promise<void> => {
const button = new ButtonBuilder().
setLabel(i18n("button.support", locale)).
setStyle(ButtonStyle.Link).
setURL("https://chat.nhcarrigan.com");
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(button);
if (interaction.deferred || interaction.replied) { if (interaction.deferred || interaction.replied) {
await interaction.editReply(i18n("command-error", locale)); await interaction.editReply({
components: [ row ],
content: i18n("command-error", locale),
});
return; return;
} }
await interaction.reply(i18n("command-error", locale)); await interaction.reply({
components: [ row ],
content: i18n("command-error", locale),
});
}; };