Skip to content

Commit b9a96da

Browse files
committed
feat: validate DISCORD_WEBHOOK_URL configuration before sending embeds
- Added a check to ensure DISCORD_WEBHOOK_URL is configured before attempting to send an embed. - Throws an error if the webhook URL is not set, improving error handling and user feedback.
1 parent 0a10c19 commit b9a96da

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

apps/web/src/providers/discord/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ const RETRY_CONFIG = {
1010
} as const;
1111

1212
export async function sendEmbed(embed: Embed): Promise<void> {
13+
if (!env.DISCORD_WEBHOOK_URL) {
14+
throw new Error("Discord: DISCORD_WEBHOOK_URL is not configured");
15+
}
16+
1317
const hook = new Webhook(env.DISCORD_WEBHOOK_URL);
1418
hook.setUsername(env.DISCORD_WEBHOOK_USERNAME || "Vercord");
1519
hook.setAvatarUrl(env.DISCORD_WEBHOOK_AVATAR_URL || DEFAULT_AVATAR_URL);

0 commit comments

Comments
 (0)