diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 980fb2ff..8194c7d2 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -397,19 +397,14 @@ class Client: disable_web_page_preview: bool = None, disable_notification: bool = None, reply_to_msg_id: int = None): - # TODO: Resolve usernames when they don't exists yet (contacts.ResolveUsername) - - text, entities = Markdown.parse(text) - return self.send( functions.messages.SendMessage( peer=self.resolve_peer(chat_id), - message=text, no_webpage=disable_web_page_preview or None, silent=disable_notification or None, reply_to_msg_id=reply_to_msg_id, - entities=entities, random_id=self.rnd_id(), + **Markdown.parse(text) ) ) @@ -470,7 +465,10 @@ class Client: ) ) - def send_chat_action(self, chat_id: int or str, action: str, progress: int = 0): + def send_chat_action(self, + chat_id: int or str, + action: str, + progress: int = 0): return self.send( functions.messages.SetTyping( peer=self.resolve_peer(chat_id), @@ -480,7 +478,11 @@ class Client: ) ) - def edit_message_text(self, chat_id: int or str, message_id: int, text: str, disable_web_page_preview: bool = None): + def edit_message_text(self, + chat_id: int or str, + message_id: int, + text: str, + disable_web_page_preview: bool = None): return self.send( functions.messages.EditMessage( peer=self.resolve_peer(chat_id), diff --git a/pyrogram/extensions/markdown.py b/pyrogram/extensions/markdown.py index 5ae51702..2e1c757f 100644 --- a/pyrogram/extensions/markdown.py +++ b/pyrogram/extensions/markdown.py @@ -117,4 +117,7 @@ class Markdown: entities.append(entity) text = text.replace(pattern, replace) - return cls.remove_surrogates(text), entities + return dict( + message=cls.remove_surrogates(text), + entities=entities + )