feat: also pipe errors to Discord
Code Analysis / SonarQube (push) Failing after 17s
Node.js CI / Lint and Test (push) Successful in 46s

This commit is contained in:
2025-10-07 12:07:20 -07:00
parent 2ac9157b0d
commit 568cbb92e1
+14 -1
View File
@@ -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 appName - The name of the application.
* @param message - The message to log. * @param message - The message to log.
* @param level - The level of the log, used for priority. * @param level - The level of the log, used for priority.
@@ -67,6 +68,18 @@ const pipeError = async(
}, },
method: "POST", 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 }; export { pipeError, pipeLog };