aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-02-23 22:05:08 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-02-24 12:13:44 +0100
commitb96376187472fc5469f6f7c126a6dcb73667bf0a (patch)
tree7ad9afc97df2b11608ce192d1279eddfc19a1fb9
parent8213c5ed612459b4f69688377d8db914e63a39a2 (diff)
mod/notification-telegram: support sending in reply
-rw-r--r--mod/notification-telegram5
1 files changed, 4 insertions, 1 deletions
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;");