mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 08:44:04 +00:00
fix: remove service name/type from discord notifier
This commit is contained in:
parent
0d328e7c8e
commit
c28710cdc6
1 changed files with 17 additions and 36 deletions
|
@ -33,6 +33,21 @@ class Discord extends NotificationProvider {
|
||||||
return okMsg;
|
return okMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const embedFields = [
|
||||||
|
{
|
||||||
|
name: "Service Name",
|
||||||
|
value: monitorJSON["name"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: `Time (${heartbeatJSON["timezone"]})`,
|
||||||
|
value: heartbeatJSON["localDateTime"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Error",
|
||||||
|
value: heartbeatJSON["msg"] == null ? "N/A" : heartbeatJSON["msg"],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
// 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"] === DOWN) {
|
if (heartbeatJSON["status"] === DOWN) {
|
||||||
let discorddowndata = {
|
let discorddowndata = {
|
||||||
|
@ -41,24 +56,7 @@ class Discord extends NotificationProvider {
|
||||||
title: "❌ Your service " + monitorJSON["name"] + " went down. ❌",
|
title: "❌ Your service " + monitorJSON["name"] + " went down. ❌",
|
||||||
color: 16711680,
|
color: 16711680,
|
||||||
timestamp: heartbeatJSON["time"],
|
timestamp: heartbeatJSON["time"],
|
||||||
fields: [
|
fields: embedFields,
|
||||||
{
|
|
||||||
name: "Service Name",
|
|
||||||
value: monitorJSON["name"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
|
|
||||||
value: this.extractAddress(monitorJSON),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `Time (${heartbeatJSON["timezone"]})`,
|
|
||||||
value: heartbeatJSON["localDateTime"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Error",
|
|
||||||
value: heartbeatJSON["msg"] == null ? "N/A" : heartbeatJSON["msg"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
if (notification.discordChannelType === "createNewForumPost") {
|
if (notification.discordChannelType === "createNewForumPost") {
|
||||||
|
@ -78,24 +76,7 @@ class Discord extends NotificationProvider {
|
||||||
title: "✅ Your service " + monitorJSON["name"] + " is up! ✅",
|
title: "✅ Your service " + monitorJSON["name"] + " is up! ✅",
|
||||||
color: 65280,
|
color: 65280,
|
||||||
timestamp: heartbeatJSON["time"],
|
timestamp: heartbeatJSON["time"],
|
||||||
fields: [
|
fields: embedFields,
|
||||||
{
|
|
||||||
name: "Service Name",
|
|
||||||
value: monitorJSON["name"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
|
|
||||||
value: this.extractAddress(monitorJSON),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `Time (${heartbeatJSON["timezone"]})`,
|
|
||||||
value: heartbeatJSON["localDateTime"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Ping",
|
|
||||||
value: heartbeatJSON["ping"] == null ? "N/A" : heartbeatJSON["ping"] + " ms",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue