diff options
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/global-functions b/global-functions index 5e4ef8b..5e643d9 100644 --- a/global-functions +++ b/global-functions @@ -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" "" ]; |