Merge develop -> asyncio
This commit is contained in:
commit
fe55233f50
@ -288,9 +288,9 @@ def start():
|
||||
sorted_args = sort_args(c.args)
|
||||
|
||||
arguments = (
|
||||
", "
|
||||
+ ("*, " if c.args else "")
|
||||
+ (", ".join([get_argument_type(i) for i in sorted_args if i != ("flags", "#")]) 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 "")
|
||||
)
|
||||
|
||||
fields = "\n ".join(
|
||||
|
@ -58,7 +58,7 @@ with open(DEST / "index.rst", "w") as index:
|
||||
date = datetime.strptime(
|
||||
release["published_at"],
|
||||
"%Y-%m-%dT%H:%M:%SZ"
|
||||
).strftime("%b %d, %Y - %H:%M:%S (UTC)")
|
||||
).strftime("%b %d, %Y")
|
||||
|
||||
body = pypandoc.convert_text(
|
||||
release["body"].replace(r"\r\n", "\n"),
|
||||
@ -67,12 +67,17 @@ with open(DEST / "index.rst", "w") as index:
|
||||
extra_args=["--wrap=none"]
|
||||
)
|
||||
|
||||
tarball_url = release["tarball_url"]
|
||||
zipball_url = release["zipball_url"]
|
||||
|
||||
index.write("- :doc:`{} <{}>`\n".format(title, tag))
|
||||
tags.append(tag)
|
||||
|
||||
with open(DEST / "{}.rst".format(tag), "w") as page:
|
||||
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(body + "\n\n")
|
||||
|
||||
|
@ -45,7 +45,7 @@ Messages & Media
|
||||
- :class:`Messages`
|
||||
- :class:`MessageEntity`
|
||||
- :class:`Photo`
|
||||
- :class:`Photos`
|
||||
- :class:`ProfilePhotos`
|
||||
- :class:`Thumbnail`
|
||||
- :class:`Audio`
|
||||
- :class:`Document`
|
||||
@ -133,7 +133,7 @@ Details
|
||||
.. autoclass:: Messages()
|
||||
.. autoclass:: MessageEntity()
|
||||
.. autoclass:: Photo()
|
||||
.. autoclass:: Photos()
|
||||
.. autoclass:: ProfilePhotos()
|
||||
.. autoclass:: Thumbnail()
|
||||
.. autoclass:: Audio()
|
||||
.. autoclass:: Document()
|
||||
|
@ -197,7 +197,7 @@ And here's a good explanation of how, probably, the system works:
|
||||
data-width="100%">
|
||||
</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
|
||||
of mistakes by either the automatic systems or a moderator. In such cases you can kindly email Telegram at
|
||||
|
@ -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
|
||||
order using the Next button at the end of each page. Here below you can, instead, find a list of the most relevant
|
||||
pages for a quick access.
|
||||
order using the :guilabel:`Next` button at the end of each page. Here below you can, instead, find a list of the most
|
||||
relevant pages for a quick access.
|
||||
|
||||
First Steps
|
||||
-----------
|
||||
|
@ -39,8 +39,8 @@ keep the session alive, Pyrogram won't ask you again to enter your phone number.
|
||||
|
||||
.. note::
|
||||
|
||||
The code above does nothing except asking for credentials and keeping the client online, hit ``CTRL+C`` now to stop
|
||||
your application and keep reading.
|
||||
The code above does nothing except asking for credentials and keeping the client online, hit :guilabel:`CTRL+C` now
|
||||
to stop your application and keep reading.
|
||||
|
||||
Bot Authorization
|
||||
-----------------
|
||||
|
@ -22,8 +22,8 @@ from .gzip_packed import GzipPacked
|
||||
from .list import List
|
||||
from .message import Message
|
||||
from .msg_container import MsgContainer
|
||||
from .tl_object import TLObject
|
||||
from .primitives import (
|
||||
Bool, BoolTrue, BoolFalse, Bytes, Double,
|
||||
Int, Long, Int128, Int256, Null, String, Vector
|
||||
)
|
||||
from .tl_object import TLObject
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
from .tl_object import TLObject
|
||||
from .primitives import Int, Long
|
||||
from .tl_object import TLObject
|
||||
|
||||
|
||||
class FutureSalt(TLObject):
|
||||
|
@ -19,8 +19,8 @@
|
||||
from io import BytesIO
|
||||
|
||||
from . import FutureSalt
|
||||
from .tl_object import TLObject
|
||||
from .primitives import Int, Long
|
||||
from .tl_object import TLObject
|
||||
|
||||
|
||||
class FutureSalts(TLObject):
|
||||
|
@ -19,8 +19,8 @@
|
||||
from gzip import compress, decompress
|
||||
from io import BytesIO
|
||||
|
||||
from .tl_object import TLObject
|
||||
from .primitives import Int, Bytes
|
||||
from .tl_object import TLObject
|
||||
|
||||
|
||||
class GzipPacked(TLObject):
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
from .tl_object import TLObject
|
||||
from .primitives import Int, Long
|
||||
from .tl_object import TLObject
|
||||
|
||||
|
||||
class Message(TLObject):
|
||||
|
@ -19,8 +19,8 @@
|
||||
from io import BytesIO
|
||||
|
||||
from .message import Message
|
||||
from .tl_object import TLObject
|
||||
from .primitives import Int
|
||||
from .tl_object import TLObject
|
||||
|
||||
|
||||
class MsgContainer(TLObject):
|
||||
|
@ -19,8 +19,8 @@
|
||||
from typing import Union
|
||||
|
||||
from pyrogram.api import functions, types
|
||||
from pyrogram.errors import UnknownError
|
||||
from pyrogram.client.ext import BaseClient
|
||||
from pyrogram.errors import UnknownError
|
||||
|
||||
|
||||
class GetInlineBotResults(BaseClient):
|
||||
|
@ -23,6 +23,7 @@ from .get_chat_member import GetChatMember
|
||||
from .get_chat_members import GetChatMembers
|
||||
from .get_chat_members_count import GetChatMembersCount
|
||||
from .get_dialogs import GetDialogs
|
||||
from .get_dialogs_count import GetDialogsCount
|
||||
from .iter_chat_members import IterChatMembers
|
||||
from .iter_dialogs import IterDialogs
|
||||
from .join_chat import JoinChat
|
||||
@ -38,7 +39,6 @@ from .set_chat_title import SetChatTitle
|
||||
from .unban_chat_member import UnbanChatMember
|
||||
from .unpin_chat_message import UnpinChatMessage
|
||||
from .update_chat_username import UpdateChatUsername
|
||||
from .get_dialogs_count import GetDialogsCount
|
||||
|
||||
|
||||
class Chats(
|
||||
|
@ -37,8 +37,8 @@ class GetChatMember(BaseClient):
|
||||
Unique identifier (int) or username (str) of the target chat.
|
||||
|
||||
user_id (``int`` | ``str``)::
|
||||
Unique identifier (int) or username (str) of the target chat.
|
||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||
Unique identifier (int) or username (str) of the target user.
|
||||
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).
|
||||
|
||||
Returns:
|
||||
|
@ -29,7 +29,7 @@ class GetProfilePhotos(BaseClient):
|
||||
chat_id: Union[int, str],
|
||||
offset: int = 0,
|
||||
limit: int = 100
|
||||
) -> "pyrogram.Photos":
|
||||
) -> "pyrogram.ProfilePhotos":
|
||||
"""Get a list of profile pictures for a user or a chat.
|
||||
|
||||
Parameters:
|
||||
@ -47,7 +47,7 @@ class GetProfilePhotos(BaseClient):
|
||||
Values between 1—100 are accepted. Defaults to 100.
|
||||
|
||||
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:
|
||||
RPCError: In case of a Telegram RPC error.
|
||||
@ -55,7 +55,7 @@ class GetProfilePhotos(BaseClient):
|
||||
peer_id = await self.resolve_peer(chat_id)
|
||||
|
||||
if isinstance(peer_id, types.InputPeerUser):
|
||||
return pyrogram.Photos._parse(
|
||||
return pyrogram.ProfilePhotos._parse(
|
||||
self,
|
||||
await self.send(
|
||||
functions.photos.GetUserPhotos(
|
||||
@ -86,7 +86,7 @@ class GetProfilePhotos(BaseClient):
|
||||
)
|
||||
)
|
||||
|
||||
return pyrogram.Photos(
|
||||
return pyrogram.ProfilePhotos(
|
||||
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]
|
||||
)
|
||||
|
@ -42,7 +42,7 @@ from ..object import Object
|
||||
class InlineQueryResult(Object):
|
||||
"""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`
|
||||
"""
|
||||
|
@ -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.id = id # string
|
||||
self.audio_url = audio_url # string
|
||||
|
@ -20,10 +20,10 @@ import binascii
|
||||
import struct
|
||||
|
||||
from pyrogram.api import types
|
||||
from pyrogram.errors import FileIdInvalid
|
||||
from pyrogram.client.ext import utils, BaseClient
|
||||
from pyrogram.client.style import HTML, Markdown
|
||||
from pyrogram.client.types.object import Object
|
||||
from pyrogram.errors import FileIdInvalid
|
||||
|
||||
|
||||
class InlineQueryResultCachedAudio(Object):
|
||||
|
@ -56,7 +56,8 @@ class InlineQueryResultCachedDocument(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.title = title # string
|
||||
|
@ -53,7 +53,8 @@ class InlineQueryResultCachedGif(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.gif_file_id = gif_file_id # string
|
||||
|
@ -53,7 +53,8 @@ class InlineQueryResultCachedMpeg4Gif(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.mpeg4_file_id = mpeg4_file_id # string
|
||||
|
@ -56,7 +56,8 @@ class InlineQueryResultCachedPhoto(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.photo_file_id = photo_file_id # string
|
||||
|
@ -56,7 +56,8 @@ class InlineQueryResultCachedVideo(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.video_file_id = video_file_id # string
|
||||
|
@ -53,7 +53,8 @@ class InlineQueryResultCachedVoice(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.voice_file_id = voice_file_id # string
|
||||
|
@ -62,7 +62,9 @@ class InlineQueryResultContact(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.phone_number = phone_number # string
|
||||
|
@ -68,7 +68,9 @@ class InlineQueryResultDocument(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.title = title # string
|
||||
|
@ -65,7 +65,9 @@ class InlineQueryResultGif(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.gif_url = gif_url # string
|
||||
|
@ -62,7 +62,9 @@ class InlineQueryResultLocation(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.latitude = latitude # double
|
||||
|
@ -65,7 +65,9 @@ class InlineQueryResultMpeg4Gif(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.mpeg4_url = mpeg4_url # string
|
||||
|
@ -63,18 +63,18 @@ class InlineQueryResultPhoto(Object):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
id: str,
|
||||
photo_url: str,
|
||||
thumb_url: str,
|
||||
photo_width: int = 0,
|
||||
photo_height: int = 0,
|
||||
title: str = None,
|
||||
description: str = None,
|
||||
caption: str = "",
|
||||
parse_mode: str = "",
|
||||
reply_markup=None,
|
||||
input_message_content=None
|
||||
self,
|
||||
id: str,
|
||||
photo_url: str,
|
||||
thumb_url: str,
|
||||
photo_width: int = 0,
|
||||
photo_height: int = 0,
|
||||
title: str = None,
|
||||
description: str = None,
|
||||
caption: str = "",
|
||||
parse_mode: str = "",
|
||||
reply_markup=None,
|
||||
input_message_content=None
|
||||
):
|
||||
self.id = id # string
|
||||
self.photo_url = photo_url # string
|
||||
|
@ -68,7 +68,9 @@ class InlineQueryResultVenue(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.latitude = latitude # double
|
||||
|
@ -71,7 +71,9 @@ class InlineQueryResultVideo(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.video_url = video_url # string
|
||||
|
@ -56,7 +56,8 @@ class InlineQueryResultVoice(Object):
|
||||
"""
|
||||
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.id = id # string
|
||||
self.voice_url = voice_url # string
|
||||
|
@ -17,6 +17,7 @@
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from pyrogram.api.types import InputPhoneContact as RawInputPhoneContact
|
||||
|
||||
from pyrogram.session.internals import MsgId
|
||||
from ..object import Object
|
||||
|
||||
|
@ -26,7 +26,7 @@ from ..object import Object
|
||||
class InputMessageContent(Object):
|
||||
"""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`
|
||||
"""
|
||||
|
@ -17,6 +17,7 @@
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from pyrogram.api.types import ReplyKeyboardForceReply
|
||||
|
||||
from ..object import Object
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
from pyrogram.api.types import KeyboardButton as RawKeyboardButton
|
||||
from pyrogram.api.types import KeyboardButtonRequestPhone, KeyboardButtonRequestGeoLocation
|
||||
|
||||
from ..object import Object
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from pyrogram.api.types import ReplyKeyboardHide
|
||||
|
||||
from ..object import Object
|
||||
|
||||
|
||||
|
@ -28,10 +28,10 @@ from .messages import Messages
|
||||
from .photo import Photo
|
||||
from .poll import Poll
|
||||
from .poll_option import PollOption
|
||||
from .profile_photos import ProfilePhotos
|
||||
from .sticker import Sticker
|
||||
from .stripped_thumbnail import StrippedThumbnail
|
||||
from .thumbnail import Thumbnail
|
||||
from .photos import Photos
|
||||
from .venue import Venue
|
||||
from .video import Video
|
||||
from .video_note import VideoNote
|
||||
@ -39,5 +39,6 @@ from .voice import Voice
|
||||
|
||||
__all__ = [
|
||||
"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"
|
||||
]
|
||||
|
@ -54,11 +54,11 @@ class Animation(Object):
|
||||
date (``int``, *optional*):
|
||||
Date the animation was sent in Unix time.
|
||||
|
||||
thumbnails (List of :obj:`Thumbnail`, *optional*):
|
||||
thumbs (List of :obj:`Thumbnail`, *optional*):
|
||||
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__(
|
||||
self,
|
||||
@ -72,7 +72,7 @@ class Animation(Object):
|
||||
mime_type: str = None,
|
||||
file_size: int = None,
|
||||
date: int = None,
|
||||
thumbnails: List[Thumbnail] = None,
|
||||
thumbs: List[Thumbnail] = None,
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
@ -84,7 +84,7 @@ class Animation(Object):
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.duration = duration
|
||||
self.thumbnails = thumbnails
|
||||
self.thumbs = thumbs
|
||||
|
||||
@staticmethod
|
||||
def _parse(
|
||||
@ -110,6 +110,6 @@ class Animation(Object):
|
||||
file_size=animation.size,
|
||||
file_name=file_name,
|
||||
date=animation.date,
|
||||
thumbnails=Thumbnail._parse(client, animation),
|
||||
thumbs=Thumbnail._parse(client, animation),
|
||||
client=client
|
||||
)
|
||||
|
@ -54,12 +54,12 @@ class Audio(Object):
|
||||
title (``str``, *optional*):
|
||||
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.
|
||||
"""
|
||||
|
||||
__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__(
|
||||
@ -74,7 +74,7 @@ class Audio(Object):
|
||||
date: int = None,
|
||||
performer: str = None,
|
||||
title: str = None,
|
||||
thumbnails: List[Thumbnail] = None,
|
||||
thumbs: List[Thumbnail] = None,
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
@ -86,7 +86,7 @@ class Audio(Object):
|
||||
self.duration = duration
|
||||
self.performer = performer
|
||||
self.title = title
|
||||
self.thumbnails = thumbnails
|
||||
self.thumbs = thumbs
|
||||
|
||||
@staticmethod
|
||||
def _parse(
|
||||
@ -112,6 +112,6 @@ class Audio(Object):
|
||||
file_size=audio.size,
|
||||
file_name=file_name,
|
||||
date=audio.date,
|
||||
thumbnails=Thumbnail._parse(client, audio),
|
||||
thumbs=Thumbnail._parse(client, audio),
|
||||
client=client
|
||||
)
|
||||
|
@ -45,11 +45,11 @@ class Document(Object):
|
||||
date (``int``, *optional*):
|
||||
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.
|
||||
"""
|
||||
|
||||
__slots__ = ["file_id", "file_name", "mime_type", "file_size", "date", "thumbnails"]
|
||||
__slots__ = ["file_id", "file_name", "mime_type", "file_size", "date", "thumbs"]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -60,7 +60,7 @@ class Document(Object):
|
||||
mime_type: str = None,
|
||||
file_size: int = None,
|
||||
date: int = None,
|
||||
thumbnails: List[Thumbnail] = None,
|
||||
thumbs: List[Thumbnail] = None,
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
@ -69,7 +69,7 @@ class Document(Object):
|
||||
self.mime_type = mime_type
|
||||
self.file_size = file_size
|
||||
self.date = date
|
||||
self.thumbnails = thumbnails
|
||||
self.thumbs = thumbs
|
||||
|
||||
@staticmethod
|
||||
def _parse(client, document: types.Document, file_name: str) -> "Document":
|
||||
@ -87,6 +87,6 @@ class Document(Object):
|
||||
mime_type=document.mime_type,
|
||||
file_size=document.size,
|
||||
date=document.date,
|
||||
thumbnails=Thumbnail._parse(client, document),
|
||||
thumbs=Thumbnail._parse(client, document),
|
||||
client=client
|
||||
)
|
||||
|
@ -45,11 +45,11 @@ class Photo(Object):
|
||||
date (``int``):
|
||||
Date the photo was sent in Unix time.
|
||||
|
||||
thumbnails (List of :obj:`Thumbnail`):
|
||||
Available sizes of this photo.
|
||||
thumbs (List of :obj:`Thumbnail`, *optional*):
|
||||
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__(
|
||||
self,
|
||||
@ -60,7 +60,7 @@ class Photo(Object):
|
||||
height: int,
|
||||
file_size: int,
|
||||
date: int,
|
||||
thumbnails: List[Thumbnail]
|
||||
thumbs: List[Thumbnail]
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
@ -69,7 +69,7 @@ class Photo(Object):
|
||||
self.height = height
|
||||
self.file_size = file_size
|
||||
self.date = date
|
||||
self.thumbnails = thumbnails
|
||||
self.thumbs = thumbs
|
||||
|
||||
@staticmethod
|
||||
def _parse(client, photo: types.Photo) -> "Photo":
|
||||
@ -89,6 +89,6 @@ class Photo(Object):
|
||||
height=big.h,
|
||||
file_size=big.size,
|
||||
date=photo.date,
|
||||
thumbnails=Thumbnail._parse(client, photo),
|
||||
thumbs=Thumbnail._parse(client, photo),
|
||||
client=client
|
||||
)
|
||||
|
@ -23,35 +23,35 @@ from .photo import Photo
|
||||
from ..object import Object
|
||||
|
||||
|
||||
class Photos(Object):
|
||||
class ProfilePhotos(Object):
|
||||
"""Contains a user's profile pictures.
|
||||
|
||||
Parameters:
|
||||
total_count (``int``):
|
||||
Total number of profile pictures the target user has.
|
||||
|
||||
photos (List of :obj:`Photo`):
|
||||
profile_photos (List of :obj:`Photo`):
|
||||
Requested profile pictures.
|
||||
"""
|
||||
|
||||
__slots__ = ["total_count", "photos"]
|
||||
__slots__ = ["total_count", "profile_photos"]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
client: "pyrogram.BaseClient" = None,
|
||||
total_count: int,
|
||||
photos: List[Photo]
|
||||
profile_photos: List[Photo]
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
self.total_count = total_count
|
||||
self.photos = photos
|
||||
self.profile_photos = profile_photos
|
||||
|
||||
@staticmethod
|
||||
def _parse(client, photos) -> "Photos":
|
||||
return Photos(
|
||||
def _parse(client, photos) -> "ProfilePhotos":
|
||||
return ProfilePhotos(
|
||||
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
|
||||
)
|
@ -60,14 +60,14 @@ class Sticker(Object):
|
||||
set_name (``str``, *optional*):
|
||||
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.
|
||||
"""
|
||||
|
||||
# TODO: Add mask position
|
||||
|
||||
__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__(
|
||||
@ -83,7 +83,7 @@ class Sticker(Object):
|
||||
date: int = None,
|
||||
emoji: str = None,
|
||||
set_name: str = None,
|
||||
thumbnails: List[Thumbnail] = None
|
||||
thumbs: List[Thumbnail] = None
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
@ -96,7 +96,7 @@ class Sticker(Object):
|
||||
self.height = height
|
||||
self.emoji = emoji
|
||||
self.set_name = set_name,
|
||||
self.thumbnails = thumbnails
|
||||
self.thumbs = thumbs
|
||||
# self.mask_position = mask_position
|
||||
|
||||
@staticmethod
|
||||
@ -144,6 +144,6 @@ class Sticker(Object):
|
||||
mime_type=sticker.mime_type,
|
||||
file_name=file_name,
|
||||
date=sticker.date,
|
||||
thumbnails=Thumbnail._parse(client, sticker),
|
||||
thumbs=Thumbnail._parse(client, sticker),
|
||||
client=client
|
||||
)
|
||||
|
@ -57,13 +57,13 @@ class Video(Object):
|
||||
date (``int``, *optional*):
|
||||
Date the video was sent in Unix time.
|
||||
|
||||
thumbnails (List of :obj:`Thumbnail`, *optional*):
|
||||
thumbs (List of :obj:`Thumbnail`, *optional*):
|
||||
Video thumbnails.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
"file_id", "width", "height", "duration", "file_name", "mime_type", "supports_streaming", "file_size", "date",
|
||||
"thumbnails"
|
||||
"thumbs"
|
||||
]
|
||||
|
||||
def __init__(
|
||||
@ -79,7 +79,7 @@ class Video(Object):
|
||||
supports_streaming: bool = None,
|
||||
file_size: int = None,
|
||||
date: int = None,
|
||||
thumbnails: List[Thumbnail] = None
|
||||
thumbs: List[Thumbnail] = None
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
@ -92,7 +92,7 @@ class Video(Object):
|
||||
self.supports_streaming = supports_streaming
|
||||
self.file_size = file_size
|
||||
self.date = date
|
||||
self.thumbnails = thumbnails
|
||||
self.thumbs = thumbs
|
||||
|
||||
@staticmethod
|
||||
def _parse(
|
||||
@ -119,6 +119,6 @@ class Video(Object):
|
||||
supports_streaming=video_attributes.supports_streaming,
|
||||
file_size=video.size,
|
||||
date=video.date,
|
||||
thumbnails=Thumbnail._parse(client, video),
|
||||
thumbs=Thumbnail._parse(client, video),
|
||||
client=client
|
||||
)
|
||||
|
@ -48,11 +48,11 @@ class VideoNote(Object):
|
||||
date (``int``, *optional*):
|
||||
Date the video note was sent in Unix time.
|
||||
|
||||
thumbnails (List of :obj:`Thumbnail`, *optional*):
|
||||
thumbs (List of :obj:`Thumbnail`, *optional*):
|
||||
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__(
|
||||
self,
|
||||
@ -61,7 +61,7 @@ class VideoNote(Object):
|
||||
file_id: str,
|
||||
length: int,
|
||||
duration: int,
|
||||
thumbnails: List[Thumbnail] = None,
|
||||
thumbs: List[Thumbnail] = None,
|
||||
mime_type: str = None,
|
||||
file_size: int = None,
|
||||
date: int = None
|
||||
@ -74,7 +74,7 @@ class VideoNote(Object):
|
||||
self.date = date
|
||||
self.length = length
|
||||
self.duration = duration
|
||||
self.thumbnails = thumbnails
|
||||
self.thumbs = thumbs
|
||||
|
||||
@staticmethod
|
||||
def _parse(client, video_note: types.Document, video_attributes: types.DocumentAttributeVideo) -> "VideoNote":
|
||||
@ -93,6 +93,6 @@ class VideoNote(Object):
|
||||
file_size=video_note.size,
|
||||
mime_type=video_note.mime_type,
|
||||
date=video_note.date,
|
||||
thumbnails=Thumbnail._parse(client, video_note),
|
||||
thumbs=Thumbnail._parse(client, video_note),
|
||||
client=client
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user