Commit 0c3530f8 authored by MaksimSmile13's avatar MaksimSmile13
Browse files

TGSender fix markdown

parent 5becca72
......@@ -2,7 +2,7 @@
# ----------------------------------------------------------------------
# tgsender service
# ----------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# Copyright (C) 2007-2022 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -59,8 +59,8 @@ class TgSenderService(FastAPIService):
@staticmethod
def escape_markdown(text):
"""Helper function to escape telegram markup symbols"""
escape_chars = r"\*_`"
return re.sub(r"([%s])" % escape_chars, r"\\\1", text)
escape_chars = r"\*_`["
return re.sub(r"([%s])" % escape_chars, r"\\\1", text).replace("\\`\\`\\`", "```")
def send_tb(self, topic: str, data: str) -> None:
body_l = 3000
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment