Clean all types and add docs

This commit is contained in:
Dan 2018-04-24 16:41:52 +02:00
parent 6e78935857
commit 7a20c8bca8
45 changed files with 281 additions and 287 deletions

View File

@ -8,6 +8,7 @@ after the well established `Telegram Bot API`_ methods, thus offering a familiar
.. toctree:: .. toctree::
Client Client
types/index
MessageHandler MessageHandler
RawUpdateHandler RawUpdateHandler
Filters Filters
@ -16,30 +17,4 @@ after the well established `Telegram Bot API`_ methods, thus offering a familiar
Emoji Emoji
Error 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 .. _Telegram Bot API: https://core.telegram.org/bots/api#available-methods

View File

@ -0,0 +1,5 @@
Audio
=====
.. autoclass:: pyrogram.Audio
:members:

View File

@ -0,0 +1,5 @@
Chat
====
.. autoclass:: pyrogram.Chat
:members:

View File

@ -0,0 +1,5 @@
ChatMember
==========
.. autoclass:: pyrogram.ChatMember
:members:

View File

@ -0,0 +1,5 @@
ChatPhoto
=========
.. autoclass:: pyrogram.ChatPhoto
:members:

View File

@ -0,0 +1,5 @@
Contact
=======
.. autoclass:: pyrogram.Contact
:members:

View File

@ -0,0 +1,5 @@
Document
========
.. autoclass:: pyrogram.Document
:members:

View File

@ -3,4 +3,3 @@ InputMediaPhoto
.. autoclass:: pyrogram.InputMediaPhoto .. autoclass:: pyrogram.InputMediaPhoto
:members: :members:
:undoc-members:

View File

@ -3,4 +3,3 @@ InputMediaVideo
.. autoclass:: pyrogram.InputMediaVideo .. autoclass:: pyrogram.InputMediaVideo
:members: :members:
:undoc-members:

View File

@ -3,4 +3,3 @@ InputPhoneContact
.. autoclass:: pyrogram.InputPhoneContact .. autoclass:: pyrogram.InputPhoneContact
:members: :members:
:undoc-members:

View File

@ -0,0 +1,5 @@
Location
========
.. autoclass:: pyrogram.Location
:members:

View File

@ -0,0 +1,5 @@
Message
=======
.. autoclass:: pyrogram.Message
:members:

View File

@ -0,0 +1,5 @@
MessageEntity
=============
.. autoclass:: pyrogram.MessageEntity
:members:

View File

@ -0,0 +1,5 @@
PhotoSize
=========
.. autoclass:: pyrogram.PhotoSize
:members:

View File

@ -0,0 +1,5 @@
Sticker
=======
.. autoclass:: pyrogram.Sticker
:members:

View File

@ -0,0 +1,5 @@
Update
======
.. autoclass:: pyrogram.Update
:members:

View File

@ -0,0 +1,5 @@
User
====
.. autoclass:: pyrogram.User
:members:

View File

@ -0,0 +1,5 @@
UserProfilePhotos
=================
.. autoclass:: pyrogram.UserProfilePhotos
:members:

View File

@ -0,0 +1,5 @@
Venue
=====
.. autoclass:: pyrogram.Venue
:members:

View File

@ -0,0 +1,5 @@
Video
=====
.. autoclass:: pyrogram.Video
:members:

View File

@ -0,0 +1,5 @@
VideoNote
=========
.. autoclass:: pyrogram.VideoNote
:members:

View File

@ -0,0 +1,5 @@
Voice
=====
.. autoclass:: pyrogram.Voice
:members:

View File

@ -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

View File

@ -1,91 +0,0 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# 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 <http://www.gnu.org/licenses/>.
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

View File

@ -591,8 +591,4 @@ def parse_message_empty(
users: dict, users: dict,
chats: dict chats: dict
) -> pyrogram_types.Message: ) -> pyrogram_types.Message:
return pyrogram_types.Message( return pyrogram_types.Message(message_id=message.id)
message_id=message.id,
date=None,
chat=None
)

View File

