mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-09 17:44:29 +02:00
global-functions: $SendTelegram: give amount of truncated text
This commit is contained in:
parent
e2e831dbf9
commit
cef0e8c079
1 changed files with 4 additions and 2 deletions
|
@ -816,7 +816,8 @@
|
|||
:local Truncated false;
|
||||
:local LenLink [ :len $Link ];
|
||||
:local Text ("[" . $Identity . "] " . $Subject . "\n\n" . $Message);
|
||||
:if ([ :len $Text ] > (3968 - $LenLink)) do={
|
||||
:local LenText [ :len $Text ];
|
||||
:if ($LenText > (3968 - $LenLink)) do={
|
||||
:set Text [ $EscapeMD ([ :pick $Text 0 (3840 - $LenLink) ] . "...") "body" ];
|
||||
:set Truncated true;
|
||||
} else={
|
||||
|
@ -827,7 +828,8 @@
|
|||
}
|
||||
:if ($Truncated = true) do={
|
||||
:set Text ($Text . "\n" . [ $SymbolForNotification "scissors" ] . \
|
||||
[ $EscapeMD "The Telegram message was too long and has been truncated!" "hint" ]);
|
||||
[ $EscapeMD ("The Telegram message was too long and has been truncated, cut off " . \
|
||||
(($LenText - [ :len $Text ]) * 100 / $LenText) . "%!") "hint" ]);
|
||||
}
|
||||
:set Text [ $UrlEncode $Text ];
|
||||
:local ParseMode [ $IfThenElse ($TelegramFixedWidthFont = true) "MarkdownV2" "" ];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue