1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-22 07:42:24 +00:00

fallback to default text notification in case of errors

This commit is contained in:
Bart274 2020-01-31 15:41:12 +01:00 committed by evilhero
parent 7f44f4a278
commit 563439acdf
No known key found for this signature in database
GPG key ID: 3E12C51E39D91142

View file

@ -357,13 +357,16 @@ class TELEGRAM:
logger.info('Telegram notify failed: ' + str(e)) logger.info('Telegram notify failed: ' + str(e))
# Error logging # Error logging
sent_successfuly = True sent_successfully = True
if not response.status_code == 200: if not response.status_code == 200:
logger.info(u'Could not send notification to TelegramBot (token=%s). Response: [%s]' % (self.token, response.text)) 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.") logger.info(u"Telegram notifications sent.")
return sent_successfuly return sent_successfully
def test_notify(self): def test_notify(self):
return self.notify('Test Message: Release the Ninjas!') return self.notify('Test Message: Release the Ninjas!')