don't call extractAddress twice
This commit is contained in:
parent
b16aa9c832
commit
1532acaaf3
@ -47,6 +47,7 @@ class Discord extends NotificationProvider {
|
|||||||
|
|
||||||
// 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 addess = this.extractAddress(monitorJSON);
|
||||||
let discorddowndata = {
|
let discorddowndata = {
|
||||||
username: discordDisplayName,
|
username: discordDisplayName,
|
||||||
embeds: [{
|
embeds: [{
|
||||||
@ -58,9 +59,9 @@ class Discord extends NotificationProvider {
|
|||||||
name: "Service Name",
|
name: "Service Name",
|
||||||
value: monitorJSON["name"],
|
value: monitorJSON["name"],
|
||||||
},
|
},
|
||||||
...((!notification.disableUrl && this.extractAddress(monitorJSON)) ? [{
|
...((!notification.disableUrl && addess) ? [{
|
||||||
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
|
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
|
||||||
value: this.extractAddress(monitorJSON),
|
value: addess,
|
||||||
}] : []),
|
}] : []),
|
||||||
{
|
{
|
||||||
name: `Time (${heartbeatJSON["timezone"]})`,
|
name: `Time (${heartbeatJSON["timezone"]})`,
|
||||||
@ -87,6 +88,7 @@ class Discord extends NotificationProvider {
|
|||||||
return okMsg;
|
return okMsg;
|
||||||
|
|
||||||
} else if (heartbeatJSON["status"] === UP) {
|
} else if (heartbeatJSON["status"] === UP) {
|
||||||
|
let addess = this.extractAddress(monitorJSON);
|
||||||
let discordupdata = {
|
let discordupdata = {
|
||||||
username: discordDisplayName,
|
username: discordDisplayName,
|
||||||
embeds: [{
|
embeds: [{
|
||||||
@ -98,9 +100,9 @@ class Discord extends NotificationProvider {
|
|||||||
name: "Service Name",
|
name: "Service Name",
|
||||||
value: monitorJSON["name"],
|
value: monitorJSON["name"],
|
||||||
},
|
},
|
||||||
...((!notification.disableUrl && this.extractAddress(monitorJSON)) ? [{
|
...((!notification.disableUrl && addess) ? [{
|
||||||
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
|
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
|
||||||
value: this.extractAddress(monitorJSON),
|
value: addess,
|
||||||
}] : []),
|
}] : []),
|
||||||
{
|
{
|
||||||
name: `Time (${heartbeatJSON["timezone"]})`,
|
name: `Time (${heartbeatJSON["timezone"]})`,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user