Merge branch 'develop' into asyncio

# Conflicts:
#	pyrogram/__init__.py
#	pyrogram/client/client.py
#	pyrogram/session/session.py
This commit is contained in:
Dan 2019-03-25 11:40:00 +01:00
commit 1179a5b994
112 changed files with 280 additions and 298 deletions

View File

@ -32,7 +32,7 @@ Features
- **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.
- **Documented**: Pyrogram API methods, types and public interfaces are well documented. - **Documented**: Pyrogram API methods, types and public interfaces are well documented.
- **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted. - **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted.
- **Updated**, to the latest Telegram API version, currently Layer 95 on top of `MTProto 2.0`_. - **Updated**, to the latest Telegram API version, currently Layer 97 on top of `MTProto 2.0`_.
- **Pluggable**: The Smart Plugin system allows to write components with minimal boilerplate code. - **Pluggable**: The Smart Plugin system allows to write components with minimal boilerplate code.
- **Comprehensive**: Execute any advanced action an official client is able to do, and even more. - **Comprehensive**: Execute any advanced action an official client is able to do, and even more.
@ -107,7 +107,7 @@ Copyright & License
</a> </a>
<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/schema-layer%2095-eda738.svg?longCache=true&colorA=262b30" <img src="https://img.shields.io/badge/schema-layer%2097-eda738.svg?longCache=true&colorA=262b30"
alt="Schema Layer"> alt="Schema Layer">
</a> </a>
<a href="https://github.com/pyrogram/tgcrypto"> <a href="https://github.com/pyrogram/tgcrypto">
@ -122,7 +122,7 @@ Copyright & License
.. |description| replace:: **Telegram MTProto API Framework for Python** .. |description| replace:: **Telegram MTProto API Framework for Python**
.. |schema| image:: https://img.shields.io/badge/schema-layer%2095-eda738.svg?longCache=true&colorA=262b30 .. |schema| image:: https://img.shields.io/badge/schema-layer%2097-eda738.svg?longCache=true&colorA=262b30
:target: compiler/api/source/main_api.tl :target: compiler/api/source/main_api.tl
:alt: Schema Layer :alt: Schema Layer

View File

@ -335,7 +335,7 @@ def start():
docstring_args = "Attributes:\n ID: ``{}``\n\n ".format(c.id) + docstring_args docstring_args = "Attributes:\n ID: ``{}``\n\n ".format(c.id) + docstring_args
if c.section == "functions": if c.section == "functions":
docstring_args += "\n\n Raises:\n :obj:`Error <pyrogram.Error>`" docstring_args += "\n\n Raises:\n :obj:`RPCError <pyrogram.RPCError>`"
docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type) docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type)
else: else:
references = get_references(".".join(filter(None, [c.namespace, c.name]))) references = get_references(".".join(filter(None, [c.namespace, c.name])))

View File

@ -315,7 +315,7 @@ updateContactsReset#7084a7be = Update;
updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update;
updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update; updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update;
updateUserPinnedMessage#4c43da18 user_id:int id:int = Update; updateUserPinnedMessage#4c43da18 user_id:int id:int = Update;
updateChatPinnedMessage#22893b26 chat_id:int id:int = Update; updateChatPinnedMessage#e10db349 chat_id:int id:int version:int = Update;
updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update; updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update;
updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update; updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update;
@ -411,11 +411,15 @@ inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey;
inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey;
inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey;
inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey; inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey;
inputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey;
inputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey;
privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey;
privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey;
privacyKeyPhoneCall#3d662b7b = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey;
privacyKeyPhoneP2P#39491cc8 = PrivacyKey; privacyKeyPhoneP2P#39491cc8 = PrivacyKey;
privacyKeyForwards#69ec56a3 = PrivacyKey;
privacyKeyProfilePhoto#96151fed = PrivacyKey;
inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule;
inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule;
@ -487,7 +491,7 @@ inputStickerSetEmpty#ffb62b95 = InputStickerSet;
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
stickerSet#5585a139 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; stickerSet#6a90bcb7 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumb:flags.4?PhotoSize count:int hash:int = StickerSet;
messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
@ -595,7 +599,7 @@ messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_off
exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; messageFwdHeader#ec338270 flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader;
auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeSms#72a3158c = auth.CodeType;
auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType;
@ -985,6 +989,17 @@ codeSettings#302f59f3 flags:# allow_flashcall:flags.0?true current_number:flags.
wallPaperSettings#a12f40b8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int intensity:flags.3?int = WallPaperSettings; wallPaperSettings#a12f40b8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int intensity:flags.3?int = WallPaperSettings;
autoDownloadSettings#d246fd47 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true photo_size_max:int video_size_max:int file_size_max:int = AutoDownloadSettings;
account.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings;
emojiKeyword#d5b3b9f9 keyword:string emoticons:Vector<string> = EmojiKeyword;
emojiKeywordDeleted#236df622 keyword:string emoticons:Vector<string> = EmojiKeyword;
emojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int keywords:Vector<EmojiKeyword> = EmojiKeywordsDifference;
emojiURL#a575739d url:string = EmojiURL;
---functions--- ---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -1064,6 +1079,8 @@ account.uploadWallPaper#dd853661 file:InputFile mime_type:string settings:WallPa
account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool; account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool;
account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool; account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool;
account.resetWallPapers#bb3b9804 = Bool; account.resetWallPapers#bb3b9804 = Bool;
account.getAutoDownloadSettings#56da0b3f = account.AutoDownloadSettings;
account.saveAutoDownloadSettings#76f36233 flags:# low:flags.0?true high:flags.1?true settings:AutoDownloadSettings = Bool;
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>; users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
users.getFullUser#ca30a5b1 id:InputUser = UserFull; users.getFullUser#ca30a5b1 id:InputUser = UserFull;
@ -1092,7 +1109,7 @@ messages.getDialogs#b098aee6 flags:# exclude_pinned:flags.0?true offset_date:int
messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;
messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int = messages.AffectedHistory;
messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>; messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
@ -1190,9 +1207,12 @@ messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true peer:InputPeer
messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates; messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates;
messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates; messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates;
messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines; messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;
messages.getStatsURL#83f6c0cd peer:InputPeer = StatsURL; messages.getStatsURL#812c2ae6 flags:# dark:flags.0?true peer:InputPeer params:string = StatsURL;
messages.editChatAbout#def60797 peer:InputPeer about:string = Bool; messages.editChatAbout#def60797 peer:InputPeer about:string = Bool;
messages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates; messages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates;
messages.getEmojiKeywords#35a0e062 lang_code:string = EmojiKeywordsDifference;
messages.getEmojiKeywordsDifference#1508b6af lang_code:string from_version:int = EmojiKeywordsDifference;
messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL;
updates.getState#edd4882a = updates.State; updates.getState#edd4882a = updates.State;
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
@ -1283,7 +1303,7 @@ phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtoc
phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall; phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall;
phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool; phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool;
phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; phone.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates;
phone.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = Updates; phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhoneCall rating:int comment:string = Updates;
phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool;
langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference; langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
@ -1292,4 +1312,4 @@ langpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:i
langpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>; langpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>;
langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage; langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage;
// LAYER 95 // LAYER 97

