aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-11-26 22:24:56 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-11-26 22:24:56 +0100
commitb078ce2f0f8544936274506e55ee4ecc5c5425cb (patch)
treee0de1a6c9ca5e67f10f2dd149241ecf231b9f9d5 /global-functions
parent7e0558e85dcf06161d0b9c554688d4fc4d1b3101 (diff)
global-functions: $SendTelegram: split off & move down truncation message
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions10
1 files changed, 7 insertions, 3 deletions
diff --git a/global-functions b/global-functions
index 384f438..ac7cec1 100644
--- a/global-functions
+++ b/global-functions
@@ -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" "" ];