diff options
author | Christian Hesse <mail@eworm.de> | 2024-04-26 08:15:56 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-04-26 08:27:29 +0200 |
commit | bdaeb461224bde4e0dae6f9fa19f9612c9bb19ac (patch) | |
tree | 5cf2a005958c344538624d0f6e0d1c11dea38b71 | |
parent | 2a17398e27150a6dff0efb4480835de3874f3757 (diff) |
mod/notification-telegram: use proper variable naming...
... in local escaping function.
-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") \ |