diff --git a/pyrogram/client/style/html.py b/pyrogram/client/style/html.py index 63a80733..4cafeb35 100644 --- a/pyrogram/client/style/html.py +++ b/pyrogram/client/style/html.py @@ -34,8 +34,8 @@ class HTML: HTML_RE = re.compile(r"<(\w+)(?: href=([\"'])([^<]+)\2)?>([^>]+)") MENTION_RE = re.compile(r"tg://user\?id=(\d+)") - def __init__(self, peers_by_id): - self.peers_by_id = peers_by_id + def __init__(self, peers_by_id: dict = None): + self.peers_by_id = peers_by_id or {} def parse(self, text): entities = [] diff --git a/pyrogram/client/style/markdown.py b/pyrogram/client/style/markdown.py index 7a67d0ae..61b60e17 100644 --- a/pyrogram/client/style/markdown.py +++ b/pyrogram/client/style/markdown.py @@ -51,8 +51,8 @@ class Markdown: )) MENTION_RE = re.compile(r"tg://user\?id=(\d+)") - def __init__(self, peers_by_id: dict): - self.peers_by_id = peers_by_id + def __init__(self, peers_by_id: dict = None): + self.peers_by_id = peers_by_id or {} def parse(self, message: str): message = utils.add_surrogates(message).strip()