From 568cbb92e1bf1657f7cc3c136d627fb0a5ef2f17 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Tue, 7 Oct 2025 12:07:20 -0700 Subject: [PATCH] feat: also pipe errors to Discord --- src/modules/pipeLog.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/modules/pipeLog.ts b/src/modules/pipeLog.ts index cc73dfd..fecd8ce 100644 --- a/src/modules/pipeLog.ts +++ b/src/modules/pipeLog.ts @@ -41,7 +41,8 @@ const pipeLog = async( }; /** - * Pipes a log message to the Gotify server. + * Pipes a log message to the Gotify server. Also notifies + * Naomi in Discord. * @param appName - The name of the application. * @param message - The message to log. * @param level - The level of the log, used for priority. @@ -67,6 +68,18 @@ const pipeError = async( }, method: "POST", }); + await fetch(`https://discord.com/api/v10/channels/1385797320389431336/messages`, { + body: JSON.stringify({ + content: `:warning: **${appName}** has encountered an error. <@465650873650118659> please check the logs.`, + }), + headers: { + // eslint-disable-next-line @typescript-eslint/naming-convention -- Standard header. + "Authorization": `Bot ${process.env.DISCORD_TOKEN ?? ""}`, + // eslint-disable-next-line @typescript-eslint/naming-convention -- Standard header. + "Content-Type": "application/json", + }, + method: "POST", + }); }; export { pipeError, pipeLog };