diff --git a/docs/source/releases/changes-in-this-fork.rst b/docs/source/releases/changes-in-this-fork.rst index fa6c1d865..918747447 100644 --- a/docs/source/releases/changes-in-this-fork.rst +++ b/docs/source/releases/changes-in-this-fork.rst @@ -38,7 +38,7 @@ If you found any issue or have any suggestions, feel free to make `an issue Optional["types.Message"]: """Edit a media stored on the Telegram servers using a file_id. @@ -83,6 +86,9 @@ async def edit_cached_media( reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): An InlineKeyboardMarkup object. + business_connection_id (``str``, *optional*): + Unique identifier of the business connection on behalf of which the message to be edited was sent + Returns: :obj:`~pyrogram.types.Message`: On success, the edited media message is returned. @@ -101,7 +107,26 @@ async def edit_cached_media( invert_media=show_caption_above_media, **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) ) - r = await self.invoke(rpc) + session = None + business_connection = None + if business_connection_id: + business_connection = self.business_user_connection_cache[business_connection_id] + if not business_connection: + business_connection = await self.get_business_connection(business_connection_id) + session = await get_session( + self, + business_connection._raw.connection.dc_id + ) + if business_connection_id: + r = await session.invoke( + raw.functions.InvokeWithBusinessConnection( + query=rpc, + connection_id=business_connection_id + ) + ) + # await session.stop() + else: + r = await self.invoke(rpc) for i in r.updates: if isinstance( @@ -119,3 +144,18 @@ async def edit_cached_media( is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage), replies=self.fetch_replies ) + elif isinstance( + i, + ( + raw.types.UpdateBotEditBusinessMessage + ) + ): + return await types.Message._parse( + self, + i.message, + {i.id: i for i in r.users}, + {i.id: i for i in r.chats}, + business_connection_id=getattr(i, "connection_id", business_connection_id), + raw_reply_to_message=i.reply_to_message, + replies=0 + ) diff --git a/pyrogram/methods/messages/set_reaction.py b/pyrogram/methods/messages/set_reaction.py index c6cd91e3e..b96661ebf 100644 --- a/pyrogram/methods/messages/set_reaction.py +++ b/pyrogram/methods/messages/set_reaction.py @@ -42,9 +42,9 @@ async def set_reaction( a channel to its discussion group have the same available reactions as messages in the channel. - You must use exactly one of ``chat_id`` OR ``story_id``. + You must use exactly one of ``message_id`` OR ``story_id``. - If you specify, ``chat_id`` + If you specify, ``message_id`` .. include:: /_includes/usable-by/users-bots.rst diff --git a/pyrogram/methods/users/set_personal_chat.py b/pyrogram/methods/users/set_personal_chat.py index ce62687a7..781391672 100644 --- a/pyrogram/methods/users/set_personal_chat.py +++ b/pyrogram/methods/users/set_personal_chat.py @@ -32,7 +32,7 @@ async def set_personal_chat( .. include:: /_includes/usable-by/users.rst Parameters: - chat_id (``int`` | ``str`, *optional*): + chat_id (``int`` | ``str``, *optional*): Identifier of the new personal chat; pass None to remove the chat. Use :meth:`~pyrogram.Client.get_created_chats` with ``is_suitable_for_my_personal_chat`` to get suitable chats Returns: diff --git a/pyrogram/types/object.py b/pyrogram/types/object.py index 8eaf6aeae..2371babd3 100644 --- a/pyrogram/types/object.py +++ b/pyrogram/types/object.py @@ -60,6 +60,7 @@ def default(obj: "Object"): if isinstance(obj, datetime): return str(obj) + # TODO: #20 if not hasattr(obj, "__dict__"): return obj.__class__.__name__