mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
mod/notification-telegram: support excluding characters from escaping...
... to support formatting in plain text. Handle with care, this can break the request if done wrong!
This commit is contained in:
@ -83,6 +83,7 @@
|
||||
:local EscapeMD do={
|
||||
:local Text [ :tostr $1 ];
|
||||
:local Mode [ :tostr $2 ];
|
||||
:local Excl [ :tostr $3 ];
|
||||
|
||||
:global CharacterReplace;
|
||||
:global IfThenElse;
|
||||
@ -93,8 +94,10 @@
|
||||
"#"; "+"; "-"; "="; "|"; "{"; "}"; "."; "!" };
|
||||
}
|
||||
:foreach Char in=($Chars->$Mode) do={
|
||||
:if ([ :typeof [ :find $Excl $Char ] ] = "nil") do={
|
||||
:set Text [ $CharacterReplace $Text $Char ("\\" . $Char) ];
|
||||
}
|
||||
}
|
||||
|
||||
:if ($Mode = "body") do={
|
||||
:return ("```\n" . $Text . "\n```");
|
||||
|
Reference in New Issue
Block a user