From 0961c6d9b3b73db5446faa77bbd1173be6b4e979 Mon Sep 17 00:00:00 2001 From: jordanbertasso <36979824+jordanbertasso@users.noreply.github.com> Date: Sun, 10 Apr 2022 21:45:07 +1000 Subject: [PATCH] Check for ping and port type in discord notifs --- server/notification-providers/discord.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index 881ad2113..39eeef5ab 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -24,14 +24,17 @@ class Discord extends NotificationProvider { let url; - if (monitorJSON["type"] === "port") { - url = monitorJSON["hostname"]; - if (monitorJSON["port"]) { - url += ":" + monitorJSON["port"]; - } - - } else { - url = monitorJSON["url"]; + switch (monitorJSON["type"]) { + case "port": + case "ping": + url = monitorJSON["hostname"]; + if (monitorJSON["port"]) { + url += ":" + monitorJSON["port"]; + } + break; + default: + url = monitorJSON["url"]; + break; } // If heartbeatJSON is not null, we go into the normal alerting loop.