From 563439acdf42359976e2e980b587f256d9f65aa5 Mon Sep 17 00:00:00 2001 From: Bart274 Date: Fri, 31 Jan 2020 15:41:12 +0100 Subject: [PATCH] fallback to default text notification in case of errors --- mylar/notifiers.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mylar/notifiers.py b/mylar/notifiers.py index 509168ed..52ce656b 100644 --- a/mylar/notifiers.py +++ b/mylar/notifiers.py @@ -357,13 +357,16 @@ class TELEGRAM: logger.info('Telegram notify failed: ' + str(e)) # Error logging - sent_successfuly = True + sent_successfully = True if not response.status_code == 200: logger.info(u'Could not send notification to TelegramBot (token=%s). Response: [%s]' % (self.token, response.text)) - sent_successfuly = False + sent_successfully = False + + if not sent_successfully and sendMethod != "sendMessage": + return self.notify(message) logger.info(u"Telegram notifications sent.") - return sent_successfuly + return sent_successfully def test_notify(self): return self.notify('Test Message: Release the Ninjas!')