do not attempt to exec fetch if no url exists (fixes #83)

This commit is contained in:
Grant 2024-07-12 18:56:48 -06:00
parent 85dd5d76b8
commit ec338e6893
1 changed files with 6 additions and 2 deletions

View File

@ -74,7 +74,9 @@ class Recaptcha_ {
} }
async notifyStaff(user: User, score: number) { async notifyStaff(user: User, score: number) {
return await fetch(process.env.DISCORD_WEBHOOK!, { if (!process.env.DISCORD_WEBHOOK) return;
return await fetch(process.env.DISCORD_WEBHOOK, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -86,7 +88,9 @@ class Recaptcha_ {
} }
async notifyStaffOfError(obj: any) { async notifyStaffOfError(obj: any) {
return await fetch(process.env.DISCORD_WEBHOOK!, { if (!process.env.DISCORD_WEBHOOK) return;
return await fetch(process.env.DISCORD_WEBHOOK, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",