aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions10
1 files changed, 8 insertions, 2 deletions
diff --git a/global-functions b/global-functions
index 1cacde6..21fa1f3 100644
--- a/global-functions
+++ b/global-functions
@@ -287,6 +287,8 @@
:global TelegramTokenId;
:global LogPrintExit;
+ :global SymbolForNotification;
+ :global UrlEncode;
:local AllDone true;
:local QueueLen [ :len $TelegramQueue ];
@@ -297,7 +299,9 @@
("https://api.telegram.org/bot" . $TelegramTokenId . "/sendMessage") \
http-data=("chat_id=" . ($Message->"chatid") . \
"&disable_notification=" . ($Message->"silent") . \
- "&text=" . ($Message->"text"));
+ "&text=" . ($Message->"text") . "\n\n" . \
+ [ $UrlEncode ([ $SymbolForNotification "alarm-clock" ] . "This message was " . \
+ "queued since " . ($Message->"since") . " and may be obsolete.") ]);
:set ($TelegramQueue->$Id);
} on-error={
$LogPrintExit debug ("Sending queued Telegram message failed.") false;
@@ -765,7 +769,8 @@
:if ([ :typeof $TelegramQueue ] = "nothing") do={
:set TelegramQueue [ :toarray "" ];
}
- :set ($TelegramQueue->[ :len $TelegramQueue ]) { chatid=$ChatId; text=$Text; silent=$Silent };
+ :set ($TelegramQueue->[ :len $TelegramQueue ]) { chatid=$ChatId; text=$Text; \
+ silent=$Silent; since=([ / system clock get date ] . " " . [ / system clock get time ]) };
: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;";
@@ -776,6 +781,7 @@
# return UTF-8 symbol for unicode name
:set SymbolByUnicodeName do={
:local Symbols {
+ "alarm-clock"="\E2\8F\B0";
"cross-mark"="\E2\9D\8C";
"fire"="\F0\9F\94\A5";
"floppy-disk"="\F0\9F\92\BE";