mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-17 11:44:38 -05:00
Discord notification URL now also represents non http services
This commit is contained in:
parent
a7cd70f7de
commit
5d438ca2b6
@ -95,12 +95,15 @@ class Notification {
|
|||||||
await axios.post(notification.discordWebhookUrl, discordtestdata)
|
await axios.post(notification.discordWebhookUrl, discordtestdata)
|
||||||
return okMsg;
|
return okMsg;
|
||||||
}
|
}
|
||||||
|
let url = monitorJSON["url"] === "https://" ? monitorJSON["hostname"] : monitorJSON["url"]
|
||||||
|
if (monitorJSON["port"]) url += ":" + monitorJSON[port]
|
||||||
|
|
||||||
// If heartbeatJSON is not null, we go into the normal alerting loop.
|
// If heartbeatJSON is not null, we go into the normal alerting loop.
|
||||||
if (heartbeatJSON["status"] == 0) {
|
if (heartbeatJSON["status"] == 0) {
|
||||||
let discorddowndata = {
|
let discorddowndata = {
|
||||||
username: discordDisplayName,
|
username: discordDisplayName,
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: "❌ One of your services went down. ❌",
|
title: "❌ Your service " + monitorJSON["name"] + " went down. ❌",
|
||||||
color: 16711680,
|
color: 16711680,
|
||||||
timestamp: heartbeatJSON["time"],
|
timestamp: heartbeatJSON["time"],
|
||||||
fields: [
|
fields: [
|
||||||
@ -110,7 +113,7 @@ class Notification {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Service URL",
|
name: "Service URL",
|
||||||
value: monitorJSON["url"],
|
value: url,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Time (UTC)",
|
name: "Time (UTC)",
|
||||||
@ -140,7 +143,7 @@ class Notification {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Service URL",
|
name: "Service URL",
|
||||||
value: "[Visit Service](" + monitorJSON["url"] + ")",
|
value: url.startsWith("http") ? "[Visit Service](" + url + ")" : url,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Time (UTC)",
|
name: "Time (UTC)",
|
||||||
|
Loading…
Reference in New Issue
Block a user