mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: $SendTelegram: split off & move down truncation message
This commit is contained in:
@ -809,18 +809,22 @@
|
||||
:return false;
|
||||
}
|
||||
|
||||
:local Truncated false;
|
||||
:local LenLink [ :len $Link ];
|
||||
:local Text ("[" . $Identity . "] " . $Subject . "\n\n" . $Message);
|
||||
:if ([ :len $Text ] > (3968 - $LenLink)) do={
|
||||
:set Text ([ $EscapeMD ([ :pick $Text 0 (3840 - $LenLink) ] . "...") "body" ] . \
|
||||
"\n" . [ $SymbolForNotification "scissors" ] . \
|
||||
[ $EscapeMD "The Telegram message was too long and has been truncated!" "hint" ]);
|
||||
:set Text [ $EscapeMD ([ :pick $Text 0 (3840 - $LenLink) ] . "...") "body" ];
|
||||
:set Truncated true;
|
||||
} else={
|
||||
:set Text [ $EscapeMD $Text "body" ];
|
||||
}
|
||||
:if ($LenLink > 0) do={
|
||||
:set Text ($Text . "\n" . [ $SymbolForNotification "link" ] . [ $EscapeMD $Link "hint" ]);
|
||||
}
|
||||
:if ($Truncated = true) do={
|
||||
:set Text ($Text . "\n" . [ $SymbolForNotification "scissors" ] . \
|
||||
[ $EscapeMD "The Telegram message was too long and has been truncated!" "hint" ]);
|
||||
}
|
||||
:set Text [ $UrlEncode $Text ];
|
||||
:local ParseMode [ $IfThenElse ($TelegramFixedWidthFont = true) "MarkdownV2" "" ];
|
||||
|
||||
|
Reference in New Issue
Block a user