aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-03-05 10:59:13 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-03-05 11:00:36 +0100
commit227151e189f465ea426dd11bb912ff818046ff8f (patch)
treeb6bed3bf8362dace13817f3eac80f78be1073934
parent34db2e34db40867c97c87c6604cf8049a3b7e53b (diff)
global-functions: $SendTelegram: invert condition
-rw-r--r--global-functions22
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!";
}
}