telegram-chat: do not act on foreign reply...

... even if active!
This commit is contained in:
Christian Hesse 2023-10-16 13:07:29 +02:00
parent bc4839f611
commit c9233773b3
2 changed files with 2 additions and 4 deletions

View file

@ -75,9 +75,6 @@ that message.
Associated messages are cleared on device reboot.
> ⚠️ **Warning**: If another device is activated both will act, the one from
> reply and the active one!
### Ask for devices
Send a message with a single question mark (`?`) to query for devices

View file

@ -63,6 +63,7 @@ $WaitFullyConnected;
:local Update [ $ParseJson $UpdateArray ];
:set UpdateID ($Update->"update_id");
:local Message [ $ParseJson ($Update->"message") ];
:local IsReply [ :len ($Message->"reply_to_message") ];
:local IsMyReply ($TelegramMessageIDs->([ $ParseJson ($Message->"reply_to_message") ]->"message_id"));
:if (($IsMyReply = 1 || $TelegramChatOffset->0 > 0 || $Uptime > 5m) && $UpdateID >= $TelegramChatOffset->2) do={
:local Trusted false;
@ -93,7 +94,7 @@ $WaitFullyConnected;
" from update " . $UpdateID . "!") false;
:set Done true;
}
:if ($Done = false && ($IsMyReply = 1 || $TelegramChatActive = true) && [ :len ($Message->"text") ] > 0) do={
:if ($Done = false && ($IsMyReply = 1 || ($IsReply = 0 && $TelegramChatActive = true)) && [ :len ($Message->"text") ] > 0) do={
:if ([ $ValidateSyntax ($Message->"text") ] = true) do={
:local State "";
:local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]);