From 06685cfe15985d9e709a6ab978e94117dbdb9ec3 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 16 Apr 2018 12:03:31 +0200 Subject: [PATCH] Make edit_message_caption return the new type --- pyrogram/client/client.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 1add1790..f9bcbfa3 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -2472,12 +2472,15 @@ class Client: if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. Defaults to Markdown. + Returns: + On success, the edited :obj:`Message ` is returned. + Raises: :class:`Error ` """ style = self.html if parse_mode.lower() == "html" else self.markdown - return self.send( + r = self.send( functions.messages.EditMessage( peer=self.resolve_peer(chat_id), id=message_id, @@ -2485,6 +2488,13 @@ class Client: ) ) + for i in r.updates: + if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)): + users = {i.id: i for i in r.users} + chats = {i.id: i for i in r.chats} + + return message_parser.parse_message(self, i.message, users, chats) + def delete_messages(self, chat_id: int or str, message_ids: list,