diff options
author | Christian Hesse <mail@eworm.de> | 2019-08-18 18:44:07 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-08-18 21:30:59 +0200 |
commit | 06b93ca6c2b754e21d109716bd17da0d7e2909af (patch) | |
tree | ca7abda6cab62d53fbec94051ec5113068d73aed /global-functions | |
parent | d457421e1e339d9eeaa7645ab83a71190f9109d7 (diff) |
global-functions: support sending silent telegram notifications
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/global-functions b/global-functions index b1548a7..2e4d43c 100644 --- a/global-functions +++ b/global-functions @@ -118,6 +118,7 @@ :global SendTelegram do={ :local Subject [ :tostr $1 ]; :local Message [ :tostr $2 ]; + :local Silent [ :tostr $3 ]; :global Identity; :global TelegramTokenId; @@ -131,8 +132,8 @@ :do { / tool fetch check-certificate=yes-without-crl keep-result=no http-method=post \ ("https://api.telegram.org/bot" . $TelegramTokenId . "/sendMessage") \ - http-data=("chat_id=" . $TelegramChatId . "&text=" . \ - [ $UrlEncode ("[" . $Identity . "] " . $Subject . "\n\n" . $Message) ]); + http-data=("chat_id=" . $TelegramChatId . "&disable_notification=" . $Silent . \ + "&text=" . [ $UrlEncode ("[" . $Identity . "] " . $Subject . "\n\n" . $Message) ]); } on-error={ :log warning "Failed sending telegram notification!"; } @@ -140,17 +141,18 @@ } # send notification via e-mail and telegram -# Note that attachment is ignored for telegram! +# Note that attachment is ignored for telegram, silent is ignored for e-mail! :global SendNotification do={ :local Subject [ :tostr $1 ]; :local Message [ :tostr $2 ]; :local Attach [ :tostr $3 ]; + :local Silent [ :tostr $4 ]; :global SendEMail; :global SendTelegram; $SendEMail $Subject $Message $Attach; - $SendTelegram $Subject $Message; + $SendTelegram $Subject $Message $Silent; } |