From 2a7576f4e4e0ea7c9b2406a9a6a3cb4f23f0826a Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 14 Feb 2023 21:28:15 +0100 Subject: telegram-chat: add updateid in log messages --- telegram-chat | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/telegram-chat b/telegram-chat index c861c5d..67183a7 100644 --- a/telegram-chat +++ b/telegram-chat @@ -95,14 +95,15 @@ $WaitFullyConnected; } else={ :set TelegramChatActive false; } - $LogPrintExit2 info $0 ("Now " . [ $IfThenElse $TelegramChatActive "active" "passive" ] . "!") false; + $LogPrintExit2 info $0 ("Now " . [ $IfThenElse $TelegramChatActive "active" "passive" ] . \ + " from update " . $UpdateID . "!") false; } else={ :if ($TelegramChatActive = true && $Text != false && [ :len $Text ] > 0) do={ :if ([ $ValidateSyntax $Text ] = true) do={ :local State ""; :local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]); $MkDir "tmpfs/telegram-chat"; - $LogPrintExit2 info $0 ("Running command: " . $Text) false; + $LogPrintExit2 info $0 ("Running command from update " . $UpdateID . ": " . $Text) false; :exec script=(":do {\n" . $Text . "\n} on-error={ :execute script=\"/\" file=" . $File . ".failed };" . \ ":execute script=\"/\" file=" . $File . ".done") file=$File; :if ([ $WaitForFile ($File . ".done.txt") [ $EitherOr $TelegramChatRunTime 20s ] ] = false) do={ @@ -128,7 +129,7 @@ $WaitFullyConnected; } else={ :local Message ("Received a message from untrusted contact " . \ [ $IfThenElse ($FromUserName = false) "without username" ("'" . $FromUserName . "'") ] . \ - " (ID " . $FromID . ")!"); + " (ID " . $FromID . ") in update " . $UpdateID . "!"); :if ($Text ~ ("^! *" . [ $EscapeForRegEx $Identity ] . "\$")) do={ $LogPrintExit2 warning $0 $Message false; $SendTelegram2 ({ origin=$0; chatid=$ChatID; silent=false; \ -- cgit v1.2.3-54-g00ecf