aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-02-14 21:28:15 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-02-14 21:28:15 +0100
commit2a7576f4e4e0ea7c9b2406a9a6a3cb4f23f0826a (patch)
treeeb4f1e829b8c3773f969c9e83786c808f97b91ef
parentc48509683c556aacde6b4fcbbdd53f2c77d38077 (diff)
telegram-chat: add updateid in log messages
-rw-r--r--telegram-chat7
1 files 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; \