mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-25 21:54:16 -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) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
const mentionAll = notification.mentioning === "everyone"
|
||||
const mobileList = notification.mentioning === "specify-mobiles" ? notification.mobileList.split(",") : []
|
||||
const userList = notification.mentioning === "specify-users" ? notification.userList.split(",") : []
|
||||
const mentionStr = [...mobileList || [], ...userList || [] ].map(item => `@${item}`).join(" ")
|
||||
console.log('mobileList: ',mobileList)
|
||||
console.log('userList: ',userList)
|
||||
console.log('mentionStr: ',mentionStr)
|
||||
const mentionAll = notification.mentioning === "everyone"
|
||||
const mobileList = notification.mentioning === "specify-mobiles" ? notification.mobileList.split(",") : []
|
||||
const userList = notification.mentioning === "specify-users" ? notification.userList.split(",") : []
|
||||
const mentionStr = [...mobileList || [], ...userList || []].map(item => `@${item}`).join(" ")
|
||||
try {
|
||||
if (heartbeatJSON != null) {
|
||||
notification.mobileList
|
||||
|
@ -25,7 +22,7 @@ class DingDing extends NotificationProvider {
|
|||
msgtype: "markdown",
|
||||
markdown: {
|
||||
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: {
|
||||
isAtAll: mentionAll,
|
||||
|
@ -40,7 +37,7 @@ class DingDing extends NotificationProvider {
|
|||
let params = {
|
||||
msgtype: "text",
|
||||
text: {
|
||||
content: `${msg}${'\n'+mentionStr}`
|
||||
content: `${msg}${'\n' + mentionStr}`
|
||||
},
|
||||
at: {
|
||||
isAtAll: mentionAll,
|
||||
|
|
Loading…
Reference in a new issue