aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-04-19 09:09:13 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-04-19 09:09:13 +0200
commitee54956a6909190eceb5eae696ad8590720bc3c3 (patch)
treea894a4a0bab4e79172867b39ebf75c823b222531
parent8cd03167ca0bd47efd9b7c9b12aabebbe228b36c (diff)
mod/notification-telegram: string protocol for display
-rw-r--r--mod/notification-telegram.rsc7
1 files changed, 5 insertions, 2 deletions
diff --git a/mod/notification-telegram.rsc b/mod/notification-telegram.rsc
index c78a8ad..745367a 100644
--- a/mod/notification-telegram.rsc
+++ b/mod/notification-telegram.rsc
@@ -76,6 +76,7 @@
:global EitherOr;
:global IfThenElse;
:global LogPrint;
+ :global ProtocolStrip;
:global SymbolForNotification;
:global UrlEncode;
@@ -117,7 +118,7 @@
($Notification->"subject")) "plain" ] . "__*\n\n");
:local LenSubject [ :len $Text ];
:local LenMessage [ :len ($Notification->"message") ];
- :local LenLink [ :len ($Notification->"link") ];
+ :local LenLink ([ :len ($Notification->"link") ] * 2);
:local LenSum ($LenSubject + $LenMessage + $LenLink);
:if ($LenSum > 3968) do={
:set Text ($Text . [ $EscapeMD ([ :pick ($Notification->"message") 0 (3840 - $LenSubject - $LenLink) ] . "...") "body" ]);
@@ -126,7 +127,9 @@
:set Text ($Text . [ $EscapeMD ($Notification->"message") "body" ]);
}
:if ($LenLink > 0) do={
- :set Text ($Text . "\n" . [ $SymbolForNotification "link" ] . [ $EscapeMD ($Notification->"link") "plain" ]);
+ :set Text ($Text . "\n" . [ $SymbolForNotification "link" ] . \
+ "[" . [ $EscapeMD [ $ProtocolStrip ($Notification->"link") ] "plain" ] . "]" . \
+ "(" . [ $EscapeMD ($Notification->"link") "plain" ] . ")");
}
:if ($Truncated = true) do={
:set Text ($Text . "\n" . [ $SymbolForNotification "scissors" ] . \