aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-10-16 13:07:29 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-10-16 15:27:14 +0200
commitc9233773b3a1dd967d1dd5924c5f00c516d55d41 (patch)
treeee2518def3c4021329eb41a01ce4e6c1a7ca31cc
parentbc4839f61130695f504ccd3745dd099540db5206 (diff)
telegram-chat: do not act on foreign reply...
... even if active!
-rw-r--r--doc/telegram-chat.md3
-rw-r--r--telegram-chat.rsc3
2 files changed, 2 insertions, 4 deletions
diff --git a/doc/telegram-chat.md b/doc/telegram-chat.md
index 79a9eb1..397920a 100644
--- a/doc/telegram-chat.md
+++ b/doc/telegram-chat.md
@@ -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
diff --git a/telegram-chat.rsc b/telegram-chat.rsc
index 1a89544..2bd8ccd 100644
--- a/telegram-chat.rsc
+++ b/telegram-chat.rsc
@@ -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 ]);