mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-08-03 01:35:03 +02:00
mod/notification-telegram: $GetTelegramChatId: use last message
This commit is contained in:
parent
24de060904
commit
e2fe653035
1 changed files with 7 additions and 4 deletions
|
@ -82,12 +82,15 @@
|
|||
}
|
||||
|
||||
:local JSON [ :deserialize from=json value=$Data ];
|
||||
:foreach Update in=($JSON->"result") do={
|
||||
$LogPrint info $0 ("The chat id is: " . ($Update->"message"->"chat"->"id"));
|
||||
:return true;
|
||||
:local Count [ :len ($JSON->"result") ];
|
||||
|
||||
:if ($Count = 0) do={
|
||||
$LogPrint info $0 ("No message received.");
|
||||
:return false;
|
||||
}
|
||||
|
||||
$LogPrint info $0 ("No message received.");
|
||||
:local Message ($JSON->"result"->($Count - 1)->"message");
|
||||
$LogPrint info $0 ("The chat id is: " . ($Message->"chat"->"id"));
|
||||
} on-error={
|
||||
:global ExitError; $ExitError false $0;
|
||||
} }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue