diff options
author | Christian Hesse <mail@eworm.de> | 2020-11-26 22:02:39 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-11-26 22:02:39 +0100 |
commit | 54e164e542bcd5b220ed3cbb3ad866d53f052efe (patch) | |
tree | ad14fe26e2086554369ac99c721e403ee2e7cb88 | |
parent | c93d1c4944fff937598ec2825869a02030362a9a (diff) |
global-functions: $SendTelegram: try to get the line breaks right
-rw-r--r-- | global-functions | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/global-functions b/global-functions index a058d69..ee13de8 100644 --- a/global-functions +++ b/global-functions @@ -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 ]) { |