2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-30 22:05:28 +00:00

Merge develop -> asyncio

This commit is contained in:
Dan
2019-06-06 19:33:45 +02:00
48 changed files with 135 additions and 103 deletions

View File

@@ -288,9 +288,9 @@ def start():
sorted_args = sort_args(c.args) sorted_args = sort_args(c.args)
arguments = ( arguments = (
", " ", "
+ ("*, " if c.args else "") + ("*, " if c.args else "")
+ (", ".join([get_argument_type(i) for i in sorted_args if i != ("flags", "#")]) if c.args else "") + (", ".join([get_argument_type(i) for i in sorted_args if i != ("flags", "#")]) if c.args else "")
) )
fields = "\n ".join( fields = "\n ".join(

View File

@@ -58,7 +58,7 @@ with open(DEST / "index.rst", "w") as index:
date = datetime.strptime( date = datetime.strptime(
release["published_at"], release["published_at"],
"%Y-%m-%dT%H:%M:%SZ" "%Y-%m-%dT%H:%M:%SZ"
).strftime("%b %d, %Y - %H:%M:%S (UTC)") ).strftime("%b %d, %Y")
body = pypandoc.convert_text( body = pypandoc.convert_text(
release["body"].replace(r"\r\n", "\n"), release["body"].replace(r"\r\n", "\n"),
@@ -67,12 +67,17 @@ with open(DEST / "index.rst", "w") as index:
extra_args=["--wrap=none"] extra_args=["--wrap=none"]
) )
tarball_url = release["tarball_url"]
zipball_url = release["zipball_url"]
index.write("- :doc:`{} <{}>`\n".format(title, tag)) index.write("- :doc:`{} <{}>`\n".format(title, tag))
tags.append(tag) tags.append(tag)
with open(DEST / "{}.rst".format(tag), "w") as page: with open(DEST / "{}.rst".format(tag), "w") as page:
page.write("Pyrogram " + tag + "\n" + "=" * (len(tag) + 9) + "\n\n") page.write("Pyrogram " + tag + "\n" + "=" * (len(tag) + 9) + "\n\n")
page.write("--- *Released on " + str(date) + "*\n\n") page.write("\t\tReleased on " + str(date) + "\n\n")
page.write("- :download:`Source Code (zip) <{}>`\n".format(zipball_url))
page.write("- :download:`Source Code (tar.gz) <{}>`\n\n".format(tarball_url))
page.write(name + "\n" + "-" * len(name) + "\n\n") page.write(name + "\n" + "-" * len(name) + "\n\n")
page.write(body + "\n\n") page.write(body + "\n\n")

View File

@@ -45,7 +45,7 @@ Messages & Media
- :class:`Messages` - :class:`Messages`
- :class:`MessageEntity` - :class:`MessageEntity`
- :class:`Photo` - :class:`Photo`
- :class:`Photos` - :class:`ProfilePhotos`
- :class:`Thumbnail` - :class:`Thumbnail`
- :class:`Audio` - :class:`Audio`
- :class:`Document` - :class:`Document`
@@ -133,7 +133,7 @@ Details
.. autoclass:: Messages() .. autoclass:: Messages()
.. autoclass:: MessageEntity() .. autoclass:: MessageEntity()
.. autoclass:: Photo() .. autoclass:: Photo()
.. autoclass:: Photos() .. autoclass:: ProfilePhotos()
.. autoclass:: Thumbnail() .. autoclass:: Thumbnail()
.. autoclass:: Audio() .. autoclass:: Audio()
.. autoclass:: Document() .. autoclass:: Document()

View File

@@ -197,7 +197,7 @@ And here's a good explanation of how, probably, the system works:
data-width="100%"> data-width="100%">
</script> </script>
.. centered:: Join the discussion at `@PyrogramChat <https://t.me/pyrogramchat>`_ .. centered:: Join the discussion at `@Pyrogram <https://t.me/pyrogram>`_
However, you might be right, and your account was deactivated/limited without any good reason. This could happen because However, you might be right, and your account was deactivated/limited without any good reason. This could happen because
of mistakes by either the automatic systems or a moderator. In such cases you can kindly email Telegram at of mistakes by either the automatic systems or a moderator. In such cases you can kindly email Telegram at

View File

@@ -50,8 +50,8 @@ How the Documentation is Organized
---------------------------------- ----------------------------------
Contents are organized into self-contained topics and can be all accessed from the sidebar, or by following them in Contents are organized into self-contained topics and can be all accessed from the sidebar, or by following them in
order using the Next button at the end of each page. Here below you can, instead, find a list of the most relevant order using the :guilabel:`Next` button at the end of each page. Here below you can, instead, find a list of the most
pages for a quick access. relevant pages for a quick access.
First Steps First Steps
----------- -----------

View File

@@ -39,8 +39,8 @@ keep the session alive, Pyrogram won't ask you again to enter your phone number.
.. note:: .. note::
The code above does nothing except asking for credentials and keeping the client online, hit ``CTRL+C`` now to stop The code above does nothing except asking for credentials and keeping the client online, hit :guilabel:`CTRL+C` now
your application and keep reading. to stop your application and keep reading.
Bot Authorization Bot Authorization
----------------- -----------------

View File

@@ -22,8 +22,8 @@ from .gzip_packed import GzipPacked
from .list import List from .list import List
from .message import Message from .message import Message
from .msg_container import MsgContainer from .msg_container import MsgContainer
from .tl_object import TLObject
from .primitives import ( from .primitives import (
Bool, BoolTrue, BoolFalse, Bytes, Double, Bool, BoolTrue, BoolFalse, Bytes, Double,
Int, Long, Int128, Int256, Null, String, Vector Int, Long, Int128, Int256, Null, String, Vector
) )
from .tl_object import TLObject

View File

@@ -18,8 +18,8 @@
from io import BytesIO from io import BytesIO
from .tl_object import TLObject
from .primitives import Int, Long from .primitives import Int, Long
from .tl_object import TLObject
class FutureSalt(TLObject): class FutureSalt(TLObject):

View File

@@ -19,8 +19,8 @@
from io import BytesIO from io import BytesIO
from . import FutureSalt from . import FutureSalt
from .tl_object import TLObject
from .primitives import Int, Long from .primitives import Int, Long
from .tl_object import TLObject
class FutureSalts(TLObject): class FutureSalts(TLObject):

View File

@@ -19,8 +19,8 @@
from gzip import compress, decompress from gzip import compress, decompress
from io import BytesIO from io import BytesIO
from .tl_object import TLObject
from .primitives import Int, Bytes from .primitives import Int, Bytes
from .tl_object import TLObject
class GzipPacked(TLObject): class GzipPacked(TLObject):

View File

@@ -18,8 +18,8 @@
from io import BytesIO from io import BytesIO
from .tl_object import TLObject
from .primitives import Int, Long from .primitives import Int, Long
from .tl_object import TLObject
class Message(TLObject): class Message(TLObject):

View File

@@ -19,8 +19,8 @@
from io import BytesIO from io import BytesIO
from .message import Message from .message import Message
from .tl_object import TLObject
from .primitives import Int from .primitives import Int
from .tl_object import TLObject
class MsgContainer(TLObject): class MsgContainer(TLObject):

View File

@@ -19,8 +19,8 @@
from typing import Union from typing import Union
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.errors import UnknownError
from pyrogram.client.ext import BaseClient from pyrogram.client.ext import BaseClient
from pyrogram.errors import UnknownError
class GetInlineBotResults(BaseClient): class GetInlineBotResults(BaseClient):

View File

@@ -23,6 +23,7 @@ from .get_chat_member import GetChatMember
from .get_chat_members import GetChatMembers from .get_chat_members import GetChatMembers
from .get_chat_members_count import GetChatMembersCount from .get_chat_members_count import GetChatMembersCount
from .get_dialogs import GetDialogs from .get_dialogs import GetDialogs
from .get_dialogs_count import GetDialogsCount
from .iter_chat_members import IterChatMembers from .iter_chat_members import IterChatMembers
from .iter_dialogs import IterDialogs from .iter_dialogs import IterDialogs
from .join_chat import JoinChat from .join_chat import JoinChat
@@ -38,7 +39,6 @@ from .set_chat_title import SetChatTitle
from .unban_chat_member import UnbanChatMember from .unban_chat_member import UnbanChatMember
from .unpin_chat_message import UnpinChatMessage from .unpin_chat_message import UnpinChatMessage
from .update_chat_username import UpdateChatUsername from .update_chat_username import UpdateChatUsername
from .get_dialogs_count import GetDialogsCount
class Chats( class Chats(

View File

@@ -37,8 +37,8 @@ class GetChatMember(BaseClient):
Unique identifier (int) or username (str) of the target chat. Unique identifier (int) or username (str) of the target chat.
user_id (``int`` | ``str``):: user_id (``int`` | ``str``)::
Unique identifier (int) or username (str) of the target chat. Unique identifier (int) or username (str) of the target user.
For your personal cloud (Saved Messages) you can simply use "me" or "self". For you yourself you can simply use "me" or "self".
For a contact that exists in your Telegram address book you can use his phone number (str). For a contact that exists in your Telegram address book you can use his phone number (str).
Returns: Returns:

View File

@@ -29,7 +29,7 @@ class GetProfilePhotos(BaseClient):
chat_id: Union[int, str], chat_id: Union[int, str],
offset: int = 0, offset: int = 0,
limit: int = 100 limit: int = 100
) -> "pyrogram.Photos": ) -> "pyrogram.ProfilePhotos":
"""Get a list of profile pictures for a user or a chat. """Get a list of profile pictures for a user or a chat.
Parameters: Parameters:
@@ -47,7 +47,7 @@ class GetProfilePhotos(BaseClient):
Values between 1—100 are accepted. Defaults to 100. Values between 1—100 are accepted. Defaults to 100.
Returns: Returns:
:obj:`Photos`: On success, an object containing a list of the profile photos is returned. :obj:`ProfilePhotos`: On success, an object containing a list of the profile photos is returned.
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
@@ -55,7 +55,7 @@ class GetProfilePhotos(BaseClient):
peer_id = await self.resolve_peer(chat_id) peer_id = await self.resolve_peer(chat_id)
if isinstance(peer_id, types.InputPeerUser): if isinstance(peer_id, types.InputPeerUser):
return pyrogram.Photos._parse( return pyrogram.ProfilePhotos._parse(
self, self,
await self.send( await self.send(
functions.photos.GetUserPhotos( functions.photos.GetUserPhotos(
@@ -86,7 +86,7 @@ class GetProfilePhotos(BaseClient):
) )
) )
return pyrogram.Photos( return pyrogram.ProfilePhotos(
total_count=new_chat_photos.total_count, total_count=new_chat_photos.total_count,
photos=[m.new_chat_photo for m in new_chat_photos.messages][:limit] profile_photos=[m.new_chat_photo for m in new_chat_photos.messages][:limit]
) )

View File

@@ -42,7 +42,7 @@ from ..object import Object
class InlineQueryResult(Object): class InlineQueryResult(Object):
"""One result of an inline query. """One result of an inline query.
Pyrogram currently supports results of the following 20 types: Pyrogram currently supports results of the following types:
- :obj:`InlineQueryResultArticle` - :obj:`InlineQueryResultArticle`
""" """

View File

@@ -58,7 +58,8 @@ class InlineQueryResultAudio(Object):
""" """
def __init__(self, type: str, id: str, audio_url: str, title: str, caption: str = None, parse_mode: str = None, performer: str = None, audio_duration: int = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, audio_url: str, title: str, caption: str = None, parse_mode: str = None,
performer: str = None, audio_duration: int = None, reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.audio_url = audio_url # string self.audio_url = audio_url # string

View File

@@ -20,10 +20,10 @@ import binascii
import struct import struct
from pyrogram.api import types from pyrogram.api import types
from pyrogram.errors import FileIdInvalid
from pyrogram.client.ext import utils, BaseClient from pyrogram.client.ext import utils, BaseClient
from pyrogram.client.style import HTML, Markdown from pyrogram.client.style import HTML, Markdown
from pyrogram.client.types.object import Object from pyrogram.client.types.object import Object
from pyrogram.errors import FileIdInvalid
class InlineQueryResultCachedAudio(Object): class InlineQueryResultCachedAudio(Object):

View File

@@ -56,7 +56,8 @@ class InlineQueryResultCachedDocument(Object):
""" """
ID = 0xb0700015 ID = 0xb0700015
def __init__(self, type: str, id: str, title: str, document_file_id: str, description: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, title: str, document_file_id: str, description: str = None,
caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.title = title # string self.title = title # string

View File

@@ -53,7 +53,8 @@ class InlineQueryResultCachedGif(Object):
""" """
ID = 0xb0700012 ID = 0xb0700012
def __init__(self, type: str, id: str, gif_file_id: str, title: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, gif_file_id: str, title: str = None, caption: str = None,
parse_mode: str = None, reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.gif_file_id = gif_file_id # string self.gif_file_id = gif_file_id # string

View File

@@ -53,7 +53,8 @@ class InlineQueryResultCachedMpeg4Gif(Object):
""" """
ID = 0xb0700013 ID = 0xb0700013
def __init__(self, type: str, id: str, mpeg4_file_id: str, title: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, mpeg4_file_id: str, title: str = None, caption: str = None,
parse_mode: str = None, reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.mpeg4_file_id = mpeg4_file_id # string self.mpeg4_file_id = mpeg4_file_id # string

View File

@@ -56,7 +56,8 @@ class InlineQueryResultCachedPhoto(Object):
""" """
ID = 0xb0700011 ID = 0xb0700011
def __init__(self, type: str, id: str, photo_file_id: str, title: str = None, description: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, photo_file_id: str, title: str = None, description: str = None,
caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.photo_file_id = photo_file_id # string self.photo_file_id = photo_file_id # string

View File

@@ -56,7 +56,8 @@ class InlineQueryResultCachedVideo(Object):
""" """
ID = 0xb0700016 ID = 0xb0700016
def __init__(self, type: str, id: str, video_file_id: str, title: str, description: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, video_file_id: str, title: str, description: str = None, caption: str = None,
parse_mode: str = None, reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.video_file_id = video_file_id # string self.video_file_id = video_file_id # string

View File

@@ -53,7 +53,8 @@ class InlineQueryResultCachedVoice(Object):
""" """
ID = 0xb0700017 ID = 0xb0700017
def __init__(self, type: str, id: str, voice_file_id: str, title: str, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, voice_file_id: str, title: str, caption: str = None, parse_mode: str = None,
reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.voice_file_id = voice_file_id # string self.voice_file_id = voice_file_id # string

View File

@@ -62,7 +62,9 @@ class InlineQueryResultContact(Object):
""" """
ID = 0xb0700009 ID = 0xb0700009
def __init__(self, type: str, id: str, phone_number: str, first_name: str, last_name: str = None, vcard: str = None, reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None): def __init__(self, type: str, id: str, phone_number: str, first_name: str, last_name: str = None, vcard: str = None,
reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None,
thumb_height: int = None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.phone_number = phone_number # string self.phone_number = phone_number # string

View File

@@ -68,7 +68,9 @@ class InlineQueryResultDocument(Object):
""" """
ID = 0xb0700006 ID = 0xb0700006
def __init__(self, type: str, id: str, title: str, document_url: str, mime_type: str, caption: str = None, parse_mode: str = None, description: str = None, reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None): def __init__(self, type: str, id: str, title: str, document_url: str, mime_type: str, caption: str = None,
parse_mode: str = None, description: str = None, reply_markup=None, input_message_content=None,
thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.title = title # string self.title = title # string

View File

@@ -65,7 +65,9 @@ class InlineQueryResultGif(Object):
""" """
ID = 0xb0700001 ID = 0xb0700001
def __init__(self, type: str, id: str, gif_url: str, thumb_url: str, gif_width: int = None, gif_height: int = None, gif_duration: int = None, title: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, gif_url: str, thumb_url: str, gif_width: int = None, gif_height: int = None,
gif_duration: int = None, title: str = None, caption: str = None, parse_mode: str = None,
reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.gif_url = gif_url # string self.gif_url = gif_url # string

View File

@@ -62,7 +62,9 @@ class InlineQueryResultLocation(Object):
""" """
ID = 0xb0700007 ID = 0xb0700007
def __init__(self, type: str, id: str, latitude: float, longitude: float, title: str, live_period: int = None, reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None): def __init__(self, type: str, id: str, latitude: float, longitude: float, title: str, live_period: int = None,
reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None,
thumb_height: int = None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.latitude = latitude # double self.latitude = latitude # double

View File

@@ -65,7 +65,9 @@ class InlineQueryResultMpeg4Gif(Object):
""" """
ID = 0xb0700002 ID = 0xb0700002
def __init__(self, type: str, id: str, mpeg4_url: str, thumb_url: str, mpeg4_width: int = None, mpeg4_height: int = None, mpeg4_duration: int = None, title: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, mpeg4_url: str, thumb_url: str, mpeg4_width: int = None,
mpeg4_height: int = None, mpeg4_duration: int = None, title: str = None, caption: str = None,
parse_mode: str = None, reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.mpeg4_url = mpeg4_url # string self.mpeg4_url = mpeg4_url # string

View File

@@ -63,18 +63,18 @@ class InlineQueryResultPhoto(Object):
""" """
def __init__( def __init__(
self, self,
id: str, id: str,
photo_url: str, photo_url: str,
thumb_url: str, thumb_url: str,
photo_width: int = 0, photo_width: int = 0,
photo_height: int = 0, photo_height: int = 0,
title: str = None, title: str = None,
description: str = None, description: str = None,
caption: str = "", caption: str = "",
parse_mode: str = "", parse_mode: str = "",
reply_markup=None, reply_markup=None,
input_message_content=None input_message_content=None
): ):
self.id = id # string self.id = id # string
self.photo_url = photo_url # string self.photo_url = photo_url # string

View File

@@ -68,7 +68,9 @@ class InlineQueryResultVenue(Object):
""" """
ID = 0xb0700008 ID = 0xb0700008
def __init__(self, type: str, id: str, latitude: float, longitude: float, title: str, address: str, foursquare_id: str = None, foursquare_type: str = None, reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None): def __init__(self, type: str, id: str, latitude: float, longitude: float, title: str, address: str,
foursquare_id: str = None, foursquare_type: str = None, reply_markup=None, input_message_content=None,
thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.latitude = latitude # double self.latitude = latitude # double

View File

@@ -71,7 +71,9 @@ class InlineQueryResultVideo(Object):
""" """
ID = 0xb0700003 ID = 0xb0700003
def __init__(self, type: str, id: str, video_url: str, mime_type: str, thumb_url: str, title: str, caption: str = None, parse_mode: str = None, video_width: int = None, video_height: int = None, video_duration: int = None, description: str = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, video_url: str, mime_type: str, thumb_url: str, title: str,
caption: str = None, parse_mode: str = None, video_width: int = None, video_height: int = None,
video_duration: int = None, description: str = None, reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.video_url = video_url # string self.video_url = video_url # string

View File

@@ -56,7 +56,8 @@ class InlineQueryResultVoice(Object):
""" """
ID = 0xb0700005 ID = 0xb0700005
def __init__(self, type: str, id: str, voice_url: str, title: str, caption: str = None, parse_mode: str = None, voice_duration: int = None, reply_markup=None, input_message_content=None): def __init__(self, type: str, id: str, voice_url: str, title: str, caption: str = None, parse_mode: str = None,
voice_duration: int = None, reply_markup=None, input_message_content=None):
self.type = type # string self.type = type # string
self.id = id # string self.id = id # string
self.voice_url = voice_url # string self.voice_url = voice_url # string

View File

@@ -17,6 +17,7 @@
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from pyrogram.api.types import InputPhoneContact as RawInputPhoneContact from pyrogram.api.types import InputPhoneContact as RawInputPhoneContact
from pyrogram.session.internals import MsgId from pyrogram.session.internals import MsgId
from ..object import Object from ..object import Object

View File

@@ -26,7 +26,7 @@ from ..object import Object
class InputMessageContent(Object): class InputMessageContent(Object):
"""Content of a message to be sent as a result of an inline query. """Content of a message to be sent as a result of an inline query.
Pyrogram currently supports the following 4 types: Pyrogram currently supports the following types:
- :obj:`InputTextMessageContent` - :obj:`InputTextMessageContent`
""" """

View File

@@ -17,6 +17,7 @@
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from pyrogram.api.types import ReplyKeyboardForceReply from pyrogram.api.types import ReplyKeyboardForceReply
from ..object import Object from ..object import Object

View File

@@ -18,6 +18,7 @@
from pyrogram.api.types import KeyboardButton as RawKeyboardButton from pyrogram.api.types import KeyboardButton as RawKeyboardButton
from pyrogram.api.types import KeyboardButtonRequestPhone, KeyboardButtonRequestGeoLocation from pyrogram.api.types import KeyboardButtonRequestPhone, KeyboardButtonRequestGeoLocation
from ..object import Object from ..object import Object

View File

@@ -17,6 +17,7 @@
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from pyrogram.api.types import ReplyKeyboardHide from pyrogram.api.types import ReplyKeyboardHide
from ..object import Object from ..object import Object

View File

@@ -28,10 +28,10 @@ from .messages import Messages
from .photo import Photo from .photo import Photo
from .poll import Poll from .poll import Poll
from .poll_option import PollOption from .poll_option import PollOption
from .profile_photos import ProfilePhotos
from .sticker import Sticker from .sticker import Sticker
from .stripped_thumbnail import StrippedThumbnail from .stripped_thumbnail import StrippedThumbnail
from .thumbnail import Thumbnail from .thumbnail import Thumbnail
from .photos import Photos
from .venue import Venue from .venue import Venue
from .video import Video from .video import Video
from .video_note import VideoNote from .video_note import VideoNote
@@ -39,5 +39,6 @@ from .voice import Voice
__all__ = [ __all__ = [
"Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Messages", "Photo", "Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Messages", "Photo",
"Thumbnail", "StrippedThumbnail", "Poll", "PollOption", "Sticker", "Photos", "Venue", "Video", "VideoNote", "Voice" "Thumbnail", "StrippedThumbnail", "Poll", "PollOption", "Sticker", "ProfilePhotos", "Venue", "Video", "VideoNote",
"Voice"
] ]

View File

@@ -54,11 +54,11 @@ class Animation(Object):
date (``int``, *optional*): date (``int``, *optional*):
Date the animation was sent in Unix time. Date the animation was sent in Unix time.
thumbnails (List of :obj:`Thumbnail`, *optional*): thumbs (List of :obj:`Thumbnail`, *optional*):
Animation thumbnails. Animation thumbnails.
""" """
__slots__ = ["file_id", "file_name", "mime_type", "file_size", "date", "width", "height", "duration", "thumbnails"] __slots__ = ["file_id", "file_name", "mime_type", "file_size", "date", "width", "height", "duration", "thumbs"]
def __init__( def __init__(
self, self,
@@ -72,7 +72,7 @@ class Animation(Object):
mime_type: str = None, mime_type: str = None,
file_size: int = None, file_size: int = None,
date: int = None, date: int = None,
thumbnails: List[Thumbnail] = None, thumbs: List[Thumbnail] = None,
): ):
super().__init__(client) super().__init__(client)
@@ -84,7 +84,7 @@ class Animation(Object):
self.width = width self.width = width
self.height = height self.height = height
self.duration = duration self.duration = duration
self.thumbnails = thumbnails self.thumbs = thumbs
@staticmethod @staticmethod
def _parse( def _parse(
@@ -110,6 +110,6 @@ class Animation(Object):
file_size=animation.size, file_size=animation.size,
file_name=file_name, file_name=file_name,
date=animation.date, date=animation.date,
thumbnails=Thumbnail._parse(client, animation), thumbs=Thumbnail._parse(client, animation),
client=client client=client
) )

View File

@@ -54,12 +54,12 @@ class Audio(Object):
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.
thumbnails (List of :obj:`Thumbnail`, *optional*): thumbs (List of :obj:`Thumbnail`, *optional*):
Thumbnails of the music file album cover. Thumbnails of the music file album cover.
""" """
__slots__ = [ __slots__ = [
"file_id", "file_name", "mime_type", "file_size", "date", "duration", "performer", "title", "thumbnails" "file_id", "file_name", "mime_type", "file_size", "date", "duration", "performer", "title", "thumbs"
] ]
def __init__( def __init__(
@@ -74,7 +74,7 @@ class Audio(Object):
date: int = None, date: int = None,
performer: str = None, performer: str = None,
title: str = None, title: str = None,
thumbnails: List[Thumbnail] = None, thumbs: List[Thumbnail] = None,
): ):
super().__init__(client) super().__init__(client)
@@ -86,7 +86,7 @@ class Audio(Object):
self.duration = duration self.duration = duration
self.performer = performer self.performer = performer
self.title = title self.title = title
self.thumbnails = thumbnails self.thumbs = thumbs
@staticmethod @staticmethod
def _parse( def _parse(
@@ -112,6 +112,6 @@ class Audio(Object):
file_size=audio.size, file_size=audio.size,
file_name=file_name, file_name=file_name,
date=audio.date, date=audio.date,
thumbnails=Thumbnail._parse(client, audio), thumbs=Thumbnail._parse(client, audio),
client=client client=client
) )

View File

@@ -45,11 +45,11 @@ class Document(Object):
date (``int``, *optional*): date (``int``, *optional*):
Date the document was sent in Unix time. Date the document was sent in Unix time.
thumbnails (List of :obj:`Thumbnail`, *optional*): thumbs (List of :obj:`Thumbnail`, *optional*):
Document thumbnails as defined by sender. Document thumbnails as defined by sender.
""" """
__slots__ = ["file_id", "file_name", "mime_type", "file_size", "date", "thumbnails"] __slots__ = ["file_id", "file_name", "mime_type", "file_size", "date", "thumbs"]
def __init__( def __init__(
self, self,
@@ -60,7 +60,7 @@ class Document(Object):
mime_type: str = None, mime_type: str = None,
file_size: int = None, file_size: int = None,
date: int = None, date: int = None,
thumbnails: List[Thumbnail] = None, thumbs: List[Thumbnail] = None,
): ):
super().__init__(client) super().__init__(client)
@@ -69,7 +69,7 @@ class Document(Object):
self.mime_type = mime_type self.mime_type = mime_type
self.file_size = file_size self.file_size = file_size
self.date = date self.date = date
self.thumbnails = thumbnails self.thumbs = thumbs
@staticmethod @staticmethod
def _parse(client, document: types.Document, file_name: str) -> "Document": def _parse(client, document: types.Document, file_name: str) -> "Document":
@@ -87,6 +87,6 @@ class Document(Object):
mime_type=document.mime_type, mime_type=document.mime_type,
file_size=document.size, file_size=document.size,
date=document.date, date=document.date,
thumbnails=Thumbnail._parse(client, document), thumbs=Thumbnail._parse(client, document),
client=client client=client
) )

View File

@@ -45,11 +45,11 @@ class Photo(Object):
date (``int``): date (``int``):
Date the photo was sent in Unix time. Date the photo was sent in Unix time.
thumbnails (List of :obj:`Thumbnail`): thumbs (List of :obj:`Thumbnail`, *optional*):
Available sizes of this photo. Available thumbnails of this photo.
""" """
__slots__ = ["file_id", "width", "height", "file_size", "date", "thumbnails"] __slots__ = ["file_id", "width", "height", "file_size", "date", "thumbs"]
def __init__( def __init__(
self, self,
@@ -60,7 +60,7 @@ class Photo(Object):
height: int, height: int,
file_size: int, file_size: int,
date: int, date: int,
thumbnails: List[Thumbnail] thumbs: List[Thumbnail]
): ):
super().__init__(client) super().__init__(client)
@@ -69,7 +69,7 @@ class Photo(Object):
self.height = height self.height = height
self.file_size = file_size self.file_size = file_size
self.date = date self.date = date
self.thumbnails = thumbnails self.thumbs = thumbs
@staticmethod @staticmethod
def _parse(client, photo: types.Photo) -> "Photo": def _parse(client, photo: types.Photo) -> "Photo":
@@ -89,6 +89,6 @@ class Photo(Object):
height=big.h, height=big.h,
file_size=big.size, file_size=big.size,
date=photo.date, date=photo.date,
thumbnails=Thumbnail._parse(client, photo), thumbs=Thumbnail._parse(client, photo),
client=client client=client
) )

View File

@@ -23,35 +23,35 @@ from .photo import Photo
from ..object import Object from ..object import Object
class Photos(Object): class ProfilePhotos(Object):
"""Contains a user's profile pictures. """Contains a user's profile pictures.
Parameters: Parameters:
total_count (``int``): total_count (``int``):
Total number of profile pictures the target user has. Total number of profile pictures the target user has.
photos (List of :obj:`Photo`): profile_photos (List of :obj:`Photo`):
Requested profile pictures. Requested profile pictures.
""" """
__slots__ = ["total_count", "photos"] __slots__ = ["total_count", "profile_photos"]
def __init__( def __init__(
self, self,
*, *,
client: "pyrogram.BaseClient" = None, client: "pyrogram.BaseClient" = None,
total_count: int, total_count: int,
photos: List[Photo] profile_photos: List[Photo]
): ):
super().__init__(client) super().__init__(client)
self.total_count = total_count self.total_count = total_count
self.photos = photos self.profile_photos = profile_photos
@staticmethod @staticmethod
def _parse(client, photos) -> "Photos": def _parse(client, photos) -> "ProfilePhotos":
return Photos( return ProfilePhotos(
total_count=getattr(photos, "count", len(photos.photos)), total_count=getattr(photos, "count", len(photos.photos)),
photos=[Photo._parse(client, photo) for photo in photos.photos], profile_photos=[Photo._parse(client, photo) for photo in photos.photos],
client=client client=client
) )

View File

@@ -60,14 +60,14 @@ class Sticker(Object):
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.
thumbnails (List of :obj:`Thumbnail`, *optional*): thumbs (List of :obj:`Thumbnail`, *optional*):
Sticker thumbnails in the .webp or .jpg format. Sticker thumbnails in the .webp or .jpg format.
""" """
# TODO: Add mask position # TODO: Add mask position
__slots__ = [ __slots__ = [
"file_id", "file_name", "mime_type", "file_size", "date", "width", "height", "emoji", "set_name", "thumbnails" "file_id", "file_name", "mime_type", "file_size", "date", "width", "height", "emoji", "set_name", "thumbs"
] ]
def __init__( def __init__(
@@ -83,7 +83,7 @@ class Sticker(Object):
date: int = None, date: int = None,
emoji: str = None, emoji: str = None,
set_name: str = None, set_name: str = None,
thumbnails: List[Thumbnail] = None thumbs: List[Thumbnail] = None
): ):
super().__init__(client) super().__init__(client)
@@ -96,7 +96,7 @@ class Sticker(Object):
self.height = height self.height = height
self.emoji = emoji self.emoji = emoji
self.set_name = set_name, self.set_name = set_name,
self.thumbnails = thumbnails self.thumbs = thumbs
# self.mask_position = mask_position # self.mask_position = mask_position
@staticmethod @staticmethod
@@ -144,6 +144,6 @@ class Sticker(Object):
mime_type=sticker.mime_type, mime_type=sticker.mime_type,
file_name=file_name, file_name=file_name,
date=sticker.date, date=sticker.date,
thumbnails=Thumbnail._parse(client, sticker), thumbs=Thumbnail._parse(client, sticker),
client=client client=client
) )

View File

@@ -57,13 +57,13 @@ class Video(Object):
date (``int``, *optional*): date (``int``, *optional*):
Date the video was sent in Unix time. Date the video was sent in Unix time.
thumbnails (List of :obj:`Thumbnail`, *optional*): thumbs (List of :obj:`Thumbnail`, *optional*):
Video thumbnails. Video thumbnails.
""" """
__slots__ = [ __slots__ = [
"file_id", "width", "height", "duration", "file_name", "mime_type", "supports_streaming", "file_size", "date", "file_id", "width", "height", "duration", "file_name", "mime_type", "supports_streaming", "file_size", "date",
"thumbnails" "thumbs"
] ]
def __init__( def __init__(
@@ -79,7 +79,7 @@ class Video(Object):
supports_streaming: bool = None, supports_streaming: bool = None,
file_size: int = None, file_size: int = None,
date: int = None, date: int = None,
thumbnails: List[Thumbnail] = None thumbs: List[Thumbnail] = None
): ):
super().__init__(client) super().__init__(client)
@@ -92,7 +92,7 @@ class Video(Object):
self.supports_streaming = supports_streaming self.supports_streaming = supports_streaming
self.file_size = file_size self.file_size = file_size
self.date = date self.date = date
self.thumbnails = thumbnails self.thumbs = thumbs
@staticmethod @staticmethod
def _parse( def _parse(
@@ -119,6 +119,6 @@ class Video(Object):
supports_streaming=video_attributes.supports_streaming, supports_streaming=video_attributes.supports_streaming,
file_size=video.size, file_size=video.size,
date=video.date, date=video.date,
thumbnails=Thumbnail._parse(client, video), thumbs=Thumbnail._parse(client, video),
client=client client=client
) )

View File

@@ -48,11 +48,11 @@ class VideoNote(Object):
date (``int``, *optional*): date (``int``, *optional*):
Date the video note was sent in Unix time. Date the video note was sent in Unix time.
thumbnails (List of :obj:`Thumbnail`, *optional*): thumbs (List of :obj:`Thumbnail`, *optional*):
Video thumbnails. Video thumbnails.
""" """
__slots__ = ["file_id", "mime_type", "file_size", "date", "length", "duration", "thumbnails"] __slots__ = ["file_id", "mime_type", "file_size", "date", "length", "duration", "thumbs"]
def __init__( def __init__(
self, self,
@@ -61,7 +61,7 @@ class VideoNote(Object):
file_id: str, file_id: str,
length: int, length: int,
duration: int, duration: int,
thumbnails: List[Thumbnail] = None, thumbs: List[Thumbnail] = None,
mime_type: str = None, mime_type: str = None,
file_size: int = None, file_size: int = None,
date: int = None date: int = None
@@ -74,7 +74,7 @@ class VideoNote(Object):
self.date = date self.date = date
self.length = length self.length = length
self.duration = duration self.duration = duration
self.thumbnails = thumbnails self.thumbs = thumbs
@staticmethod @staticmethod
def _parse(client, video_note: types.Document, video_attributes: types.DocumentAttributeVideo) -> "VideoNote": def _parse(client, video_note: types.Document, video_attributes: types.DocumentAttributeVideo) -> "VideoNote":
@@ -93,6 +93,6 @@ class VideoNote(Object):
file_size=video_note.size, file_size=video_note.size,
mime_type=video_note.mime_type, mime_type=video_note.mime_type,
date=video_note.date, date=video_note.date,
thumbnails=Thumbnail._parse(client, video_note), thumbs=Thumbnail._parse(client, video_note),
client=client client=client
) )