aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-04-26 08:15:56 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-04-29 17:41:49 +0200
commit05fb41b92396cbb131eea79b72c68eb26264c663 (patch)
treed47dcc36aa310182c82f3e80b9906dddbc4b7541
parent8d223b244bccd51fcc7d4275f4a9916a31374fd8 (diff)
mod/notification-telegram: use proper variable naming...
... in local escaping function.
-rw-r--r--mod/notification-telegram.rsc16
1 files changed, 9 insertions, 7 deletions
diff --git a/mod/notification-telegram.rsc b/mod/notification-telegram.rsc
index 440e0dd..efde85a 100644
--- a/mod/notification-telegram.rsc
+++ b/mod/notification-telegram.rsc
@@ -81,24 +81,26 @@
:global UrlEncode;
:local EscapeMD do={
+ :local Text [ :tostr $1 ];
+ :local Mode [ :tostr $2 ];
+
:global CharacterReplace;
:global IfThenElse;
- :local Return $1;
:local Chars {
- "body"={ "\\"; "`" };
+ "body"={ "\\"; "`" };
"plain"={ "_"; "*"; "["; "]"; "("; ")"; "~"; "`"; ">";
"#"; "+"; "-"; "="; "|"; "{"; "}"; "."; "!" };
}
- :foreach Char in=($Chars->$2) do={
- :set Return [ $CharacterReplace $Return $Char ("\\" . $Char) ];
+ :foreach Char in=($Chars->$Mode) do={
+ :set Text [ $CharacterReplace $Text $Char ("\\" . $Char) ];
}
- :if ($2 = "body") do={
- :return ("```\n" . $Return . "\n```");
+ :if ($Mode = "body") do={
+ :return ("```\n" . $Text . "\n```");
}
- :return $Return;
+ :return $Text;
}
:local ChatId [ $EitherOr ($Notification->"chatid") \