diff --git a/pyrogram/methods/chats/unpin_all_chat_messages.py b/pyrogram/methods/chats/unpin_all_chat_messages.py index fe34bb14..ad0b0b7d 100644 --- a/pyrogram/methods/chats/unpin_all_chat_messages.py +++ b/pyrogram/methods/chats/unpin_all_chat_messages.py @@ -27,6 +27,7 @@ class UnpinAllChatMessages: async def unpin_all_chat_messages( self: "pyrogram.Client", chat_id: Union[int, str], + message_thread_id: int = None, ) -> bool: """Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have @@ -39,6 +40,9 @@ class UnpinAllChatMessages: Unique identifier (int) or username (str) of the target chat. You can also use chat public link in form of *t.me/* (str). + message_thread_id (``int``, *optional*): + Unique identifier for the target message thread of the forum topic + Returns: ``bool``: True on success. @@ -48,10 +52,10 @@ class UnpinAllChatMessages: # Unpin all chat messages await app.unpin_all_chat_messages(chat_id) """ - await self.invoke( + r = await self.invoke( raw.functions.messages.UnpinAllMessages( - peer=await self.resolve_peer(chat_id) + peer=await self.resolve_peer(chat_id), + top_msg_id=message_thread_id ) ) - - return True + return r.pts_count