From b5ed1037b02038ac432b0d5736b042b8a6845489 Mon Sep 17 00:00:00 2001 From: nd Date: Sat, 7 Nov 2020 03:48:27 +0100 Subject: [PATCH] telegram moved to version 2: --- templates/telegram-bot.py.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/telegram-bot.py.j2 b/templates/telegram-bot.py.j2 index bf3d3ab..402fa97 100755 --- a/templates/telegram-bot.py.j2 +++ b/templates/telegram-bot.py.j2 @@ -37,11 +37,11 @@ def postAlertmanager(chatID): elif alert['status'] == "firing": correctDate = parser.parse(alert['startsAt']).strftime('%Y-%m-%d %H:%M:%S') message += "Started: "+correctDate+"\n" - message = telegram.utils.helpers.escape_markdown(message.replace('-', '\-').replace('.', '\.').replace('!', '\!').replace('[', '\[').replace(']', '\]') + "labels: \n```\n") + message += "labels: \n```\n" for l in alert['labels']: message += l + " : "+alert['labels'][l] + "\n" message += "```" - bot.sendMessage(chat_id=chatID, text=message, parse_mode=telegram.ParseMode.MARKDOWN_V2) + bot.sendMessage(chat_id=chatID, text=telegram.utils.helpers.escape_markdown(message, version=2), parse_mode=telegram.ParseMode.MARKDOWN_V2) return "Alert OK", 200 except Exception as error: bot.sendMessage(chat_id=chatID, text="Error to read json: "+str(error))