From afdaff964bc098ebf6c1feebedeb92df878802e5 Mon Sep 17 00:00:00 2001 From: vados-dev <192440777+vados-dev@users.noreply.github.com> Date: Fri, 1 May 2026 01:00:03 +0300 Subject: [PATCH] Autocommit in repo: ros.vados.ru, generated by owner: root, in 01:00:02 01.05.2026. --- html/AM-GlobalFunc.rsc | 4 ++-- html/mod/AM-TG-Bot.rsc | 9 +++++++-- html/mod/AM-TG-Bot.rsc.diff | 17 +++-------------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/html/AM-GlobalFunc.rsc b/html/AM-GlobalFunc.rsc index ab53a4cca..6ea8f0a5d 100644 --- a/html/AM-GlobalFunc.rsc +++ b/html/AM-GlobalFunc.rsc @@ -17,9 +17,9 @@ :global GlobalFuncReady false; # Git commit id & info, expected configuration version -:global CommitId "main/323/5941eae8"; +:global CommitId "main/324/d193fd99"; :global CommitTAG "unknown"; -:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 00:55:02 01.05.2026."; +:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 01:00:02 01.05.2026."; # The variables are received right here. :global GlobalConfVersion 138; diff --git a/html/mod/AM-TG-Bot.rsc b/html/mod/AM-TG-Bot.rsc index ebc741627..63089998b 100644 --- a/html/mod/AM-TG-Bot.rsc +++ b/html/mod/AM-TG-Bot.rsc @@ -54,7 +54,6 @@ :if ([ :len [ /system/scheduler/find where name=$ScriptName ] ] = 0) do={ /system/scheduler/add start-time=startup interval=30s name=$ScriptName on-event="/system/script/run $ScriptName;" comment="Telegram Chat Bot"; } - :if ([ :typeof $TelegramChatOffset ] != "array") do={ :set TelegramChatOffset { 0; 0; 0 }; } @@ -69,6 +68,7 @@ } $RandomDelay $TelegramRandomDelay; + :local Data false; :for I from=1 to=4 do={ :if ($Data = false) do={ @@ -86,6 +86,7 @@ } } } + :if ($Data = false) do={ $LogPrint warning $ScriptName ("Failed getting updates."); :set ExitOK true; @@ -108,6 +109,7 @@ :local From ($Message->"from"); :local Command ($Message->"text"); :local ThreadId [ $IfThenElse ($Message->"is_topic_message") ($Message->"message_thread_id") "" ]; + :foreach IdsTrusted in=($TelegramChatId, $TelegramChatIdsTrusted) do={ :if ($From->"id" = $IdsTrusted || \ $From->"username" = $IdsTrusted || \ @@ -115,6 +117,7 @@ :set Trusted true; } } + :if ($Trusted = true) do={ :local Done false; :if ($Command = "?") do={ @@ -183,7 +186,9 @@ replyto=($Message->"message_id"); threadid=$ThreadId; \ subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \ message=("You are not trusted.") }); - } else={$LogPrint info $ScriptName $MessageText} + } else={ + $LogPrint info $ScriptName $MessageText; + } } } else={ $LogPrint debug $ScriptName ("Already handled update " . $UpdateID . "."); diff --git a/html/mod/AM-TG-Bot.rsc.diff b/html/mod/AM-TG-Bot.rsc.diff index 29730d982..0c6a8857c 100644 --- a/html/mod/AM-TG-Bot.rsc.diff +++ b/html/mod/AM-TG-Bot.rsc.diff @@ -20,22 +20,11 @@ --- > :global GlobalConfigReady; :global GlobalFunctionsReady; > :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \ -54,57d56 +54,56d56 < :if ([ :len [ /system/scheduler/find where name=$ScriptName ] ] = 0) do={ < /system/scheduler/add start-time=startup interval=30s name=$ScriptName on-event="/system/script/run $ScriptName;" comment="Telegram Chat Bot"; < } -< -71a71 +111a112 > -88a89 +118a120 > -110a112 -> -117a120 -> -186c189,191 -< } else={$LogPrint info $ScriptName $MessageText} ---- -> } else={ -> $LogPrint info $ScriptName $MessageText; -> } -- 2.52.0