diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 22eee1bf..0853625e 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -262,7 +262,7 @@ class Client: return func return decorator - + # TODO: Maybe make add_handler return (handler, group)? def add_handler(self, handler, group: int = 0): """Use this method to register an update handler. @@ -1154,7 +1154,7 @@ class Client: """ style = self.html if parse_mode.lower() == "html" else self.markdown - return self.send( + r = self.send( functions.messages.SendMessage( peer=self.resolve_peer(chat_id), no_webpage=disable_web_page_preview or None, @@ -1166,6 +1166,21 @@ class Client: ) ) + if isinstance(r, types.UpdateShortSentMessage): + return pyrogram_types.Message( + message_id=r.id, + date=r.date, + outgoing=r.out, + entities=utils.parse_entities(r.entities, {}) or None + ) + + for i in r.updates: + if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)): + users = {i.id: i for i in r.users} + chats = {i.id: i for i in r.chats} + + return utils.parse_message(self, i.message, users, chats) + def forward_messages(self, chat_id: int or str, from_chat_id: int or str,