diff options
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/global-functions b/global-functions index 1fb832a..c2727fc 100644 --- a/global-functions +++ b/global-functions @@ -438,16 +438,18 @@ :set ChatId $TelegramChatIdOverride; } - :if ([ :len $TelegramTokenId ] > 0 && [ :len $ChatId ] > 0) do={ - $CertificateAvailable "Go Daddy Secure Certificate Authority - G2"; - :do { - / tool fetch check-certificate=yes-without-crl output=none http-method=post \ - ("https://api.telegram.org/bot" . $TelegramTokenId . "/sendMessage") \ - http-data=("chat_id=" . $ChatId . "&disable_notification=" . $Silent . \ - "&text=" . [ $UrlEncode ("[" . $Identity . "] " . $Subject . "\n\n" . $Message) ]); - } on-error={ - :log warning "Failed sending telegram notification!"; - } + :if ([ :len $TelegramTokenId ] = 0 || [ :len $ChatId ] = 0) do={ + :return; + } + + $CertificateAvailable "Go Daddy Secure Certificate Authority - G2"; + :do { + / tool fetch check-certificate=yes-without-crl output=none http-method=post \ + ("https://api.telegram.org/bot" . $TelegramTokenId . "/sendMessage") \ + http-data=("chat_id=" . $ChatId . "&disable_notification=" . $Silent . \ + "&text=" . [ $UrlEncode ("[" . $Identity . "] " . $Subject . "\n\n" . $Message) ]); + } on-error={ + :log warning "Failed sending telegram notification!"; } } |