telegram-chat: :do ... on-error=... -> :onerror ... do=...

This commit is contained in:
Christian Hesse 2025-05-08 10:13:05 +02:00
parent d0adf9974e
commit f22d46da96

View file

@ -70,14 +70,14 @@
:local Data false;
:for I from=1 to=4 do={
:if ($Data = false) do={
:do {
:onerror Err {
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
("https://api.telegram.org/bot" . $TelegramTokenId . "/getUpdates?offset=" . \
$TelegramChatOffset->0 . "&allowed_updates=%5B%22message%22%5D") as-value ]->"data");
:set TelegramRandomDelay [ $MAX 0 ($TelegramRandomDelay - 1) ];
} on-error={
} do={
:if ($I < 4) do={
$LogPrint debug $ScriptName ("Fetch failed, " . $I . ". try.");
$LogPrint debug $ScriptName ("Fetch failed, " . $I . ". try: " . $Err);
:set TelegramRandomDelay [ $MIN 15 ($TelegramRandomDelay + 5) ];
:delay (($I * $I) . "s");
}