From fdf91fe0a2de9e77914890fb6e7917ce50dbb6f3 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Sun, 6 Jul 2025 16:04:49 -0700 Subject: [PATCH] feat: use bot account (#5) ### Explanation _No response_ ### Issue _No response_ ### Attestations - [ ] I have read and agree to the [Code of Conduct](https://docs.nhcarrigan.com/community/coc/) - [ ] I have read and agree to the [Community Guidelines](https://docs.nhcarrigan.com/community/guide/). - [ ] My contribution complies with the [Contributor Covenant](https://docs.nhcarrigan.com/dev/covenant/). ### Dependencies - [ ] I have pinned the dependencies to a specific patch version. ### Style - [ ] I have run the linter and resolved any errors. - [ ] My pull request uses an appropriate title, matching the conventional commit standards. - [ ] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request. ### Tests - [ ] My contribution adds new code, and I have added tests to cover it. - [ ] My contribution modifies existing code, and I have updated the tests to reflect these changes. - [ ] All new and existing tests pass locally with my changes. - [ ] Code coverage remains at or above the configured threshold. ### Documentation _No response_ ### Versioning _No response_ Reviewed-on: https://git.nhcarrigan.com/nhcarrigan/rosalia-nightsong/pulls/5 Co-authored-by: Naomi Carrigan Co-committed-by: Naomi Carrigan --- prod.env | 3 ++- src/modules/discord.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/prod.env b/prod.env index 0ea110f..252b16a 100644 --- a/prod.env +++ b/prod.env @@ -4,4 +4,5 @@ API_AUTH="op://Environment Variables - Naomi/Alert Server/api_auth" EMAIL_PASSWORD="op://Environment Variables - Naomi/Alert Server/email_pass" DISCORD_WEBHOOK_URL="op://Environment Variables - Naomi/Alert Server/discord_hook" STRIPE_SECRET_KEY="op://Environment Variables - Naomi/Alert Server/stripe" -STRIPE_WEBHOOK_SECRET="op://Environment Variables - Naomi/Alert Server/stripe_webhook" \ No newline at end of file +STRIPE_WEBHOOK_SECRET="op://Environment Variables - Naomi/Alert Server/stripe_webhook" +DISCORD_TOKEN="op://Environment Variables - Naomi/Alert Server/discord_token" \ No newline at end of file diff --git a/src/modules/discord.ts b/src/modules/discord.ts index 89ff13e..91ec22a 100644 --- a/src/modules/discord.ts +++ b/src/modules/discord.ts @@ -13,7 +13,7 @@ export const sendDiscord = async( subject: string, body: string, ): Promise => { - await fetch(`${process.env.DISCORD_WEBHOOK_URL ?? ""}?with_components=true`, { + await fetch(`https://discord.com/api/v10/channels/1355232348840394785/messages`, { body: JSON.stringify({ components: [ { @@ -42,7 +42,9 @@ export const sendDiscord = async( }), headers: { // 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", });