aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-02-23 22:07:37 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-02-26 22:19:30 +0100
commit5ea892662f94d817ff325abe21620665efde24fa (patch)
treeb7ec49dbbf9d3182c21db529b26f9a5e0c80ed86
parentb96376187472fc5469f6f7c126a6dcb73667bf0a (diff)
telegram-chat: send messages in reply
-rw-r--r--telegram-chat7
1 files changed, 4 insertions, 3 deletions
diff --git a/telegram-chat b/telegram-chat
index 882ce55..8b7fa5f 100644
--- a/telegram-chat
+++ b/telegram-chat
@@ -77,6 +77,7 @@ $WaitFullyConnected;
:if ($UpdateID >= $TelegramChatOffset->2) do={
:local Trusted false;
:local Message [ $JsonGetKey $Update "message" ];
+ :local MessageId [ $JsonGetKey $Message "message_id" ];
:local From [ $JsonGetKey $Message "from" ];
:local FromID [ $JsonGetKey $From "id" ];
:local FromUserName [ $JsonGetKey $From "username" ];
@@ -113,7 +114,7 @@ $WaitFullyConnected;
:set State "The command failed with an error!\n\n";
}
:local Content [ /file/get ($File . ".txt") contents ];
- $SendTelegram2 ({ origin=$0; chatid=$ChatID; silent=false; \
+ $SendTelegram2 ({ origin=$0; chatid=$ChatID; silent=false; replyto=$MessageId; \
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
message=("Command:\n" . $Text . "\n\n" . $State . [ $IfThenElse ([ :len $Content ] > 0) \
("Output:\n" . $Content) [ $IfThenElse ([ /file/get ($File . ".txt") size ] > 0) \
@@ -121,7 +122,7 @@ $WaitFullyConnected;
/file/remove "tmpfs/telegram-chat";
} else={
$LogPrintExit2 info $0 ("The command from update " . $UpdateID . " failed syntax validation!") false;
- $SendTelegram2 ({ origin=$0; chatid=$ChatID; silent=false; \
+ $SendTelegram2 ({ origin=$0; chatid=$ChatID; silent=false; replyto=$MessageId; \
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
message=("Command:\n" . $Text . "\n\nThe command failed syntax validation!") });
}
@@ -133,7 +134,7 @@ $WaitFullyConnected;
" (ID " . $FromID . ") in update " . $UpdateID . "!");
:if ($Text ~ ("^! *" . [ $EscapeForRegEx $Identity ] . "\$")) do={
$LogPrintExit2 warning $0 $Message false;
- $SendTelegram2 ({ origin=$0; chatid=$ChatID; silent=false; \
+ $SendTelegram2 ({ origin=$0; chatid=$ChatID; silent=false; replyto=$MessageId; \
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
message=("You are not trusted.") });
} else={