mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-06 19:53:50 +00:00
fix ESLint issues in OneChat.js
This commit is contained in:
parent
dab089086c
commit
ef9b6d2be8
1 changed files with 29 additions and 11 deletions
|
@ -34,10 +34,17 @@ class OneChat extends NotificationProvider {
|
||||||
bot_id: notification.botId,
|
bot_id: notification.botId,
|
||||||
type: "text",
|
type: "text",
|
||||||
message:
|
message:
|
||||||
`UptimeKuma Alert:\n[🔴 Down]\n` +
|
"UptimeKuma Alert:\n" +
|
||||||
`Name: ${monitorJSON["name"]}\n` +
|
"[🔴 Down]\n" +
|
||||||
`${heartbeatJSON["msg"]}\n` +
|
"Name: " +
|
||||||
`Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
monitorJSON["name"] +
|
||||||
|
"\n" +
|
||||||
|
heartbeatJSON["msg"] +
|
||||||
|
"\n" +
|
||||||
|
"Time (" +
|
||||||
|
heartbeatJSON["timezone"] +
|
||||||
|
"): " +
|
||||||
|
heartbeatJSON["localDateTime"],
|
||||||
};
|
};
|
||||||
await axios.post(url, downMessage, config);
|
await axios.post(url, downMessage, config);
|
||||||
} else if (heartbeatJSON["status"] === UP) {
|
} else if (heartbeatJSON["status"] === UP) {
|
||||||
|
@ -46,10 +53,17 @@ class OneChat extends NotificationProvider {
|
||||||
bot_id: notification.botId,
|
bot_id: notification.botId,
|
||||||
type: "text",
|
type: "text",
|
||||||
message:
|
message:
|
||||||
`UptimeKuma Alert:\n[✅ Up]\n` +
|
"UptimeKuma Alert:\n" +
|
||||||
`Name: ${monitorJSON["name"]}\n` +
|
"[🟢 Up]\n" +
|
||||||
`${heartbeatJSON["msg"]}\n` +
|
"Name: " +
|
||||||
`Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
monitorJSON["name"] +
|
||||||
|
"\n" +
|
||||||
|
heartbeatJSON["msg"] +
|
||||||
|
"\n" +
|
||||||
|
"Time (" +
|
||||||
|
heartbeatJSON["timezone"] +
|
||||||
|
"): " +
|
||||||
|
heartbeatJSON["localDateTime"],
|
||||||
};
|
};
|
||||||
await axios.post(url, upMessage, config);
|
await axios.post(url, upMessage, config);
|
||||||
}
|
}
|
||||||
|
@ -58,13 +72,17 @@ class OneChat extends NotificationProvider {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Handle errors and throw a descriptive message
|
// Handle errors and throw a descriptive message
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
const errorMessage = error.response.data?.message || "Unknown API error occurred.";
|
const errorMessage =
|
||||||
|
error.response.data?.message ||
|
||||||
|
"Unknown API error occurred.";
|
||||||
throw new Error(`OneChat API Error: ${errorMessage}`);
|
throw new Error(`OneChat API Error: ${errorMessage}`);
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Network or unexpected error: ${error.message}`);
|
throw new Error(
|
||||||
|
`Network or unexpected error: ${error.message}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = OneChat;
|
module.exports = OneChat;
|
||||||
|
|
Loading…
Add table
Reference in a new issue