@ -29,28 +29,28 @@ class Audio(Object):
file_id (``str``): file_id (``str``):
Unique identifier for this file. Unique identifier for this file.
duration (``int`` ``32-bit``): duration (``int``):
Duration of the audio in seconds as defined by sender. Duration of the audio in seconds as defined by sender.
thumb (:obj:`PhotoSize <pyrogram.types.PhotoSize>`, optional): thumb (:obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
Audio thumbnail. Audio thumbnail.
file_name (``str``, optional): file_name (``str``, *optional*):
Audio file name. Audio file name.
mime_type (``str``, optional): mime_type (``str``, *optional*):
MIME type of the file as defined by sender. MIME type of the file as defined by sender.
file_size (``int`` ``32-bit``, optional): file_size (``int``, *optional*):
File size. File size.
date (``int``, optional): date (``int``, *optional*):
Date the audio was sent in Unix time. 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. 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. Title of the audio as defined by sender or by audio tags.
""" """
ID = 0xb0700006 ID = 0xb0700006

View File

@ -26,7 +26,7 @@ class Chat(Object):
ID: ``0xb0700002`` ID: ``0xb0700002``
Args: Args:
id (``int`` ``32-bit``): id (``int``):
Unique identifier for this chat. This number may be greater than 32 bits and some programming 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, 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. 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 (``str``):
Type of chat, can be either "private", "group", "supergroup" or "channel". Type of chat, can be either "private", "group", "supergroup" or "channel".
title (``str``, optional): title (``str``, *optional*):
Title, for supergroups, channels and group chats. Title, for supergroups, channels and group chats.
username (``str``, optional): username (``str``, *optional*):
Username, for private chats, supergroups and channels if available. 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. 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. 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. True if a group has 'All Members Are Admins' enabled.
photo (:obj:`ChatPhoto <pyrogram.types.ChatPhoto>`, optional): photo (:obj:`ChatPhoto <pyrogram.ChatPhoto>`, *optional*):
Chat photo. Returned only in getChat. Chat photo. Returned only in getChat.
description (``str``, optional): description (``str``, *optional*):
Description, for supergroups and channel chats. Returned only in getChat. 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. Chat invite link, for supergroups and channel chats. Returned only in getChat.
pinned_message (:obj:`Message <pyrogram.types.Message>`, optional): pinned_message (:obj:`Message <pyrogram.Message>`, *optional*):
Pinned message, for supergroups and channel chats. Returned only in getChat. 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. 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. True, if the bot can change the group sticker set. Returned only in getChat.
""" """

View File

@ -26,58 +26,58 @@ class ChatMember(Object):
ID: ``0xb0700016`` ID: ``0xb0700016``
Args: Args:
user (:obj:`User <pyrogram.types.User>`): user (:obj:`User <pyrogram.User>`):
Information about the user. Information about the user.
status (``str``): status (``str``):
The member's status in the chat. Can be "creator", "administrator", "member", "restricted", The member's status in the chat. Can be "creator", "administrator", "member", "restricted",
"left" or "kicked". "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. 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. 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. 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. 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, Administrators only. True, if the administrator can edit messages of other users and can pin messages,
channels only. channels only.
can_delete_messages (``bool``, optional): can_delete_messages (``bool``, *optional*):
Administrators only. True, if the administrator can delete messages of other users. 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. 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. 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. 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 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 own privileges or demote administrators that he has promoted, directly or indirectly (promoted by
administrators that were appointed by the user). 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. 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, Restricted only. True, if the user can send audios, documents, photos, videos, video notes and voice notes,
implies can_send_messages. 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 Restricted only. True, if the user can send animations, games, stickers and use inline bots, implies
can_send_media_messages. 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. Restricted only. True, if user may add web page previews to his messages, implies can_send_media_messages.
""" """

View File

@ -32,10 +32,10 @@ class Contact(Object):
first_name (``str``): first_name (``str``):
Contact's first name. Contact's first name.
last_name (``str``, optional): last_name (``str``, *optional*):
Contact's last name. Contact's last name.
user_id (``int`` ``32-bit``, optional): user_id (``int``, *optional*):
Contact's user identifier in Telegram. Contact's user identifier in Telegram.
""" """
ID = 0xb0700011 ID = 0xb0700011

View File

@ -29,19 +29,19 @@ class Document(Object):
file_id (``str``): file_id (``str``):
Unique file identifier. Unique file identifier.
thumb (:obj:`PhotoSize <pyrogram.types.PhotoSize>`, optional): thumb (:obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
Document thumbnail as defined by sender. Document thumbnail as defined by sender.
file_name (``str``, optional): file_name (``str``, *optional*):
Original filename as defined by sender. Original filename as defined by sender.
mime_type (``str``, optional): mime_type (``str``, *optional*):
MIME type of the file as defined by sender. MIME type of the file as defined by sender.
file_size (``int`` ``32-bit``, optional): file_size (``int``, *optional*):
File size. File size.
date (``int``, optional): date (``int``, *optional*):
Date the document was sent in Unix time. Date the document was sent in Unix time.
""" """
ID = 0xb0700007 ID = 0xb0700007

View File

@ -22,16 +22,16 @@ class InputMediaPhoto:
It is intended to be used with :obj:`send_media_group() <pyrogram.Client.send_media_group>`. It is intended to be used with :obj:`send_media_group() <pyrogram.Client.send_media_group>`.
Args: Args:
media (:obj:`str`): media (``str``):
Photo to send. Photo to send.
Pass a file_id as string to send a photo that exists on the Telegram servers or 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. 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. 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 Caption of the photo to be sent, 0-200 characters
parse_mode (:obj:`str`, optional): parse_mode (``str``, *optional*):
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>` Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
Defaults to Markdown. Defaults to Markdown.

View File

@ -22,30 +22,30 @@ class InputMediaVideo:
It is intended to be used with :obj:`send_media_group() <pyrogram.Client.send_media_group>`. It is intended to be used with :obj:`send_media_group() <pyrogram.Client.send_media_group>`.
Args: Args:
media (:obj:`str`): media (``str``):
Video to send. Video to send.
Pass a file_id as string to send a video that exists on the Telegram servers or 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. 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. 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 Caption of the video to be sent, 0-200 characters
parse_mode (:obj:`str`, optional): parse_mode (``str``, *optional*):
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>` Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
Defaults to Markdown. Defaults to Markdown.
width (:obj:`int`, optional): width (``int``, *optional*):
Video width. Video width.
height (:obj:`int`, optional): height (``int``, *optional*):
Video height. Video height.
duration (:obj:`int`, optional): duration (``int``, *optional*):
Video duration. Video duration.
supports_streaming (:obj:`bool`, optional): supports_streaming (``bool``, *optional*):
Pass True, if the uploaded video is suitable for streaming. Pass True, if the uploaded video is suitable for streaming.
""" """

View File

@ -31,7 +31,7 @@ class InputPhoneContact:
first_name (``str``): first_name (``str``):
Contact's first name Contact's first name
last_name (``str``, optional): last_name (``str``, *optional*):
Contact's last name Contact's last name
""" """

View File

@ -26,10 +26,10 @@ class Location(Object):
ID: ``0xb0700012`` ID: ``0xb0700012``
Args: Args:
longitude (``float`` ``64-bit``): longitude (``float``):
Longitude as defined by sender. Longitude as defined by sender.
latitude (``float`` ``64-bit``): latitude (``float``):
Latitude as defined by sender. Latitude as defined by sender.
""" """
ID = 0xb0700012 ID = 0xb0700012

View File

@ -26,153 +26,153 @@ class Message(Object):
ID: ``0xb0700003`` ID: ``0xb0700003``
Args: Args:
message_id (``int`` ``32-bit``): message_id (``int``):
Unique message identifier inside this chat. Unique message identifier inside this chat.
date (``int`` ``32-bit``): date (``int``, *optional*):
Sender, empty for messages sent to channels.
chat (:obj:`Chat <pyrogram.types.Chat>`):
Date the message was sent in Unix time. Date the message was sent in Unix time.
from_user (:obj:`User <pyrogram.types.User>`, optional): chat (:obj:`Chat <pyrogram.Chat>`, *optional*):
Conversation the message belongs to. Conversation the message belongs to.
forward_from (:obj:`User <pyrogram.types.User>`, optional): from_user (:obj:`User <pyrogram.User>`, *optional*):
Sender, empty for messages sent to channels.
forward_from (:obj:`User <pyrogram.User>`, *optional*):
For forwarded messages, sender of the original message. For forwarded messages, sender of the original message.
forward_from_chat (:obj:`Chat <pyrogram.types.Chat>`, optional): forward_from_chat (:obj:`Chat <pyrogram.Chat>`, *optional*):
For messages forwarded from channels, information about the original channel. 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. 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. 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. For forwarded messages, date the original message was sent in Unix time.
reply_to_message (:obj:`Message <pyrogram.types.Message>`, optional): reply_to_message (:obj:`Message <pyrogram.Message>`, *optional*):
For replies, the original message. Note that the Message object in this field will not contain 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. 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. 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. 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. 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. For text messages, the actual UTF-8 text of the message, 0-4096 characters.
entities (List of :obj:`MessageEntity <pyrogram.types.MessageEntity>`, optional): entities (List of :obj:`MessageEntity <pyrogram.MessageEntity>`, *optional*):
For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.
caption_entities (List of :obj:`MessageEntity <pyrogram.types.MessageEntity>`, optional): caption_entities (List of :obj:`MessageEntity <pyrogram.MessageEntity>`, *optional*):
For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear
in the caption. in the caption.
audio (:obj:`Audio <pyrogram.types.Audio>`, optional): audio (:obj:`Audio <pyrogram.Audio>`, *optional*):
Message is an audio file, information about the file. Message is an audio file, information about the file.
document (:obj:`Document <pyrogram.types.Document>`, optional): document (:obj:`Document <pyrogram.Document>`, *optional*):
Message is a general file, information about the file. Message is a general file, information about the file.
game (:obj:`Game <pyrogram.types.Game>`, optional): game (:obj:`Game <pyrogram.Game>`, *optional*):
Message is a game, information about the game. More about games. Message is a game, information about the game. More about games.
photo (List of :obj:`PhotoSize <pyrogram.types.PhotoSize>`, optional): photo (List of :obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
Message is a photo, available sizes of the photo. Message is a photo, available sizes of the photo.
sticker (:obj:`Sticker <pyrogram.types.Sticker>`, optional): sticker (:obj:`Sticker <pyrogram.Sticker>`, *optional*):
Message is a sticker, information about the sticker. Message is a sticker, information about the sticker.
video (:obj:`Video <pyrogram.types.Video>`, optional): video (:obj:`Video <pyrogram.Video>`, *optional*):
Message is a video, information about the video. Message is a video, information about the video.
voice (:obj:`Voice <pyrogram.types.Voice>`, optional): voice (:obj:`Voice <pyrogram.Voice>`, *optional*):
Message is a voice message, information about the file. Message is a voice message, information about the file.
video_note (:obj:`VideoNote <pyrogram.types.VideoNote>`, optional): video_note (:obj:`VideoNote <pyrogram.VideoNote>`, *optional*):
Message is a video note, information about the video message. 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. Caption for the audio, document, photo, video or voice, 0-200 characters.
contact (:obj:`Contact <pyrogram.types.Contact>`, optional): contact (:obj:`Contact <pyrogram.Contact>`, *optional*):
Message is a shared contact, information about the contact. Message is a shared contact, information about the contact.
location (:obj:`Location <pyrogram.types.Location>`, optional): location (:obj:`Location <pyrogram.Location>`, *optional*):
Message is a shared location, information about the location. Message is a shared location, information about the location.
venue (:obj:`Venue <pyrogram.types.Venue>`, optional): venue (:obj:`Venue <pyrogram.Venue>`, *optional*):
Message is a venue, information about the venue. Message is a venue, information about the venue.
new_chat_members (List of :obj:`User <pyrogram.types.User>`, optional): new_chat_members (List of :obj:`User <pyrogram.User>`, *optional*):
New members that were added to the group or supergroup and information about them New members that were added to the group or supergroup and information about them
(the bot itself may be one of these members). (the bot itself may be one of these members).
left_chat_member (:obj:`User <pyrogram.types.User>`, optional): left_chat_member (:obj:`User <pyrogram.User>`, *optional*):
A member was removed from the group, information about them (this member may be the bot itself). 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. A chat title was changed to this value.
new_chat_photo (List of :obj:`PhotoSize <pyrogram.types.PhotoSize>`, optional): new_chat_photo (List of :obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
A chat photo was change to this value. 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. Service message: the chat photo was deleted.
group_chat_created (``bool``, optional): group_chat_created (``bool``, *optional*):
Service message: the group has been created. Service message: the group has been created.
supergroup_chat_created (``bool``, optional): supergroup_chat_created (``bool``, *optional*):
Service message: the supergroup has been created. 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 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 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. first message in a directly created supergroup.
channel_chat_created (``bool``, optional): channel_chat_created (``bool``, *optional*):
Service message: the channel has been created. 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 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 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. 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. 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 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 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. 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. 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 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 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. type are safe for storing this identifier.
pinned_message (:obj:`Message <pyrogram.types.Message>`, optional): pinned_message (:obj:`Message <pyrogram.Message>`, *optional*):
Specified message was pinned. Specified message was pinned.
Note that the Message object in this field will not contain further reply_to_message fields even if it Note that the Message object in this field will not contain further reply_to_message fields even if it
is itself a reply. is itself a reply.
invoice (:obj:`Invoice <pyrogram.types.Invoice>`, optional): invoice (:obj:`Invoice <pyrogram.Invoice>`, *optional*):
Message is an invoice for a payment, information about the invoice. More about payments. Message is an invoice for a payment, information about the invoice. More about payments.
successful_payment (:obj:`SuccessfulPayment <pyrogram.types.SuccessfulPayment>`, optional): successful_payment (:obj:`SuccessfulPayment <pyrogram.SuccessfulPayment>`, *optional*):
Message is a service message about a successful payment, information about the payment. More about payments. 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. 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. Channel post views.
via_bot (:obj:`User <pyrogram.types.User>`): via_bot (:obj:`User <pyrogram.User>`):
Via bot. Via bot.
""" """
ID = 0xb0700003 ID = 0xb0700003
@ -180,8 +180,8 @@ class Message(Object):
def __init__( def __init__(
self, self,
message_id: int, message_id: int,
date: int, date: int = None,
chat, chat = None,
from_user=None, from_user=None,
forward_from=None, forward_from=None,
forward_from_chat=None, forward_from_chat=None,

View File

@ -33,16 +33,16 @@ class MessageEntity(Object):
code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs),
text_mention (for users without usernames). text_mention (for users without usernames).
offset (``int`` ``32-bit``): offset (``int``):
Offset in UTF-16 code units to the start of the entity. 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. 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. For "text_link" only, url that will be opened after user taps on the text.
user (:obj:`User <pyrogram.types.User>`, optional): user (:obj:`User <pyrogram.User>`, *optional*):
For "text_mention" only, the mentioned user. For "text_mention" only, the mentioned user.
""" """

View File

@ -29,16 +29,16 @@ class PhotoSize(Object):
file_id (``str``): file_id (``str``):
Unique identifier for this file. Unique identifier for this file.
width (``int`` ``32-bit``): width (``int``):
Photo width. Photo width.
height (``int`` ``32-bit``): height (``int``):
Photo height. Photo height.
file_size (``int`` ``32-bit``, optional): file_size (``int``, *optional*):
File size. File size.
date (``int``, optional): date (``int``, *optional*):
Date the photo was sent in Unix time Date the photo was sent in Unix time
""" """
ID = 0xb0700005 ID = 0xb0700005

View File

@ -29,34 +29,34 @@ class Sticker(Object):
file_id (``str``): file_id (``str``):
Unique identifier for this file. Unique identifier for this file.
width (``int`` ``32-bit``): width (``int``):
Sticker width. Sticker width.
height (``int`` ``32-bit``): height (``int``):
Sticker height. Sticker height.
thumb (:obj:`PhotoSize <pyrogram.types.PhotoSize>`, optional): thumb (:obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
Sticker thumbnail in the .webp or .jpg format. Sticker thumbnail in the .webp or .jpg format.
file_name (``str``, optional): file_name (``str``, *optional*):
Sticker file name. Sticker file name.
mime_type (``str``, optional): mime_type (``str``, *optional*):
MIME type of the file as defined by sender. MIME type of the file as defined by sender.
file_size (``int`` ``32-bit``, optional): file_size (``int``, *optional*):
File size. File size.
date (``int``, optional): date (``int``, *optional*):
Date the sticker was sent in Unix time. Date the sticker was sent in Unix time.
emoji (``str``, optional): emoji (``str``, *optional*):
Emoji associated with the sticker. Emoji associated with the sticker.
set_name (``str``, optional): set_name (``str``, *optional*):
Name of the sticker set to which the sticker belongs. Name of the sticker set to which the sticker belongs.
mask_position (:obj:`MaskPosition <pyrogram.types.MaskPosition>`, optional): mask_position (:obj:`MaskPosition <pyrogram.MaskPosition>`, *optional*):
For mask stickers, the position where the mask should be placed. For mask stickers, the position where the mask should be placed.
""" """
ID = 0xb0700017 ID = 0xb0700017

View File

@ -27,33 +27,33 @@ class Update(Object):
ID: ``0xb0700000`` ID: ``0xb0700000``
Args: Args:
message (:obj:`Message <pyrogram.types.Message>`, optional): message (:obj:`Message <pyrogram.Message>`, *optional*):
New incoming message of any kind text, photo, sticker, etc. New incoming message of any kind text, photo, sticker, etc.
edited_message (:obj:`Message <pyrogram.types.Message>`, optional): edited_message (:obj:`Message <pyrogram.Message>`, *optional*):
New version of a message that is known to the bot and was edited. New version of a message that is known to the bot and was edited.
channel_post (:obj:`Message <pyrogram.types.Message>`, optional): channel_post (:obj:`Message <pyrogram.Message>`, *optional*):
New incoming channel post of any kind text, photo, sticker, etc. New incoming channel post of any kind text, photo, sticker, etc.
edited_channel_post (:obj:`Message <pyrogram.types.Message>`, optional): edited_channel_post (:obj:`Message <pyrogram.Message>`, *optional*):
New version of a channel post that is known to the bot and was edited. New version of a channel post that is known to the bot and was edited.
inline_query (:obj:`InlineQuery <pyrogram.types.InlineQuery>`, optional): inline_query (:obj:`InlineQuery <pyrogram.InlineQuery>`, *optional*):
New incoming inline query. New incoming inline query.
chosen_inline_result (:obj:`ChosenInlineResult <pyrogram.types.ChosenInlineResult>`, optional): chosen_inline_result (:obj:`ChosenInlineResult <pyrogram.ChosenInlineResult>`, *optional*):
The result of an inline query that was chosen by a user and sent to their chat partner. 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 Please see our documentation on the feedback collecting for details on how to enable these updates
for your bot. for your bot.
callback_query (:obj:`CallbackQuery <pyrogram.types.CallbackQuery>`, optional): callback_query (:obj:`CallbackQuery <pyrogram.CallbackQuery>`, *optional*):
New incoming callback query. New incoming callback query.
shipping_query (:obj:`ShippingQuery <pyrogram.types.ShippingQuery>`, optional): shipping_query (:obj:`ShippingQuery <pyrogram.ShippingQuery>`, *optional*):
New incoming shipping query. Only for invoices with flexible price. New incoming shipping query. Only for invoices with flexible price.
pre_checkout_query (:obj:`PreCheckoutQuery <pyrogram.types.PreCheckoutQuery>`, optional): pre_checkout_query (:obj:`PreCheckoutQuery <pyrogram.PreCheckoutQuery>`, *optional*):
New incoming pre-checkout query. Contains full information about checkout. New incoming pre-checkout query. Contains full information about checkout.
""" """

View File

@ -26,7 +26,7 @@ class User(Object):
ID: ``0xb0700001`` ID: ``0xb0700001``
Args: Args:
id (``int`` ``32-bit``): id (``int``):
Unique identifier for this user or bot. Unique identifier for this user or bot.
is_bot (``bool``): is_bot (``bool``):
@ -35,19 +35,19 @@ class User(Object):
first_name (``str``): first_name (``str``):
User's or bot's first name. User's or bot's first name.
last_name (``str``, optional): last_name (``str``, *optional*):
User's or bot's last name. User's or bot's last name.
username (``str``, optional): username (``str``, *optional*):
User's or bot's username. User's or bot's username.
language_code (``str``, optional): language_code (``str``, *optional*):
IETF language tag of the user's language. IETF language tag of the user's language.
phone_number (``str``, optional): phone_number (``str``, *optional*):
User's or bot's phone number. User's or bot's phone number.
photo (obj:`ChatPhoto <pyrogram.types.ChatPhoto>`, optional): photo (:obj:`ChatPhoto <pyrogram.ChatPhoto>`, *optional*):
User's or bot's current profile photo. User's or bot's current profile photo.
""" """
ID = 0xb0700001 ID = 0xb0700001

View File

@ -26,10 +26,10 @@ class UserProfilePhotos(Object):
ID: ``0xb0700014`` ID: ``0xb0700014``
Args: Args:
total_count (``int`` ``32-bit``): total_count (``int``):
Total number of profile pictures the target user has. Total number of profile pictures the target user has.
photos (List of List of :obj:`PhotoSize <pyrogram.types.PhotoSize>`): photos (List of List of :obj:`PhotoSize <pyrogram.PhotoSize>`):
Requested profile pictures (in up to 4 sizes each). Requested profile pictures (in up to 4 sizes each).
""" """

View File

@ -26,7 +26,7 @@ class Venue(Object):
ID: ``0xb0700013`` ID: ``0xb0700013``
Args: Args:
location (:obj:`Location <pyrogram.types.Location>`): location (:obj:`Location <pyrogram.Location>`):
Venue location. Venue location.
title (``str``): title (``str``):
@ -35,7 +35,7 @@ class Venue(Object):
address (``str``): address (``str``):
Address of the venue. Address of the venue.
foursquare_id (``str``, optional): foursquare_id (``str``, *optional*):
Foursquare identifier of the venue. Foursquare identifier of the venue.
""" """

View File

@ -29,28 +29,28 @@ class Video(Object):
file_id (``str``): file_id (``str``):
Unique identifier for this file. Unique identifier for this file.
width (``int`` ``32-bit``): width (``int``):
Video width as defined by sender. Video width as defined by sender.
height (``int`` ``32-bit``): height (``int``):
Video height as defined by sender. Video height as defined by sender.
duration (``int`` ``32-bit``): duration (``int``):
Duration of the video in seconds as defined by sender. Duration of the video in seconds as defined by sender.
thumb (:obj:`PhotoSize <pyrogram.types.PhotoSize>`, optional): thumb (:obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
Video thumbnail. Video thumbnail.
file_name (``str``, optional): file_name (``str``, *optional*):
Video file name. Video file name.
mime_type (``str``, optional): mime_type (``str``, *optional*):
Mime type of a file as defined by sender. Mime type of a file as defined by sender.
file_size (``int`` ``32-bit``, optional): file_size (``int``, *optional*):
File size. File size.
date (``int``, optional): date (``int``, *optional*):
Date the video was sent in Unix time. Date the video was sent in Unix time.
""" """
ID = 0xb0700008 ID = 0xb0700008

View File

@ -29,28 +29,28 @@ class VideoNote(Object):
file_id (``str``): file_id (``str``):
Unique identifier for this file. Unique identifier for this file.
length (``int`` ``32-bit``): length (``int``):
Video width and height as defined by sender. Video width and height as defined by sender.
duration (``int`` ``32-bit``): duration (``int``):
Duration of the video in seconds as defined by sender. Duration of the video in seconds as defined by sender.
thumb (:obj:`PhotoSize <pyrogram.types.PhotoSize>`, optional): thumb (:obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
Video thumbnail. Video thumbnail.
file_size (``int`` ``32-bit``, optional): file_size (``int``, *optional*):
File size. File size.
file_name (``str``, optional): file_name (``str``, *optional*):
Video note file name. Video note file name.
mime_type (``str``, optional): mime_type (``str``, *optional*):
MIME type of the file as defined by sender. MIME type of the file as defined by sender.
file_size (``int`` ``32-bit``, optional): file_size (``int``, *optional*):
File size. File size.
date (``int``, optional): date (``int``, *optional*):
Date the video note was sent in Unix time. Date the video note was sent in Unix time.
""" """
ID = 0xb0700010 ID = 0xb0700010

View File

@ -29,22 +29,22 @@ class Voice(Object):
file_id (``str``): file_id (``str``):
Unique identifier for this file. Unique identifier for this file.
duration (``int`` ``32-bit``): duration (``int``):
Duration of the audio in seconds as defined by sender. Duration of the audio in seconds as defined by sender.
thumb (:obj:`PhotoSize <pyrogram.types.PhotoSize>`, optional): thumb (:obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
Voice thumbnail. Voice thumbnail.
file_name (``str``, optional): file_name (``str``, *optional*):
Voice file name. Voice file name.
mime_type (``str``, optional): mime_type (``str``, *optional*):
MIME type of the file as defined by sender. MIME type of the file as defined by sender.
file_size (``int`` ``32-bit``, optional): file_size (``int``, *optional*):
File size. File size.
date (``int``, optional): date (``int``, *optional*):
Date the voice was sent in Unix time. Date the voice was sent in Unix time.
""" """
ID = 0xb0700009 ID = 0xb0700009