From 27d10b04c0953c4718ac10ad93f2f3dd2b9f4433 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 2 Nov 2018 10:23:41 +0100 Subject: [PATCH 1/4] Update dev version --- pyrogram/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py index 12f181c3..e8e564cf 100644 --- a/pyrogram/__init__.py +++ b/pyrogram/__init__.py @@ -23,7 +23,7 @@ __copyright__ = "Copyright (C) 2017-2018 Dan Tès Date: Fri, 2 Nov 2018 10:26:59 +0100 Subject: [PATCH 2/4] Reformat code --- pyrogram/client/types/user_and_chats/__init__.py | 2 +- pyrogram/connection/transport/tcp/tcp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/types/user_and_chats/__init__.py b/pyrogram/client/types/user_and_chats/__init__.py index f4742d83..0f814b92 100644 --- a/pyrogram/client/types/user_and_chats/__init__.py +++ b/pyrogram/client/types/user_and_chats/__init__.py @@ -22,5 +22,5 @@ from .chat_members import ChatMembers from .chat_photo import ChatPhoto from .dialog import Dialog from .dialogs import Dialogs -from .user_status import UserStatus from .user import User +from .user_status import UserStatus diff --git a/pyrogram/connection/transport/tcp/tcp.py b/pyrogram/connection/transport/tcp/tcp.py index 2ee08d09..4d8d4a58 100644 --- a/pyrogram/connection/transport/tcp/tcp.py +++ b/pyrogram/connection/transport/tcp/tcp.py @@ -16,9 +16,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import ipaddress import logging import socket -import ipaddress try: import socks From 45129658b0c8eb69a29c92a91e4eb56fe535d210 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 3 Nov 2018 10:49:11 +0100 Subject: [PATCH 3/4] Revisit docstrings --- pyrogram/client/client.py | 17 +++--- .../methods/bots/answer_callback_query.py | 6 +++ .../methods/bots/get_inline_bot_results.py | 4 +- .../methods/bots/request_callback_answer.py | 4 +- .../methods/bots/send_inline_bot_result.py | 2 +- .../client/methods/chats/delete_chat_photo.py | 4 +- .../methods/chats/export_chat_invite_link.py | 2 +- pyrogram/client/methods/chats/get_chat.py | 2 +- .../client/methods/chats/get_chat_member.py | 2 +- .../client/methods/chats/get_chat_members.py | 14 +++-- .../methods/chats/get_chat_members_count.py | 4 +- pyrogram/client/methods/chats/get_dialogs.py | 2 +- pyrogram/client/methods/chats/join_chat.py | 2 +- .../client/methods/chats/kick_chat_member.py | 2 +- pyrogram/client/methods/chats/leave_chat.py | 2 +- .../client/methods/chats/pin_chat_message.py | 4 +- .../methods/chats/promote_chat_member.py | 2 +- .../methods/chats/restrict_chat_member.py | 2 +- .../methods/chats/set_chat_description.py | 4 +- .../client/methods/chats/set_chat_photo.py | 4 +- .../client/methods/chats/set_chat_title.py | 4 +- .../client/methods/chats/unban_chat_member.py | 2 +- .../methods/chats/unpin_chat_message.py | 4 +- .../client/methods/contacts/add_contacts.py | 2 +- .../methods/contacts/delete_contacts.py | 2 +- .../client/methods/contacts/get_contacts.py | 2 +- .../methods/messages/delete_messages.py | 2 +- .../methods/messages/edit_message_caption.py | 2 +- .../methods/messages/edit_message_media.py | 6 +++ .../messages/edit_message_reply_markup.py | 2 +- .../methods/messages/edit_message_text.py | 2 +- .../methods/messages/forward_messages.py | 2 +- .../client/methods/messages/get_history.py | 2 +- .../client/methods/messages/get_messages.py | 2 +- .../client/methods/messages/send_animation.py | 2 +- .../client/methods/messages/send_audio.py | 2 +- .../methods/messages/send_chat_action.py | 4 +- .../client/methods/messages/send_contact.py | 2 +- .../client/methods/messages/send_document.py | 2 +- .../client/methods/messages/send_location.py | 2 +- .../client/methods/messages/send_message.py | 2 +- .../client/methods/messages/send_photo.py | 2 +- .../client/methods/messages/send_sticker.py | 2 +- .../client/methods/messages/send_venue.py | 2 +- .../client/methods/messages/send_video.py | 2 +- .../methods/messages/send_video_note.py | 2 +- .../client/methods/messages/send_voice.py | 2 +- .../methods/password/change_cloud_password.py | 2 +- .../methods/password/enable_cloud_password.py | 2 +- .../methods/password/remove_cloud_password.py | 2 +- .../users/delete_user_profile_photos.py | 2 +- pyrogram/client/methods/users/get_me.py | 2 +- .../methods/users/get_user_profile_photos.py | 2 +- pyrogram/client/methods/users/get_users.py | 2 +- .../methods/users/set_user_profile_photo.py | 2 +- .../methods/utilities/download_media.py | 4 +- pyrogram/client/types/bots/callback_query.py | 4 +- .../types/bots/inline_keyboard_button.py | 18 +++---- .../types/bots/inline_keyboard_markup.py | 2 +- .../types/bots/reply_keyboard_markup.py | 4 +- .../types/messages_and_media/animation.py | 2 +- .../types/messages_and_media/contact.py | 2 +- .../types/messages_and_media/message.py | 54 +++++++++---------- .../client/types/messages_and_media/photo.py | 2 +- .../types/messages_and_media/sticker.py | 4 +- .../client/types/user_and_chats/dialog.py | 2 +- .../types/user_and_chats/user_status.py | 2 +- 67 files changed, 140 insertions(+), 125 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 9b45e941..0a973788 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -147,7 +147,7 @@ class Client(Methods, BaseClient): plugins_dir (``str``, *optional*): Define a custom directory for your plugins. The plugins directory is the location in your filesystem where Pyrogram will automatically load your update handlers. - Defaults to "./plugins". Set to None to completely disable plugins. + Defaults to None (plugins disabled). """ def __init__(self, @@ -218,7 +218,8 @@ class Client(Methods, BaseClient): Requires no parameters. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. + ``ConnectionError`` in case you try to start an already started Client. """ if self.is_started: raise ConnectionError("Client has already been started") @@ -296,6 +297,9 @@ class Client(Methods, BaseClient): def stop(self): """Use this method to manually stop the Client. Requires no parameters. + + Raises: + ``ConnectionError`` in case you try to stop an already stopped Client. """ if not self.is_started: raise ConnectionError("Client is already stopped") @@ -355,7 +359,7 @@ class Client(Methods, BaseClient): Requires no parameters. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ self.start() self.idle() @@ -887,7 +891,7 @@ class Client(Methods, BaseClient): Args: data (``Object``): - The API Scheme function filled with proper arguments. + The API Schema function filled with proper arguments. retries (``int``): Number of retries. @@ -896,7 +900,7 @@ class Client(Methods, BaseClient): Timeout in seconds. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ if not self.is_started: raise ConnectionError("Client has not been started") @@ -1085,7 +1089,8 @@ class Client(Methods, BaseClient): On success, the resolved peer id is returned in form of an InputPeer object. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. + ``KeyError`` in case the peer doesn't exist in the internal database. """ if type(peer_id) is str: if peer_id in ("self", "me"): diff --git a/pyrogram/client/methods/bots/answer_callback_query.py b/pyrogram/client/methods/bots/answer_callback_query.py index 64951692..00e437b1 100644 --- a/pyrogram/client/methods/bots/answer_callback_query.py +++ b/pyrogram/client/methods/bots/answer_callback_query.py @@ -50,6 +50,12 @@ class AnswerCallbackQuery(BaseClient): cache_time (``int``): The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. + + Returns: + True, on success. + + Raises: + :class:`Error ` in case of a Telegram RPC error. """ return self.send( functions.messages.SetBotCallbackAnswer( diff --git a/pyrogram/client/methods/bots/get_inline_bot_results.py b/pyrogram/client/methods/bots/get_inline_bot_results.py index a43eb6c1..cb931d49 100644 --- a/pyrogram/client/methods/bots/get_inline_bot_results.py +++ b/pyrogram/client/methods/bots/get_inline_bot_results.py @@ -54,8 +54,8 @@ class GetInlineBotResults(BaseClient): On Success, :obj:`BotResults ` is returned. Raises: - :class:`Error ` - ``TimeoutError``: If the bot fails to answer within 10 seconds + :class:`Error ` in case of a Telegram RPC error. + ``TimeoutError`` if the bot fails to answer within 10 seconds """ # TODO: Don't return the raw type diff --git a/pyrogram/client/methods/bots/request_callback_answer.py b/pyrogram/client/methods/bots/request_callback_answer.py index b242f4af..c2c7e312 100644 --- a/pyrogram/client/methods/bots/request_callback_answer.py +++ b/pyrogram/client/methods/bots/request_callback_answer.py @@ -45,8 +45,8 @@ class RequestCallbackAnswer(BaseClient): or as an alert. Raises: - :class:`Error ` - ``TimeoutError``: If the bot fails to answer within 10 seconds + :class:`Error ` in case of a Telegram RPC error. + ``TimeoutError`` if the bot fails to answer within 10 seconds. """ return self.send( functions.messages.GetBotCallbackAnswer( diff --git a/pyrogram/client/methods/bots/send_inline_bot_result.py b/pyrogram/client/methods/bots/send_inline_bot_result.py index bdfcc65c..97ea2a4a 100644 --- a/pyrogram/client/methods/bots/send_inline_bot_result.py +++ b/pyrogram/client/methods/bots/send_inline_bot_result.py @@ -53,7 +53,7 @@ class SendInlineBotResult(BaseClient): On success, the sent Message is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ return self.send( functions.messages.SendInlineBotResult( diff --git a/pyrogram/client/methods/chats/delete_chat_photo.py b/pyrogram/client/methods/chats/delete_chat_photo.py index 31e02923..5a1fe74e 100644 --- a/pyrogram/client/methods/chats/delete_chat_photo.py +++ b/pyrogram/client/methods/chats/delete_chat_photo.py @@ -38,8 +38,8 @@ class DeleteChatPhoto(BaseClient): True on success. Raises: - :class:`Error ` - ``ValueError``: If a chat_id belongs to user. + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if a chat_id belongs to user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/export_chat_invite_link.py b/pyrogram/client/methods/chats/export_chat_invite_link.py index dc289af3..4972493b 100644 --- a/pyrogram/client/methods/chats/export_chat_invite_link.py +++ b/pyrogram/client/methods/chats/export_chat_invite_link.py @@ -35,7 +35,7 @@ class ExportChatInviteLink(BaseClient): On success, the exported invite link as string is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/get_chat.py b/pyrogram/client/methods/chats/get_chat.py index 5cb22db1..8e41695a 100644 --- a/pyrogram/client/methods/chats/get_chat.py +++ b/pyrogram/client/methods/chats/get_chat.py @@ -33,7 +33,7 @@ class GetChat(BaseClient): On success, a :obj:`Chat ` object is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/get_chat_member.py b/pyrogram/client/methods/chats/get_chat_member.py index 51e07f91..b9b23e54 100644 --- a/pyrogram/client/methods/chats/get_chat_member.py +++ b/pyrogram/client/methods/chats/get_chat_member.py @@ -39,7 +39,7 @@ class GetChatMember(BaseClient): On success, a :obj:`ChatMember ` object is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ chat_id = self.resolve_peer(chat_id) user_id = self.resolve_peer(user_id) diff --git a/pyrogram/client/methods/chats/get_chat_members.py b/pyrogram/client/methods/chats/get_chat_members.py index 818c667e..5952a39d 100644 --- a/pyrogram/client/methods/chats/get_chat_members.py +++ b/pyrogram/client/methods/chats/get_chat_members.py @@ -39,7 +39,7 @@ class GetChatMembers(BaseClient): """Use this method to get the members list of a chat. A chat can be either a basic group, a supergroup or a channel. - You must be admin to retrieve the members (also known as "subscribers") list of a channel. + You must be admin to retrieve the members list of a channel (also known as "subscribers"). Args: chat_id (``int`` | ``str``): @@ -51,7 +51,7 @@ class GetChatMembers(BaseClient): limit (``int``, *optional*): Limits the number of members to be retrieved. - Defaults to 200, which is also the maximum limit allowed per method call. + Defaults to 200, which is also the maximum server limit allowed per method call. query (``str``, *optional*): Query string to filter members based on their display names and usernames. @@ -68,9 +68,17 @@ class GetChatMembers(BaseClient): *"administrators"* - chat administrators only. Defaults to *"all"*. - .. [1] On supergroups and channels you can get up to 10,000 members for a single query string. + .. [1] Server limit: on supergroups, you can get up to 10,000 members for a single query and up to 200 members + on channels. .. [2] A query string is applicable only for *"all"*, *"kicked"* and *"restricted"* filters only. + + Returns: + On success, a :obj:`ChatMembers` object is returned. + + Raises: + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if you used an invalid filter or a chat_id that belongs to a user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/get_chat_members_count.py b/pyrogram/client/methods/chats/get_chat_members_count.py index 41650bdd..ec5aaae0 100644 --- a/pyrogram/client/methods/chats/get_chat_members_count.py +++ b/pyrogram/client/methods/chats/get_chat_members_count.py @@ -32,8 +32,8 @@ class GetChatMembersCount(BaseClient): On success, an integer is returned. Raises: - :class:`Error ` - ``ValueError``: If a chat_id belongs to user. + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if a chat_id belongs to user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/get_dialogs.py b/pyrogram/client/methods/chats/get_dialogs.py index e22f7e2f..045c541a 100644 --- a/pyrogram/client/methods/chats/get_dialogs.py +++ b/pyrogram/client/methods/chats/get_dialogs.py @@ -47,7 +47,7 @@ class GetDialogs(BaseClient): On success, a :obj:`Dialogs` object is returned. Raises: - :class:`Error` + :class:`Error ` in case of a Telegram RPC error. """ if pinned_only: diff --git a/pyrogram/client/methods/chats/join_chat.py b/pyrogram/client/methods/chats/join_chat.py index b7b8d42c..f5e3953c 100644 --- a/pyrogram/client/methods/chats/join_chat.py +++ b/pyrogram/client/methods/chats/join_chat.py @@ -30,7 +30,7 @@ class JoinChat(BaseClient): channel/supergroup (in the format @username). Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ match = self.INVITE_LINK_RE.match(chat_id) diff --git a/pyrogram/client/methods/chats/kick_chat_member.py b/pyrogram/client/methods/chats/kick_chat_member.py index e0efa722..5bac80b8 100644 --- a/pyrogram/client/methods/chats/kick_chat_member.py +++ b/pyrogram/client/methods/chats/kick_chat_member.py @@ -53,7 +53,7 @@ class KickChatMember(BaseClient): True on success. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ chat_peer = self.resolve_peer(chat_id) user_peer = self.resolve_peer(user_id) diff --git a/pyrogram/client/methods/chats/leave_chat.py b/pyrogram/client/methods/chats/leave_chat.py index 55d6ef21..8f070b82 100644 --- a/pyrogram/client/methods/chats/leave_chat.py +++ b/pyrogram/client/methods/chats/leave_chat.py @@ -33,7 +33,7 @@ class LeaveChat(BaseClient): Deletes the group chat dialog after leaving (for simple group chats, not supergroups). Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/pin_chat_message.py b/pyrogram/client/methods/chats/pin_chat_message.py index eb653f3c..de7e69d4 100644 --- a/pyrogram/client/methods/chats/pin_chat_message.py +++ b/pyrogram/client/methods/chats/pin_chat_message.py @@ -41,8 +41,8 @@ class PinChatMessage(BaseClient): True on success. Raises: - :class:`Error ` - ``ValueError``: If a chat_id doesn't belong to a supergroup or a channel. + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if a chat_id doesn't belong to a supergroup or a channel. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/promote_chat_member.py b/pyrogram/client/methods/chats/promote_chat_member.py index adff4605..9db7709b 100644 --- a/pyrogram/client/methods/chats/promote_chat_member.py +++ b/pyrogram/client/methods/chats/promote_chat_member.py @@ -74,7 +74,7 @@ class PromoteChatMember(BaseClient): True on success. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ self.send( functions.channels.EditAdmin( diff --git a/pyrogram/client/methods/chats/restrict_chat_member.py b/pyrogram/client/methods/chats/restrict_chat_member.py index fb11a989..35db5e59 100644 --- a/pyrogram/client/methods/chats/restrict_chat_member.py +++ b/pyrogram/client/methods/chats/restrict_chat_member.py @@ -64,7 +64,7 @@ class RestrictChatMember(BaseClient): True on success. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ send_messages = True send_media = True diff --git a/pyrogram/client/methods/chats/set_chat_description.py b/pyrogram/client/methods/chats/set_chat_description.py index f9b5c7a2..5f5ead7f 100644 --- a/pyrogram/client/methods/chats/set_chat_description.py +++ b/pyrogram/client/methods/chats/set_chat_description.py @@ -36,8 +36,8 @@ class SetChatDescription(BaseClient): True on success. Raises: - :class:`Error ` - ``ValueError``: If a chat_id doesn't belong to a supergroup or a channel. + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if a chat_id doesn't belong to a supergroup or a channel. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/set_chat_photo.py b/pyrogram/client/methods/chats/set_chat_photo.py index 224a8d99..51045a8a 100644 --- a/pyrogram/client/methods/chats/set_chat_photo.py +++ b/pyrogram/client/methods/chats/set_chat_photo.py @@ -45,8 +45,8 @@ class SetChatPhoto(BaseClient): True on success. Raises: - :class:`Error ` - ``ValueError``: If a chat_id belongs to user. + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if a chat_id belongs to user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/set_chat_title.py b/pyrogram/client/methods/chats/set_chat_title.py index 98da8737..c7176c82 100644 --- a/pyrogram/client/methods/chats/set_chat_title.py +++ b/pyrogram/client/methods/chats/set_chat_title.py @@ -41,8 +41,8 @@ class SetChatTitle(BaseClient): True on success. Raises: - :class:`Error ` - ``ValueError``: If a chat_id belongs to user. + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if a chat_id belongs to user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/unban_chat_member.py b/pyrogram/client/methods/chats/unban_chat_member.py index e191a0b7..c8b20131 100644 --- a/pyrogram/client/methods/chats/unban_chat_member.py +++ b/pyrogram/client/methods/chats/unban_chat_member.py @@ -40,7 +40,7 @@ class UnbanChatMember(BaseClient): True on success. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ self.send( functions.channels.EditBanned( diff --git a/pyrogram/client/methods/chats/unpin_chat_message.py b/pyrogram/client/methods/chats/unpin_chat_message.py index 4b0ee46b..9bbb1021 100644 --- a/pyrogram/client/methods/chats/unpin_chat_message.py +++ b/pyrogram/client/methods/chats/unpin_chat_message.py @@ -34,8 +34,8 @@ class UnpinChatMessage(BaseClient): True on success. Raises: - :class:`Error ` - ``ValueError``: If a chat_id doesn't belong to a supergroup or a channel. + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if a chat_id doesn't belong to a supergroup or a channel. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/contacts/add_contacts.py b/pyrogram/client/methods/contacts/add_contacts.py index 10b5e415..3a1dcc92 100644 --- a/pyrogram/client/methods/contacts/add_contacts.py +++ b/pyrogram/client/methods/contacts/add_contacts.py @@ -32,7 +32,7 @@ class AddContacts(BaseClient): On success, the added contacts are returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ imported_contacts = self.send( functions.contacts.ImportContacts( diff --git a/pyrogram/client/methods/contacts/delete_contacts.py b/pyrogram/client/methods/contacts/delete_contacts.py index ed3d67f9..74f08dd1 100644 --- a/pyrogram/client/methods/contacts/delete_contacts.py +++ b/pyrogram/client/methods/contacts/delete_contacts.py @@ -34,7 +34,7 @@ class DeleteContacts(BaseClient): True on success. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ contacts = [] diff --git a/pyrogram/client/methods/contacts/get_contacts.py b/pyrogram/client/methods/contacts/get_contacts.py index 376e8be2..c8f903ce 100644 --- a/pyrogram/client/methods/contacts/get_contacts.py +++ b/pyrogram/client/methods/contacts/get_contacts.py @@ -36,7 +36,7 @@ class GetContacts(BaseClient): On success, the user's contacts are returned Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ while True: try: diff --git a/pyrogram/client/methods/messages/delete_messages.py b/pyrogram/client/methods/messages/delete_messages.py index 8932a699..f824a4b6 100644 --- a/pyrogram/client/methods/messages/delete_messages.py +++ b/pyrogram/client/methods/messages/delete_messages.py @@ -53,7 +53,7 @@ class DeleteMessages(BaseClient): True on success. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ peer = self.resolve_peer(chat_id) message_ids = list(message_ids) if not isinstance(message_ids, int) else [message_ids] diff --git a/pyrogram/client/methods/messages/edit_message_caption.py b/pyrogram/client/methods/messages/edit_message_caption.py index a83c670e..0e12f72b 100644 --- a/pyrogram/client/methods/messages/edit_message_caption.py +++ b/pyrogram/client/methods/messages/edit_message_caption.py @@ -53,7 +53,7 @@ class EditMessageCaption(BaseClient): On success, the edited :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/edit_message_media.py b/pyrogram/client/methods/messages/edit_message_media.py index 74778865..ccbacac7 100644 --- a/pyrogram/client/methods/messages/edit_message_media.py +++ b/pyrogram/client/methods/messages/edit_message_media.py @@ -57,6 +57,12 @@ class EditMessageMedia(BaseClient): reply_markup (:obj:`InlineKeyboardMarkup`, *optional*): An InlineKeyboardMarkup object. + + Returns: + On success, the edited :obj:`Message ` is returned. + + Raises: + :class:`Error ` in case of a Telegram RPC error. """ style = self.html if media.parse_mode.lower() == "html" else self.markdown caption = media.caption diff --git a/pyrogram/client/methods/messages/edit_message_reply_markup.py b/pyrogram/client/methods/messages/edit_message_reply_markup.py index 6d846ca4..72796306 100644 --- a/pyrogram/client/methods/messages/edit_message_reply_markup.py +++ b/pyrogram/client/methods/messages/edit_message_reply_markup.py @@ -44,7 +44,7 @@ class EditMessageReplyMarkup(BaseClient): :obj:`Message ` is returned, otherwise True is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ r = self.send( diff --git a/pyrogram/client/methods/messages/edit_message_text.py b/pyrogram/client/methods/messages/edit_message_text.py index 379a1988..144f5413 100644 --- a/pyrogram/client/methods/messages/edit_message_text.py +++ b/pyrogram/client/methods/messages/edit_message_text.py @@ -57,7 +57,7 @@ class EditMessageText(BaseClient): On success, the edited :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/forward_messages.py b/pyrogram/client/methods/messages/forward_messages.py index 2b24aadf..a8783044 100644 --- a/pyrogram/client/methods/messages/forward_messages.py +++ b/pyrogram/client/methods/messages/forward_messages.py @@ -54,7 +54,7 @@ class ForwardMessages(BaseClient): is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ is_iterable = not isinstance(message_ids, int) message_ids = list(message_ids) if is_iterable else [message_ids] diff --git a/pyrogram/client/methods/messages/get_history.py b/pyrogram/client/methods/messages/get_history.py index 66949a1c..017c7f8b 100644 --- a/pyrogram/client/methods/messages/get_history.py +++ b/pyrogram/client/methods/messages/get_history.py @@ -56,7 +56,7 @@ class GetHistory(BaseClient): On success, a :obj:`Messages ` object is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ r = self.send( diff --git a/pyrogram/client/methods/messages/get_messages.py b/pyrogram/client/methods/messages/get_messages.py index e65ce128..7411e22f 100644 --- a/pyrogram/client/methods/messages/get_messages.py +++ b/pyrogram/client/methods/messages/get_messages.py @@ -54,7 +54,7 @@ class GetMessages(BaseClient): :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ ids, ids_type = ( (message_ids, types.InputMessageID) if message_ids diff --git a/pyrogram/client/methods/messages/send_animation.py b/pyrogram/client/methods/messages/send_animation.py index 39bfb27f..dbd29575 100644 --- a/pyrogram/client/methods/messages/send_animation.py +++ b/pyrogram/client/methods/messages/send_animation.py @@ -116,7 +116,7 @@ class SendAnimation(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_audio.py b/pyrogram/client/methods/messages/send_audio.py index 124f3bb3..613ec90c 100644 --- a/pyrogram/client/methods/messages/send_audio.py +++ b/pyrogram/client/methods/messages/send_audio.py @@ -118,7 +118,7 @@ class SendAudio(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_chat_action.py b/pyrogram/client/methods/messages/send_chat_action.py index 1117a2dd..c519f67b 100644 --- a/pyrogram/client/methods/messages/send_chat_action.py +++ b/pyrogram/client/methods/messages/send_chat_action.py @@ -47,8 +47,8 @@ class SendChatAction(BaseClient): On success, True is returned. Raises: - :class:`Error ` - ``ValueError``: If the provided string is not a valid ChatAction + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if the provided string is not a valid ChatAction. """ # Resolve Enum type diff --git a/pyrogram/client/methods/messages/send_contact.py b/pyrogram/client/methods/messages/send_contact.py index f661a31f..b40321be 100644 --- a/pyrogram/client/methods/messages/send_contact.py +++ b/pyrogram/client/methods/messages/send_contact.py @@ -65,7 +65,7 @@ class SendContact(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ r = self.send( functions.messages.SendMedia( diff --git a/pyrogram/client/methods/messages/send_document.py b/pyrogram/client/methods/messages/send_document.py index 7cab15a5..f3f52178 100644 --- a/pyrogram/client/methods/messages/send_document.py +++ b/pyrogram/client/methods/messages/send_document.py @@ -104,7 +104,7 @@ class SendDocument(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_location.py b/pyrogram/client/methods/messages/send_location.py index 49a41256..2bd3eff3 100644 --- a/pyrogram/client/methods/messages/send_location.py +++ b/pyrogram/client/methods/messages/send_location.py @@ -57,7 +57,7 @@ class SendLocation(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ r = self.send( functions.messages.SendMedia( diff --git a/pyrogram/client/methods/messages/send_message.py b/pyrogram/client/methods/messages/send_message.py index 00087307..2ad4b8e4 100644 --- a/pyrogram/client/methods/messages/send_message.py +++ b/pyrogram/client/methods/messages/send_message.py @@ -64,7 +64,7 @@ class SendMessage(BaseClient): On success, the sent :obj:`Message` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_photo.py b/pyrogram/client/methods/messages/send_photo.py index c8a74598..7f0c2d07 100644 --- a/pyrogram/client/methods/messages/send_photo.py +++ b/pyrogram/client/methods/messages/send_photo.py @@ -102,7 +102,7 @@ class SendPhoto(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_sticker.py b/pyrogram/client/methods/messages/send_sticker.py index 9f1f64da..0b8f8073 100644 --- a/pyrogram/client/methods/messages/send_sticker.py +++ b/pyrogram/client/methods/messages/send_sticker.py @@ -86,7 +86,7 @@ class SendSticker(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ file = None diff --git a/pyrogram/client/methods/messages/send_venue.py b/pyrogram/client/methods/messages/send_venue.py index 3decd5fb..30b848ea 100644 --- a/pyrogram/client/methods/messages/send_venue.py +++ b/pyrogram/client/methods/messages/send_venue.py @@ -74,7 +74,7 @@ class SendVenue(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ r = self.send( functions.messages.SendMedia( diff --git a/pyrogram/client/methods/messages/send_video.py b/pyrogram/client/methods/messages/send_video.py index d58d1851..e8e4627a 100644 --- a/pyrogram/client/methods/messages/send_video.py +++ b/pyrogram/client/methods/messages/send_video.py @@ -120,7 +120,7 @@ class SendVideo(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_video_note.py b/pyrogram/client/methods/messages/send_video_note.py index 6da1962a..de539a81 100644 --- a/pyrogram/client/methods/messages/send_video_note.py +++ b/pyrogram/client/methods/messages/send_video_note.py @@ -102,7 +102,7 @@ class SendVideoNote(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ file = None diff --git a/pyrogram/client/methods/messages/send_voice.py b/pyrogram/client/methods/messages/send_voice.py index a3a35b8f..4be702d0 100644 --- a/pyrogram/client/methods/messages/send_voice.py +++ b/pyrogram/client/methods/messages/send_voice.py @@ -101,7 +101,7 @@ class SendVoice(BaseClient): On success, the sent :obj:`Message ` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/password/change_cloud_password.py b/pyrogram/client/methods/password/change_cloud_password.py index 045a0cc9..4b5e86b3 100644 --- a/pyrogram/client/methods/password/change_cloud_password.py +++ b/pyrogram/client/methods/password/change_cloud_password.py @@ -41,7 +41,7 @@ class ChangeCloudPassword(BaseClient): True on success, False otherwise. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ r = self.send(functions.account.GetPassword()) diff --git a/pyrogram/client/methods/password/enable_cloud_password.py b/pyrogram/client/methods/password/enable_cloud_password.py index 639879cb..80d527c4 100644 --- a/pyrogram/client/methods/password/enable_cloud_password.py +++ b/pyrogram/client/methods/password/enable_cloud_password.py @@ -43,7 +43,7 @@ class EnableCloudPassword(BaseClient): True on success, False otherwise. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ r = self.send(functions.account.GetPassword()) diff --git a/pyrogram/client/methods/password/remove_cloud_password.py b/pyrogram/client/methods/password/remove_cloud_password.py index bfbb2c8b..5a9875ff 100644 --- a/pyrogram/client/methods/password/remove_cloud_password.py +++ b/pyrogram/client/methods/password/remove_cloud_password.py @@ -34,7 +34,7 @@ class RemoveCloudPassword(BaseClient): True on success, False otherwise. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ r = self.send(functions.account.GetPassword()) diff --git a/pyrogram/client/methods/users/delete_user_profile_photos.py b/pyrogram/client/methods/users/delete_user_profile_photos.py index 58c2deb4..6f13e17f 100644 --- a/pyrogram/client/methods/users/delete_user_profile_photos.py +++ b/pyrogram/client/methods/users/delete_user_profile_photos.py @@ -36,7 +36,7 @@ class DeleteUserProfilePhotos(BaseClient): True on success. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ id = id if isinstance(id, list) else [id] input_photos = [] diff --git a/pyrogram/client/methods/users/get_me.py b/pyrogram/client/methods/users/get_me.py index 80ee65e9..009ef71e 100644 --- a/pyrogram/client/methods/users/get_me.py +++ b/pyrogram/client/methods/users/get_me.py @@ -28,7 +28,7 @@ class GetMe(BaseClient): Basic information about the user or bot in form of a :obj:`User` object Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ return utils.parse_user( self.send( diff --git a/pyrogram/client/methods/users/get_user_profile_photos.py b/pyrogram/client/methods/users/get_user_profile_photos.py index 127ad232..552ebb9a 100644 --- a/pyrogram/client/methods/users/get_user_profile_photos.py +++ b/pyrogram/client/methods/users/get_user_profile_photos.py @@ -45,7 +45,7 @@ class GetUserProfilePhotos(BaseClient): On success, a :obj:`UserProfilePhotos` object is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ return utils.parse_profile_photos( self.send( diff --git a/pyrogram/client/methods/users/get_users.py b/pyrogram/client/methods/users/get_users.py index 400e35a1..70c62568 100644 --- a/pyrogram/client/methods/users/get_users.py +++ b/pyrogram/client/methods/users/get_users.py @@ -37,7 +37,7 @@ class GetUsers(BaseClient): *user_ids* was an integer, the single requested :obj:`User` is returned. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ is_iterable = not isinstance(user_ids, (int, str)) user_ids = list(user_ids) if is_iterable else [user_ids] diff --git a/pyrogram/client/methods/users/set_user_profile_photo.py b/pyrogram/client/methods/users/set_user_profile_photo.py index b107a968..b3ab66b1 100644 --- a/pyrogram/client/methods/users/set_user_profile_photo.py +++ b/pyrogram/client/methods/users/set_user_profile_photo.py @@ -36,7 +36,7 @@ class SetUserProfilePhoto(BaseClient): True on success. Raises: - :class:`Error ` + :class:`Error ` in case of a Telegram RPC error. """ return bool( diff --git a/pyrogram/client/methods/utilities/download_media.py b/pyrogram/client/methods/utilities/download_media.py index 26918f27..1453539c 100644 --- a/pyrogram/client/methods/utilities/download_media.py +++ b/pyrogram/client/methods/utilities/download_media.py @@ -73,8 +73,8 @@ class DownloadMedia(BaseClient): On success, the absolute path of the downloaded file as string is returned, None otherwise. Raises: - :class:`Error ` - ``ValueError``: If the message doesn't contain any downloadable media + :class:`Error ` in case of a Telegram RPC error. + ``ValueError`` if the message doesn't contain any downloadable media """ error_message = "This message doesn't contain any downloadable media" diff --git a/pyrogram/client/types/bots/callback_query.py b/pyrogram/client/types/bots/callback_query.py index 083ab58a..843a9bb8 100644 --- a/pyrogram/client/types/bots/callback_query.py +++ b/pyrogram/client/types/bots/callback_query.py @@ -73,7 +73,9 @@ class CallbackQuery(Object): self.game_short_name = game_short_name # flags.3?string def answer(self, text: str = None, show_alert: bool = None, url: str = None, cache_time: int = 0): - """Use this method as a shortcut for: + """Bound method *answer* of :obj:`CallbackQuery `. + + Use this method as a shortcut for: .. code-block:: python diff --git a/pyrogram/client/types/bots/inline_keyboard_button.py b/pyrogram/client/types/bots/inline_keyboard_button.py index 001b105f..0f4779a9 100644 --- a/pyrogram/client/types/bots/inline_keyboard_button.py +++ b/pyrogram/client/types/bots/inline_keyboard_button.py @@ -50,16 +50,10 @@ class InlineKeyboardButton(Object): chat's input field. Can be empty, in which case only the bot's username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. - - callback_game (:obj:`CallbackGame `, *optional*): - Description of the game that will be launched when the user presses the button.NOTE: This type of button - must always be the first button in the first row. - - pay (``bool``, *optional*): - Specify True, to send a Pay button.NOTE: This type of button must always be the first button in the - first row. """ + # TODO: Add callback_game and pay fields + ID = 0xb0700019 def __init__( @@ -69,16 +63,16 @@ class InlineKeyboardButton(Object): url: str = None, switch_inline_query: str = None, switch_inline_query_current_chat: str = None, - callback_game=None, - pay: bool = None + # callback_game=None, + # pay: bool = None ): self.text = text self.url = url self.callback_data = callback_data self.switch_inline_query = switch_inline_query self.switch_inline_query_current_chat = switch_inline_query_current_chat - self.callback_game = callback_game - self.pay = pay + # self.callback_game = callback_game + # self.pay = pay @staticmethod def read(b, *args): diff --git a/pyrogram/client/types/bots/inline_keyboard_markup.py b/pyrogram/client/types/bots/inline_keyboard_markup.py index c21fabab..2a6993c4 100644 --- a/pyrogram/client/types/bots/inline_keyboard_markup.py +++ b/pyrogram/client/types/bots/inline_keyboard_markup.py @@ -27,7 +27,7 @@ class InlineKeyboardMarkup(Object): Args: inline_keyboard (List of List of :obj:`InlineKeyboardButton `): - Array of button rows, each represented by an Array of InlineKeyboardButton objects. + List of button rows, each represented by a List of InlineKeyboardButton objects. """ ID = 0xb0700020 diff --git a/pyrogram/client/types/bots/reply_keyboard_markup.py b/pyrogram/client/types/bots/reply_keyboard_markup.py index f6d42a2b..29fc1081 100644 --- a/pyrogram/client/types/bots/reply_keyboard_markup.py +++ b/pyrogram/client/types/bots/reply_keyboard_markup.py @@ -25,11 +25,11 @@ from . import KeyboardButton class ReplyKeyboardMarkup(Object): - """This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). + """This object represents a custom keyboard with reply options. Args: keyboard (List of List of :obj:`KeyboardButton `): - Array of button rows, each represented by an Array of KeyboardButton objects. + List of button rows, each represented by a List of KeyboardButton objects. resize_keyboard (``bool``, *optional*): Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if diff --git a/pyrogram/client/types/messages_and_media/animation.py b/pyrogram/client/types/messages_and_media/animation.py index 85d5a365..a8641e9e 100644 --- a/pyrogram/client/types/messages_and_media/animation.py +++ b/pyrogram/client/types/messages_and_media/animation.py @@ -48,7 +48,7 @@ class Animation(Object): File size. date (``int``, *optional*): - Date the Animation was sent in Unix time. + Date the animation was sent in Unix time. """ ID = 0xb0700025 diff --git a/pyrogram/client/types/messages_and_media/contact.py b/pyrogram/client/types/messages_and_media/contact.py index a7be558e..2569f03a 100644 --- a/pyrogram/client/types/messages_and_media/contact.py +++ b/pyrogram/client/types/messages_and_media/contact.py @@ -36,7 +36,7 @@ class Contact(Object): Contact's user identifier in Telegram. vcard (``str``, *optional*): - Additional data about the contact in the form of a vCard + Additional data about the contact in the form of a vCard. """ ID = 0xb0700011 diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index e86e4300..86bb57bc 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -164,20 +164,11 @@ class Message(Object): Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. - invoice (:obj:`Invoice `, *optional*): - Message is an invoice for a payment, information about the invoice. More about payments. - - successful_payment (:obj:`SuccessfulPayment `, *optional*): - Message is a service message about a successful payment, information about the payment. More about payments. - - connected_website (``str``, *optional*): - The domain name of the website on which the user has logged in. More about Telegram Login. - views (``int``, *optional*): Channel post views. via_bot (:obj:`User `): - Via bot. + The information of the bot that generated the message from an inline query of a user. outgoing (``bool``, *optional*): Whether the message is incoming or outgoing. @@ -199,6 +190,7 @@ class Message(Object): instructions to remove reply keyboard or to force a reply from the user. """ + # TODO: Add game missing field. Also invoice, successful_payment, connected_website ID = 0xb0700003 def __init__( @@ -243,9 +235,6 @@ class Message(Object): migrate_to_chat_id: int = None, migrate_from_chat_id: int = None, pinned_message=None, - invoice=None, - successful_payment=None, - connected_website=None, views: int = None, via_bot=None, outgoing: bool = None, @@ -293,9 +282,6 @@ class Message(Object): self.migrate_to_chat_id = migrate_to_chat_id # flags.33?int self.migrate_from_chat_id = migrate_from_chat_id # flags.34?int self.pinned_message = pinned_message # flags.35?Message - self.invoice = invoice # flags.36?Invoice - self.successful_payment = successful_payment # flags.37?SuccessfulPayment - self.connected_website = connected_website # flags.38?string self.views = views # flags.39?int self.via_bot = via_bot # flags.40?User self.outgoing = outgoing @@ -311,7 +297,9 @@ class Message(Object): disable_notification: bool = None, reply_to_message_id: int = None, reply_markup=None): - """Use this method as a shortcut for: + """Bound method *reply* of :obj:`Message `. + + Use as a shortcut for: .. code-block:: python @@ -379,7 +367,9 @@ class Message(Object): def forward(self, chat_id: int or str, disable_notification: bool = None): - """Use this method as a shortcut for: + """Bound method *forward* of :obj:`Message `. + + Use as a shortcut for: .. code-block:: python @@ -418,7 +408,9 @@ class Message(Object): ) def delete(self, revoke: bool = True): - """Use this method as a shortcut for: + """Bound method *delete* of :obj:`Message `. + + Use as a shortcut for: .. code-block:: python @@ -454,8 +446,9 @@ class Message(Object): return True def click(self, x: int or str, y: int = None, quote: bool = None): - """Use this method to click a button attached to the message. - It's a shortcut for: + """Bound method *click* of :obj:`Message `. + + Use as a shortcut for clicking a button attached to the message instead of. - Clicking inline buttons: @@ -476,16 +469,17 @@ class Message(Object): text=message.reply_markup[i][j].text ) - This method can be used in three different ways: + Example: + This method can be used in three different ways: - 1. Pass one integer argument only (e.g.: ``.click(2)``, to click a button at index 2). - Buttons are counted left to right, starting from the top. + 1. Pass one integer argument only (e.g.: ``.click(2)``, to click a button at index 2). + Buttons are counted left to right, starting from the top. - 2. Pass two integer arguments (e.g.: ``.click(1, 0)``, to click a button at position (1, 0)). - The origin (0, 0) is top-left. + 2. Pass two integer arguments (e.g.: ``.click(1, 0)``, to click a button at position (1, 0)). + The origin (0, 0) is top-left. - 3. Pass one string argument only (e.g.: ``.click("Settings")``, to click a button by using its label). - Only the first matching button will be pressed. + 3. Pass one string argument only (e.g.: ``.click("Settings")``, to click a button by using its label). + Only the first matching button will be pressed. Args: x (``int`` | ``str``): @@ -567,7 +561,9 @@ class Message(Object): raise ValueError("The message doesn't contain any keyboard") def download(self, file_name: str = "", block: bool = True): - """Use this method as a shortcut for: + """Bound method *download* of :obj:`Message `. + + Use as a shortcut for: .. code-block:: python diff --git a/pyrogram/client/types/messages_and_media/photo.py b/pyrogram/client/types/messages_and_media/photo.py index d9deed76..4037025b 100644 --- a/pyrogram/client/types/messages_and_media/photo.py +++ b/pyrogram/client/types/messages_and_media/photo.py @@ -20,7 +20,7 @@ from pyrogram.api.core import Object class Photo(Object): - """This object represents a Photo + """This object represents a Photo. Args: id (``str``): diff --git a/pyrogram/client/types/messages_and_media/sticker.py b/pyrogram/client/types/messages_and_media/sticker.py index 2e7ac901..d2ff6731 100644 --- a/pyrogram/client/types/messages_and_media/sticker.py +++ b/pyrogram/client/types/messages_and_media/sticker.py @@ -52,11 +52,9 @@ class Sticker(Object): set_name (``str``, *optional*): Name of the sticker set to which the sticker belongs. - - mask_position (:obj:`MaskPosition `, *optional*): - For mask stickers, the position where the mask should be placed. """ + # TODO: Add mask position ID = 0xb0700017 def __init__( diff --git a/pyrogram/client/types/user_and_chats/dialog.py b/pyrogram/client/types/user_and_chats/dialog.py index fa5fb2b8..8107d363 100644 --- a/pyrogram/client/types/user_and_chats/dialog.py +++ b/pyrogram/client/types/user_and_chats/dialog.py @@ -20,7 +20,7 @@ from pyrogram.api.core import Object class Dialog(Object): - """This object represents a dialog + """This object represents a dialog. Args: chat (:obj:`Chat `): diff --git a/pyrogram/client/types/user_and_chats/user_status.py b/pyrogram/client/types/user_and_chats/user_status.py index b2974dbe..cc96df52 100644 --- a/pyrogram/client/types/user_and_chats/user_status.py +++ b/pyrogram/client/types/user_and_chats/user_status.py @@ -20,7 +20,7 @@ from pyrogram.api.core import Object class UserStatus(Object): - """This object represents a User status (Last Seen privacy) + """This object represents a User status (Last Seen privacy). .. note:: From 74754f288aebf1f6f309eaf3507207eec2ae698f Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 3 Nov 2018 11:00:26 +0100 Subject: [PATCH 4/4] Update SmartPlugins page --- docs/source/resources/SmartPlugins.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/source/resources/SmartPlugins.rst b/docs/source/resources/SmartPlugins.rst index ecb5dfdc..46c4e17a 100644 --- a/docs/source/resources/SmartPlugins.rst +++ b/docs/source/resources/SmartPlugins.rst @@ -5,15 +5,22 @@ Pyrogram embeds a **smart** (automatic) and lightweight plugin system that is me of large projects and to provide a way for creating pluggable components that can be **easily shared** across different Pyrogram applications with **minimal boilerplate code**. +.. tip:: + + Smart Plugins are completely optional and disabled by default. + Introduction ------------ Prior to the Smart Plugin system, pluggable handlers were already possible. For example, if you wanted to modularize your applications, you had to do something like this... -.. note:: This is an example application that replies in private chats with two messages: one containing the same - text message you sent and the other containing the reversed text message (e.g.: "pyrogram" -> "pyrogram" and - "margoryp"): +.. note:: + + This is an example application that replies in private chats with two messages: one containing the same + text message you sent and the other containing the reversed text message. + + Example: *"Pyrogram"* replies with *"Pyrogram"* and *"margoryP"* .. code-block:: text