mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-31 19:50:40 +00:00
31 lines
853 B
JavaScript
31 lines
853 B
JavaScript
const NotificationProvider = require("./notification-provider");
|
|
const axios = require("axios");
|
|
|
|
class Kook extends NotificationProvider {
|
|
|
|
name = "Kook";
|
|
|
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
|
let okMsg = "Sent Successfully.";
|
|
let url = "https://www.kookapp.cn/api/v3/message/create";
|
|
let data = {
|
|
target_id: notification.kookGuildID,
|
|
content: msg,
|
|
};
|
|
let config = {
|
|
headers: {
|
|
"Authorization": "Bot " + notification.kookBotToken,
|
|
"Content-Type": "application/json",
|
|
},
|
|
};
|
|
try {
|
|
await axios.post(url, data, config);
|
|
return okMsg;
|
|
|
|
} catch (error) {
|
|
this.throwGeneralAxiosError(error);
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = Kook;
|