View File

@ -22,7 +22,7 @@ import re
import shutil import shutil
HOME = "compiler/error" HOME = "compiler/error"
DEST = "pyrogram/api/errors/exceptions" DEST = "pyrogram/errors/exceptions"
NOTICE_PATH = "NOTICE" NOTICE_PATH = "NOTICE"
@ -134,7 +134,7 @@ def start():
if "__main__" == __name__: if "__main__" == __name__:
HOME = "." HOME = "."
DEST = "../../pyrogram/api/errors/exceptions" DEST = "../../pyrogram/errors/exceptions"
NOTICE_PATH = "../../NOTICE" NOTICE_PATH = "../../NOTICE"
start() start()

View File

@ -1,12 +1,12 @@
{notice} {notice}
from ..error import Error from ..rpc_error import RPCError
class {super_class}(Error): class {super_class}(RPCError):
{docstring} {docstring}
CODE = {code} CODE = {code}
"""``int``: Error Code""" """``int``: RPC Error Code"""
NAME = __doc__ NAME = __doc__

View File

@ -1,7 +1,7 @@
class {sub_class}({super_class}): class {sub_class}({super_class}):
{docstring} {docstring}
ID = {id} ID = {id}
"""``str``: Error ID""" """``str``: RPC Error ID"""
MESSAGE = __doc__ MESSAGE = __doc__

View File

@ -1,8 +1,7 @@
400 - Bad Request 400 - Bad Request
================= =================
.. module:: pyrogram.api.errors.BadRequest .. module:: pyrogram.errors.BadRequest
.. automodule:: pyrogram.api.errors.exceptions.bad_request_400 .. automodule:: pyrogram.errors.exceptions.bad_request_400
:members: :members:
:show-inheritance:

View File

@ -1,8 +1,7 @@
420 - Flood 420 - Flood
=========== ===========
.. module:: pyrogram.api.errors.Flood .. module:: pyrogram.errors.Flood
.. automodule:: pyrogram.api.errors.exceptions.flood_420 .. automodule:: pyrogram.errors.exceptions.flood_420
:members: :members:
:show-inheritance:

View File

@ -1,8 +1,7 @@
403 - Forbidden 403 - Forbidden
=============== ===============
.. module:: pyrogram.api.errors.Forbidden .. module:: pyrogram.errors.Forbidden
.. automodule:: pyrogram.api.errors.exceptions.forbidden_403 .. automodule:: pyrogram.errors.exceptions.forbidden_403
:members: :members:
:show-inheritance:

View File

@ -1,8 +1,7 @@
500 - Internal Server Error 500 - Internal Server Error
=========================== ===========================
.. module:: pyrogram.api.errors.InternalServerError .. module:: pyrogram.errors.InternalServerError
.. automodule:: pyrogram.api.errors.exceptions.internal_server_error_500 .. automodule:: pyrogram.errors.exceptions.internal_server_error_500
:members: :members:
:show-inheritance:

View File

@ -1,8 +1,7 @@
406 - Not Acceptable 406 - Not Acceptable
==================== ====================
.. module:: pyrogram.api.errors.NotAcceptable .. module:: pyrogram.errors.NotAcceptable
.. automodule:: pyrogram.api.errors.exceptions.not_acceptable_406 .. automodule:: pyrogram.errors.exceptions.not_acceptable_406
:members: :members:
:show-inheritance:

View File

@ -1,8 +1,7 @@
303 - See Other 303 - See Other
=============== ===============
.. module:: pyrogram.api.errors.SeeOther .. module:: pyrogram.errors.SeeOther
.. automodule:: pyrogram.api.errors.exceptions.see_other_303 .. automodule:: pyrogram.errors.exceptions.see_other_303
:members: :members:
:show-inheritance:

View File

@ -1,8 +1,7 @@
401 - Unauthorized 401 - Unauthorized
================== ==================
.. module:: pyrogram.api.errors.Unauthorized .. module:: pyrogram.errors.Unauthorized
.. automodule:: pyrogram.api.errors.exceptions.unauthorized_401 .. automodule:: pyrogram.errors.exceptions.unauthorized_401
:members: :members:
:show-inheritance:

View File

@ -1,8 +1,7 @@
520 - Unknown Error 520 - Unknown Error
=================== ===================
.. module:: pyrogram.api.errors.UnknownError .. module:: pyrogram.errors.UnknownError
.. autoexception:: pyrogram.api.errors.error.UnknownError .. autoexception:: pyrogram.errors.rpc_error.UnknownError
:members: :members:
:show-inheritance:

View File

