mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 10:04:19 +02:00
mod/notification-telegram: use proper variable naming...
... in local escaping function.
This commit is contained in:
parent
d6e315580b
commit
4b6cd7ba29
|
@ -81,24 +81,26 @@
|
|||
:global UrlEncode;
|
||||
|
||||
:local EscapeMD do={
|
||||
:local Text [ :tostr $1 ];
|
||||
:local Mode [ :tostr $2 ];
|
||||
|
||||
:global CharacterReplace;
|
||||
:global IfThenElse;
|
||||
|
||||
:local Return $1;
|
||||
:local Chars {
|
||||
"body"={ "\\"; "`" };
|
||||
"body"={ "\\"; "`" };
|
||||
"plain"={ "_"; "*"; "["; "]"; "("; ")"; "~"; "`"; ">";
|
||||
"#"; "+"; "-"; "="; "|"; "{"; "}"; "."; "!" };
|
||||
}
|
||||
:foreach Char in=($Chars->$2) do={
|
||||
:set Return [ $CharacterReplace $Return $Char ("\\" . $Char) ];
|
||||
:foreach Char in=($Chars->$Mode) do={
|
||||
:set Text [ $CharacterReplace $Text $Char ("\\" . $Char) ];
|
||||
}
|
||||
|
||||
:if ($2 = "body") do={
|
||||
:return ("```\n" . $Return . "\n```");
|
||||
:if ($Mode = "body") do={
|
||||
:return ("```\n" . $Text . "\n```");
|
||||
}
|
||||
|
||||
:return $Return;
|
||||
:return $Text;
|
||||
}
|
||||
|
||||
:local ChatId [ $EitherOr ($Notification->"chatid") \
|
||||
|
|
Loading…
Reference in a new issue