diff options
author | Christian Hesse <mail@eworm.de> | 2024-04-26 08:15:56 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-04-29 23:02:48 +0200 |
commit | 4b6cd7ba2911b44f8d0890c19c5342ce28a6b3a8 (patch) | |
tree | 5f9263709231b7e48f4ecbedba9fb2f32f34e894 /mod/notification-telegram.rsc | |
parent | d6e315580bf354e7a5620955c707e604d3cdaf9e (diff) |
mod/notification-telegram: use proper variable naming...
... in local escaping function.
Diffstat (limited to 'mod/notification-telegram.rsc')
-rw-r--r-- | mod/notification-telegram.rsc | 16 |
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") \ |