mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: split off $SendEMail and $SendTelegram
This commit is contained in:
parent
4210a49098
commit
d457421e1e
1 changed files with 31 additions and 9 deletions
|
@ -89,9 +89,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# send notification via e-mail and telegram
|
# send notification via e-mail
|
||||||
# Note that attachment is ignored for telegram!
|
:global SendEMail do={
|
||||||
:global SendNotification do={
|
|
||||||
:local Subject [ :tostr $1 ];
|
:local Subject [ :tostr $1 ];
|
||||||
:local Message [ :tostr $2 ];
|
:local Message [ :tostr $2 ];
|
||||||
:local Attach [ :tostr $3 ];
|
:local Attach [ :tostr $3 ];
|
||||||
|
@ -99,11 +98,6 @@
|
||||||
:global Identity;
|
:global Identity;
|
||||||
:global EmailGeneralTo;
|
:global EmailGeneralTo;
|
||||||
:global EmailGeneralCc;
|
:global EmailGeneralCc;
|
||||||
:global TelegramTokenId;
|
|
||||||
:global TelegramChatId;
|
|
||||||
|
|
||||||
:global UrlEncode;
|
|
||||||
:global CertificateAvailable;
|
|
||||||
|
|
||||||
:if ([ :len $EmailGeneralTo ] > 0) do={
|
:if ([ :len $EmailGeneralTo ] > 0) do={
|
||||||
:do {
|
:do {
|
||||||
|
@ -118,6 +112,19 @@
|
||||||
:log warning "Failed sending notification mail!";
|
:log warning "Failed sending notification mail!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# send notification via telegram
|
||||||
|
:global SendTelegram do={
|
||||||
|
:local Subject [ :tostr $1 ];
|
||||||
|
:local Message [ :tostr $2 ];
|
||||||
|
|
||||||
|
:global Identity;
|
||||||
|
:global TelegramTokenId;
|
||||||
|
:global TelegramChatId;
|
||||||
|
|
||||||
|
:global UrlEncode;
|
||||||
|
:global CertificateAvailable;
|
||||||
|
|
||||||
:if ([ :len $TelegramTokenId ] > 0 && [ :len $TelegramChatId ] > 0) do={
|
:if ([ :len $TelegramTokenId ] > 0 && [ :len $TelegramChatId ] > 0) do={
|
||||||
$CertificateAvailable "Go Daddy Secure Certificate Authority - G2";
|
$CertificateAvailable "Go Daddy Secure Certificate Authority - G2";
|
||||||
|
@ -132,6 +139,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# send notification via e-mail and telegram
|
||||||
|
# Note that attachment is ignored for telegram!
|
||||||
|
:global SendNotification do={
|
||||||
|
:local Subject [ :tostr $1 ];
|
||||||
|
:local Message [ :tostr $2 ];
|
||||||
|
:local Attach [ :tostr $3 ];
|
||||||
|
|
||||||
|
:global SendEMail;
|
||||||
|
:global SendTelegram;
|
||||||
|
|
||||||
|
$SendEMail $Subject $Message $Attach;
|
||||||
|
$SendTelegram $Subject $Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# get MAC vendor
|
# get MAC vendor
|
||||||
:global GetMacVendor do={
|
:global GetMacVendor do={
|
||||||
:local Mac [ :tostr $1 ];
|
:local Mac [ :tostr $1 ];
|
||||||
|
|
Loading…
Reference in a new issue