From cec052183434f98edac6da6c81232a680050addc Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sat, 14 May 2022 14:36:40 +0800 Subject: [PATCH] [Discord] Fix ping type should no port, update better naming --- server/notification-providers/discord.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index c981d59df..77b04d9d3 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -22,20 +22,22 @@ class Discord extends NotificationProvider { return okMsg; } - let url; + let address; switch (monitorJSON["type"]) { - case "dns": case "ping": + address = monitorJSON["hostname"]; + break; case "port": + case "dns": case "steam": - url = monitorJSON["hostname"]; + address = monitorJSON["hostname"]; if (monitorJSON["port"]) { - url += ":" + monitorJSON["port"]; + address += ":" + monitorJSON["port"]; } break; default: - url = monitorJSON["url"]; + address = monitorJSON["url"]; break; } @@ -53,8 +55,8 @@ class Discord extends NotificationProvider { value: monitorJSON["name"], }, { - name: "Service URL", - value: url, + name: "Service URL / Address", + value: address, }, { name: "Time (UTC)", @@ -89,7 +91,7 @@ class Discord extends NotificationProvider { }, { name: "Service URL", - value: url.startsWith("http") ? "[Visit Service](" + url + ")" : url, + value: address.startsWith("http") ? "[Visit Service](" + address + ")" : address, }, { name: "Time (UTC)",