uptime-kuma/server/notification-providers/onebot.js
Newton Langidrik 8cdf7a905a Rebrand to PSS Uptime: Add custom logo and favicon, update all references from Uptime Kuma to PSS Uptime
- Add custom logo.png and favicon.ico for Marshall Islands Public School System
- Update all application references from 'Uptime Kuma' to 'PSS Uptime'
- Update README.md with PSS Uptime branding and credits to original Uptime Kuma project
- Update Docker configuration to build from source
- Update all notification providers to use PSS Uptime branding
- Update UI components, layouts, and pages with new branding
- Update language files (en, zh-CN, zh-TW) with PSS Uptime translations
- Add logo URL input field in status page settings
- Update default icon references from icon.svg to logo.png
2026-01-20 13:47:09 +12:00

50 lines
1.5 KiB
JavaScript

const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class OneBot extends NotificationProvider {
name = "OneBot";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
try {
let url = notification.httpAddr;
if (!url.startsWith("http")) {
url = "http://" + url;
}
if (!url.endsWith("/")) {
url += "/";
}
url += "send_msg";
let config = {
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + notification.accessToken,
},
};
config = this.getAxiosConfigWithProxy(config);
let pushText = "PSS Uptime Alert: " + msg;
let data = {
auto_escape: true,
message: pushText,
};
if (notification.msgType === "group") {
data["message_type"] = "group";
data["group_id"] = notification.recieverId;
} else {
data["message_type"] = "private";
data["user_id"] = notification.recieverId;
}
await axios.post(url, data, config);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = OneBot;