From b96376187472fc5469f6f7c126a6dcb73667bf0a Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 23 Feb 2023 22:05:08 +0100 Subject: mod/notification-telegram: support sending in reply --- mod/notification-telegram | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/notification-telegram b/mod/notification-telegram index 69c4801..c90e3f0 100644 --- a/mod/notification-telegram +++ b/mod/notification-telegram @@ -34,6 +34,7 @@ ("https://api.telegram.org/bot" . ($Message->"tokenid") . "/sendMessage") \ http-data=("chat_id=" . ($Message->"chatid") . \ "&disable_notification=" . ($Message->"silent") . \ + "&reply_to_message_id=" . ($Notification->"replyto") . \ "&disable_web_page_preview=true&parse_mode=" . ($Message->"parsemode") . \ "&text=" . ($Message->"text")) as-value; :set ($TelegramQueue->$Id); @@ -137,6 +138,7 @@ /tool/fetch check-certificate=yes-without-crl output=none http-method=post \ ("https://api.telegram.org/bot" . $TokenId . "/sendMessage") \ http-data=("chat_id=" . $ChatId . "&disable_notification=" . ($Notification->"silent") . \ + "&reply_to_message_id=" . ($Notification->"replyto") . \ "&disable_web_page_preview=true&parse_mode=" . $ParseMode . "&text=" . $Text) as-value; } on-error={ $LogPrintExit2 info $0 ("Failed sending telegram notification! Queuing...") false; @@ -148,7 +150,8 @@ [ $EscapeMD ("This message was queued since " . [ /system/clock/get date ] . \ " " . [ /system/clock/get time ] . " and may be obsolete.") "plain" ]) ]); :set ($TelegramQueue->[ :len $TelegramQueue ]) { chatid=$ChatId; tokenid=$TokenId; - parsemode=$ParseMode; text=$Text; silent=($Notification->"silent") }; + parsemode=$ParseMode; text=$Text; silent=($Notification->"silent"); + replyto=($Notification->"replyto") }; :if ([ :len [ /system/scheduler/find where name="\$FlushTelegramQueue" ] ] = 0) do={ /system/scheduler/add name="\$FlushTelegramQueue" interval=1m start-time=startup \ on-event=(":global FlushTelegramQueue; \$FlushTelegramQueue;"); -- cgit v1.2.3-70-g09d2