mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-09 11:17:43 +08:00
Added a more telegram options
such as thread id, silent notifications and forward protect
This commit is contained in:
@@ -9,11 +9,20 @@ class Telegram extends NotificationProvider {
|
||||
let okMsg = "Sent Successfully.";
|
||||
|
||||
try {
|
||||
const paramsObj =
|
||||
{
|
||||
chat_id: notification.telegramChatID,
|
||||
text: msg,
|
||||
disable_notification: notification.telegramSilentNotification ?? false,
|
||||
protect_content: notification.telegramProtectContent ?? false,
|
||||
|
||||
};
|
||||
// if telegramChatThread specified, then add it to paramsObj
|
||||
if (notification.telegramChatThread && notification.telegramChatThread.length > 0) {
|
||||
paramsObj.message_thread_id = notification.telegramChatThread;
|
||||
}
|
||||
await axios.get(`https://api.telegram.org/bot${notification.telegramBotToken}/sendMessage`, {
|
||||
params: {
|
||||
chat_id: notification.telegramChatID,
|
||||
text: msg,
|
||||
},
|
||||
params: paramsObj
|
||||
});
|
||||
return okMsg;
|
||||
|
||||
|
Reference in New Issue
Block a user