feat: use bot account #5

Merged
naomi merged 2 commits from feat/bot into main 2025-07-06 16:04:49 -07:00
2 changed files with 6 additions and 3 deletions

View File

@ -4,4 +4,5 @@ API_AUTH="op://Environment Variables - Naomi/Alert Server/api_auth"
EMAIL_PASSWORD="op://Environment Variables - Naomi/Alert Server/email_pass" EMAIL_PASSWORD="op://Environment Variables - Naomi/Alert Server/email_pass"
DISCORD_WEBHOOK_URL="op://Environment Variables - Naomi/Alert Server/discord_hook" DISCORD_WEBHOOK_URL="op://Environment Variables - Naomi/Alert Server/discord_hook"
STRIPE_SECRET_KEY="op://Environment Variables - Naomi/Alert Server/stripe" STRIPE_SECRET_KEY="op://Environment Variables - Naomi/Alert Server/stripe"
STRIPE_WEBHOOK_SECRET="op://Environment Variables - Naomi/Alert Server/stripe_webhook" STRIPE_WEBHOOK_SECRET="op://Environment Variables - Naomi/Alert Server/stripe_webhook"
DISCORD_TOKEN="op://Environment Variables - Naomi/Alert Server/discord_token"

View File

@ -13,7 +13,7 @@ export const sendDiscord = async(
subject: string, subject: string,
body: string, body: string,
): Promise<void> => { ): Promise<void> => {
await fetch(`${process.env.DISCORD_WEBHOOK_URL ?? ""}?with_components=true`, { await fetch(`https://discord.com/api/v10/channels/1355232348840394785/messages`, {
body: JSON.stringify({ body: JSON.stringify({
components: [ components: [
{ {
@ -42,7 +42,9 @@ export const sendDiscord = async(
}), }),
headers: { headers: {
// eslint-disable-next-line @typescript-eslint/naming-convention -- Needs to match Discord's structure. // eslint-disable-next-line @typescript-eslint/naming-convention -- Needs to match Discord's structure.
"Content-Type": "application/json", "Authorization": `Bot ${process.env.DISCORD_TOKEN ?? ""}`,
// eslint-disable-next-line @typescript-eslint/naming-convention -- Needs to match Discord's structure.
"Content-Type": "application/json",
}, },
method: "POST", method: "POST",
}); });