From e471a6566bee3bc1d9367eab2c823b2835d684a8 Mon Sep 17 00:00:00 2001 From: AJaccP Date: Sun, 28 Jul 2024 21:56:56 +0530 Subject: [PATCH] Change alerts url to env var --- README.md | 1 + src/discord/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 46ce18d..3ab07b6 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ npm install -g dotenv-cli ``` DISCORD_CHANNEL_WEBHOOK_URL=YOUR_WEBHOOK_URL_HERE GITHUB_ACCESS_TOKEN=(ask Matthew for this) +DISCORD_ALERTS_WEBHOOK_URL=YOUR_ALERTS_CHANNEL_WEBHOOK_URL_HERE ``` 7. Start the job: diff --git a/src/discord/index.ts b/src/discord/index.ts index e179df7..3690918 100644 --- a/src/discord/index.ts +++ b/src/discord/index.ts @@ -38,8 +38,8 @@ export const sendDiscordItemMessage = async ( }); return Ok(response.data); } catch (error) { - const alertWebhook = - "https://discord.com/api/webhooks/1255153467937390703/5v_7sPhvtFT3mtNPgogL1jcl56z6n2KHyjT1rCNf6wZ4vPFCAvrtr65fFVY562m48Znn"; + const alertWebhook = process.env.DISCORD_ALERTS_WEBHOOK_URL ?? ""; + await axios.post(alertWebhook, { // @ts-ignore content: `Failed to send Discord message: ${error.message}`,