feat: use bot account (#5)
Some checks failed
Code Analysis / SonarQube (push) Failing after 16s
Node.js CI / Lint and Test (push) Successful in 36s

### 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: #5
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
This commit is contained in:
2025-07-06 16:04:49 -07:00
committed by Naomi Carrigan
parent c5bd74de4a
commit fdf91fe0a2
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",
}); });