Added a more telegram options

such as thread id, silent notifications and forward protect
This commit is contained in:
shyneko
2023-01-12 15:09:05 +02:00
parent d9f12a6376
commit b91fe9d96d
3 changed files with 53 additions and 4 deletions

View File

@@ -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;