@ -26,7 +26,7 @@ Welcome to Pyrogram
</a> </a>
<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/schema-layer%2095-eda738.svg?longCache=true&colorA=262b30" <img src="https://img.shields.io/badge/schema-layer%2097-eda738.svg?longCache=true&colorA=262b30"
alt="Schema Layer"> alt="Schema Layer">
</a> </a>
<a href="https://github.com/pyrogram/tgcrypto"> <a href="https://github.com/pyrogram/tgcrypto">
@ -67,7 +67,7 @@ Features
- **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.
- **Documented**: Pyrogram API methods, types and public interfaces are well documented. - **Documented**: Pyrogram API methods, types and public interfaces are well documented.
- **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted. - **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted.
- **Updated**, to the latest Telegram API version, currently Layer 95 on top of `MTProto 2.0`_. - **Updated**, to the latest Telegram API version, currently Layer 97 on top of `MTProto 2.0`_.
- **Pluggable**: The Smart Plugin system allows to write components with minimal boilerplate code. - **Pluggable**: The Smart Plugin system allows to write components with minimal boilerplate code.
- **Comprehensive**: Execute any advanced action an official client is able to do, and even more. - **Comprehensive**: Execute any advanced action an official client is able to do, and even more.

View File

@ -31,6 +31,7 @@ Decorators
on_message on_message
on_callback_query on_callback_query
on_inline_query
on_deleted_messages on_deleted_messages
on_user_status on_user_status
on_disconnect on_disconnect
@ -56,6 +57,7 @@ Messages
send_location send_location
send_venue send_venue
send_contact send_contact
send_cached_media
send_chat_action send_chat_action
edit_message_text edit_message_text
edit_message_caption edit_message_caption
@ -67,6 +69,7 @@ Messages
iter_history iter_history
send_poll send_poll
vote_poll vote_poll
close_poll
retract_vote retract_vote
download_media download_media
@ -97,6 +100,8 @@ Chats
iter_chat_members iter_chat_members
get_dialogs get_dialogs
iter_dialogs iter_dialogs
restrict_chat
update_chat_username
Users Users
----- -----
@ -109,6 +114,7 @@ Users
get_user_profile_photos get_user_profile_photos
set_user_profile_photo set_user_profile_photo
delete_user_profile_photos delete_user_profile_photos
update_username
Contacts Contacts
-------- --------
@ -139,6 +145,7 @@ Bots
get_inline_bot_results get_inline_bot_results
send_inline_bot_result send_inline_bot_result
answer_callback_query answer_callback_query
answer_inline_query
request_callback_answer request_callback_answer
send_game send_game
set_game_score set_game_score

View File

@ -1,9 +1,8 @@
Error RPCError
===== ========
.. autoexception:: pyrogram.Error .. autoexception:: pyrogram.RPCError
:members: :members:
:show-inheritance:
.. toctree:: .. toctree::
../errors/SeeOther ../errors/SeeOther

View File

@ -15,6 +15,6 @@ after the well established `Telegram Bot API`_ methods, thus offering a familiar
Filters Filters
ChatAction ChatAction
ParseMode ParseMode
Error RPCError
.. _Telegram Bot API: https://core.telegram.org/bots/api#available-methods .. _Telegram Bot API: https://core.telegram.org/bots/api#available-methods

View File

@ -97,7 +97,7 @@ BotFather_. Bot tokens replace the Users' phone numbers only — you still need
`configure a Telegram API key <#configuration>`_ with Pyrogram, even when using Bots. `configure a Telegram API key <#configuration>`_ with Pyrogram, even when using Bots.
The authorization process is automatically managed. All you need to do is choose a ``session_name`` (can be anything, The authorization process is automatically managed. All you need to do is choose a ``session_name`` (can be anything,
but is usually your bot username) and pass your bot token using the ``bot_token`` parameter. usually your bot username) and pass your bot token using the ``bot_token`` parameter.
The session file will be named after the session name, which will be ``pyrogrambot.session`` for the example below. The session file will be named after the session name, which will be ``pyrogrambot.session`` for the example below.
.. code-block:: python .. code-block:: python

View File

@ -16,44 +16,22 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
import asyncio
import sys import sys
if sys.version_info[:3] in [(3, 5, 0), (3, 5, 1), (3, 5, 2)]: __version__ = "0.12.0.develop"
from .vendor import typing __license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
__copyright__ = "Copyright (C) 2017-2019 Dan Tès <https://github.com/delivrance>".replace(
# Monkey patch the standard "typing" module because Python versions from 3.5.0 to 3.5.2 have a broken one. "\xe8", "e" if sys.getfilesystemencoding() != "utf-8" else "\xe8"
sys.modules["typing"] = typing )
try: try:
import uvloop import uvloop
except ImportError: except ImportError:
pass pass
else: else:
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) uvloop.install()
__copyright__ = "Copyright (C) 2017-2019 Dan Tès <https://github.com/delivrance>".replace( from .errors import RPCError
"\xe8", from .client import *
"e" if sys.getfilesystemencoding() != "utf-8" else "\xe8" from .client.handlers import *
) from .client.types import *
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
__version__ = "0.12.0.asyncio"
from .api.errors import Error
from .client.types import (
Audio, Chat, ChatMember, ChatMembers, ChatPhoto, Contact, Document, InputMedia, InputMediaPhoto,
InputMediaVideo, InputMediaDocument, InputMediaAudio, InputMediaAnimation, InputPhoneContact,
Location, Message, MessageEntity, Dialog, Dialogs, Photo, PhotoSize, Sticker, User, UserStatus,
UserProfilePhotos, Venue, Animation, Video, VideoNote, Voice, CallbackQuery, Messages, ForceReply,
InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove,
InlineQuery, InlineQueryResult, InlineQueryResultArticle, InputMessageContent, InputTextMessageContent,
InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove, Poll,
PollOption, ChatPreview, StopPropagation, ContinuePropagation, Game, CallbackGame, GameHighScore, GameHighScores,
ChatPermissions
)
from .client import (
Client, ChatAction, ParseMode, Emoji,
MessageHandler, DeletedMessagesHandler, CallbackQueryHandler,
RawUpdateHandler, DisconnectHandler, UserStatusHandler, Filters,
InlineQueryHandler
)

View File

@ -39,18 +39,9 @@ class Object:
def __str__(self) -> str: def __str__(self) -> str:
return dumps(self, indent=4, default=default, ensure_ascii=False) return dumps(self, indent=4, default=default, ensure_ascii=False)
def __bool__(self) -> bool:
return True
def __eq__(self, other) -> bool:
return self.__dict__ == other.__dict__
def __len__(self) -> int: def __len__(self) -> int:
return len(self.write()) return len(self.write())
def __call__(self):
pass
def __getitem__(self, item): def __getitem__(self, item):
return getattr(self, item) return getattr(self, item)

View File

@ -19,9 +19,7 @@
from .client import Client from .client import Client
from .ext import BaseClient, ChatAction, Emoji, ParseMode from .ext import BaseClient, ChatAction, Emoji, ParseMode
from .filters import Filters from .filters import Filters
from .handlers import (
MessageHandler, DeletedMessagesHandler, __all__ = [
CallbackQueryHandler, RawUpdateHandler, "Client", "BaseClient", "ChatAction", "Emoji", "ParseMode", "Filters",
DisconnectHandler, UserStatusHandler, ]
InlineQueryHandler
)

View File

@ -41,7 +41,7 @@ from typing import Union, List
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.core import Object from pyrogram.api.core import Object
from pyrogram.api.errors import ( from pyrogram.errors import (
PhoneMigrate, NetworkMigrate, PhoneNumberInvalid, PhoneMigrate, NetworkMigrate, PhoneNumberInvalid,
PhoneNumberUnoccupied, PhoneCodeInvalid, PhoneCodeHashEmpty, PhoneNumberUnoccupied, PhoneCodeInvalid, PhoneCodeHashEmpty,
PhoneCodeExpired, PhoneCodeEmpty, SessionPasswordNeeded, PhoneCodeExpired, PhoneCodeEmpty, SessionPasswordNeeded,
@ -49,14 +49,13 @@ from pyrogram.api.errors import (
VolumeLocNotFound, UserMigrate, FileIdInvalid, ChannelPrivate, PhoneNumberOccupied, VolumeLocNotFound, UserMigrate, FileIdInvalid, ChannelPrivate, PhoneNumberOccupied,
PasswordRecoveryNa, PasswordEmpty PasswordRecoveryNa, PasswordEmpty
) )
from pyrogram.client.handlers import DisconnectHandler
from pyrogram.client.handlers.handler import Handler from pyrogram.client.handlers.handler import Handler
from pyrogram.client.methods.password.utils import compute_check from pyrogram.client.methods.password.utils import compute_check
from pyrogram.crypto import AES from pyrogram.crypto import AES
from pyrogram.session import Auth, Session from pyrogram.session import Auth, Session
from .dispatcher import Dispatcher
from .ext import BaseClient, Syncer, utils
from .ext.utils import ainput from .ext.utils import ainput
from .handlers import DisconnectHandler from .ext import utils, Syncer, BaseClient, Dispatcher
from .methods import Methods from .methods import Methods
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -274,7 +273,7 @@ class Client(Methods, BaseClient):
Requires no parameters. Requires no parameters.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ConnectionError`` in case you try to start an already started Client. ``ConnectionError`` in case you try to start an already started Client.
""" """
if self.is_started: if self.is_started:
@ -436,7 +435,7 @@ class Client(Methods, BaseClient):
Pass a coroutine to run it until is complete. Pass a coroutine to run it until is complete.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
run = asyncio.get_event_loop().run_until_complete run = asyncio.get_event_loop().run_until_complete
@ -1044,7 +1043,7 @@ class Client(Methods, BaseClient):
Timeout in seconds. Timeout in seconds.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
if not self.is_started: if not self.is_started:
raise ConnectionError("Client has not been started") raise ConnectionError("Client has not been started")
@ -1334,7 +1333,7 @@ class Client(Methods, BaseClient):
On success, the resolved peer id is returned in form of an InputPeer object. On success, the resolved peer id is returned in form of an InputPeer object.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``KeyError`` in case the peer doesn't exist in the internal database. ``KeyError`` in case the peer doesn't exist in the internal database.
""" """
try: try:
@ -1437,7 +1436,7 @@ class Client(Methods, BaseClient):
On success, the uploaded file is returned in form of an InputFile object. On success, the uploaded file is returned in form of an InputFile object.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
async def worker(session): async def worker(session):

View File

@ -1,19 +0,0 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2019 Dan Tès <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from .dispatcher import Dispatcher

View File

@ -18,6 +18,7 @@
from .base_client import BaseClient from .base_client import BaseClient
from .chat_action import ChatAction from .chat_action import ChatAction
from .dispatcher import Dispatcher
from .emoji import Emoji from .emoji import Emoji
from .parse_mode import ParseMode from .parse_mode import ParseMode
from .syncer import Syncer from .syncer import Syncer

View File

@ -22,7 +22,6 @@ from collections import OrderedDict
import pyrogram import pyrogram
from pyrogram.api import types from pyrogram.api import types
from ..ext import utils
from ..handlers import ( from ..handlers import (
CallbackQueryHandler, MessageHandler, DeletedMessagesHandler, CallbackQueryHandler, MessageHandler, DeletedMessagesHandler,
UserStatusHandler, RawUpdateHandler, InlineQueryHandler UserStatusHandler, RawUpdateHandler, InlineQueryHandler

View File

@ -23,3 +23,8 @@ from .inline_query_handler import InlineQueryHandler
from .message_handler import MessageHandler from .message_handler import MessageHandler
from .raw_update_handler import RawUpdateHandler from .raw_update_handler import RawUpdateHandler
from .user_status_handler import UserStatusHandler from .user_status_handler import UserStatusHandler
__all__ = [
"MessageHandler", "DeletedMessagesHandler", "CallbackQueryHandler", "RawUpdateHandler", "DisconnectHandler",
"UserStatusHandler", "InlineQueryHandler"
]

View File

@ -57,7 +57,7 @@ class AnswerCallbackQuery(BaseClient):
True, on success. True, on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
return await self.send( return await self.send(
functions.messages.SetBotCallbackAnswer( functions.messages.SetBotCallbackAnswer(

View File

@ -52,7 +52,7 @@ class GetGameHighScores(BaseClient):
On success, a :obj:`GameHighScores <pyrogram.GameHighScores>` object is returned. On success, a :obj:`GameHighScores <pyrogram.GameHighScores>` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
# TODO: inline_message_id # TODO: inline_message_id

View File

@ -19,7 +19,7 @@
from typing import Union from typing import Union
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import UnknownError from pyrogram.errors import UnknownError
from pyrogram.client.ext import BaseClient from pyrogram.client.ext import BaseClient
@ -58,7 +58,7 @@ class GetInlineBotResults(BaseClient):
On Success, :obj:`BotResults <pyrogram.api.types.messages.BotResults>` is returned. On Success, :obj:`BotResults <pyrogram.api.types.messages.BotResults>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``TimeoutError`` if the bot fails to answer within 10 seconds ``TimeoutError`` if the bot fails to answer within 10 seconds
""" """
# TODO: Don't return the raw type # TODO: Don't return the raw type

View File

@ -49,7 +49,7 @@ class RequestCallbackAnswer(BaseClient):
or as an alert. or as an alert.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``TimeoutError`` if the bot fails to answer within 10 seconds. ``TimeoutError`` if the bot fails to answer within 10 seconds.
""" """
return await self.send( return await self.send(

View File

@ -63,7 +63,7 @@ class SendGame(BaseClient):
On success, the sent :obj:`Message` is returned. On success, the sent :obj:`Message` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
r = await self.send( r = await self.send(
functions.messages.SendMedia( functions.messages.SendMedia(

View File

@ -61,7 +61,7 @@ class SendInlineBotResult(BaseClient):
On success, the sent Message is returned. On success, the sent Message is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
return await self.send( return await self.send(
functions.messages.SendInlineBotResult( functions.messages.SendInlineBotResult(

View File

@ -67,7 +67,7 @@ class SetGameScore(BaseClient):
otherwise returns True. otherwise returns True.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
:class:`BotScoreNotModified` if the new score is not greater than the user's current score in the chat and force is False. :class:`BotScoreNotModified` if the new score is not greater than the user's current score in the chat and force is False.
""" """
r = await self.send( r = await self.send(

View File

@ -43,7 +43,7 @@ class DeleteChatPhoto(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC 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)

View File

@ -40,7 +40,7 @@ class ExportChatInviteLink(BaseClient):
On success, the exported invite link as string is returned. On success, the exported invite link as string is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
peer = await self.resolve_peer(chat_id) peer = await self.resolve_peer(chat_id)

View File

@ -42,7 +42,7 @@ class GetChat(BaseClient):
On success, a :obj:`Chat <pyrogram.Chat>` object is returned. On success, a :obj:`Chat <pyrogram.Chat>` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` in case the chat invite link refers to a chat you haven't joined yet. ``ValueError`` in case the chat invite link refers to a chat you haven't joined yet.
""" """
match = self.INVITE_LINK_RE.match(str(chat_id)) match = self.INVITE_LINK_RE.match(str(chat_id))

View File

@ -19,7 +19,8 @@
from typing import Union from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types, errors from pyrogram.api import functions, types
from pyrogram.errors import UserNotParticipant
from ...ext import BaseClient from ...ext import BaseClient
@ -44,7 +45,7 @@ class GetChatMember(BaseClient):
On success, a :obj:`ChatMember <pyrogram.ChatMember>` object is returned. On success, a :obj:`ChatMember <pyrogram.ChatMember>` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
chat_id = await self.resolve_peer(chat_id) chat_id = await self.resolve_peer(chat_id)
user_id = await self.resolve_peer(user_id) user_id = await self.resolve_peer(user_id)
@ -60,7 +61,7 @@ class GetChatMember(BaseClient):
if member.user.is_self: if member.user.is_self:
return member return member
else: else:
raise errors.UserNotParticipant raise UserNotParticipant
elif isinstance(chat_id, types.InputPeerChannel): elif isinstance(chat_id, types.InputPeerChannel):
r = await self.send( r = await self.send(
functions.channels.GetParticipant( functions.channels.GetParticipant(

View File

@ -84,7 +84,7 @@ class GetChatMembers(BaseClient):
On success, a :obj:`ChatMembers` object is returned. On success, a :obj:`ChatMembers` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` if you used an invalid filter or a chat_id that belongs to a user. ``ValueError`` if you used an invalid filter or a chat_id that belongs to a user.
""" """
peer = await self.resolve_peer(chat_id) peer = await self.resolve_peer(chat_id)

View File

@ -37,7 +37,7 @@ class GetChatMembersCount(BaseClient):
On success, an integer is returned. On success, an integer is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC 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)

View File

@ -38,7 +38,7 @@ class GetChatPreview(BaseClient):
Either :obj:`Chat` or :obj:`ChatPreview`, depending on whether you already joined the chat or not. Either :obj:`Chat` or :obj:`ChatPreview`, depending on whether you already joined the chat or not.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` in case of an invalid invite_link. ``ValueError`` in case of an invalid invite_link.
""" """
match = self.INVITE_LINK_RE.match(invite_link) match = self.INVITE_LINK_RE.match(invite_link)

View File

@ -21,7 +21,7 @@ import logging
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FloodWait from pyrogram.errors import FloodWait
from ...ext import BaseClient from ...ext import BaseClient
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -56,7 +56,7 @@ class GetDialogs(BaseClient):
On success, a :obj:`Dialogs` object is returned. On success, a :obj:`Dialogs` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
while True: while True:

View File

@ -81,7 +81,7 @@ class IterChatMembers(BaseClient):
A generator yielding :obj:`ChatMember <pyrogram.ChatMember>` objects. A generator yielding :obj:`ChatMember <pyrogram.ChatMember>` objects.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
current = 0 current = 0
yielded = set() yielded = set()

View File

@ -49,7 +49,7 @@ class IterDialogs(BaseClient):
A generator yielding :obj:`Dialog <pyrogram.Dialog>` objects. A generator yielding :obj:`Dialog <pyrogram.Dialog>` objects.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
current = 0 current = 0
total = limit or (1 << 31) - 1 total = limit or (1 << 31) - 1

View File

@ -37,7 +37,7 @@ class JoinChat(BaseClient):
On success, a :obj:`Chat <pyrogram.Chat>` object is returned. On success, a :obj:`Chat <pyrogram.Chat>` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
match = self.INVITE_LINK_RE.match(chat_id) match = self.INVITE_LINK_RE.match(chat_id)

View File

@ -57,7 +57,7 @@ class KickChatMember(BaseClient):
On success, either True or a service :obj:`Message <pyrogram.Message>` will be returned (when applicable). On success, either True or a service :obj:`Message <pyrogram.Message>` will be returned (when applicable).
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
chat_peer = await self.resolve_peer(chat_id) chat_peer = await self.resolve_peer(chat_id)
user_peer = await self.resolve_peer(user_id) user_peer = await self.resolve_peer(user_id)

View File

@ -39,7 +39,7 @@ class LeaveChat(BaseClient):
Deletes the group chat dialog after leaving (for simple group chats, not supergroups). Deletes the group chat dialog after leaving (for simple group chats, not supergroups).
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
peer = await self.resolve_peer(chat_id) peer = await self.resolve_peer(chat_id)

View File

@ -48,7 +48,7 @@ class PinChatMessage(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
await self.send( await self.send(
functions.messages.UpdatePinnedMessage( functions.messages.UpdatePinnedMessage(

View File

@ -79,7 +79,7 @@ class PromoteChatMember(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
await self.send( await self.send(
functions.channels.EditAdmin( functions.channels.EditAdmin(

View File

@ -73,7 +73,7 @@ class RestrictChat(BaseClient):
On success, a :obj:`Chat <pyrogram.Chat>` object is returned. On success, a :obj:`Chat <pyrogram.Chat>` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
send_messages = True send_messages = True
send_media = True send_media = True

View File

@ -86,7 +86,7 @@ class RestrictChatMember(BaseClient):
On success, a :obj:`Chat <pyrogram.Chat>` object is returned. On success, a :obj:`Chat <pyrogram.Chat>` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
send_messages = True send_messages = True
send_media = True send_media = True

View File

@ -42,7 +42,7 @@ class SetChatDescription(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` if a chat_id doesn't belong to a supergroup or a channel. ``ValueError`` if a chat_id doesn't belong to a supergroup or a channel.
""" """
peer = await self.resolve_peer(chat_id) peer = await self.resolve_peer(chat_id)

View File

@ -50,7 +50,7 @@ class SetChatPhoto(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC 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)

View File

@ -47,7 +47,7 @@ class SetChatTitle(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC 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)

View File

@ -44,7 +44,7 @@ class UnbanChatMember(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
await self.send( await self.send(
functions.channels.EditBanned( functions.channels.EditBanned(

View File

@ -39,7 +39,7 @@ class UnpinChatMessage(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
await self.send( await self.send(
functions.messages.UpdatePinnedMessage( functions.messages.UpdatePinnedMessage(

View File

@ -42,7 +42,7 @@ class UpdateChatUsername(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` if a chat_id belongs to a user or chat. ``ValueError`` if a chat_id belongs to a user or chat.
""" """

View File

@ -38,7 +38,7 @@ class AddContacts(BaseClient):
On success, the added contacts are returned. On success, the added contacts are returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
imported_contacts = await self.send( imported_contacts = await self.send(
functions.contacts.ImportContacts( functions.contacts.ImportContacts(

View File

@ -19,7 +19,7 @@
from typing import List from typing import List
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import PeerIdInvalid from pyrogram.errors import PeerIdInvalid
from ...ext import BaseClient from ...ext import BaseClient
@ -39,7 +39,7 @@ class DeleteContacts(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
contacts = [] contacts = []

View File

@ -21,7 +21,7 @@ import logging
import pyrogram import pyrogram
from pyrogram.api import functions from pyrogram.api import functions
from pyrogram.api.errors import FloodWait from pyrogram.errors import FloodWait
from ...ext import BaseClient from ...ext import BaseClient
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -35,7 +35,7 @@ class GetContacts(BaseClient):
On success, a list of :obj:`User` objects is returned. On success, a list of :obj:`User` objects is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
while True: while True:
try: try:

View File

@ -45,7 +45,7 @@ class ClosePoll(BaseClient):
On success, True is returned. On success, True is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
poll = self.get_messages(chat_id, message_id).poll poll = self.get_messages(chat_id, message_id).poll

View File

@ -31,14 +31,6 @@ class DeleteMessages(BaseClient):
) -> bool: ) -> bool:
"""Use this method to delete messages, including service messages. """Use this method to delete messages, including service messages.
Deleting messages have the following limitations:
- A message can only be deleted if it was sent less than 48 hours ago.
- Users can delete outgoing messages in groups and supergroups.
- Users granted *can_post_messages* permissions can delete outgoing messages in channels.
- If the user is an administrator of a group, it can delete any message there.
- If the user has *can_delete_messages* permission in a supergroup or a channel, it can delete any message there.
Args: Args:
chat_id (``int`` | ``str``): chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat. Unique identifier (int) or username (str) of the target chat.
@ -59,7 +51,7 @@ class DeleteMessages(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
peer = await self.resolve_peer(chat_id) peer = await self.resolve_peer(chat_id)
message_ids = list(message_ids) if not isinstance(message_ids, int) else [message_ids] message_ids = list(message_ids) if not isinstance(message_ids, int) else [message_ids]

View File

@ -77,7 +77,7 @@ class DownloadMedia(BaseClient):
In case the download is deliberately stopped with :meth:`stop_transmission`, None is returned as well. In case the download is deliberately stopped with :meth:`stop_transmission`, None is returned as well.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` if the message doesn't contain any downloadable media ``ValueError`` if the message doesn't contain any downloadable media
""" """
error_message = "This message doesn't contain any downloadable media" error_message = "This message doesn't contain any downloadable media"

View File

@ -58,7 +58,7 @@ class EditMessageCaption(BaseClient):
On success, the edited :obj:`Message <pyrogram.Message>` is returned. On success, the edited :obj:`Message <pyrogram.Message>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown

View File

@ -23,7 +23,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid from pyrogram.errors import FileIdInvalid
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
from pyrogram.client.types import ( from pyrogram.client.types import (
InputMediaPhoto, InputMediaVideo, InputMediaAudio, InputMediaPhoto, InputMediaVideo, InputMediaAudio,
@ -66,7 +66,7 @@ class EditMessageMedia(BaseClient):
On success, the edited :obj:`Message <pyrogram.Message>` is returned. On success, the edited :obj:`Message <pyrogram.Message>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
style = self.html if media.parse_mode.lower() == "html" else self.markdown style = self.html if media.parse_mode.lower() == "html" else self.markdown
caption = media.caption caption = media.caption

View File

@ -49,7 +49,7 @@ class EditMessageReplyMarkup(BaseClient):
:obj:`Message <pyrogram.Message>` is returned, otherwise True is returned. :obj:`Message <pyrogram.Message>` is returned, otherwise True is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
r = await self.send( r = await self.send(

View File

@ -62,7 +62,7 @@ class EditMessageText(BaseClient):
On success, the edited :obj:`Message <pyrogram.Message>` is returned. On success, the edited :obj:`Message <pyrogram.Message>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown

View File

@ -70,7 +70,7 @@ class ForwardMessages(BaseClient):
is returned. is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
is_iterable = not isinstance(message_ids, int) is_iterable = not isinstance(message_ids, int)

View File

@ -22,7 +22,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions from pyrogram.api import functions
from pyrogram.api.errors import FloodWait from pyrogram.errors import FloodWait
from ...ext import BaseClient from ...ext import BaseClient
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -70,7 +70,7 @@ class GetHistory(BaseClient):
On success, a :obj:`Messages <pyrogram.Messages>` object is returned. On success, a :obj:`Messages <pyrogram.Messages>` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
while True: while True:

View File

@ -22,7 +22,7 @@ from typing import Union, Iterable
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FloodWait from pyrogram.errors import FloodWait
from ...ext import BaseClient from ...ext import BaseClient
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -63,7 +63,7 @@ class GetMessages(BaseClient):
*reply_to_message_ids* was an integer, the single requested :obj:`Message <pyrogram.Message>` is returned. *reply_to_message_ids* was an integer, the single requested :obj:`Message <pyrogram.Message>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
ids, ids_type = ( ids, ids_type = (
(message_ids, types.InputMessageID) if message_ids (message_ids, types.InputMessageID) if message_ids

View File

@ -67,7 +67,7 @@ class IterHistory(BaseClient):
A generator yielding :obj:`Message <pyrogram.Message>` objects. A generator yielding :obj:`Message <pyrogram.Message>` objects.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
offset_id = offset_id or (1 if reverse else 0) offset_id = offset_id or (1 if reverse else 0)
current = 0 current = 0

View File

@ -43,7 +43,7 @@ class RetractVote(BaseClient):
On success, True is returned. On success, True is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
self.send( self.send(
functions.messages.SendVote( functions.messages.SendVote(

View File

@ -23,7 +23,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid, FilePartMissing from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
@ -125,7 +125,7 @@ class SendAnimation(BaseClient):
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
file = None file = None
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown

View File

@ -23,7 +23,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid, FilePartMissing from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
@ -126,7 +126,7 @@ class SendAudio(BaseClient):
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
file = None file = None
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown

View File

@ -22,7 +22,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid from pyrogram.errors import FileIdInvalid
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
@ -81,7 +81,7 @@ class SendCachedMedia(BaseClient):
On success, the sent :obj:`Message <pyrogram.Message>` is returned. On success, the sent :obj:`Message <pyrogram.Message>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown

View File

@ -51,7 +51,7 @@ class SendChatAction(BaseClient):
On success, True is returned. On success, True is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` if the provided string is not a valid ChatAction. ``ValueError`` if the provided string is not a valid ChatAction.
""" """

View File

@ -74,7 +74,7 @@ class SendContact(BaseClient):
On success, the sent :obj:`Message <pyrogram.Message>` is returned. On success, the sent :obj:`Message <pyrogram.Message>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
r = await self.send( r = await self.send(
functions.messages.SendMedia( functions.messages.SendMedia(

View File

@ -23,7 +23,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid, FilePartMissing from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
@ -112,7 +112,7 @@ class SendDocument(BaseClient):
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
file = None file = None
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown

View File

@ -67,7 +67,7 @@ class SendLocation(BaseClient):
On success, the sent :obj:`Message <pyrogram.Message>` is returned. On success, the sent :obj:`Message <pyrogram.Message>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
r = await self.send( r = await self.send(
functions.messages.SendMedia( functions.messages.SendMedia(

View File

@ -25,7 +25,7 @@ import asyncio
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid, FloodWait from pyrogram.errors import FileIdInvalid, FloodWait
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -64,7 +64,7 @@ class SendMediaGroup(BaseClient):
single messages sent. single messages sent.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
multi_media = [] multi_media = []

View File

@ -73,7 +73,7 @@ class SendMessage(BaseClient):
On success, the sent :obj:`Message` is returned. On success, the sent :obj:`Message` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown
message, entities = style.parse(text).values() message, entities = style.parse(text).values()

View File

@ -23,7 +23,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid, FilePartMissing from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
@ -112,7 +112,7 @@ class SendPhoto(BaseClient):
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
file = None file = None
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown

View File

@ -67,7 +67,7 @@ class SendPoll(BaseClient):
On success, the sent :obj:`Message <pyrogram.Message>` is returned. On success, the sent :obj:`Message <pyrogram.Message>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
r = self.send( r = self.send(
functions.messages.SendMedia( functions.messages.SendMedia(

View File

@ -23,7 +23,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid, FilePartMissing from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
@ -96,7 +96,7 @@ class SendSticker(BaseClient):
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
file = None file = None

View File

@ -84,7 +84,7 @@ class SendVenue(BaseClient):
On success, the sent :obj:`Message <pyrogram.Message>` is returned. On success, the sent :obj:`Message <pyrogram.Message>` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
r = await self.send( r = await self.send(
functions.messages.SendMedia( functions.messages.SendMedia(

View File

@ -23,7 +23,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid, FilePartMissing from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
@ -129,7 +129,7 @@ class SendVideo(BaseClient):
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
file = None file = None
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown

View File

@ -23,7 +23,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid, FilePartMissing from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
@ -111,7 +111,7 @@ class SendVideoNote(BaseClient):
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
file = None file = None

View File

@ -23,7 +23,7 @@ from typing import Union
import pyrogram import pyrogram
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.api.errors import FileIdInvalid, FilePartMissing from pyrogram.errors import FileIdInvalid, FilePartMissing
from pyrogram.client.ext import BaseClient, utils from pyrogram.client.ext import BaseClient, utils
@ -110,7 +110,7 @@ class SendVoice(BaseClient):
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
file = None file = None
style = self.html if parse_mode.lower() == "html" else self.markdown style = self.html if parse_mode.lower() == "html" else self.markdown

View File

@ -47,7 +47,7 @@ class VotePoll(BaseClient):
On success, True is returned. On success, True is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
poll = self.get_messages(chat_id, message_id).poll poll = self.get_messages(chat_id, message_id).poll

View File

@ -46,7 +46,7 @@ class ChangeCloudPassword(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` in case there is no cloud password to change. ``ValueError`` in case there is no cloud password to change.
""" """
r = await self.send(functions.account.GetPassword()) r = await self.send(functions.account.GetPassword())

View File

@ -48,7 +48,7 @@ class EnableCloudPassword(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` in case there is already a cloud password enabled. ``ValueError`` in case there is already a cloud password enabled.
""" """
r = await self.send(functions.account.GetPassword()) r = await self.send(functions.account.GetPassword())

View File

@ -36,7 +36,7 @@ class RemoveCloudPassword(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
``ValueError`` in case there is no cloud password to remove. ``ValueError`` in case there is no cloud password to remove.
""" """
r = await self.send(functions.account.GetPassword()) r = await self.send(functions.account.GetPassword())

View File

@ -40,7 +40,7 @@ class DeleteUserProfilePhotos(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
id = id if isinstance(id, list) else [id] id = id if isinstance(id, list) else [id]
input_photos = [] input_photos = []

View File

@ -29,7 +29,7 @@ class GetMe(BaseClient):
Basic information about the user or bot in form of a :obj:`User` object Basic information about the user or bot in form of a :obj:`User` object
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
return pyrogram.User._parse( return pyrogram.User._parse(
self, self,

View File

@ -50,7 +50,7 @@ class GetUserProfilePhotos(BaseClient):
On success, a :obj:`UserProfilePhotos` object is returned. On success, a :obj:`UserProfilePhotos` object is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
return pyrogram.UserProfilePhotos._parse( return pyrogram.UserProfilePhotos._parse(
self, self,

View File

@ -44,7 +44,7 @@ class GetUsers(BaseClient):
*user_ids* was an integer or string, the single requested :obj:`User` is returned. *user_ids* was an integer or string, the single requested :obj:`User` is returned.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
is_iterable = not isinstance(user_ids, (int, str)) is_iterable = not isinstance(user_ids, (int, str))
user_ids = list(user_ids) if is_iterable else [user_ids] user_ids = list(user_ids) if is_iterable else [user_ids]

View File

@ -39,7 +39,7 @@ class SetUserProfilePhoto(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
return bool( return bool(

View File

@ -41,7 +41,7 @@ class UpdateUsername(BaseClient):
True on success. True on success.
Raises: Raises:
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error. :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
""" """
return bool( return bool(

View File

@ -16,28 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from .bots import ( from .bots import *
ForceReply, InlineKeyboardButton, InlineKeyboardMarkup, from .inline_mode import *
KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove, CallbackGame, from .input_media import *
GameHighScore, GameHighScores, CallbackQuery from .input_message_content import *
) from .messages_and_media import *
from .inline_mode import ( from .update import *
InlineQuery, InlineQueryResult, InlineQueryResultArticle from .user_and_chats import *
)
from .input_media import (
InputMedia, InputMediaAudio, InputPhoneContact, InputMediaVideo, InputMediaPhoto,
InputMediaDocument, InputMediaAnimation
)
from .input_message_content import (
InputMessageContent, InputTextMessageContent
)
from .messages_and_media import (
Audio, Contact, Document, Animation, Location, Photo, PhotoSize,
Sticker, Venue, Video, VideoNote, Voice, UserProfilePhotos,
Message, Messages, MessageEntity, Poll, PollOption, Game
)
from .update import StopPropagation, ContinuePropagation
from .user_and_chats import (
Chat, ChatMember, ChatMembers, ChatPhoto,
Dialog, Dialogs, User, UserStatus, ChatPreview, ChatPermissions
)

View File

@ -26,3 +26,8 @@ from .inline_keyboard_markup import InlineKeyboardMarkup
from .keyboard_button import KeyboardButton from .keyboard_button import KeyboardButton
from .reply_keyboard_markup import ReplyKeyboardMarkup from .reply_keyboard_markup import ReplyKeyboardMarkup
from .reply_keyboard_remove import ReplyKeyboardRemove from .reply_keyboard_remove import ReplyKeyboardRemove
__all__ = [
"CallbackGame", "CallbackQuery", "ForceReply", "GameHighScore", "GameHighScores", "InlineKeyboardButton",
"InlineKeyboardMarkup", "KeyboardButton", "ReplyKeyboardMarkup", "ReplyKeyboardRemove"
]

Some files were not shown because too many files have changed in this diff Show More