mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-26 22:19:43 -08:00
format: format code
This commit is contained in:
parent
7add28ebd9
commit
b0910138f3
|
@ -11,13 +11,10 @@ class DingDing extends NotificationProvider {
|
||||||
*/
|
*/
|
||||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
const okMsg = "Sent Successfully.";
|
const okMsg = "Sent Successfully.";
|
||||||
const mentionAll = notification.mentioning === "everyone"
|
const mentionAll = notification.mentioning === "everyone"
|
||||||
const mobileList = notification.mentioning === "specify-mobiles" ? notification.mobileList.split(",") : []
|
const mobileList = notification.mentioning === "specify-mobiles" ? notification.mobileList.split(",") : []
|
||||||
const userList = notification.mentioning === "specify-users" ? notification.userList.split(",") : []
|
const userList = notification.mentioning === "specify-users" ? notification.userList.split(",") : []
|
||||||
const mentionStr = [...mobileList || [], ...userList || [] ].map(item => `@${item}`).join(" ")
|
const mentionStr = [...mobileList || [], ...userList || []].map(item => `@${item}`).join(" ")
|
||||||
console.log('mobileList: ',mobileList)
|
|
||||||
console.log('userList: ',userList)
|
|
||||||
console.log('mentionStr: ',mentionStr)
|
|
||||||
try {
|
try {
|
||||||
if (heartbeatJSON != null) {
|
if (heartbeatJSON != null) {
|
||||||
notification.mobileList
|
notification.mobileList
|
||||||
|
@ -25,7 +22,7 @@ class DingDing extends NotificationProvider {
|
||||||
msgtype: "markdown",
|
msgtype: "markdown",
|
||||||
markdown: {
|
markdown: {
|
||||||
title: `[${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]}`,
|
title: `[${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]}`,
|
||||||
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}${'\n\n'+mentionStr}`,
|
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}${'\n\n' + mentionStr}`,
|
||||||
},
|
},
|
||||||
at: {
|
at: {
|
||||||
isAtAll: mentionAll,
|
isAtAll: mentionAll,
|
||||||
|
@ -40,7 +37,7 @@ class DingDing extends NotificationProvider {
|
||||||
let params = {
|
let params = {
|
||||||
msgtype: "text",
|
msgtype: "text",
|
||||||
text: {
|
text: {
|
||||||
content: `${msg}${'\n'+mentionStr}`
|
content: `${msg}${'\n' + mentionStr}`
|
||||||
},
|
},
|
||||||
at: {
|
at: {
|
||||||
isAtAll: mentionAll,
|
isAtAll: mentionAll,
|
||||||
|
|
Loading…
Reference in a new issue