mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-08-17 16:21:00 +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 ];
|
:local JSON [ :deserialize from=json value=$Data ];
|
||||||
:foreach Update in=($JSON->"result") do={
|
:local Count [ :len ($JSON->"result") ];
|
||||||
$LogPrint info $0 ("The chat id is: " . ($Update->"message"->"chat"->"id"));
|
|
||||||
:return true;
|
: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={
|
} on-error={
|
||||||
:global ExitError; $ExitError false $0;
|
:global ExitError; $ExitError false $0;
|
||||||
} }
|
} }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue