mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-18 13:34:54 +00:00
Merge branch 'develop' into asyncio
# Conflicts: # pyrogram/__init__.py # pyrogram/client/methods/messages/send_document.py # pyrogram/client/methods/messages/send_video_note.py
This commit is contained in:
commit
df8bc62fb3
15
README.rst
15
README.rst
@ -26,7 +26,7 @@ Features
|
|||||||
- **Easy to use**: You can easily install Pyrogram using pip and start building your app right away.
|
- **Easy to use**: You can easily install Pyrogram using pip and start building your app right away.
|
||||||
- **High-level**: The low-level details of MTProto are abstracted and automatically handled.
|
- **High-level**: The low-level details of MTProto are abstracted and automatically handled.
|
||||||
- **Fast**: Crypto parts are boosted up by TgCrypto_, a high-performance library written in pure C.
|
- **Fast**: Crypto parts are boosted up by TgCrypto_, a high-performance library written in pure C.
|
||||||
- **Updated** to the latest Telegram API version, currently Layer 81 on top of MTProto 2.0.
|
- **Updated** to the latest Telegram API version, currently Layer 82 on top of MTProto 2.0.
|
||||||
- **Documented**: The Pyrogram API is well documented and resembles the Telegram Bot API.
|
- **Documented**: The Pyrogram API is well documented and resembles the Telegram Bot API.
|
||||||
- **Full API**, allowing to execute any advanced action an official client is able to do, and more.
|
- **Full API**, allowing to execute any advanced action an official client is able to do, and more.
|
||||||
|
|
||||||
@ -78,8 +78,7 @@ Copyright & License
|
|||||||
|
|
||||||
<h1 align="center">
|
<h1 align="center">
|
||||||
<a href="https://github.com/pyrogram/pyrogram">
|
<a href="https://github.com/pyrogram/pyrogram">
|
||||||
<div><img src="https://media.pyrogram.ml/images/icon.png" alt="Pyrogram Icon"></div>
|
<div><img src="https://raw.githubusercontent.com/pyrogram/logos/master/logos/pyrogram_logo2.png" alt="Pyrogram Logo"></div>
|
||||||
<div><img src="https://media.pyrogram.ml/images/label.png" alt="Pyrogram Label"></div>
|
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
@ -100,25 +99,25 @@ Copyright & License
|
|||||||
</a>
|
</a>
|
||||||
<br><br>
|
<br><br>
|
||||||
<a href="compiler/api/source/main_api.tl">
|
<a href="compiler/api/source/main_api.tl">
|
||||||
<img src="https://img.shields.io/badge/SCHEME-LAYER%2081-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
<img src="https://img.shields.io/badge/SCHEME-LAYER%2082-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
||||||
alt="Scheme Layer">
|
alt="Scheme Layer">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/pyrogram/tgcrypto">
|
<a href="https://github.com/pyrogram/tgcrypto">
|
||||||
<img src="https://img.shields.io/badge/TGCRYPTO-V1.0.4-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
<img src="https://img.shields.io/badge/TGCRYPTO-V1.1.1-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
||||||
alt="TgCrypto">
|
alt="TgCrypto">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
.. |logo| image:: https://pyrogram.ml/images/logo.png
|
.. |logo| image:: https://raw.githubusercontent.com/pyrogram/logos/master/logos/pyrogram_logo2.png
|
||||||
:target: https://pyrogram.ml
|
:target: https://pyrogram.ml
|
||||||
:alt: Pyrogram
|
:alt: Pyrogram
|
||||||
|
|
||||||
.. |description| replace:: **Telegram MTProto API Client Library for Python**
|
.. |description| replace:: **Telegram MTProto API Client Library for Python**
|
||||||
|
|
||||||
.. |scheme| image:: "https://img.shields.io/badge/SCHEME-LAYER%2081-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
.. |scheme| image:: "https://img.shields.io/badge/SCHEME-LAYER%2082-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
||||||
:target: compiler/api/source/main_api.tl
|
:target: compiler/api/source/main_api.tl
|
||||||
:alt: Scheme Layer
|
:alt: Scheme Layer
|
||||||
|
|
||||||
.. |tgcrypto| image:: "https://img.shields.io/badge/TGCRYPTO-V1.0.4-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
.. |tgcrypto| image:: "https://img.shields.io/badge/TGCRYPTO-V1.1.1-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
||||||
:target: https://github.com/pyrogram/tgcrypto
|
:target: https://github.com/pyrogram/tgcrypto
|
||||||
:alt: TgCrypto
|
:alt: TgCrypto
|
||||||
|
2
compiler/error/source/403_FORBIDDEN.tsv
Normal file
2
compiler/error/source/403_FORBIDDEN.tsv
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
id message
|
||||||
|
CHAT_WRITE_FORBIDDEN You don't have rights to send messages in this chat
|
|
@ -5,8 +5,7 @@ Welcome to Pyrogram
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a href="https://docs.pyrogram.ml">
|
<a href="https://docs.pyrogram.ml">
|
||||||
<div><img src="https://media.pyrogram.ml/images/icon.png" alt="Pyrogram Icon"></div>
|
<div><img src="_static/logo.png" alt="Pyrogram Logo"></div>
|
||||||
<div><img src="https://media.pyrogram.ml/images/label.png" alt="Pyrogram Label"></div>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -26,11 +25,11 @@ Welcome to Pyrogram
|
|||||||
</a>
|
</a>
|
||||||
<br><br>
|
<br><br>
|
||||||
<a href="https://github.com/pyrogram/pyrogram/blob/master/compiler/api/source/main_api.tl">
|
<a href="https://github.com/pyrogram/pyrogram/blob/master/compiler/api/source/main_api.tl">
|
||||||
<img src="https://img.shields.io/badge/SCHEME-LAYER%2081-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
<img src="https://img.shields.io/badge/SCHEME-LAYER%2082-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
||||||
alt="Scheme Layer">
|
alt="Scheme Layer">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/pyrogram/tgcrypto">
|
<a href="https://github.com/pyrogram/tgcrypto">
|
||||||
<img src="https://img.shields.io/badge/TGCRYPTO-V1.0.4-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
<img src="https://img.shields.io/badge/TGCRYPTO-V1.1.1-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
|
||||||
alt="TgCrypto">
|
alt="TgCrypto">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -57,10 +57,10 @@ Messages
|
|||||||
edit_message_text
|
edit_message_text
|
||||||
edit_message_caption
|
edit_message_caption
|
||||||
edit_message_reply_markup
|
edit_message_reply_markup
|
||||||
|
edit_message_media
|
||||||
delete_messages
|
delete_messages
|
||||||
get_messages
|
get_messages
|
||||||
get_history
|
get_history
|
||||||
get_dialogs
|
|
||||||
|
|
||||||
Chats
|
Chats
|
||||||
-----
|
-----
|
||||||
@ -84,6 +84,8 @@ Chats
|
|||||||
get_chat
|
get_chat
|
||||||
get_chat_member
|
get_chat_member
|
||||||
get_chat_members
|
get_chat_members
|
||||||
|
get_chat_members_count
|
||||||
|
get_dialogs
|
||||||
|
|
||||||
Users
|
Users
|
||||||
-----
|
-----
|
||||||
|
@ -45,7 +45,7 @@ If no error shows up you are good to go.
|
|||||||
|
|
||||||
>>> import pyrogram
|
>>> import pyrogram
|
||||||
>>> pyrogram.__version__
|
>>> pyrogram.__version__
|
||||||
'0.7.5'
|
'0.8.0'
|
||||||
|
|
||||||
.. _TgCrypto: https://docs.pyrogram.ml/resources/TgCrypto
|
.. _TgCrypto: https://docs.pyrogram.ml/resources/TgCrypto
|
||||||
.. _develop: http://github.com/pyrogram/pyrogram
|
.. _develop: http://github.com/pyrogram/pyrogram
|
@ -183,6 +183,13 @@ class Client(Methods, BaseClient):
|
|||||||
|
|
||||||
self.dispatcher = Dispatcher(self, workers)
|
self.dispatcher = Dispatcher(self, workers)
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
self.start()
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
self.stop()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def proxy(self):
|
def proxy(self):
|
||||||
return self._proxy
|
return self._proxy
|
||||||
@ -897,30 +904,18 @@ class Client(Methods, BaseClient):
|
|||||||
"More info: https://docs.pyrogram.ml/start/ProjectSetup#configuration"
|
"More info: https://docs.pyrogram.ml/start/ProjectSetup#configuration"
|
||||||
)
|
)
|
||||||
|
|
||||||
for option in {"app_version", "device_model", "system_version", "lang_code"}:
|
for option in ["app_version", "device_model", "system_version", "lang_code"]:
|
||||||
if getattr(self, option):
|
if getattr(self, option):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
setattr(self, option, Client.APP_VERSION)
|
|
||||||
|
|
||||||
if parser.has_section("pyrogram"):
|
if parser.has_section("pyrogram"):
|
||||||
setattr(self, option, parser.get(
|
setattr(self, option, parser.get(
|
||||||
"pyrogram",
|
"pyrogram",
|
||||||
option,
|
option,
|
||||||
fallback=getattr(Client, option.upper())
|
fallback=getattr(Client, option.upper())
|
||||||
))
|
))
|
||||||
|
|
||||||
if self.lang_code:
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
self.lang_code = Client.LANG_CODE
|
setattr(self, option, getattr(Client, option.upper()))
|
||||||
|
|
||||||
if parser.has_section("pyrogram"):
|
|
||||||
self.lang_code = parser.get(
|
|
||||||
"pyrogram",
|
|
||||||
"lang_code",
|
|
||||||
fallback=Client.LANG_CODE
|
|
||||||
)
|
|
||||||
|
|
||||||
if self._proxy:
|
if self._proxy:
|
||||||
self._proxy["enabled"] = True
|
self._proxy["enabled"] = True
|
||||||
|
@ -32,7 +32,7 @@ class GetChatMembersCount(BaseClient):
|
|||||||
On success, an integer is returned.
|
On success, an integer is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`Error <pyrogram.Error>
|
:class:`Error <pyrogram.Error>`
|
||||||
``ValueError``: If a chat_id belongs to user.
|
``ValueError``: If a chat_id belongs to user.
|
||||||
"""
|
"""
|
||||||
peer = await self.resolve_peer(chat_id)
|
peer = await self.resolve_peer(chat_id)
|
||||||
|
@ -73,9 +73,10 @@ class SendAnimation(BaseClient):
|
|||||||
Animation height.
|
Animation height.
|
||||||
|
|
||||||
thumb (``str``, *optional*):
|
thumb (``str``, *optional*):
|
||||||
Animation thumbnail.
|
Thumbnail of the animation file sent.
|
||||||
Pass a file path as string to send an image that exists on your local machine.
|
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||||
Thumbnail should have 90 or less pixels of width and 90 or less pixels of height.
|
A thumbnail's width and height should not exceed 90 pixels.
|
||||||
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
disable_notification (``bool``, *optional*):
|
disable_notification (``bool``, *optional*):
|
||||||
Sends the message silently.
|
Sends the message silently.
|
||||||
|
@ -30,7 +30,7 @@ class SendDocument(BaseClient):
|
|||||||
async def send_document(self,
|
async def send_document(self,
|
||||||
chat_id: int or str,
|
chat_id: int or str,
|
||||||
document: str,
|
document: str,
|
||||||
caption: str = "",
|
thumb: str = None,caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: str = "",
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
@ -51,6 +51,12 @@ class SendDocument(BaseClient):
|
|||||||
pass an HTTP URL as a string for Telegram to get a file from the Internet, or
|
pass an HTTP URL as a string for Telegram to get a file from the Internet, or
|
||||||
pass a file path as string to upload a new file that exists on your local machine.
|
pass a file path as string to upload a new file that exists on your local machine.
|
||||||
|
|
||||||
|
thumb (``str``):
|
||||||
|
Thumbnail of the file sent.
|
||||||
|
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||||
|
A thumbnail's width and height should not exceed 90 pixels.
|
||||||
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
caption (``str``, *optional*):
|
caption (``str``, *optional*):
|
||||||
Document caption, 0-200 characters.
|
Document caption, 0-200 characters.
|
||||||
|
|
||||||
@ -103,10 +109,12 @@ class SendDocument(BaseClient):
|
|||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
|
||||||
if os.path.exists(document):
|
if os.path.exists(document):
|
||||||
|
thumb = None if thumb is None else await self.save_file(thumb)
|
||||||
file = await self.save_file(document, progress=progress, progress_args=progress_args)
|
file = await self.save_file(document, progress=progress, progress_args=progress_args)
|
||||||
media = types.InputMediaUploadedDocument(
|
media = types.InputMediaUploadedDocument(
|
||||||
mime_type=mimetypes.types_map.get("." + document.split(".")[-1], "text/plain"),
|
mime_type=mimetypes.types_map.get("." + document.split(".")[-1], "text/plain"),
|
||||||
file=file,
|
file=file,
|
||||||
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
types.DocumentAttributeFilename(os.path.basename(document))
|
types.DocumentAttributeFilename(os.path.basename(document))
|
||||||
]
|
]
|
||||||
|
@ -32,7 +32,7 @@ class SendVideoNote(BaseClient):
|
|||||||
video_note: str,
|
video_note: str,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
length: int = 1,
|
length: int = 1,
|
||||||
disable_notification: bool = None,
|
thumb: str = None,disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup=None,
|
reply_markup=None,
|
||||||
progress: callable = None,
|
progress: callable = None,
|
||||||
@ -57,6 +57,12 @@ class SendVideoNote(BaseClient):
|
|||||||
length (``int``, *optional*):
|
length (``int``, *optional*):
|
||||||
Video width and height.
|
Video width and height.
|
||||||
|
|
||||||
|
thumb (``str``, *optional*):
|
||||||
|
Thumbnail of the video sent.
|
||||||
|
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||||
|
A thumbnail's width and height should not exceed 90 pixels.
|
||||||
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
disable_notification (``bool``, *optional*):
|
disable_notification (``bool``, *optional*):
|
||||||
Sends the message silently.
|
Sends the message silently.
|
||||||
Users will receive a notification with no sound.
|
Users will receive a notification with no sound.
|
||||||
@ -100,10 +106,12 @@ class SendVideoNote(BaseClient):
|
|||||||
file = None
|
file = None
|
||||||
|
|
||||||
if os.path.exists(video_note):
|
if os.path.exists(video_note):
|
||||||
|
thumb = None if thumb is None else await self.save_file(thumb)
|
||||||
file = await self.save_file(video_note, progress=progress, progress_args=progress_args)
|
file = await self.save_file(video_note, progress=progress, progress_args=progress_args)
|
||||||
media = types.InputMediaUploadedDocument(
|
media = types.InputMediaUploadedDocument(
|
||||||
mime_type=mimetypes.types_map[".mp4"],
|
mime_type=mimetypes.types_map[".mp4"],
|
||||||
file=file,
|
file=file,
|
||||||
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
types.DocumentAttributeVideo(
|
types.DocumentAttributeVideo(
|
||||||
round_message=True,
|
round_message=True,
|
||||||
|
@ -28,6 +28,12 @@ class InputMediaAnimation(InputMedia):
|
|||||||
Pass a file_id as string to send a file that exists on the Telegram servers or
|
Pass a file_id as string to send a file that exists on the Telegram servers or
|
||||||
pass a file path as string to upload a new file that exists on your local machine.
|
pass a file path as string to upload a new file that exists on your local machine.
|
||||||
|
|
||||||
|
thumb (``str``, *optional*):
|
||||||
|
Thumbnail of the animation file sent.
|
||||||
|
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||||
|
A thumbnail's width and height should not exceed 90 pixels.
|
||||||
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
caption (``str``, *optional*):
|
caption (``str``, *optional*):
|
||||||
Caption of the animation to be sent, 0-200 characters
|
Caption of the animation to be sent, 0-200 characters
|
||||||
|
|
||||||
@ -48,6 +54,7 @@ class InputMediaAnimation(InputMedia):
|
|||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
media: str,
|
media: str,
|
||||||
|
thumb: str = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: str = "",
|
||||||
width: int = 0,
|
width: int = 0,
|
||||||
@ -55,6 +62,7 @@ class InputMediaAnimation(InputMedia):
|
|||||||
duration: int = 0):
|
duration: int = 0):
|
||||||
super().__init__(media, caption, parse_mode)
|
super().__init__(media, caption, parse_mode)
|
||||||
|
|
||||||
|
self.thumb = thumb
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
|
@ -29,6 +29,12 @@ class InputMediaAudio(InputMedia):
|
|||||||
Pass a file_id as string to send an audio that exists on the Telegram servers or
|
Pass a file_id as string to send an audio that exists on the Telegram servers or
|
||||||
pass a file path as string to upload a new audio that exists on your local machine.
|
pass a file path as string to upload a new audio that exists on your local machine.
|
||||||
|
|
||||||
|
thumb (``str``, *optional*):
|
||||||
|
Thumbnail of the music file album cover.
|
||||||
|
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||||
|
A thumbnail's width and height should not exceed 90 pixels.
|
||||||
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
caption (``str``, *optional*):
|
caption (``str``, *optional*):
|
||||||
Caption of the audio to be sent, 0-200 characters
|
Caption of the audio to be sent, 0-200 characters
|
||||||
|
|
||||||
@ -49,6 +55,7 @@ class InputMediaAudio(InputMedia):
|
|||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
media: str,
|
media: str,
|
||||||
|
thumb: str = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: str = "",
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
@ -56,6 +63,7 @@ class InputMediaAudio(InputMedia):
|
|||||||
title: str = ""):
|
title: str = ""):
|
||||||
super().__init__(media, caption, parse_mode)
|
super().__init__(media, caption, parse_mode)
|
||||||
|
|
||||||
|
self.thumb = thumb
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
self.performer = performer
|
self.performer = performer
|
||||||
self.title = title
|
self.title = title
|
||||||
|
@ -28,6 +28,12 @@ class InputMediaDocument(InputMedia):
|
|||||||
Pass a file_id as string to send a file that exists on the Telegram servers or
|
Pass a file_id as string to send a file that exists on the Telegram servers or
|
||||||
pass a file path as string to upload a new file that exists on your local machine.
|
pass a file path as string to upload a new file that exists on your local machine.
|
||||||
|
|
||||||
|
thumb (``str``):
|
||||||
|
Thumbnail of the file sent.
|
||||||
|
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||||
|
A thumbnail's width and height should not exceed 90 pixels.
|
||||||
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
caption (``str``, *optional*):
|
caption (``str``, *optional*):
|
||||||
Caption of the document to be sent, 0-200 characters
|
Caption of the document to be sent, 0-200 characters
|
||||||
|
|
||||||
@ -39,6 +45,9 @@ class InputMediaDocument(InputMedia):
|
|||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
media: str,
|
media: str,
|
||||||
|
thumb: str = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = ""):
|
parse_mode: str = ""):
|
||||||
super().__init__(media, caption, parse_mode)
|
super().__init__(media, caption, parse_mode)
|
||||||
|
|
||||||
|
self.thumb = thumb
|
||||||
|
@ -30,6 +30,12 @@ class InputMediaVideo(InputMedia):
|
|||||||
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.
|
||||||
|
|
||||||
|
thumb (``str``):
|
||||||
|
Thumbnail of the video sent.
|
||||||
|
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||||
|
A thumbnail's width and height should not exceed 90 pixels.
|
||||||
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
caption (``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
|
||||||
|
|
||||||
@ -53,6 +59,7 @@ class InputMediaVideo(InputMedia):
|
|||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
media: str,
|
media: str,
|
||||||
|
thumb: str = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: str = "",
|
||||||
width: int = 0,
|
width: int = 0,
|
||||||
@ -61,6 +68,7 @@ class InputMediaVideo(InputMedia):
|
|||||||
supports_streaming: bool = True):
|
supports_streaming: bool = True):
|
||||||
super().__init__(media, caption, parse_mode)
|
super().__init__(media, caption, parse_mode)
|
||||||
|
|
||||||
|
self.thumb = thumb
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
|
@ -30,7 +30,7 @@ class Audio(Object):
|
|||||||
Duration of the audio in seconds as defined by sender.
|
Duration of the audio in seconds as defined by sender.
|
||||||
|
|
||||||
thumb (:obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
|
thumb (:obj:`PhotoSize <pyrogram.PhotoSize>`, *optional*):
|
||||||
Audio thumbnail.
|
Thumbnail of the music file album cover.
|
||||||
|
|
||||||
file_name (``str``, *optional*):
|
file_name (``str``, *optional*):
|
||||||
Audio file name.
|
Audio file name.
|
||||||
|
@ -27,22 +27,21 @@ try:
|
|||||||
|
|
||||||
|
|
||||||
class AES:
|
class AES:
|
||||||
# TODO: Use new tgcrypto function names
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ige256_encrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes:
|
def ige256_encrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes:
|
||||||
return tgcrypto.ige_encrypt(data, key, iv)
|
return tgcrypto.ige256_encrypt(data, key, iv)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ige256_decrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes:
|
def ige256_decrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes:
|
||||||
return tgcrypto.ige_decrypt(data, key, iv)
|
return tgcrypto.ige256_decrypt(data, key, iv)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def ctr256_encrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes:
|
def ctr256_encrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes:
|
||||||
return tgcrypto.ctr_encrypt(data, key, iv, state or bytearray(1))
|
return tgcrypto.ctr256_encrypt(data, key, iv, state or bytearray(1))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def ctr256_decrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes:
|
def ctr256_decrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes:
|
||||||
return tgcrypto.ctr_decrypt(data, key, iv, state or bytearray(1))
|
return tgcrypto.ctr256_decrypt(data, key, iv, state or bytearray(1))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def xor(a: bytes, b: bytes) -> bytes:
|
def xor(a: bytes, b: bytes) -> bytes:
|
||||||
|
2
setup.py
2
setup.py
@ -172,7 +172,7 @@ setup(
|
|||||||
packages=find_packages(exclude=["compiler*"]),
|
packages=find_packages(exclude=["compiler*"]),
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
install_requires=read("requirements.txt"),
|
install_requires=read("requirements.txt"),
|
||||||
extras_require={"tgcrypto": ["tgcrypto>=1.0.4"]},
|
extras_require={"tgcrypto": ["tgcrypto==1.1.1"]},
|
||||||
cmdclass={
|
cmdclass={
|
||||||
"clean": Clean,
|
"clean": Clean,
|
||||||
"generate": Generate
|
"generate": Generate
|
||||||
|
Loading…
Reference in New Issue
Block a user