aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-10-13 09:00:55 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-10-13 09:00:55 +0200
commit6b1d9e8f40cf708bbc51be40bb7345ee3cf676b7 (patch)
tree7f15c273b0dfa432dbc69aba525fa3829b518948
parentfc994402241d97d084669d63f1c8c2accc2550c7 (diff)
global-functions: $FlushTelegramQueue, $SendTelegram: move hint
-rw-r--r--global-functions13
1 files changed, 6 insertions, 7 deletions
diff --git a/global-functions b/global-functions
index 10c5bd9..1188c76 100644
--- a/global-functions
+++ b/global-functions
@@ -287,8 +287,6 @@
:global TelegramTokenId;
:global LogPrintExit;
- :global SymbolForNotification;
- :global UrlEncode;
:local AllDone true;
:local QueueLen [ :len $TelegramQueue ];
@@ -299,9 +297,7 @@
("https://api.telegram.org/bot" . $TelegramTokenId . "/sendMessage") \
http-data=("chat_id=" . ($Message->"chatid") . \
"&disable_notification=" . ($Message->"silent") . \
- "&text=" . ($Message->"text") . "\n\n" . \
- [ $UrlEncode ([ $SymbolForNotification "alarm-clock" ] . "This message was " . \
- "queued since " . ($Message->"since") . " and may be obsolete.") ]);
+ "&text=" . ($Message->"text"));
:set ($TelegramQueue->$Id);
} on-error={
$LogPrintExit debug ("Sending queued Telegram message failed.") false;
@@ -802,8 +798,11 @@
:if ([ :typeof $TelegramQueue ] = "nothing") do={
:set TelegramQueue [ :toarray "" ];
}
- :set ($TelegramQueue->[ :len $TelegramQueue ]) { chatid=$ChatId; text=$Text; \
- silent=$Silent; since=([ / system clock get date ] . " " . [ / system clock get time ]) };
+ :set Text ($Text . [ $UrlEncode ("\n\n" . [ $SymbolForNotification "alarm-clock" ] . \
+ "This message was queued since " . [ / system clock get date ] . " " . \
+ [ / system clock get time ] . " and may be obsolete.") ]);
+ :set ($TelegramQueue->[ :len $TelegramQueue ]) {
+ chatid=$ChatId; text=$Text; silent=$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;";