From 7a20c8bca88941c211c77585930f6a366aa0ffbf Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Tue, 24 Apr 2018 16:41:52 +0200 Subject: [PATCH] Clean all types and add docs --- docs/source/pyrogram/index.rst | 27 +----- docs/source/pyrogram/types/Audio.rst | 5 + docs/source/pyrogram/types/Chat.rst | 5 + docs/source/pyrogram/types/ChatMember.rst | 5 + docs/source/pyrogram/types/ChatPhoto.rst | 5 + docs/source/pyrogram/types/Contact.rst | 5 + docs/source/pyrogram/types/Document.rst | 5 + .../pyrogram/{ => types}/InputMediaPhoto.rst | 1 - .../pyrogram/{ => types}/InputMediaVideo.rst | 1 - .../{ => types}/InputPhoneContact.rst | 1 - docs/source/pyrogram/types/Location.rst | 5 + docs/source/pyrogram/types/Message.rst | 5 + docs/source/pyrogram/types/MessageEntity.rst | 5 + docs/source/pyrogram/types/PhotoSize.rst | 5 + docs/source/pyrogram/types/Sticker.rst | 5 + docs/source/pyrogram/types/Update.rst | 5 + docs/source/pyrogram/types/User.rst | 5 + .../pyrogram/types/UserProfilePhotos.rst | 5 + docs/source/pyrogram/types/Venue.rst | 5 + docs/source/pyrogram/types/Video.rst | 5 + docs/source/pyrogram/types/VideoNote.rst | 5 + docs/source/pyrogram/types/Voice.rst | 5 + docs/source/pyrogram/types/index.rst | 27 ++++++ pyrogram/client/input_media.py | 91 ------------------ pyrogram/client/message_parser.py | 6 +- pyrogram/client/types/audio.py | 16 ++-- pyrogram/client/types/chat.py | 24 ++--- pyrogram/client/types/chat_member.py | 30 +++--- pyrogram/client/types/contact.py | 4 +- pyrogram/client/types/document.py | 10 +- pyrogram/client/types/input_media_photo.py | 6 +- pyrogram/client/types/input_media_video.py | 14 +-- pyrogram/client/types/input_phone_contact.py | 2 +- pyrogram/client/types/location.py | 4 +- pyrogram/client/types/message.py | 96 +++++++++---------- pyrogram/client/types/message_entity.py | 8 +- pyrogram/client/types/photo_size.py | 8 +- pyrogram/client/types/sticker.py | 20 ++-- pyrogram/client/types/update.py | 18 ++-- pyrogram/client/types/user.py | 12 +-- pyrogram/client/types/user_profile_photos.py | 4 +- pyrogram/client/types/venue.py | 4 +- pyrogram/client/types/video.py | 16 ++-- pyrogram/client/types/video_note.py | 16 ++-- pyrogram/client/types/voice.py | 12 +-- 45 files changed, 281 insertions(+), 287 deletions(-) create mode 100644 docs/source/pyrogram/types/Audio.rst create mode 100644 docs/source/pyrogram/types/Chat.rst create mode 100644 docs/source/pyrogram/types/ChatMember.rst create mode 100644 docs/source/pyrogram/types/ChatPhoto.rst create mode 100644 docs/source/pyrogram/types/Contact.rst create mode 100644 docs/source/pyrogram/types/Document.rst rename docs/source/pyrogram/{ => types}/InputMediaPhoto.rst (81%) rename docs/source/pyrogram/{ => types}/InputMediaVideo.rst (81%) rename docs/source/pyrogram/{ => types}/InputPhoneContact.rst (82%) create mode 100644 docs/source/pyrogram/types/Location.rst create mode 100644 docs/source/pyrogram/types/Message.rst create mode 100644 docs/source/pyrogram/types/MessageEntity.rst create mode 100644 docs/source/pyrogram/types/PhotoSize.rst create mode 100644 docs/source/pyrogram/types/Sticker.rst create mode 100644 docs/source/pyrogram/types/Update.rst create mode 100644 docs/source/pyrogram/types/User.rst create mode 100644 docs/source/pyrogram/types/UserProfilePhotos.rst create mode 100644 docs/source/pyrogram/types/Venue.rst create mode 100644 docs/source/pyrogram/types/Video.rst create mode 100644 docs/source/pyrogram/types/VideoNote.rst create mode 100644 docs/source/pyrogram/types/Voice.rst create mode 100644 docs/source/pyrogram/types/index.rst delete mode 100644 pyrogram/client/input_media.py diff --git a/docs/source/pyrogram/index.rst b/docs/source/pyrogram/index.rst index 9a86c11d..c81cdd6e 100644 --- a/docs/source/pyrogram/index.rst +++ b/docs/source/pyrogram/index.rst @@ -8,6 +8,7 @@ after the well established `Telegram Bot API`_ methods, thus offering a familiar .. toctree:: Client + types/index MessageHandler RawUpdateHandler Filters @@ -16,30 +17,4 @@ after the well established `Telegram Bot API`_ methods, thus offering a familiar Emoji Error -Types ------ - -.. toctree:: - ../types/pyrogram/User - ../types/pyrogram/Chat - ../types/pyrogram/Message - ../types/pyrogram/MessageEntity - ../types/pyrogram/PhotoSize - ../types/pyrogram/Audio - ../types/pyrogram/Document - ../types/pyrogram/Video - ../types/pyrogram/Voice - ../types/pyrogram/VideoNote - ../types/pyrogram/Contact - ../types/pyrogram/Location - ../types/pyrogram/Venue - ../types/pyrogram/UserProfilePhotos - ../types/pyrogram/ChatPhoto - ../types/pyrogram/ChatMember - InputMediaPhoto - InputMediaVideo - InputPhoneContact - ../types/pyrogram/Sticker - - .. _Telegram Bot API: https://core.telegram.org/bots/api#available-methods diff --git a/docs/source/pyrogram/types/Audio.rst b/docs/source/pyrogram/types/Audio.rst new file mode 100644 index 00000000..66ccb32a --- /dev/null +++ b/docs/source/pyrogram/types/Audio.rst @@ -0,0 +1,5 @@ +Audio +===== + +.. autoclass:: pyrogram.Audio + :members: diff --git a/docs/source/pyrogram/types/Chat.rst b/docs/source/pyrogram/types/Chat.rst new file mode 100644 index 00000000..50a26838 --- /dev/null +++ b/docs/source/pyrogram/types/Chat.rst @@ -0,0 +1,5 @@ +Chat +==== + +.. autoclass:: pyrogram.Chat + :members: diff --git a/docs/source/pyrogram/types/ChatMember.rst b/docs/source/pyrogram/types/ChatMember.rst new file mode 100644 index 00000000..0c4f45a3 --- /dev/null +++ b/docs/source/pyrogram/types/ChatMember.rst @@ -0,0 +1,5 @@ +ChatMember +========== + +.. autoclass:: pyrogram.ChatMember + :members: diff --git a/docs/source/pyrogram/types/ChatPhoto.rst b/docs/source/pyrogram/types/ChatPhoto.rst new file mode 100644 index 00000000..2b6b49e5 --- /dev/null +++ b/docs/source/pyrogram/types/ChatPhoto.rst @@ -0,0 +1,5 @@ +ChatPhoto +========= + +.. autoclass:: pyrogram.ChatPhoto + :members: diff --git a/docs/source/pyrogram/types/Contact.rst b/docs/source/pyrogram/types/Contact.rst new file mode 100644 index 00000000..7d8b0fb2 --- /dev/null +++ b/docs/source/pyrogram/types/Contact.rst @@ -0,0 +1,5 @@ +Contact +======= + +.. autoclass:: pyrogram.Contact + :members: diff --git a/docs/source/pyrogram/types/Document.rst b/docs/source/pyrogram/types/Document.rst new file mode 100644 index 00000000..03a57753 --- /dev/null +++ b/docs/source/pyrogram/types/Document.rst @@ -0,0 +1,5 @@ +Document +======== + +.. autoclass:: pyrogram.Document + :members: diff --git a/docs/source/pyrogram/InputMediaPhoto.rst b/docs/source/pyrogram/types/InputMediaPhoto.rst similarity index 81% rename from docs/source/pyrogram/InputMediaPhoto.rst rename to docs/source/pyrogram/types/InputMediaPhoto.rst index abc3f456..aaf8548f 100644 --- a/docs/source/pyrogram/InputMediaPhoto.rst +++ b/docs/source/pyrogram/types/InputMediaPhoto.rst @@ -3,4 +3,3 @@ InputMediaPhoto .. autoclass:: pyrogram.InputMediaPhoto :members: - :undoc-members: diff --git a/docs/source/pyrogram/InputMediaVideo.rst b/docs/source/pyrogram/types/InputMediaVideo.rst similarity index 81% rename from docs/source/pyrogram/InputMediaVideo.rst rename to docs/source/pyrogram/types/InputMediaVideo.rst index de9c480b..4df4d128 100644 --- a/docs/source/pyrogram/InputMediaVideo.rst +++ b/docs/source/pyrogram/types/InputMediaVideo.rst @@ -3,4 +3,3 @@ InputMediaVideo .. autoclass:: pyrogram.InputMediaVideo :members: - :undoc-members: diff --git a/docs/source/pyrogram/InputPhoneContact.rst b/docs/source/pyrogram/types/InputPhoneContact.rst similarity index 82% rename from docs/source/pyrogram/InputPhoneContact.rst rename to docs/source/pyrogram/types/InputPhoneContact.rst index e5c4a20d..bc4e38bc 100644 --- a/docs/source/pyrogram/InputPhoneContact.rst +++ b/docs/source/pyrogram/types/InputPhoneContact.rst @@ -3,4 +3,3 @@ InputPhoneContact .. autoclass:: pyrogram.InputPhoneContact :members: - :undoc-members: diff --git a/docs/source/pyrogram/types/Location.rst b/docs/source/pyrogram/types/Location.rst new file mode 100644 index 00000000..99aeaa70 --- /dev/null +++ b/docs/source/pyrogram/types/Location.rst @@ -0,0 +1,5 @@ +Location +======== + +.. autoclass:: pyrogram.Location + :members: diff --git a/docs/source/pyrogram/types/Message.rst b/docs/source/pyrogram/types/Message.rst new file mode 100644 index 00000000..432693fd --- /dev/null +++ b/docs/source/pyrogram/types/Message.rst @@ -0,0 +1,5 @@ +Message +======= + +.. autoclass:: pyrogram.Message + :members: diff --git a/docs/source/pyrogram/types/MessageEntity.rst b/docs/source/pyrogram/types/MessageEntity.rst new file mode 100644 index 00000000..4f2f3be0 --- /dev/null +++ b/docs/source/pyrogram/types/MessageEntity.rst @@ -0,0 +1,5 @@ +MessageEntity +============= + +.. autoclass:: pyrogram.MessageEntity + :members: diff --git a/docs/source/pyrogram/types/PhotoSize.rst b/docs/source/pyrogram/types/PhotoSize.rst new file mode 100644 index 00000000..7ced6190 --- /dev/null +++ b/docs/source/pyrogram/types/PhotoSize.rst @@ -0,0 +1,5 @@ +PhotoSize +========= + +.. autoclass:: pyrogram.PhotoSize + :members: diff --git a/docs/source/pyrogram/types/Sticker.rst b/docs/source/pyrogram/types/Sticker.rst new file mode 100644 index 00000000..d2646c99 --- /dev/null +++ b/docs/source/pyrogram/types/Sticker.rst @@ -0,0 +1,5 @@ +Sticker +======= + +.. autoclass:: pyrogram.Sticker + :members: diff --git a/docs/source/pyrogram/types/Update.rst b/docs/source/pyrogram/types/Update.rst new file mode 100644 index 00000000..1fb22b00 --- /dev/null +++ b/docs/source/pyrogram/types/Update.rst @@ -0,0 +1,5 @@ +Update +====== + +.. autoclass:: pyrogram.Update + :members: diff --git a/docs/source/pyrogram/types/User.rst b/docs/source/pyrogram/types/User.rst new file mode 100644 index 00000000..f0074a93 --- /dev/null +++ b/docs/source/pyrogram/types/User.rst @@ -0,0 +1,5 @@ +User +==== + +.. autoclass:: pyrogram.User + :members: diff --git a/docs/source/pyrogram/types/UserProfilePhotos.rst b/docs/source/pyrogram/types/UserProfilePhotos.rst new file mode 100644 index 00000000..8c9c4d75 --- /dev/null +++ b/docs/source/pyrogram/types/UserProfilePhotos.rst @@ -0,0 +1,5 @@ +UserProfilePhotos +================= + +.. autoclass:: pyrogram.UserProfilePhotos + :members: diff --git a/docs/source/pyrogram/types/Venue.rst b/docs/source/pyrogram/types/Venue.rst new file mode 100644 index 00000000..471ab026 --- /dev/null +++ b/docs/source/pyrogram/types/Venue.rst @@ -0,0 +1,5 @@ +Venue +===== + +.. autoclass:: pyrogram.Venue + :members: diff --git a/docs/source/pyrogram/types/Video.rst b/docs/source/pyrogram/types/Video.rst new file mode 100644 index 00000000..de28ae1c --- /dev/null +++ b/docs/source/pyrogram/types/Video.rst @@ -0,0 +1,5 @@ +Video +===== + +.. autoclass:: pyrogram.Video + :members: diff --git a/docs/source/pyrogram/types/VideoNote.rst b/docs/source/pyrogram/types/VideoNote.rst new file mode 100644 index 00000000..69667454 --- /dev/null +++ b/docs/source/pyrogram/types/VideoNote.rst @@ -0,0 +1,5 @@ +VideoNote +========= + +.. autoclass:: pyrogram.VideoNote + :members: diff --git a/docs/source/pyrogram/types/Voice.rst b/docs/source/pyrogram/types/Voice.rst new file mode 100644 index 00000000..c80ce124 --- /dev/null +++ b/docs/source/pyrogram/types/Voice.rst @@ -0,0 +1,5 @@ +Voice +===== + +.. autoclass:: pyrogram.Voice + :members: diff --git a/docs/source/pyrogram/types/index.rst b/docs/source/pyrogram/types/index.rst new file mode 100644 index 00000000..491810bc --- /dev/null +++ b/docs/source/pyrogram/types/index.rst @@ -0,0 +1,27 @@ +:tocdepth: 1 + +Types +===== + +.. toctree:: + Update + User + Chat + Message + MessageEntity + PhotoSize + Audio + Document + Video + Voice + VideoNote + Contact + Location + Venue + UserProfilePhotos + ChatPhoto + ChatMember + InputMediaPhoto + InputMediaVideo + InputPhoneContact + Sticker \ No newline at end of file diff --git a/pyrogram/client/input_media.py b/pyrogram/client/input_media.py deleted file mode 100644 index f4110f1b..00000000 --- a/pyrogram/client/input_media.py +++ /dev/null @@ -1,91 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017-2018 Dan Tès -# -# This file is part of Pyrogram. -# -# Pyrogram is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Pyrogram is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with Pyrogram. If not, see . - - -class InputMedia: - class Photo: - """This object represents a photo to be sent inside an album. - It is intended to be used with :obj:`pyrogram.Client.send_media_group`. - - Args: - media (:obj:`str`): - Photo file to send. - Pass a file path as string to send a photo that exists on your local machine. - - caption (:obj:`str`): - Caption of the photo to be sent, 0-200 characters - - parse_mode (:obj:`str`): - Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps - to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. - """ - - def __init__(self, - media: str, - caption: str = "", - parse_mode: str = ""): - self.media = media - self.caption = caption - self.parse_mode = parse_mode - - class Video: - """This object represents a video to be sent inside an album. - It is intended to be used with :obj:`pyrogram.Client.send_media_group`. - - Args: - media (:obj:`str`): - Video file to send. - Pass a file path as string to send a video that exists on your local machine. - - caption (:obj:`str`, optional): - Caption of the video to be sent, 0-200 characters - - parse_mode (:obj:`str`, optional): - Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps - to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. - - width (:obj:`int`, optional): - Video width. - - height (:obj:`int`, optional): - Video height - - duration (:obj:`int`, optional): - Video duration. - - supports_streaming (:obj:`bool`, optional): - Pass True, if the uploaded video is suitable for streaming. - """ - - def __init__(self, - media: str, - caption: str = "", - parse_mode: str = "", - width: int = 0, - height: int = 0, - duration: int = 0, - supports_streaming: bool = True): - self.media = media - self.caption = caption - self.parse_mode = parse_mode - self.width = width - self.height = height - self.duration = duration - self.supports_streaming = supports_streaming diff --git a/pyrogram/client/message_parser.py b/pyrogram/client/message_parser.py index b9c38837..3abc1c82 100644 --- a/pyrogram/client/message_parser.py +++ b/pyrogram/client/message_parser.py @@ -591,8 +591,4 @@ def parse_message_empty( users: dict, chats: dict ) -> pyrogram_types.Message: - return pyrogram_types.Message( - message_id=message.id, - date=None, - chat=None - ) + return pyrogram_types.Message(message_id=message.id) diff --git a/pyrogram/client/types/audio.py b/pyrogram/client/types/audio.py index 6712254c..9c2af385 100644 --- a/pyrogram/client/types/audio.py +++ b/pyrogram/client/types/audio.py @@ -29,28 +29,28 @@ class Audio(Object): file_id (``str``): Unique identifier for this file. - duration (``int`` ``32-bit``): + duration (``int``): Duration of the audio in seconds as defined by sender. - thumb (:obj:`PhotoSize `, optional): + thumb (:obj:`PhotoSize `, *optional*): Audio thumbnail. - file_name (``str``, optional): + file_name (``str``, *optional*): Audio file name. - mime_type (``str``, optional): + mime_type (``str``, *optional*): MIME type of the file as defined by sender. - file_size (``int`` ``32-bit``, optional): + file_size (``int``, *optional*): File size. - date (``int``, optional): + date (``int``, *optional*): Date the audio was sent in Unix time. - performer (``str``, optional): + performer (``str``, *optional*): Performer of the audio as defined by sender or by audio tags. - title (``str``, optional): + title (``str``, *optional*): Title of the audio as defined by sender or by audio tags. """ ID = 0xb0700006 diff --git a/pyrogram/client/types/chat.py b/pyrogram/client/types/chat.py index c025cc52..a2894b4c 100644 --- a/pyrogram/client/types/chat.py +++ b/pyrogram/client/types/chat.py @@ -26,7 +26,7 @@ class Chat(Object): ID: ``0xb0700002`` Args: - id (``int`` ``32-bit``): + id (``int``): Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. @@ -34,37 +34,37 @@ class Chat(Object): type (``str``): Type of chat, can be either "private", "group", "supergroup" or "channel". - title (``str``, optional): + title (``str``, *optional*): Title, for supergroups, channels and group chats. - username (``str``, optional): + username (``str``, *optional*): Username, for private chats, supergroups and channels if available. - first_name (``str``, optional): + first_name (``str``, *optional*): First name of the other party in a private chat. - last_name (``str``, optional): + last_name (``str``, *optional*): Last name of the other party in a private chat. - all_members_are_administrators (``bool``, optional): + all_members_are_administrators (``bool``, *optional*): True if a group has 'All Members Are Admins' enabled. - photo (:obj:`ChatPhoto `, optional): + photo (:obj:`ChatPhoto `, *optional*): Chat photo. Returned only in getChat. - description (``str``, optional): + description (``str``, *optional*): Description, for supergroups and channel chats. Returned only in getChat. - invite_link (``str``, optional): + invite_link (``str``, *optional*): Chat invite link, for supergroups and channel chats. Returned only in getChat. - pinned_message (:obj:`Message `, optional): + pinned_message (:obj:`Message `, *optional*): Pinned message, for supergroups and channel chats. Returned only in getChat. - sticker_set_name (``str``, optional): + sticker_set_name (``str``, *optional*): For supergroups, name of group sticker set. Returned only in getChat. - can_set_sticker_set (``bool``, optional): + can_set_sticker_set (``bool``, *optional*): True, if the bot can change the group sticker set. Returned only in getChat. """ diff --git a/pyrogram/client/types/chat_member.py b/pyrogram/client/types/chat_member.py index 4802082b..04e675c0 100644 --- a/pyrogram/client/types/chat_member.py +++ b/pyrogram/client/types/chat_member.py @@ -26,58 +26,58 @@ class ChatMember(Object): ID: ``0xb0700016`` Args: - user (:obj:`User `): + user (:obj:`User `): Information about the user. status (``str``): The member's status in the chat. Can be "creator", "administrator", "member", "restricted", "left" or "kicked". - until_date (``int`` ``32-bit``, optional): + until_date (``int``, *optional*): Restricted and kicked only. Date when restrictions will be lifted for this user, unix time. - can_be_edited (``bool``, optional): + can_be_edited (``bool``, *optional*): Administrators only. True, if the bot is allowed to edit administrator privileges of that user. - can_change_info (``bool``, optional): + can_change_info (``bool``, *optional*): Administrators only. True, if the administrator can change the chat title, photo and other settings. - can_post_messages (``bool``, optional): + can_post_messages (``bool``, *optional*): Administrators only. True, if the administrator can post in the channel, channels only. - can_edit_messages (``bool``, optional): + can_edit_messages (``bool``, *optional*): Administrators only. True, if the administrator can edit messages of other users and can pin messages, channels only. - can_delete_messages (``bool``, optional): + can_delete_messages (``bool``, *optional*): Administrators only. True, if the administrator can delete messages of other users. - can_invite_users (``bool``, optional): + can_invite_users (``bool``, *optional*): Administrators only. True, if the administrator can invite new users to the chat. - can_restrict_members (``bool``, optional): + can_restrict_members (``bool``, *optional*): Administrators only. True, if the administrator can restrict, ban or unban chat members. - can_pin_messages (``bool``, optional): + can_pin_messages (``bool``, *optional*): Administrators only. True, if the administrator can pin messages, supergroups only. - can_promote_members (``bool``, optional): + can_promote_members (``bool``, *optional*): Administrators only. True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user). - can_send_messages (``bool``, optional): + can_send_messages (``bool``, *optional*): Restricted only. True, if the user can send text messages, contacts, locations and venues. - can_send_media_messages (``bool``, optional): + can_send_media_messages (``bool``, *optional*): Restricted only. True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages. - can_send_other_messages (``bool``, optional): + can_send_other_messages (``bool``, *optional*): Restricted only. True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages. - can_add_web_page_previews (``bool``, optional): + can_add_web_page_previews (``bool``, *optional*): Restricted only. True, if user may add web page previews to his messages, implies can_send_media_messages. """ diff --git a/pyrogram/client/types/contact.py b/pyrogram/client/types/contact.py index e86b003a..9ec4bddf 100644 --- a/pyrogram/client/types/contact.py +++ b/pyrogram/client/types/contact.py @@ -32,10 +32,10 @@ class Contact(Object): first_name (``str``): Contact's first name. - last_name (``str``, optional): + last_name (``str``, *optional*): Contact's last name. - user_id (``int`` ``32-bit``, optional): + user_id (``int``, *optional*): Contact's user identifier in Telegram. """ ID = 0xb0700011 diff --git a/pyrogram/client/types/document.py b/pyrogram/client/types/document.py index 91fb20e5..6fa43020 100644 --- a/pyrogram/client/types/document.py +++ b/pyrogram/client/types/document.py @@ -29,19 +29,19 @@ class Document(Object): file_id (``str``): Unique file identifier. - thumb (:obj:`PhotoSize `, optional): + thumb (:obj:`PhotoSize `, *optional*): Document thumbnail as defined by sender. - file_name (``str``, optional): + file_name (``str``, *optional*): Original filename as defined by sender. - mime_type (``str``, optional): + mime_type (``str``, *optional*): MIME type of the file as defined by sender. - file_size (``int`` ``32-bit``, optional): + file_size (``int``, *optional*): File size. - date (``int``, optional): + date (``int``, *optional*): Date the document was sent in Unix time. """ ID = 0xb0700007 diff --git a/pyrogram/client/types/input_media_photo.py b/pyrogram/client/types/input_media_photo.py index 3f0e4488..336ee849 100644 --- a/pyrogram/client/types/input_media_photo.py +++ b/pyrogram/client/types/input_media_photo.py @@ -22,16 +22,16 @@ class InputMediaPhoto: It is intended to be used with :obj:`send_media_group() `. Args: - media (:obj:`str`): + media (``str``): Photo to send. Pass a file_id as string to send a photo that exists on the Telegram servers or pass a file path as string to upload a new photo that exists on your local machine. Sending photo by a URL is currently unsupported. - caption (:obj:`str`, optional): + caption (``str``, *optional*): Caption of the photo to be sent, 0-200 characters - parse_mode (:obj:`str`, optional): + parse_mode (``str``, *optional*): Use :obj:`MARKDOWN ` or :obj:`HTML ` if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. Defaults to Markdown. diff --git a/pyrogram/client/types/input_media_video.py b/pyrogram/client/types/input_media_video.py index 7ad5ce50..eb6c003e 100644 --- a/pyrogram/client/types/input_media_video.py +++ b/pyrogram/client/types/input_media_video.py @@ -22,30 +22,30 @@ class InputMediaVideo: It is intended to be used with :obj:`send_media_group() `. Args: - media (:obj:`str`): + media (``str``): Video to send. Pass a file_id as string to send a video that exists on the Telegram servers or pass a file path as string to upload a new video that exists on your local machine. Sending video by a URL is currently unsupported. - caption (:obj:`str`, optional): + caption (``str``, *optional*): Caption of the video to be sent, 0-200 characters - parse_mode (:obj:`str`, optional): + parse_mode (``str``, *optional*): Use :obj:`MARKDOWN ` or :obj:`HTML ` if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. Defaults to Markdown. - width (:obj:`int`, optional): + width (``int``, *optional*): Video width. - height (:obj:`int`, optional): + height (``int``, *optional*): Video height. - duration (:obj:`int`, optional): + duration (``int``, *optional*): Video duration. - supports_streaming (:obj:`bool`, optional): + supports_streaming (``bool``, *optional*): Pass True, if the uploaded video is suitable for streaming. """ diff --git a/pyrogram/client/types/input_phone_contact.py b/pyrogram/client/types/input_phone_contact.py index 1ca8bf4c..0e61c006 100644 --- a/pyrogram/client/types/input_phone_contact.py +++ b/pyrogram/client/types/input_phone_contact.py @@ -31,7 +31,7 @@ class InputPhoneContact: first_name (``str``): Contact's first name - last_name (``str``, optional): + last_name (``str``, *optional*): Contact's last name """ diff --git a/pyrogram/client/types/location.py b/pyrogram/client/types/location.py index 30e7c788..b3a52fa1 100644 --- a/pyrogram/client/types/location.py +++ b/pyrogram/client/types/location.py @@ -26,10 +26,10 @@ class Location(Object): ID: ``0xb0700012`` Args: - longitude (``float`` ``64-bit``): + longitude (``float``): Longitude as defined by sender. - latitude (``float`` ``64-bit``): + latitude (``float``): Latitude as defined by sender. """ ID = 0xb0700012 diff --git a/pyrogram/client/types/message.py b/pyrogram/client/types/message.py index 27bac6db..79ed5cc7 100644 --- a/pyrogram/client/types/message.py +++ b/pyrogram/client/types/message.py @@ -26,153 +26,153 @@ class Message(Object): ID: ``0xb0700003`` Args: - message_id (``int`` ``32-bit``): + message_id (``int``): Unique message identifier inside this chat. - date (``int`` ``32-bit``): - Sender, empty for messages sent to channels. - - chat (:obj:`Chat `): + date (``int``, *optional*): Date the message was sent in Unix time. - from_user (:obj:`User `, optional): + chat (:obj:`Chat `, *optional*): Conversation the message belongs to. - forward_from (:obj:`User `, optional): + from_user (:obj:`User `, *optional*): + Sender, empty for messages sent to channels. + + forward_from (:obj:`User `, *optional*): For forwarded messages, sender of the original message. - forward_from_chat (:obj:`Chat `, optional): + forward_from_chat (:obj:`Chat `, *optional*): For messages forwarded from channels, information about the original channel. - forward_from_message_id (``int`` ``32-bit``, optional): + forward_from_message_id (``int``, *optional*): For messages forwarded from channels, identifier of the original message in the channel. - forward_signature (``str``, optional): + forward_signature (``str``, *optional*): For messages forwarded from channels, signature of the post author if present. - forward_date (``int`` ``32-bit``, optional): + forward_date (``int``, *optional*): For forwarded messages, date the original message was sent in Unix time. - reply_to_message (:obj:`Message `, optional): + reply_to_message (:obj:`Message `, *optional*): For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. - edit_date (``int`` ``32-bit``, optional): + edit_date (``int``, *optional*): Date the message was last edited in Unix time. - media_group_id (``str``, optional): + media_group_id (``str``, *optional*): The unique identifier of a media message group this message belongs to. - author_signature (``str``, optional): + author_signature (``str``, *optional*): Signature of the post author for messages in channels. - text (``str``, optional): + text (``str``, *optional*): For text messages, the actual UTF-8 text of the message, 0-4096 characters. - entities (List of :obj:`MessageEntity `, optional): + entities (List of :obj:`MessageEntity `, *optional*): For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text. - caption_entities (List of :obj:`MessageEntity `, optional): + caption_entities (List of :obj:`MessageEntity `, *optional*): For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption. - audio (:obj:`Audio `, optional): + audio (:obj:`Audio `, *optional*): Message is an audio file, information about the file. - document (:obj:`Document `, optional): + document (:obj:`Document `, *optional*): Message is a general file, information about the file. - game (:obj:`Game `, optional): + game (:obj:`Game `, *optional*): Message is a game, information about the game. More about games. - photo (List of :obj:`PhotoSize `, optional): + photo (List of :obj:`PhotoSize `, *optional*): Message is a photo, available sizes of the photo. - sticker (:obj:`Sticker `, optional): + sticker (:obj:`Sticker `, *optional*): Message is a sticker, information about the sticker. - video (:obj:`Video `, optional): + video (:obj:`Video `, *optional*): Message is a video, information about the video. - voice (:obj:`Voice `, optional): + voice (:obj:`Voice `, *optional*): Message is a voice message, information about the file. - video_note (:obj:`VideoNote `, optional): + video_note (:obj:`VideoNote `, *optional*): Message is a video note, information about the video message. - caption (``str``, optional): + caption (``str``, *optional*): Caption for the audio, document, photo, video or voice, 0-200 characters. - contact (:obj:`Contact `, optional): + contact (:obj:`Contact `, *optional*): Message is a shared contact, information about the contact. - location (:obj:`Location `, optional): + location (:obj:`Location `, *optional*): Message is a shared location, information about the location. - venue (:obj:`Venue `, optional): + venue (:obj:`Venue `, *optional*): Message is a venue, information about the venue. - new_chat_members (List of :obj:`User `, optional): + new_chat_members (List of :obj:`User `, *optional*): New members that were added to the group or supergroup and information about them (the bot itself may be one of these members). - left_chat_member (:obj:`User `, optional): + left_chat_member (:obj:`User `, *optional*): A member was removed from the group, information about them (this member may be the bot itself). - new_chat_title (``str``, optional): + new_chat_title (``str``, *optional*): A chat title was changed to this value. - new_chat_photo (List of :obj:`PhotoSize `, optional): + new_chat_photo (List of :obj:`PhotoSize `, *optional*): A chat photo was change to this value. - delete_chat_photo (``bool``, optional): + delete_chat_photo (``bool``, *optional*): Service message: the chat photo was deleted. - group_chat_created (``bool``, optional): + group_chat_created (``bool``, *optional*): Service message: the group has been created. - supergroup_chat_created (``bool``, optional): + supergroup_chat_created (``bool``, *optional*): Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. - channel_chat_created (``bool``, optional): + channel_chat_created (``bool``, *optional*): Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. - migrate_to_chat_id (``int`` ``32-bit``, optional): + migrate_to_chat_id (``int``, *optional*): The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. - migrate_from_chat_id (``int`` ``32-bit``, optional): + migrate_from_chat_id (``int``, *optional*): The supergroup has been migrated from a group with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. - pinned_message (:obj:`Message `, optional): + pinned_message (:obj:`Message `, *optional*): Specified message was pinned. 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): + invoice (:obj:`Invoice `, *optional*): Message is an invoice for a payment, information about the invoice. More about payments. - successful_payment (:obj:`SuccessfulPayment `, optional): + 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): + connected_website (``str``, *optional*): The domain name of the website on which the user has logged in. More about Telegram Login. - views (``int``, optional): + views (``int``, *optional*): Channel post views. - via_bot (:obj:`User `): + via_bot (:obj:`User `): Via bot. """ ID = 0xb0700003 @@ -180,8 +180,8 @@ class Message(Object): def __init__( self, message_id: int, - date: int, - chat, + date: int = None, + chat = None, from_user=None, forward_from=None, forward_from_chat=None, diff --git a/pyrogram/client/types/message_entity.py b/pyrogram/client/types/message_entity.py index f4b68203..e526373a 100644 --- a/pyrogram/client/types/message_entity.py +++ b/pyrogram/client/types/message_entity.py @@ -33,16 +33,16 @@ class MessageEntity(Object): code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames). - offset (``int`` ``32-bit``): + offset (``int``): Offset in UTF-16 code units to the start of the entity. - length (``int`` ``32-bit``): + length (``int``): Length of the entity in UTF-16 code units. - url (``str``, optional): + url (``str``, *optional*): For "text_link" only, url that will be opened after user taps on the text. - user (:obj:`User `, optional): + user (:obj:`User `, *optional*): For "text_mention" only, the mentioned user. """ diff --git a/pyrogram/client/types/photo_size.py b/pyrogram/client/types/photo_size.py index 0af6b6d0..2be6f0e2 100644 --- a/pyrogram/client/types/photo_size.py +++ b/pyrogram/client/types/photo_size.py @@ -29,16 +29,16 @@ class PhotoSize(Object): file_id (``str``): Unique identifier for this file. - width (``int`` ``32-bit``): + width (``int``): Photo width. - height (``int`` ``32-bit``): + height (``int``): Photo height. - file_size (``int`` ``32-bit``, optional): + file_size (``int``, *optional*): File size. - date (``int``, optional): + date (``int``, *optional*): Date the photo was sent in Unix time """ ID = 0xb0700005 diff --git a/pyrogram/client/types/sticker.py b/pyrogram/client/types/sticker.py index 8d4b2124..1a173e88 100644 --- a/pyrogram/client/types/sticker.py +++ b/pyrogram/client/types/sticker.py @@ -29,34 +29,34 @@ class Sticker(Object): file_id (``str``): Unique identifier for this file. - width (``int`` ``32-bit``): + width (``int``): Sticker width. - height (``int`` ``32-bit``): + height (``int``): Sticker height. - thumb (:obj:`PhotoSize `, optional): + thumb (:obj:`PhotoSize `, *optional*): Sticker thumbnail in the .webp or .jpg format. - file_name (``str``, optional): + file_name (``str``, *optional*): Sticker file name. - mime_type (``str``, optional): + mime_type (``str``, *optional*): MIME type of the file as defined by sender. - file_size (``int`` ``32-bit``, optional): + file_size (``int``, *optional*): File size. - date (``int``, optional): + date (``int``, *optional*): Date the sticker was sent in Unix time. - emoji (``str``, optional): + emoji (``str``, *optional*): Emoji associated with the sticker. - set_name (``str``, optional): + set_name (``str``, *optional*): Name of the sticker set to which the sticker belongs. - mask_position (:obj:`MaskPosition `, optional): + mask_position (:obj:`MaskPosition `, *optional*): For mask stickers, the position where the mask should be placed. """ ID = 0xb0700017 diff --git a/pyrogram/client/types/update.py b/pyrogram/client/types/update.py index 07397d52..5a184874 100644 --- a/pyrogram/client/types/update.py +++ b/pyrogram/client/types/update.py @@ -27,33 +27,33 @@ class Update(Object): ID: ``0xb0700000`` Args: - message (:obj:`Message `, optional): + message (:obj:`Message `, *optional*): New incoming message of any kind — text, photo, sticker, etc. - edited_message (:obj:`Message `, optional): + edited_message (:obj:`Message `, *optional*): New version of a message that is known to the bot and was edited. - channel_post (:obj:`Message `, optional): + channel_post (:obj:`Message `, *optional*): New incoming channel post of any kind — text, photo, sticker, etc. - edited_channel_post (:obj:`Message `, optional): + edited_channel_post (:obj:`Message `, *optional*): New version of a channel post that is known to the bot and was edited. - inline_query (:obj:`InlineQuery `, optional): + inline_query (:obj:`InlineQuery `, *optional*): New incoming inline query. - chosen_inline_result (:obj:`ChosenInlineResult `, optional): + chosen_inline_result (:obj:`ChosenInlineResult `, *optional*): The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. - callback_query (:obj:`CallbackQuery `, optional): + callback_query (:obj:`CallbackQuery `, *optional*): New incoming callback query. - shipping_query (:obj:`ShippingQuery `, optional): + shipping_query (:obj:`ShippingQuery `, *optional*): New incoming shipping query. Only for invoices with flexible price. - pre_checkout_query (:obj:`PreCheckoutQuery `, optional): + pre_checkout_query (:obj:`PreCheckoutQuery `, *optional*): New incoming pre-checkout query. Contains full information about checkout. """ diff --git a/pyrogram/client/types/user.py b/pyrogram/client/types/user.py index 928b3f31..3dfd17a9 100644 --- a/pyrogram/client/types/user.py +++ b/pyrogram/client/types/user.py @@ -26,7 +26,7 @@ class User(Object): ID: ``0xb0700001`` Args: - id (``int`` ``32-bit``): + id (``int``): Unique identifier for this user or bot. is_bot (``bool``): @@ -35,19 +35,19 @@ class User(Object): first_name (``str``): User's or bot's first name. - last_name (``str``, optional): + last_name (``str``, *optional*): User's or bot's last name. - username (``str``, optional): + username (``str``, *optional*): User's or bot's username. - language_code (``str``, optional): + language_code (``str``, *optional*): IETF language tag of the user's language. - phone_number (``str``, optional): + phone_number (``str``, *optional*): User's or bot's phone number. - photo (obj:`ChatPhoto `, optional): + photo (:obj:`ChatPhoto `, *optional*): User's or bot's current profile photo. """ ID = 0xb0700001 diff --git a/pyrogram/client/types/user_profile_photos.py b/pyrogram/client/types/user_profile_photos.py index 4853f1fc..9e4c15c8 100644 --- a/pyrogram/client/types/user_profile_photos.py +++ b/pyrogram/client/types/user_profile_photos.py @@ -26,10 +26,10 @@ class UserProfilePhotos(Object): ID: ``0xb0700014`` Args: - total_count (``int`` ``32-bit``): + total_count (``int``): Total number of profile pictures the target user has. - photos (List of List of :obj:`PhotoSize `): + photos (List of List of :obj:`PhotoSize `): Requested profile pictures (in up to 4 sizes each). """ diff --git a/pyrogram/client/types/venue.py b/pyrogram/client/types/venue.py index bd70726f..4217dd9f 100644 --- a/pyrogram/client/types/venue.py +++ b/pyrogram/client/types/venue.py @@ -26,7 +26,7 @@ class Venue(Object): ID: ``0xb0700013`` Args: - location (:obj:`Location `): + location (:obj:`Location `): Venue location. title (``str``): @@ -35,7 +35,7 @@ class Venue(Object): address (``str``): Address of the venue. - foursquare_id (``str``, optional): + foursquare_id (``str``, *optional*): Foursquare identifier of the venue. """ diff --git a/pyrogram/client/types/video.py b/pyrogram/client/types/video.py index 82326ecf..da9ee6a6 100644 --- a/pyrogram/client/types/video.py +++ b/pyrogram/client/types/video.py @@ -29,28 +29,28 @@ class Video(Object): file_id (``str``): Unique identifier for this file. - width (``int`` ``32-bit``): + width (``int``): Video width as defined by sender. - height (``int`` ``32-bit``): + height (``int``): Video height as defined by sender. - duration (``int`` ``32-bit``): + duration (``int``): Duration of the video in seconds as defined by sender. - thumb (:obj:`PhotoSize `, optional): + thumb (:obj:`PhotoSize `, *optional*): Video thumbnail. - file_name (``str``, optional): + file_name (``str``, *optional*): Video file name. - mime_type (``str``, optional): + mime_type (``str``, *optional*): Mime type of a file as defined by sender. - file_size (``int`` ``32-bit``, optional): + file_size (``int``, *optional*): File size. - date (``int``, optional): + date (``int``, *optional*): Date the video was sent in Unix time. """ ID = 0xb0700008 diff --git a/pyrogram/client/types/video_note.py b/pyrogram/client/types/video_note.py index 1ae879fd..e4863b0c 100644 --- a/pyrogram/client/types/video_note.py +++ b/pyrogram/client/types/video_note.py @@ -29,28 +29,28 @@ class VideoNote(Object): file_id (``str``): Unique identifier for this file. - length (``int`` ``32-bit``): + length (``int``): Video width and height as defined by sender. - duration (``int`` ``32-bit``): + duration (``int``): Duration of the video in seconds as defined by sender. - thumb (:obj:`PhotoSize `, optional): + thumb (:obj:`PhotoSize `, *optional*): Video thumbnail. - file_size (``int`` ``32-bit``, optional): + file_size (``int``, *optional*): File size. - file_name (``str``, optional): + file_name (``str``, *optional*): Video note file name. - mime_type (``str``, optional): + mime_type (``str``, *optional*): MIME type of the file as defined by sender. - file_size (``int`` ``32-bit``, optional): + file_size (``int``, *optional*): File size. - date (``int``, optional): + date (``int``, *optional*): Date the video note was sent in Unix time. """ ID = 0xb0700010 diff --git a/pyrogram/client/types/voice.py b/pyrogram/client/types/voice.py index 51ff32c8..095315d3 100644 --- a/pyrogram/client/types/voice.py +++ b/pyrogram/client/types/voice.py @@ -29,22 +29,22 @@ class Voice(Object): file_id (``str``): Unique identifier for this file. - duration (``int`` ``32-bit``): + duration (``int``): Duration of the audio in seconds as defined by sender. - thumb (:obj:`PhotoSize `, optional): + thumb (:obj:`PhotoSize `, *optional*): Voice thumbnail. - file_name (``str``, optional): + file_name (``str``, *optional*): Voice file name. - mime_type (``str``, optional): + mime_type (``str``, *optional*): MIME type of the file as defined by sender. - file_size (``int`` ``32-bit``, optional): + file_size (``int``, *optional*): File size. - date (``int``, optional): + date (``int``, *optional*): Date the voice was sent in Unix time. """ ID = 0xb0700009