mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04: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:
parent
4b6cd7ba29
commit
f8856ae742
1 changed files with 4 additions and 1 deletions
|
@ -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```");
|
||||
|
|
Loading…
Reference in a new issue