aboutsummaryrefslogtreecommitdiffstats
path: root/mod/notification-telegram
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-05-12 11:03:06 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-05-12 11:03:06 +0200
commit48f0a2d21118a7bff7d598e84d9f606fb30bf07a (patch)
treefb9746502335552880823e9445cd4201414bb8eb /mod/notification-telegram
parent93ec9afe558ef6eba5d513fab359bb5f6618666d (diff)
parenta71a3d5466548d05d27d31c446c62afdf2412070 (diff)
Merge branch 'scripts' into ros-v7-path-syntax
Diffstat (limited to 'mod/notification-telegram')
-rw-r--r--mod/notification-telegram16
1 files changed, 8 insertions, 8 deletions
diff --git a/mod/notification-telegram b/mod/notification-telegram
index d42d459..230dd57 100644
--- a/mod/notification-telegram
+++ b/mod/notification-telegram
@@ -17,14 +17,14 @@
:local AllDone true;
:local QueueLen [ :len $TelegramQueue ];
- :if ([ :len [ / system scheduler find where name="FlushTelegramQueue" ] ] > 0 && $QueueLen = 0) do={
+ :if ([ :len [ /system/scheduler/find where name="FlushTelegramQueue" ] ] > 0 && $QueueLen = 0) do={
$LogPrintExit2 warning $0 ("Flushing Telegram messages from scheduler, but queue is empty.") false;
}
:foreach Id,Message in=$TelegramQueue do={
:if ([ :typeof $Message ] = "array" ) do={
:do {
- / tool fetch check-certificate=yes-without-crl output=none http-method=post \
+ /tool/fetch check-certificate=yes-without-crl output=none http-method=post \
("https://api.telegram.org/bot" . ($Message->"tokenid") . "/sendMessage") \
http-data=("chat_id=" . ($Message->"chatid") . \
"&disable_notification=" . ($Message->"silent") . \
@@ -39,7 +39,7 @@
}
:if ($AllDone = true && $QueueLen = [ :len $TelegramQueue ]) do={
- / system scheduler remove [ find where name="FlushTelegramQueue" ];
+ /system/scheduler/remove [ find where name="FlushTelegramQueue" ];
:set TelegramQueue;
}
}
@@ -125,7 +125,7 @@
:if ([ $CertificateAvailable "Go Daddy Secure Certificate Authority - G2" ] = false) do={
$LogPrintExit2 warning $0 ("Downloading required certificate failed.") true;
}
- / tool fetch check-certificate=yes-without-crl output=none http-method=post \
+ /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") . \
"&disable_web_page_preview=true&parse_mode=" . $ParseMode . "&text=" . $Text) as-value;
@@ -136,12 +136,12 @@
:set TelegramQueue [ :toarray "" ];
}
: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.") "plain" ]) ]);
+ [ $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") };
- :if ([ :len [ / system scheduler find where name="FlushTelegramQueue" ] ] = 0) do={
- / system scheduler add name=FlushTelegramQueue interval=1m start-time=startup \
+ :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;");
}
}