From bd05ca1133635a595a976d150fd10e36d46705aa Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 27 Apr 2021 21:28:52 +0200 Subject: global-functions: $SendTelegram2: store token id in queue --- global-functions | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/global-functions b/global-functions index e32a66e..fa0a34f 100644 --- a/global-functions +++ b/global-functions @@ -370,7 +370,6 @@ # flush telegram queue :set FlushTelegramQueue do={ :global TelegramQueue; - :global TelegramTokenId; :global LogPrintExit2; @@ -385,7 +384,7 @@ :if ([ :typeof $Message ] = "array" ) do={ :do { / tool fetch check-certificate=yes-without-crl output=none http-method=post \ - ("https://api.telegram.org/bot" . $TelegramTokenId . "/sendMessage") \ + ("https://api.telegram.org/bot" . ($Message->"tokenid") . "/sendMessage") \ http-data=("chat_id=" . ($Message->"chatid") . \ "&disable_notification=" . ($Message->"silent") . \ "&disable_web_page_preview=true&parse_mode=" . ($Message->"parsemode") . \ @@ -1044,8 +1043,8 @@ :set Text ($Text . [ $UrlEncode ("\n" . [ $SymbolForNotification "alarm-clock" ] . \ [ $EscapeMD ("This message was queued since " . [ / system clock get date ] . \ " " . [ / system clock get time ] . " and may be obsolete.") "hint" ]) ]); - :set ($TelegramQueue->[ :len $TelegramQueue ]) { - chatid=$ChatId; parsemode=$ParseMode; text=$Text; silent=($Notification->"silent") }; + :set ($TelegramQueue->[ :len $TelegramQueue ]) { chatid=$ChatId; tokenid=$TelegramTokenId; + parsemode=$ParseMode; text=$Text; silent=($Notification->"silent") }; :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