aboutsummaryrefslogtreecommitdiffstats
path: root/telegram-chat.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-10-11 10:24:04 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-10-16 13:11:20 +0200
commitadca33cc5bcc68911bc811d4b40f387e6b1afd97 (patch)
tree1e9bb70633ed69b4b23d08635e632ecab487388e /telegram-chat.rsc
parent399d952ac21057c5ab88120bef4a400b06caea3b (diff)
telegram-chat: act on reply without delay
Diffstat (limited to 'telegram-chat.rsc')
-rw-r--r--telegram-chat.rsc8
1 files changed, 4 insertions, 4 deletions
diff --git a/telegram-chat.rsc b/telegram-chat.rsc
index 29130db..f71cbde 100644
--- a/telegram-chat.rsc
+++ b/telegram-chat.rsc
@@ -62,9 +62,10 @@ $WaitFullyConnected;
:foreach UpdateArray in=[ :toarray $Data ] do={
:local Update [ $ParseJson $UpdateArray ];
:set UpdateID ($Update->"update_id");
- :if (($TelegramChatOffset->0 > 0 || $Uptime > 5m) && $UpdateID >= $TelegramChatOffset->2) do={
+ :local Message [ $ParseJson ($Update->"message") ];
+ :local IsReply ($TelegramMessageIDs->([ $ParseJson ($Message->"reply_to_message") ]->"message_id"));
+ :if (($IsReply = 1 || $TelegramChatOffset->0 > 0 || $Uptime > 5m) && $UpdateID >= $TelegramChatOffset->2) do={
:local Trusted false;
- :local Message [ $ParseJson ($Update->"message") ];
:local Chat [ $ParseJson ($Message->"chat") ];
:local From [ $ParseJson ($Message->"from") ];
@@ -84,8 +85,7 @@ $WaitFullyConnected;
$LogPrintExit2 info $0 ("Now " . [ $IfThenElse $TelegramChatActive "active" "passive" ] . \
" from update " . $UpdateID . "!") false;
} else={
- :if (($TelegramMessageIDs->([ $ParseJson ($Message->"reply_to_message") ]->"message_id") = 1 || \
- $TelegramChatActive = true) && [ :len ($Message->"text") ] > 0) do={
+ :if (($IsReply = 1 || $TelegramChatActive = true) && [ :len ($Message->"text") ] > 0) do={
:if ([ $ValidateSyntax ($Message->"text") ] = true) do={
:local State "";
:local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]);