Better handling

This commit is contained in:
Louis Lam
2023-02-23 20:59:24 +08:00
parent 5789112f55
commit 7e3734af53
21 changed files with 16 additions and 28 deletions

View File

@@ -9,12 +9,16 @@ class Telegram extends NotificationProvider {
let okMsg = "Sent Successfully.";
try {
let params = {
chat_id: notification.telegramChatID,
text: msg,
};
if (notification.telegramMessageThreadID) {
params.message_thread_id = notification.telegramMessageThreadID;
}
await axios.get(`https://api.telegram.org/bot${notification.telegramBotToken}/sendMessage`, {
params: {
chat_id: notification.telegramChatID,
text: msg,
message_thread_id: notification.telegramMessageThreadID,
},
params: params,
});
return okMsg;