mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-15 04:24:29 +02:00
mod/notification-telegram: use :onerror for outer block
This commit is contained in:
parent
e3a15cc6b8
commit
f7ba78702f
1 changed files with 9 additions and 9 deletions
|
@ -17,7 +17,7 @@
|
|||
:global SendTelegram2;
|
||||
|
||||
# flush telegram queue
|
||||
:set FlushTelegramQueue do={ :do {
|
||||
:set FlushTelegramQueue do={ :onerror Err {
|
||||
:global TelegramQueue;
|
||||
:global TelegramMessageIDs;
|
||||
|
||||
|
@ -55,12 +55,12 @@
|
|||
/system/scheduler/remove [ find where name="_FlushTelegramQueue" ];
|
||||
:set TelegramQueue;
|
||||
}
|
||||
} on-error={
|
||||
:global ExitError; $ExitError false $0;
|
||||
} do={
|
||||
:global ExitError; $ExitError false $0 $Err;
|
||||
} }
|
||||
|
||||
# get the chat id
|
||||
:set GetTelegramChatId do={ :do {
|
||||
:set GetTelegramChatId do={ :onerror Err {
|
||||
:global TelegramTokenId;
|
||||
|
||||
:global CertificateAvailable;
|
||||
|
@ -94,8 +94,8 @@
|
|||
:if (($Message->"is_topic_message") = true) do={
|
||||
$LogPrint info $0 ("The thread id is: " . ($Message->"message_thread_id"));
|
||||
}
|
||||
} on-error={
|
||||
:global ExitError; $ExitError false $0;
|
||||
} do={
|
||||
:global ExitError; $ExitError false $0 $Err;
|
||||
} }
|
||||
|
||||
# send notification via telegram - expects one array argument
|
||||
|
@ -226,12 +226,12 @@
|
|||
}
|
||||
|
||||
# send notification via telegram - expects at least two string arguments
|
||||
:set SendTelegram do={ :do {
|
||||
:set SendTelegram do={ :onerror Err {
|
||||
:global SendTelegram2;
|
||||
|
||||
$SendTelegram2 ({ origin=$0; subject=$1; message=$2; link=$3; silent=$4 });
|
||||
} on-error={
|
||||
:global ExitError; $ExitError false $0;
|
||||
} do={
|
||||
:global ExitError; $ExitError false $0 $Err;
|
||||
} }
|
||||
|
||||
# send notification via telegram - expects one array argument
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue