global-functions: $SendTelegram: try to get the line breaks right

This commit is contained in:
Christian Hesse 2020-11-26 22:02:39 +01:00
parent c93d1c4944
commit 54e164e542

View file

@ -776,9 +776,10 @@
:global TelegramFixedWidthFont;
:global CharacterReplace;
:global IfThenElse;
:if ($TelegramFixedWidthFont != true) do={
:return $1;
:return ($1 . [ $IfThenElse ($2 = "fixed") "\n" "" ]);
}
:local Return $1;
@ -810,7 +811,7 @@
:local Text ("[" . $Identity . "] " . $Subject . "\n\n" . $Message);
:if ([ :len $Text ] > 3968) do={
:set Text ([ $EscapeMD ([ :pick $Text 0 3840 ] . "...") "fixed" ] . \
"\n\n" . [ $SymbolForNotification "scissors" ] . \
"\n" . [ $SymbolForNotification "scissors" ] . \
[ $EscapeMD "The Telegram message was too long and has been truncated!" "hint" ]);
} else={
:set Text [ $EscapeMD $Text "fixed" ];
@ -832,7 +833,7 @@
:if ([ :typeof $TelegramQueue ] = "nothing") do={
:set TelegramQueue [ :toarray "" ];
}
:set Text ($Text . [ $UrlEncode ("\n\n" . [ $SymbolForNotification "alarm-clock" ] . \
:set Text ($Text . [ $UrlEncode ("\n" . [ $SymbolForNotification "alarm-clock" ] . \
[ $EscapeMD ("This message was queued since " . [ / system clock get date ] . \
" " . [ / system clock get time ] . " and may be obsolete.") "hint" ]) ]);
:set ($TelegramQueue->[ :len $TelegramQueue ]) {