From b74a8eba5e02390f58375590c7a73dbc234b07f3 Mon Sep 17 00:00:00 2001 From: ColinShark Date: Tue, 20 Aug 2019 10:12:55 +0200 Subject: [PATCH 1/3] Add bound method for get_common_chats (#305) --- pyrogram/client/types/user_and_chats/user.py | 51 ++++++++++++++------ 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/pyrogram/client/types/user_and_chats/user.py b/pyrogram/client/types/user_and_chats/user.py index 783c0566..2be1f561 100644 --- a/pyrogram/client/types/user_and_chats/user.py +++ b/pyrogram/client/types/user_and_chats/user.py @@ -279,21 +279,21 @@ class User(Object, Update): def block(self): """Bound method *block* of :obj:`User`. - + Use as a shortcut for: - + .. code-block:: python - + client.block_user(123456789) - + Example: .. code-block:: python - + user.block() - + Returns: True on success. - + Raises: RPCError: In case of a Telegram RPC error. """ @@ -302,23 +302,46 @@ class User(Object, Update): def unblock(self): """Bound method *unblock* of :obj:`User`. - + Use as a shortcut for: - + .. code-block:: python - + client.unblock_user(123456789) - + Example: .. code-block:: python - + user.unblock() - + Returns: True on success. - + Raises: RPCError: In case of a Telegram RPC error. """ return self._client.unblock_user(self.id) + + def get_common_chats(self): + """Bound method *get_common_chats* of :obj:`User`. + + Use as a shortcut for: + + .. code-block:: python + + client.get_common_chats(123456789) + + Example: + .. code-block:: python + + user.get_common_chats() + + Returns: + True on success. + + Raises: + RPCError: In case of a Telegram RPC error. + """ + + return self._client.get_common_chats(self.id) From 310810c32023f5434d0173da6660943af7cc3f0c Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 28 Aug 2019 13:55:11 +0200 Subject: [PATCH 2/3] Fix Message.click default parameters --- pyrogram/client/types/messages_and_media/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 7616a6ec..0052e86d 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -2743,7 +2743,7 @@ class Message(Object, Update): revoke=revoke ) - def click(self, x: int or str, y: int = 0, quote: bool = None, timeout: int = 10): + def click(self, x: int or str = 0, y: int = None, quote: bool = None, timeout: int = 10): """Bound method *click* of :obj:`Message`. Use as a shortcut for clicking a button attached to the message instead of: From d15d38ba526d8b8d4d64ab46a21e52775b24a2bf Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Tue, 3 Sep 2019 15:45:47 +0200 Subject: [PATCH 3/3] Don't pass the client to progress callbacks anymore --- pyrogram/client/client.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 8b8f58f3..2d313229 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1677,7 +1677,7 @@ class Client(Methods, BaseClient): file_part += 1 if progress: - progress(self, min(file_part * part_size, file_size), file_size, *progress_args) + progress(min(file_part * part_size, file_size), file_size, *progress_args) except Client.StopTransmission: raise except Exception as e: @@ -1808,7 +1808,6 @@ class Client(Methods, BaseClient): if progress: progress( - self, min(offset, file_size) if file_size != 0 else offset, @@ -1891,7 +1890,6 @@ class Client(Methods, BaseClient): if progress: progress( - self, min(offset, file_size) if file_size != 0 else offset,