mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-26 11:38:36 +02:00
mod/notification-telegram: use :deserialize ...
... instead of $ParseJson. This requires RouterOS 7.13.
This commit is contained in:
parent
7e5010a608
commit
29bcbc4db9
2 changed files with 5 additions and 5 deletions
|
@ -4,7 +4,7 @@ Send notifications via Telegram
|
||||||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||||
[](https://mikrotik.com/download/changelogs/)
|
[](https://mikrotik.com/download/changelogs/)
|
||||||
[](https://t.me/routeros_scripts)
|
[](https://t.me/routeros_scripts)
|
||||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
|
||||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||||
#
|
#
|
||||||
|
# requires RouterOS, version=7.13
|
||||||
|
#
|
||||||
# send notifications via Telegram
|
# send notifications via Telegram
|
||||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/mod/notification-telegram.md
|
# https://git.eworm.de/cgit/routeros-scripts/about/doc/mod/notification-telegram.md
|
||||||
|
|
||||||
|
@ -19,7 +21,6 @@
|
||||||
|
|
||||||
:global IsFullyConnected;
|
:global IsFullyConnected;
|
||||||
:global LogPrint;
|
:global LogPrint;
|
||||||
:global ParseJson;
|
|
||||||
:global UrlEncode;
|
:global UrlEncode;
|
||||||
|
|
||||||
:if ([ $IsFullyConnected ] = false) do={
|
:if ([ $IsFullyConnected ] = false) do={
|
||||||
|
@ -43,7 +44,7 @@
|
||||||
"&reply_to_message_id=" . ($Message->"replyto") . "&disable_web_page_preview=true" . \
|
"&reply_to_message_id=" . ($Message->"replyto") . "&disable_web_page_preview=true" . \
|
||||||
"&parse_mode=MarkdownV2&text=" . [ $UrlEncode ($Message->"text") ]) as-value ]->"data");
|
"&parse_mode=MarkdownV2&text=" . [ $UrlEncode ($Message->"text") ]) as-value ]->"data");
|
||||||
:set ($TelegramQueue->$Id);
|
:set ($TelegramQueue->$Id);
|
||||||
:set ($TelegramMessageIDs->([ $ParseJson ([ $ParseJson $Data ]->"result") ]->"message_id")) 1;
|
:set ($TelegramMessageIDs->[ :tostr ([ :deserialize from=json value=$Data ]->"result"->"message_id") ]) 1;
|
||||||
} on-error={
|
} on-error={
|
||||||
$LogPrint debug $0 ("Sending queued Telegram message failed.");
|
$LogPrint debug $0 ("Sending queued Telegram message failed.");
|
||||||
:set AllDone false;
|
:set AllDone false;
|
||||||
|
@ -75,7 +76,6 @@
|
||||||
:global EitherOr;
|
:global EitherOr;
|
||||||
:global IfThenElse;
|
:global IfThenElse;
|
||||||
:global LogPrint;
|
:global LogPrint;
|
||||||
:global ParseJson;
|
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global UrlEncode;
|
:global UrlEncode;
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
http-data=("chat_id=" . $ChatId . "&disable_notification=" . ($Notification->"silent") . \
|
http-data=("chat_id=" . $ChatId . "&disable_notification=" . ($Notification->"silent") . \
|
||||||
"&reply_to_message_id=" . ($Notification->"replyto") . "&disable_web_page_preview=true" . \
|
"&reply_to_message_id=" . ($Notification->"replyto") . "&disable_web_page_preview=true" . \
|
||||||
"&parse_mode=MarkdownV2&text=" . [ $UrlEncode $Text ]) as-value ]->"data");
|
"&parse_mode=MarkdownV2&text=" . [ $UrlEncode $Text ]) as-value ]->"data");
|
||||||
:set ($TelegramMessageIDs->([ $ParseJson ([ $ParseJson $Data ]->"result") ]->"message_id")) 1;
|
:set ($TelegramMessageIDs->[ :tostr ([ :deserialize from=json value=$Data ]->"result"->"message_id") ]) 1;
|
||||||
} on-error={
|
} on-error={
|
||||||
$LogPrint info $0 ("Failed sending telegram notification! Queuing...");
|
$LogPrint info $0 ("Failed sending telegram notification! Queuing...");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue