Skip to content

Commit c741e10

Browse files
committed
Stop spamming prod discord channels
1 parent 28d0b35 commit c741e10

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

common/src/discord/core.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import {IS_DEV} from "common/envs/constants";
2+
13
export const sendDiscordMessage = async (content: string, channel: string) => {
2-
const webhookUrl = {
4+
let webhookUrl = {
35
members: process.env.DISCORD_WEBHOOK_MEMBERS,
46
general: process.env.DISCORD_WEBHOOK_GENERAL,
57
}[channel]
68

9+
if (IS_DEV) webhookUrl = process.env.DISCORD_WEBHOOK_DEV
10+
711
if (!webhookUrl) return
812

913
const response = await fetch(webhookUrl!, {

common/src/envs/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export function isModId(id: string) {
1616
}
1717

1818
export const ENV = isProd() ? 'prod' : 'dev'
19+
export const IS_PROD = ENV === 'prod'
20+
export const IS_DEV = ENV === 'dev'
1921

2022
export const LOCAL_WEB_DOMAIN = 'localhost:3000';
2123
export const LOCAL_BACKEND_DOMAIN = 'localhost:8088';

0 commit comments

Comments
 (0)