diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..c3b69284 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at dan@pyrogram.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..e721fd98 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1 @@ +# How to Contribute diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..f34f615a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: delivrance +custom: https://docs.pyrogram.org/support-pyrogram diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..59410e25 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,21 @@ +--- +name: Bug Report +about: Create a bug report affecting the library +labels: "bug" +--- + + + +## Checklist +- [ ] I am sure the error is coming from Pyrogram's code and not elsewhere. +- [ ] I have searched in the issue tracker for similar bug reports, including closed ones. +- [ ] I ran `pip3 install -U https://github.com/pyrogram/pyrogram/archive/develop.zip` and reproduced the issue using the latest development version. + +## Description +A clear and concise description of the problem. + +## Steps to Reproduce +[A minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). + +## Traceback +The full traceback (if applicable). \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..4d2f447c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,14 @@ +--- +name: Feature Request +about: Suggest ideas, new features or enhancements +labels: "enhancement" +--- + + + +## Checklist +- [ ] I believe the idea is awesome and would benefit the library. +- [ ] I have searched in the issue tracker for similar requests, including closed ones. + +## Description +A detailed description of the request. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 00000000..05f342bc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,15 @@ +--- +name: Ask Question +about: Ask a Pyrogram related question +title: For Q&A purposes, please read this template body +labels: "question" +--- + + + +# Important +This place is for issues about Pyrogram, it's **not a forum**. + +If you'd like to post a question, please move to https://stackoverflow.com or join the Telegram community at https://t.me/pyrogram. Useful information on how to ask good questions can be found here: https://stackoverflow.com/help/how-to-ask. + +Thanks. diff --git a/.gitignore b/.gitignore index bfc2fb83..0b1a0699 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ config.ini # Pyrogram generated code -pyrogram/api/errors/exceptions/ +pyrogram/errors/exceptions/ pyrogram/api/functions/ pyrogram/api/types/ pyrogram/api/all.py diff --git a/MANIFEST.in b/MANIFEST.in index f818e13a..97d04588 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,7 @@ ## Include -include COPYING COPYING.lesser NOTICE requirements.txt +include README.md COPYING COPYING.lesser NOTICE requirements.txt recursive-include compiler *.py *.tl *.tsv *.txt +recursive-include pyrogram mime.types ## Exclude prune pyrogram/api/errors/exceptions diff --git a/README.md b/README.md new file mode 100644 index 00000000..4e758b5a --- /dev/null +++ b/README.md @@ -0,0 +1,85 @@ +

+ + Pyrogram + +
+ Telegram MTProto API Framework for Python +
+ + Documentation + + • + + Releases + + • + + Community + +

+ +## Pyrogram + +``` python +from pyrogram import Client, Filters + +app = Client("my_account") + + +@app.on_message(Filters.private) +def hello(client, message): + message.reply("Hello {}".format(message.from_user.first_name)) + + +app.run() +``` + +**Pyrogram** is an elegant, easy-to-use [Telegram](https://telegram.org/) client library and framework written from the +ground up in Python and C. It enables you to easily create custom apps for both user and bot identities (bot API alternative) via the [MTProto API](https://core.telegram.org/api#telegram-api). + +> [Pyrogram in fully-asynchronous mode is also available »](https://github.com/pyrogram/pyrogram/issues/181) +> +> [Working PoC of Telegram voice calls using Pyrogram »](https://github.com/bakatrouble/pytgvoip) + +### Features + +- **Easy**: You can install Pyrogram with pip and start building your applications right away. +- **Elegant**: Low-level details are abstracted and re-presented in a much nicer and easier way. +- **Fast**: Crypto parts are boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance library + written in pure C. +- **Documented**: Pyrogram API methods, types and public interfaces are well documented. +- **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted. +- **Updated**, to make use of the latest Telegram API version and features. +- **Bot API-like**: Similar to the Bot API in its simplicity, but much more powerful and detailed. +- **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. + +### Requirements + +- Python 3.4 or higher. +- A [Telegram API key](https://docs.pyrogram.org/intro/setup#api-keys). + +### Installing + +``` bash +pip3 install pyrogram +``` + +### Resources + +- The Docs contain lots of resources to help you getting started with Pyrogram: https://docs.pyrogram.org. +- Reading [Examples in this repository](https://github.com/pyrogram/pyrogram/tree/master/examples) is also a good way + for learning how Pyrogram works. +- Seeking extra help? Don't be shy, come join and ask our [Community](https://t.me/PyrogramChat)! +- For other requests you can send an [Email](mailto:dan@pyrogram.org) or a [Message](https://t.me/haskell). + +### Contributing + +Pyrogram is brand new, and **you are welcome to try it and help make it even better** by either submitting pull +requests or reporting issues/bugs as well as suggesting best practices, ideas, enhancements on both code +and documentation. Any help is appreciated! + +### Copyright & License + +- Copyright (C) 2017-2019 Dan Tès <> +- Licensed under the terms of the [GNU Lesser General Public License v3 or later (LGPLv3+)](COPYING.lesser) diff --git a/README.rst b/README.rst deleted file mode 100644 index dfb03abc..00000000 --- a/README.rst +++ /dev/null @@ -1,131 +0,0 @@ -|header| - -Pyrogram -======== - -.. code-block:: python - - from pyrogram import Client, Filters - - app = Client("my_account") - - - @app.on_message(Filters.private) - def hello(client, message): - message.reply("Hello {}".format(message.from_user.first_name)) - - - app.run() - -**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and C. -It enables you to easily create custom apps using both user and bot identities (bot API alternative) via the `MTProto API`_. - - `Pyrogram in fully-asynchronous mode is also available » `_ - - `Working PoC of Telegram voice calls using Pyrogram » `_ - -Features --------- - -- **Easy**: You can install Pyrogram with pip and start building your applications right away. -- **Elegant**: Low-level details are abstracted and re-presented in a much nicer and easier way. -- **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. -- **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted. -- **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. -- **Comprehensive**: Execute any advanced action an official client is able to do, and even more. - -Requirements ------------- - -- Python 3.4 or higher. -- A `Telegram API key`_. - -Installing ----------- - -.. code:: shell - - pip3 install pyrogram - -Resources ---------- - -- The Docs contain lots of resources to help you getting started with Pyrogram: https://docs.pyrogram.ml. -- Reading `Examples in this repository`_ is also a good way for learning how Pyrogram works. -- Seeking extra help? Don't be shy, come join and ask our Community_! -- For other requests you can send an Email_ or a Message_. - -Contributing ------------- - -Pyrogram is brand new, and **you are welcome to try it and help make it even better** by either submitting pull -requests or reporting issues/bugs as well as suggesting best practices, ideas, enhancements on both code -and documentation. Any help is appreciated! - -Copyright & License -------------------- - -- Copyright (C) 2017-2019 Dan Tès -- Licensed under the terms of the `GNU Lesser General Public License v3 or later (LGPLv3+)`_ - -.. _`Telegram`: https://telegram.org/ -.. _`MTProto API`: https://core.telegram.org/api#telegram-api -.. _`Telegram API key`: https://docs.pyrogram.ml/start/ProjectSetup#api-keys -.. _`Community`: https://t.me/PyrogramChat -.. _`Examples in this repository`: https://github.com/pyrogram/pyrogram/tree/master/examples -.. _`GitHub`: https://github.com/pyrogram/pyrogram/issues -.. _`Email`: admin@pyrogram.ml -.. _`Message`: https://t.me/haskell -.. _TgCrypto: https://github.com/pyrogram/tgcrypto -.. _`MTProto 2.0`: https://core.telegram.org/mtproto -.. _`GNU Lesser General Public License v3 or later (LGPLv3+)`: COPYING.lesser - -.. |header| raw:: html - -

- -
Pyrogram Logo
-
-

- -

- Telegram MTProto API Framework for Python - -
- - Documentation - - • - - Changelog - - • - - Community - -
- - Schema Layer - - - TgCrypto Version - -

- -.. |logo| image:: https://raw.githubusercontent.com/pyrogram/logos/master/logos/pyrogram_logo2.png - :target: https://pyrogram.ml - :alt: Pyrogram - -.. |description| replace:: **Telegram MTProto API Framework for Python** - -.. |schema| image:: https://img.shields.io/badge/schema-layer%2097-eda738.svg?longCache=true&colorA=262b30 - :target: compiler/api/source/main_api.tl - :alt: Schema Layer - -.. |tgcrypto| image:: https://img.shields.io/badge/tgcrypto-v1.1.1-eda738.svg?longCache=true&colorA=262b30 - :target: https://github.com/pyrogram/tgcrypto - :alt: TgCrypto Version diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index 6be16ba5..3995fd5f 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -53,10 +53,10 @@ def get_docstring_arg_type(t: str, is_list: bool = False, is_pyrogram_type: bool return "``{}``".format(t.lower()) elif t == "true": return "``bool``" - elif t == "Object" or t == "X": - return "Any object from :obj:`pyrogram.api.types`" + elif t == "TLObject" or t == "X": + return "Any object from :obj:`~pyrogram.api.types`" elif t == "!X": - return "Any method from :obj:`pyrogram.api.functions`" + return "Any method from :obj:`~pyrogram.api.functions`" elif t.startswith("Vector"): return "List of " + get_docstring_arg_type(t.split("<", 1)[1][:-1], True, is_pyrogram_type) else: @@ -288,9 +288,9 @@ def start(): sorted_args = sort_args(c.args) arguments = ( - ", " - + ("*, " if c.args else "") - + (", ".join([get_argument_type(i) for i in sorted_args if i != ("flags", "#")]) if c.args else "") + ", " + + ("*, " if c.args else "") + + (", ".join([get_argument_type(i) for i in sorted_args if i != ("flags", "#")]) if c.args else "") ) fields = "\n ".join( @@ -328,15 +328,16 @@ def start(): ) if docstring_args: - docstring_args = "Args:\n " + "\n ".join(docstring_args) + docstring_args = "Parameters:\n " + "\n ".join(docstring_args) else: docstring_args = "No parameters required." docstring_args = "Attributes:\n ID: ``{}``\n\n ".format(c.id) + docstring_args + docstring_args = "Attributes:\n LAYER: ``{}``\n\n ".format(layer) + docstring_args if c.section == "functions": - docstring_args += "\n\n Raises:\n :obj:`RPCError `" docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type) + else: references = get_references(".".join(filter(None, [c.namespace, c.name]))) @@ -393,7 +394,7 @@ def start(): ) read_types += "\n " - read_types += "{} = Object.read(b{}) if flags & (1 << {}) else []\n ".format( + read_types += "{} = TLObject.read(b{}) if flags & (1 << {}) else []\n ".format( arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else "", index ) else: @@ -402,7 +403,7 @@ def start(): write_types += "b.write(self.{}.write())\n ".format(arg_name) read_types += "\n " - read_types += "{} = Object.read(b) if flags & (1 << {}) else None\n ".format( + read_types += "{} = TLObject.read(b) if flags & (1 << {}) else None\n ".format( arg_name, index ) else: @@ -421,7 +422,7 @@ def start(): ) read_types += "\n " - read_types += "{} = Object.read(b{})\n ".format( + read_types += "{} = TLObject.read(b{})\n ".format( arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else "" ) else: @@ -429,7 +430,7 @@ def start(): write_types += "b.write(self.{}.write())\n ".format(arg_name) read_types += "\n " - read_types += "{} = Object.read(b)\n ".format(arg_name) + read_types += "{} = TLObject.read(b)\n ".format(arg_name) if c.docs: description = c.docs.split("|")[0].split("§")[1] @@ -462,7 +463,7 @@ def start(): ["{0}={0}".format(i[0]) for i in sorted_args if i != ("flags", "#")] ), slots=", ".join(['"{}"'.format(i[0]) for i in sorted_args if i != ("flags", "#")]), - qualname="{}{}".format("{}.".format(c.namespace) if c.namespace else "", c.name) + qualname="{}.{}{}".format(c.section, "{}.".format(c.namespace) if c.namespace else "", c.name) ) ) diff --git a/compiler/api/source/main_api.tl b/compiler/api/source/main_api.tl index 581427b5..16a93420 100644 --- a/compiler/api/source/main_api.tl +++ b/compiler/api/source/main_api.tl @@ -22,10 +22,13 @@ inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; +inputPeerUserFromMessage#17bae2e6 peer:InputPeer msg_id:int user_id:int = InputPeer; +inputPeerChannelFromMessage#9c95f7bb peer:InputPeer msg_id:int channel_id:int = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; inputUser#d8292816 user_id:int access_hash:long = InputUser; +inputUserFromMessage#2d117597 peer:InputPeer msg_id:int user_id:int = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; @@ -60,9 +63,12 @@ inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto; inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; -inputDocumentFileLocation#196683d9 id:long access_hash:long file_reference:bytes = InputFileLocation; +inputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation; inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation; inputTakeoutFileLocation#29be5899 = InputFileLocation; +inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation; +inputPeerPhotoFileLocation#27d69997 flags:# big:flags.0?true peer:InputPeer volume_id:long local_id:int = InputFileLocation; +inputStickerSetThumb#dbaeae9 stickerset:InputStickerSet volume_id:long local_id:int = InputFileLocation; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; @@ -79,14 +85,11 @@ storage.fileMov#4b09ebbc = storage.FileType; storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; -fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation; -fileLocation#91d11eb dc_id:int volume_id:long local_id:int secret:long file_reference:bytes = FileLocation; - userEmpty#200250ba id:int = User; -user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; +user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; -userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; +userProfilePhoto#ecd75d8c photo_id:long photo_small:FileLocation photo_big:FileLocation dc_id:int = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; @@ -98,11 +101,11 @@ userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat; chatForbidden#7328bdb id:int title:string = Chat; -channel#4df30834 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat; +channel#4df30834 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; -chatFull#22a235da flags:# can_set_username:flags.7?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int = ChatFull; -channelFull#1c87a71a flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull; +chatFull#1b7c9db3 flags:# can_set_username:flags.7?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int = ChatFull; +channelFull#9882e516 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.13?int pts:int = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; @@ -112,11 +115,11 @@ chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0? chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; -chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; +chatPhoto#475cdbd5 photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto; messageEmpty#83e5de54 id:int = Message; -message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; -messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; +message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message; +messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; @@ -147,7 +150,7 @@ messageActionHistoryClear#9fbab604 = MessageAction; messageActionGameScore#92a72876 game_id:long score:int = MessageAction; messageActionPaymentSentMe#8f31b327 flags:# currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; messageActionPaymentSent#40699cd0 currency:string total_amount:long = MessageAction; -messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; +messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; messageActionBotAllowed#abe9affe domain:string = MessageAction; @@ -155,10 +158,11 @@ messageActionSecureValuesSentMe#1b287353 values:Vector credentials: messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction; messageActionContactSignUp#f3f25f76 = MessageAction; -dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; +dialog#2c171f72 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog; +dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; photoEmpty#2331b22d id:long = Photo; -photo#9c477dd8 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector = Photo; +photo#d07504a5 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector dc_id:int = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; @@ -196,7 +200,7 @@ inputReportReasonChildAbuse#adf44ee3 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; inputReportReasonCopyright#9b89f93a = ReportReason; -userFull#8ea4a881 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int = UserFull; +userFull#745559cc flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; @@ -221,7 +225,7 @@ messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector< messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; -messages.messagesSlice#a6c47aaa flags:# inexact:flags.1?true count:int messages:Vector chats:Vector users:Vector = messages.Messages; +messages.messagesSlice#c8edce1e flags:# inexact:flags.1?true count:int next_rate:flags.0?int messages:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#99262e37 flags:# inexact:flags.1?true pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; @@ -271,14 +275,14 @@ updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#12b9417b user_id:int phone:string = Update; -updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; +updateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; updateChannelTooLong#eb0467fb flags:# channel_id:int pts:flags.0?int = Update; updateChannel#b6d45656 channel_id:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; -updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update; +updateReadChannelInbox#330b5424 flags:# folder_id:flags.0?int channel_id:int max_id:int still_unread_count:int pts:int = Update; updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector pts:int pts_count:int = Update; updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update; updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; @@ -300,8 +304,8 @@ updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; -updateDialogPinned#19d27f3c flags:# pinned:flags.0?true peer:DialogPeer = Update; -updatePinnedDialogs#ea4cb65b flags:# order:flags.0?Vector = Update; +updateDialogPinned#6e6fe51c flags:# pinned:flags.0?true folder_id:flags.1?int peer:DialogPeer = Update; +updatePinnedDialogs#fa0f3ca2 flags:# folder_id:flags.1?int order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; @@ -318,6 +322,7 @@ updateUserPinnedMessage#4c43da18 user_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; updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update; +updateFolderPeers#19360dc0 folder_peers:Vector pts:int pts_count:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -344,7 +349,7 @@ upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; -config#e6ca25f6 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config; +config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; @@ -413,6 +418,7 @@ inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey; inputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey; inputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey; +inputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; @@ -420,6 +426,7 @@ privacyKeyPhoneCall#3d662b7b = PrivacyKey; privacyKeyPhoneP2P#39491cc8 = PrivacyKey; privacyKeyForwards#69ec56a3 = PrivacyKey; privacyKeyProfilePhoto#96151fed = PrivacyKey; +privacyKeyPhoneNumber#d19ae46d = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; @@ -427,6 +434,8 @@ inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; +inputPrivacyValueAllowChatParticipants#4c81c1ba chats:Vector = InputPrivacyRule; +inputPrivacyValueDisallowChatParticipants#d82363af chats:Vector = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; @@ -434,8 +443,10 @@ privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; +privacyValueAllowChatParticipants#18be796b chats:Vector = PrivacyRule; +privacyValueDisallowChatParticipants#acae0690 chats:Vector = PrivacyRule; -account.privacyRules#554abb6f rules:Vector users:Vector = account.PrivacyRules; +account.privacyRules#50a04e45 rules:Vector chats:Vector users:Vector = account.PrivacyRules; accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; @@ -459,7 +470,6 @@ messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMess contactLinkUnknown#5f4f9247 = ContactLink; contactLinkNone#feedd3ad = ContactLink; -contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; @@ -485,13 +495,13 @@ chatInviteEmpty#69df3769 = ExportedChatInvite; chatInviteExported#fc2e05bc link:string = ExportedChatInvite; chatInviteAlready#5a686d7c chat:Chat = ChatInvite; -chatInvite#db74f558 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:ChatPhoto participants_count:int participants:flags.4?Vector = ChatInvite; +chatInvite#dfc2f58e flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true title:string photo:Photo participants_count:int participants:flags.4?Vector = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; -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; +stickerSet#eeb46f27 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 thumb_dc_id:flags.4?int count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; @@ -507,6 +517,8 @@ keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; +keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; +inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -533,13 +545,14 @@ messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; +inputChannelFromMessage#2a286531 peer:InputPeer msg_id:int channel_id:int = InputChannel; contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector users:Vector = contacts.ResolvedPeer; messageRange#ae30253 min_id:int max_id:int = MessageRange; updates.channelDifferenceEmpty#3e11affb flags:# final:flags.0?true pts:int timeout:flags.1?int = updates.ChannelDifference; -updates.channelDifferenceTooLong#6a9d7b35 flags:# final:flags.0?true pts:int timeout:flags.1?int top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; +updates.channelDifferenceTooLong#a4bcc6fe flags:# final:flags.0?true timeout:flags.1?int dialog:Dialog messages:Vector chats:Vector users:Vector = updates.ChannelDifference; updates.channelDifference#2064674e flags:# final:flags.0?true pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; @@ -628,6 +641,8 @@ topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; +topPeerCategoryForwardUsers#a8406ca9 = TopPeerCategory; +topPeerCategoryForwardChats#fbeec0f0 = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; @@ -767,11 +782,11 @@ inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_co inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; phoneCallEmpty#5366c915 id:long = PhoneCall; -phoneCallWaiting#1b8f4ad1 flags:# id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; -phoneCallRequested#83761ce4 id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; -phoneCallAccepted#6d003d3f id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; -phoneCall#e6f9ddf3 flags:# p2p_allowed:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connection:PhoneConnection alternative_connections:Vector start_date:int = PhoneCall; -phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; +phoneCallWaiting#1b8f4ad1 flags:# video:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; +phoneCallRequested#87eabb53 flags:# video:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; +phoneCallAccepted#997c454a flags:# video:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_b:bytes protocol:PhoneCallProtocol = PhoneCall; +phoneCall#8742ae7f flags:# p2p_allowed:flags.5?true id:long access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector start_date:int = PhoneCall; +phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.5?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall; phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; @@ -797,7 +812,7 @@ langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:fl channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction; channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction; -channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction; +channelAdminLogEventActionChangePhoto#434bd2af prev_photo:Photo new_photo:Photo = ChannelAdminLogEventAction; channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionToggleSignatures#26ae0971 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionUpdatePinned#e9e82c18 message:Message = ChannelAdminLogEventAction; @@ -812,6 +827,7 @@ channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputSticker channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction; channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeLinkedChat#a26f881b prev_value:int new_value:int = ChannelAdminLogEventAction; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; @@ -843,8 +859,10 @@ inputMessageReplyTo#bad88395 id:int = InputMessage; inputMessagePinned#86872538 = InputMessage; inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; +inputDialogPeerFolder#64600527 folder_id:int = InputDialogPeer; dialogPeer#e56dbf05 peer:Peer = DialogPeer; +dialogPeerFolder#514519e2 folder_id:int = DialogPeer; messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets; messages.foundStickerSets#5108d648 hash:int sets:Vector = messages.FoundStickerSets; @@ -1000,6 +1018,22 @@ emojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int k emojiURL#a575739d url:string = EmojiURL; +emojiLanguage#b3fb5361 lang_code:string = EmojiLanguage; + +fileLocationToBeDeprecated#bc7fc6cd volume_id:long local_id:int = FileLocation; + +folder#ff544e65 flags:# autofill_new_broadcasts:flags.0?true autofill_public_groups:flags.1?true autofill_new_correspondents:flags.2?true id:int title:string photo:flags.3?ChatPhoto = Folder; + +inputFolderPeer#fbd2c296 peer:InputPeer folder_id:int = InputFolderPeer; + +folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer; + +messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter; + +urlAuthResultRequest#92d33a0e flags:# request_write_access:flags.0?true bot:User domain:string = UrlAuthResult; +urlAuthResultAccepted#8f8c0e4e url:string = UrlAuthResult; +urlAuthResultDefault#a9d6db1f = UrlAuthResult; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1098,14 +1132,14 @@ contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.search#11f812d8 q:string limit:int = contacts.Found; contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer; -contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; +contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; contacts.getSaved#82f1e39f = Vector; contacts.toggleTopPeers#8514bdda enabled:Bool = Bool; messages.getMessages#63c66506 id:Vector = messages.Messages; -messages.getDialogs#b098aee6 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs; +messages.getDialogs#a0ee3b73 flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs; 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.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; @@ -1152,7 +1186,7 @@ messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_par messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#15a3b8e3 chat_id:int = Updates; -messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +messages.searchGlobal#f79c611 q:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector = Bool; messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document; messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; @@ -1185,8 +1219,8 @@ messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = message messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; -messages.reorderPinnedDialogs#5b51d63f flags:# force:flags.0?true order:Vector = Bool; -messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; +messages.reorderPinnedDialogs#3b1adf37 flags:# force:flags.0?true folder_id:int order:Vector = Bool; +messages.getPinnedDialogs#d6b94df2 folder_id:int = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; @@ -1212,7 +1246,11 @@ messages.editChatAbout#def60797 peer:InputPeer about:string = Bool; 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.getEmojiKeywordsLanguages#4e9963b2 lang_codes:Vector = Vector; messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL; +messages.getSearchCounters#732eef00 peer:InputPeer filters:Vector = Vector; +messages.requestUrlAuth#e33f5613 peer:InputPeer msg_id:int button_id:int = UrlAuthResult; +messages.acceptUrlAuth#f729ea98 flags:# write_allowed:flags.0?true peer:InputPeer msg_id:int button_id:int = UrlAuthResult; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -1281,6 +1319,9 @@ channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; +channels.getGroupsForDiscussion#f5dad378 = messages.Chats; +channels.getBroadcastsForDiscussion#1a87f304 = messages.Chats; +channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -1298,11 +1339,11 @@ stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = mes stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; phone.getCallConfig#55451fa9 = DataJSON; -phone.requestCall#5b95b3d4 user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; +phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes 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.discardCall#78d413a6 peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Updates; +phone.discardCall#b2cbc1c0 flags:# video:flags.0?true peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = 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; @@ -1312,4 +1353,10 @@ langpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:i langpack.getLanguages#42c6978f lang_pack:string = Vector; langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage; -// LAYER 97 +folders.editPeerFolders#6847d0ab folder_peers:Vector = Updates; +folders.deleteFolder#1c295881 folder_id:int = Updates; + +// LAYER 100 + +// Ports +channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; \ No newline at end of file diff --git a/compiler/api/template/mtproto.txt b/compiler/api/template/mtproto.txt index c63525d6..d7d3c7b7 100644 --- a/compiler/api/template/mtproto.txt +++ b/compiler/api/template/mtproto.txt @@ -5,7 +5,7 @@ from io import BytesIO from pyrogram.api.core import * -class {class_name}(Object): +class {class_name}(TLObject): """{docstring_args} """ diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index 6ea2240d..b167fa57 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -18,10 +18,11 @@ import ast import os +import re import shutil HOME = "compiler/docs" -DESTINATION = "docs/source" +DESTINATION = "docs/source/telegram" FUNCTIONS_PATH = "pyrogram/api/functions" TYPES_PATH = "pyrogram/api/types" @@ -29,8 +30,10 @@ TYPES_PATH = "pyrogram/api/types" FUNCTIONS_BASE = "functions" TYPES_BASE = "types" -shutil.rmtree(TYPES_BASE, ignore_errors=True) -shutil.rmtree(FUNCTIONS_BASE, ignore_errors=True) + +def snek(s: str): + s = re.sub(r"(.)([A-Z][a-z]+)", r"\1_\2", s) + return re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", s).lower() def generate(source_path, base): @@ -50,9 +53,11 @@ def generate(source_path, base): for node in ast.walk(p): if isinstance(node, ast.ClassDef): name = node.name + break + else: + continue - # name = "".join([str(j.title()) for j in os.path.splitext(i)[0].split("_")]) - full_path = os.path.basename(path) + "/" + name + ".rst" + full_path = os.path.basename(path) + "/" + snek(name).replace("_", "-") + ".rst" if level: full_path = base + "/" + full_path @@ -65,7 +70,7 @@ def generate(source_path, base): title=name, title_markup="=" * len(name), full_class_path="pyrogram.api.{}".format( - os.path.splitext(full_path)[0].replace("/", ".") + ".".join(full_path.split("/")[:-1]) + "." + name ) ) ) @@ -82,7 +87,7 @@ def generate(source_path, base): entities = [] for i in v: - entities.append(i) + entities.append(snek(i).replace("_", "-")) if k != base: inner_path = base + "/" + k + "/index" + ".rst" @@ -98,6 +103,7 @@ def generate(source_path, base): with open(DESTINATION + "/" + inner_path, "w", encoding="utf-8") as f: if k == base: f.write(":tocdepth: 1\n\n") + k = "Raw " + k f.write( toctree.format( @@ -115,6 +121,8 @@ def start(): global page_template global toctree + shutil.rmtree(DESTINATION, ignore_errors=True) + with open(HOME + "/template/page.txt", encoding="utf-8") as f: page_template = f.read() @@ -129,6 +137,6 @@ if "__main__" == __name__: FUNCTIONS_PATH = "../../pyrogram/api/functions" TYPES_PATH = "../../pyrogram/api/types" HOME = "." - DESTINATION = "../../docs/source" + DESTINATION = "../../docs/source/telegram" start() diff --git a/compiler/docs/template/page.txt b/compiler/docs/template/page.txt index 25a396fa..638a10cf 100644 --- a/compiler/docs/template/page.txt +++ b/compiler/docs/template/page.txt @@ -1,5 +1,5 @@ {title} {title_markup} -.. autoclass:: {full_class_path} +.. autoclass:: {full_class_path}() :members: diff --git a/compiler/error/source/400_BAD_REQUEST.tsv b/compiler/error/source/400_BAD_REQUEST.tsv index 8325040d..8e82c9f6 100644 --- a/compiler/error/source/400_BAD_REQUEST.tsv +++ b/compiler/error/source/400_BAD_REQUEST.tsv @@ -96,4 +96,13 @@ EXTERNAL_URL_INVALID The external media URL is invalid CHAT_NOT_MODIFIED The chat settings were not modified RESULTS_TOO_MUCH The result contains too many items RESULT_ID_DUPLICATE The result contains items with duplicated identifiers -ACCESS_TOKEN_INVALID The bot access token is invalid \ No newline at end of file +ACCESS_TOKEN_INVALID The bot access token is invalid +INVITE_HASH_EXPIRED The chat invite link is no longer valid +USER_BANNED_IN_CHANNEL You are limited, check @SpamBot for details +MESSAGE_EDIT_TIME_EXPIRED You can no longer edit this message +FOLDER_ID_INVALID The folder id is invalid +MEGAGROUP_PREHISTORY_HIDDEN The action failed because the supergroup has the pre-history hidden +CHAT_LINK_EXISTS The action failed because the supergroup is linked to a channel +LINK_NOT_MODIFIED The chat link was not modified because you tried to link to the same target +BROADCAST_ID_INVALID The channel is invalid +MEGAGROUP_ID_INVALID The supergroup is invalid \ No newline at end of file diff --git a/compiler/error/source/401_UNAUTHORIZED.tsv b/compiler/error/source/401_UNAUTHORIZED.tsv index 54b24dd7..e5cd3874 100644 --- a/compiler/error/source/401_UNAUTHORIZED.tsv +++ b/compiler/error/source/401_UNAUTHORIZED.tsv @@ -2,6 +2,7 @@ id message AUTH_KEY_UNREGISTERED The key is not registered in the system AUTH_KEY_INVALID The key is invalid USER_DEACTIVATED The user has been deleted/deactivated +USER_DEACTIVATED_BAN The user has been deleted/deactivated SESSION_REVOKED The authorization has been invalidated, because of the user terminating all sessions SESSION_EXPIRED The authorization has expired ACTIVE_USER_REQUIRED The method is only available to already activated users diff --git a/compiler/error/source/403_FORBIDDEN.tsv b/compiler/error/source/403_FORBIDDEN.tsv index 34433da7..dd1e98fa 100644 --- a/compiler/error/source/403_FORBIDDEN.tsv +++ b/compiler/error/source/403_FORBIDDEN.tsv @@ -2,4 +2,6 @@ id message CHAT_WRITE_FORBIDDEN You don't have rights to send messages in this chat RIGHT_FORBIDDEN One or more admin rights can't be applied to this kind of chat (channel/supergroup) CHAT_ADMIN_INVITE_REQUIRED You don't have rights to invite other users -MESSAGE_DELETE_FORBIDDEN You don't have rights to delete messages in this chat \ No newline at end of file +MESSAGE_DELETE_FORBIDDEN You don't have rights to delete messages in this chat +CHAT_SEND_MEDIA_FORBIDDEN You can't send media messages in this chat +MESSAGE_AUTHOR_REQUIRED You are not the author of this message \ No newline at end of file diff --git a/compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv b/compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv index d1c666c6..446fe908 100644 --- a/compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv +++ b/compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv @@ -5,4 +5,8 @@ RPC_MCGET_FAIL Telegram is having internal problems. Please try again later PERSISTENT_TIMESTAMP_OUTDATED Telegram is having internal problems. Please try again later HISTORY_GET_FAILED Telegram is having internal problems. Please try again later REG_ID_GENERATE_FAILED Telegram is having internal problems. Please try again later -RANDOM_ID_DUPLICATE Telegram is having internal problems. Please try again later \ No newline at end of file +RANDOM_ID_DUPLICATE Telegram is having internal problems. Please try again later +WORKER_BUSY_TOO_LONG_RETRY Telegram is having internal problems. Please try again later +INTERDC_X_CALL_ERROR Telegram is having internal problems at DC{x}. Please try again later +INTERDC_X_CALL_RICH_ERROR Telegram is having internal problems at DC{x}. Please try again later +FOLDER_DEAC_AUTOFIX_ALL Telegram is having internal problems. Please try again later \ No newline at end of file diff --git a/docs/releases.py b/docs/releases.py new file mode 100644 index 00000000..0c284f0b --- /dev/null +++ b/docs/releases.py @@ -0,0 +1,85 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-2019 Dan Tès +# +# 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 . + +import shutil +from datetime import datetime +from pathlib import Path + +import pypandoc +import requests + +URL = "https://api.github.com/repos/pyrogram/pyrogram/releases" +DEST = Path("source/releases") +INTRO = """ +Release Notes +============= + +Release notes for Pyrogram releases will describe what's new in each version, and will also make you aware of any +backwards-incompatible changes made in that version. + +When upgrading to a new version of Pyrogram, you will need to check all the breaking changes in order to find +incompatible code in your application, but also to take advantage of new features and improvements. + +Releases +-------- + +""".lstrip("\n") + +shutil.rmtree(DEST, ignore_errors=True) +DEST.mkdir(parents=True) + +releases = requests.get(URL).json() + +with open(DEST / "index.rst", "w") as index: + index.write(INTRO) + + tags = [] + + for release in releases: + tag = release["tag_name"] + title = release["name"] + name = title.split(" - ")[1] + + date = datetime.strptime( + release["published_at"], + "%Y-%m-%dT%H:%M:%SZ" + ).strftime("%b %d, %Y") + + body = pypandoc.convert_text( + release["body"].replace(r"\r\n", "\n"), + "rst", + format="markdown_github", + extra_args=["--wrap=none"] + ) + + tarball_url = release["tarball_url"] + zipball_url = release["zipball_url"] + + index.write("- :doc:`{} <{}>`\n".format(title, tag)) + tags.append(tag) + + with open(DEST / "{}.rst".format(tag), "w") as page: + page.write("Pyrogram " + tag + "\n" + "=" * (len(tag) + 9) + "\n\n") + page.write("\t\tReleased on " + str(date) + "\n\n") + page.write("- :download:`Source Code (zip) <{}>`\n".format(zipball_url)) + page.write("- :download:`Source Code (tar.gz) <{}>`\n\n".format(tarball_url)) + page.write(name + "\n" + "-" * len(name) + "\n\n") + page.write(body + "\n\n") + + index.write("\n.. toctree::\n :hidden:\n\n") + index.write("\n".join(" {}".format(tag) for tag in tags)) diff --git a/docs/robots.txt b/docs/robots.txt new file mode 100644 index 00000000..1b9e8da6 --- /dev/null +++ b/docs/robots.txt @@ -0,0 +1,8 @@ +User-agent: * + +Allow: / + +Disallow: /dev/* +Disallow: /old/* + +Sitemap: https://docs.pyrogram.org/sitemap.xml \ No newline at end of file diff --git a/docs/source/sitemap.py b/docs/sitemap.py similarity index 63% rename from docs/source/sitemap.py rename to docs/sitemap.py index 539bac0d..d4abeb32 100644 --- a/docs/source/sitemap.py +++ b/docs/sitemap.py @@ -18,17 +18,17 @@ import datetime import os -import re -canonical = "https://docs.pyrogram.ml" +canonical = "https://docs.pyrogram.org/" dirs = { + ".": ("weekly", 1.0), + "intro": ("weekly", 0.9), "start": ("weekly", 0.9), - "resources": ("weekly", 0.8), - "pyrogram": ("weekly", 0.8), - "functions": ("monthly", 0.7), - "types": ("monthly", 0.7), - "errors": ("weekly", 0.6) + "api": ("weekly", 0.8), + "topics": ("weekly", 0.8), + "releases": ("weekly", 0.8), + "telegram": ("weekly", 0.6) } @@ -37,10 +37,10 @@ def now(): with open("sitemap.xml", "w") as f: - f.write("\n") - f.write("\n") + f.write('\n') + f.write('\n') - urls = [(canonical, now(), "weekly", 1.0)] + urls = [] def search(path): @@ -48,14 +48,27 @@ with open("sitemap.xml", "w") as f: for j in os.listdir(path): search("{}/{}".format(path, j)) except NotADirectoryError: - d = path.split("/")[0] - path = "{}/{}".format(canonical, path.split(".")[0]) - path = re.sub("^(.+)/index$", "\g<1>", path) - urls.append((path, now(), dirs[d][0], dirs[d][1])) + if not path.endswith(".rst"): + return + + path = path.split("/")[1:] + + if path[0].endswith(".rst"): + folder = "." + else: + folder = path[0] + + path = "{}{}".format(canonical, "/".join(path))[:-len(".rst")] + + if path.endswith("index"): + path = path[:-len("index")] + + urls.append((path, now(), *dirs[folder])) - for i in dirs.keys(): - search(i) + search("source") + + urls.sort(key=lambda x: x[3], reverse=True) for i in urls: f.write(" \n") diff --git a/docs/source/_images/logo.png b/docs/source/_images/logo.png deleted file mode 100644 index 1f06fa81..00000000 Binary files a/docs/source/_images/logo.png and /dev/null differ diff --git a/docs/source/_images/pyrogram.png b/docs/source/_images/pyrogram.png new file mode 100644 index 00000000..caadf983 Binary files /dev/null and b/docs/source/_images/pyrogram.png differ diff --git a/docs/source/api/bound-methods.rst b/docs/source/api/bound-methods.rst new file mode 100644 index 00000000..e6729da6 --- /dev/null +++ b/docs/source/api/bound-methods.rst @@ -0,0 +1,150 @@ +Bound Methods +============= + +Some Pyrogram types define what are called bound methods. Bound methods are functions attached to a class which are +accessed via an instance of that class. They make it even easier to call specific methods by automatically inferring +some of the required arguments. + +.. code-block:: python + :emphasize-lines: 8 + + from pyrogram import Client + + app = Client("my_account") + + + @app.on_message() + def hello(client, message) + message.reply("hi") + + + app.run() + +.. currentmodule:: pyrogram + +Index +----- + +Message +^^^^^^^ + +.. hlist:: + :columns: 3 + + - :meth:`~Message.click` + - :meth:`~Message.delete` + - :meth:`~Message.download` + - :meth:`~Message.forward` + - :meth:`~Message.pin` + - :meth:`~Message.edit_text` + - :meth:`~Message.edit_caption` + - :meth:`~Message.edit_media` + - :meth:`~Message.edit_reply_markup` + - :meth:`~Message.reply_text` + - :meth:`~Message.reply_animation` + - :meth:`~Message.reply_audio` + - :meth:`~Message.reply_cached_media` + - :meth:`~Message.reply_chat_action` + - :meth:`~Message.reply_contact` + - :meth:`~Message.reply_document` + - :meth:`~Message.reply_game` + - :meth:`~Message.reply_inline_bot_result` + - :meth:`~Message.reply_location` + - :meth:`~Message.reply_media_group` + - :meth:`~Message.reply_photo` + - :meth:`~Message.reply_poll` + - :meth:`~Message.reply_sticker` + - :meth:`~Message.reply_venue` + - :meth:`~Message.reply_video` + - :meth:`~Message.reply_video_note` + - :meth:`~Message.reply_voice` + +Chat +^^^^ + +.. hlist:: + :columns: 2 + + - :meth:`~Chat.archive` + - :meth:`~Chat.unarchive` + +User +^^^^ + +.. hlist:: + :columns: 2 + + - :meth:`~User.archive` + - :meth:`~User.unarchive` + +CallbackQuery +^^^^^^^^^^^^^ + +.. hlist:: + :columns: 4 + + - :meth:`~CallbackQuery.answer` + - :meth:`~CallbackQuery.edit_text` + - :meth:`~CallbackQuery.edit_caption` + - :meth:`~CallbackQuery.edit_media` + - :meth:`~CallbackQuery.edit_reply_markup` + +InlineQuery +^^^^^^^^^^^ + +.. hlist:: + :columns: 2 + + - :meth:`~InlineQuery.answer` + +----- + +Details +------- + +.. Message +.. automethod:: Message.click() +.. automethod:: Message.delete() +.. automethod:: Message.download() +.. automethod:: Message.forward() +.. automethod:: Message.pin() +.. automethod:: Message.edit_text() +.. automethod:: Message.edit_caption() +.. automethod:: Message.edit_media() +.. automethod:: Message.edit_reply_markup() +.. automethod:: Message.reply_text() +.. automethod:: Message.reply_animation() +.. automethod:: Message.reply_audio() +.. automethod:: Message.reply_cached_media() +.. automethod:: Message.reply_chat_action() +.. automethod:: Message.reply_contact() +.. automethod:: Message.reply_document() +.. automethod:: Message.reply_game() +.. automethod:: Message.reply_inline_bot_result() +.. automethod:: Message.reply_location() +.. automethod:: Message.reply_media_group() +.. automethod:: Message.reply_photo() +.. automethod:: Message.reply_poll() +.. automethod:: Message.reply_sticker() +.. automethod:: Message.reply_venue() +.. automethod:: Message.reply_video() +.. automethod:: Message.reply_video_note() +.. automethod:: Message.reply_voice() + +.. Chat +.. automethod:: Chat.archive() +.. automethod:: Chat.unarchive() + +.. User +.. automethod:: User.archive() +.. automethod:: User.unarchive() + +.. CallbackQuery +.. automethod:: CallbackQuery.answer() +.. automethod:: CallbackQuery.edit_text() +.. automethod:: CallbackQuery.edit_caption() +.. automethod:: CallbackQuery.edit_media() +.. automethod:: CallbackQuery.edit_reply_markup() + +.. InlineQuery +.. automethod:: InlineQuery.answer() diff --git a/docs/source/api/client.rst b/docs/source/api/client.rst new file mode 100644 index 00000000..d1b8c4b0 --- /dev/null +++ b/docs/source/api/client.rst @@ -0,0 +1,19 @@ +Pyrogram Client +=============== + +This is the Client class. It exposes high-level methods for an easy access to the API. + +.. code-block:: python + :emphasize-lines: 1-3 + + from pyrogram import Client + + app = Client("my_account") + + with app: + app.send_message("me", "Hi!") + +Details +------- + +.. autoclass:: pyrogram.Client() diff --git a/docs/source/api/decorators.rst b/docs/source/api/decorators.rst new file mode 100644 index 00000000..ff31cb27 --- /dev/null +++ b/docs/source/api/decorators.rst @@ -0,0 +1,57 @@ +Decorators +========== + +While still being methods bound to the :class:`~pyrogram.Client` class, decorators are of a special kind and thus +deserve a dedicated page. + +Decorators are able to register callback functions for handling updates in a much easier and cleaner way compared to +:doc:`Handlers `; they do so by instantiating the correct handler and calling +:meth:`~pyrogram.Client.add_handler`, automatically. All you need to do is adding the decorators on top of your +functions. + +.. code-block:: python + :emphasize-lines: 6 + + from pyrogram import Client + + app = Client("my_account") + + + @app.on_message() + def log(client, message): + print(message) + + + app.run() + +.. currentmodule:: pyrogram + +Index +----- + +.. hlist:: + :columns: 3 + + - :meth:`~Client.on_message` + - :meth:`~Client.on_callback_query` + - :meth:`~Client.on_inline_query` + - :meth:`~Client.on_deleted_messages` + - :meth:`~Client.on_user_status` + - :meth:`~Client.on_poll` + - :meth:`~Client.on_disconnect` + - :meth:`~Client.on_raw_update` + +----- + +Details +------- + +.. Decorators +.. autodecorator:: pyrogram.Client.on_message() +.. autodecorator:: pyrogram.Client.on_callback_query() +.. autodecorator:: pyrogram.Client.on_inline_query() +.. autodecorator:: pyrogram.Client.on_deleted_messages() +.. autodecorator:: pyrogram.Client.on_user_status() +.. autodecorator:: pyrogram.Client.on_poll() +.. autodecorator:: pyrogram.Client.on_disconnect() +.. autodecorator:: pyrogram.Client.on_raw_update() \ No newline at end of file diff --git a/docs/source/api/errors.rst b/docs/source/api/errors.rst new file mode 100644 index 00000000..fad571e3 --- /dev/null +++ b/docs/source/api/errors.rst @@ -0,0 +1,72 @@ +RPC Errors +========== + +All Pyrogram API errors live inside the ``errors`` sub-package: ``pyrogram.errors``. +The errors ids listed here are shown as *UPPER_SNAKE_CASE*, but the actual exception names to import from Pyrogram +follow the usual *PascalCase* convention. + +.. code-block:: python + :emphasize-lines: 1, 5 + + from pyrogram.errors import FloodWait + + try: + ... + except FloodWait as e: + ... + +303 - SeeOther +-------------- + +.. csv-table:: + :file: ../../../compiler/error/source/303_SEE_OTHER.tsv + :delim: tab + :header-rows: 1 + +400 - BadRequest +---------------- + +.. csv-table:: + :file: ../../../compiler/error/source/400_BAD_REQUEST.tsv + :delim: tab + :header-rows: 1 + +401 - Unauthorized +------------------ + +.. csv-table:: + :file: ../../../compiler/error/source/401_UNAUTHORIZED.tsv + :delim: tab + :header-rows: 1 + +403 - Forbidden +--------------- + +.. csv-table:: + :file: ../../../compiler/error/source/403_FORBIDDEN.tsv + :delim: tab + :header-rows: 1 + +406 - NotAcceptable +------------------- + +.. csv-table:: + :file: ../../../compiler/error/source/406_NOT_ACCEPTABLE.tsv + :delim: tab + :header-rows: 1 + +420 - Flood +----------- + +.. csv-table:: + :file: ../../../compiler/error/source/420_FLOOD.tsv + :delim: tab + :header-rows: 1 + +500 - InternalServerError +------------------------- + +.. csv-table:: + :file: ../../../compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv + :delim: tab + :header-rows: 1 diff --git a/docs/source/pyrogram/Filters.rst b/docs/source/api/filters.rst similarity index 50% rename from docs/source/pyrogram/Filters.rst rename to docs/source/api/filters.rst index 091031ae..6cb01cda 100644 --- a/docs/source/pyrogram/Filters.rst +++ b/docs/source/api/filters.rst @@ -1,5 +1,8 @@ -Filters -======= +Update Filters +============== + +Details +------- .. autoclass:: pyrogram.Filters :members: diff --git a/docs/source/api/handlers.rst b/docs/source/api/handlers.rst new file mode 100644 index 00000000..f91dd3d5 --- /dev/null +++ b/docs/source/api/handlers.rst @@ -0,0 +1,56 @@ +Update Handlers +=============== + +Handlers are used to instruct Pyrogram about which kind of updates you'd like to handle with your callback functions. + +For a much more convenient way of registering callback functions have a look at :doc:`Decorators ` instead. +In case you decided to manually create a handler, use :class:`~pyrogram.Client.add_handler` to register +it. + +.. code-block:: python + :emphasize-lines: 1, 10 + + from pyrogram import Client, MessageHandler + + app = Client("my_account") + + + def dump(client, message): + print(message) + + + app.add_handler(MessageHandler(dump)) + + app.run() + +.. currentmodule:: pyrogram + +Index +----- + +.. hlist:: + :columns: 3 + + - :class:`MessageHandler` + - :class:`DeletedMessagesHandler` + - :class:`CallbackQueryHandler` + - :class:`InlineQueryHandler` + - :class:`UserStatusHandler` + - :class:`PollHandler` + - :class:`DisconnectHandler` + - :class:`RawUpdateHandler` + +----- + +Details +------- + +.. Handlers +.. autoclass:: MessageHandler() +.. autoclass:: DeletedMessagesHandler() +.. autoclass:: CallbackQueryHandler() +.. autoclass:: InlineQueryHandler() +.. autoclass:: UserStatusHandler() +.. autoclass:: PollHandler() +.. autoclass:: DisconnectHandler() +.. autoclass:: RawUpdateHandler() diff --git a/docs/source/api/methods.rst b/docs/source/api/methods.rst new file mode 100644 index 00000000..4a3eefd8 --- /dev/null +++ b/docs/source/api/methods.rst @@ -0,0 +1,290 @@ +Available Methods +================= + +All Pyrogram methods listed here are bound to a :class:`~pyrogram.Client` instance. + +.. code-block:: python + :emphasize-lines: 6 + + from pyrogram import Client + + app = Client("my_account") + + with app: + app.send_message("haskell", "hi") + +.. currentmodule:: pyrogram + +Index +----- + +Utilities +^^^^^^^^^ + +.. hlist:: + :columns: 4 + + - :meth:`~Client.start` + - :meth:`~Client.stop` + - :meth:`~Client.restart` + - :meth:`~Client.idle` + - :meth:`~Client.run` + - :meth:`~Client.add_handler` + - :meth:`~Client.remove_handler` + - :meth:`~Client.stop_transmission` + +Messages +^^^^^^^^ + +.. hlist:: + :columns: 3 + + - :meth:`~Client.send_message` + - :meth:`~Client.forward_messages` + - :meth:`~Client.send_photo` + - :meth:`~Client.send_audio` + - :meth:`~Client.send_document` + - :meth:`~Client.send_sticker` + - :meth:`~Client.send_animated_sticker` + - :meth:`~Client.send_video` + - :meth:`~Client.send_animation` + - :meth:`~Client.send_voice` + - :meth:`~Client.send_video_note` + - :meth:`~Client.send_media_group` + - :meth:`~Client.send_location` + - :meth:`~Client.send_venue` + - :meth:`~Client.send_contact` + - :meth:`~Client.send_cached_media` + - :meth:`~Client.edit_message_text` + - :meth:`~Client.edit_message_caption` + - :meth:`~Client.edit_message_media` + - :meth:`~Client.edit_message_reply_markup` + - :meth:`~Client.edit_inline_text` + - :meth:`~Client.edit_inline_caption` + - :meth:`~Client.edit_inline_media` + - :meth:`~Client.edit_inline_reply_markup` + - :meth:`~Client.send_chat_action` + - :meth:`~Client.delete_messages` + - :meth:`~Client.get_messages` + - :meth:`~Client.get_history` + - :meth:`~Client.get_history_count` + - :meth:`~Client.read_history` + - :meth:`~Client.iter_history` + - :meth:`~Client.send_poll` + - :meth:`~Client.vote_poll` + - :meth:`~Client.stop_poll` + - :meth:`~Client.retract_vote` + - :meth:`~Client.download_media` + +Chats +^^^^^ + +.. hlist:: + :columns: 3 + + - :meth:`~Client.join_chat` + - :meth:`~Client.leave_chat` + - :meth:`~Client.kick_chat_member` + - :meth:`~Client.unban_chat_member` + - :meth:`~Client.restrict_chat_member` + - :meth:`~Client.promote_chat_member` + - :meth:`~Client.export_chat_invite_link` + - :meth:`~Client.set_chat_photo` + - :meth:`~Client.delete_chat_photo` + - :meth:`~Client.set_chat_title` + - :meth:`~Client.set_chat_description` + - :meth:`~Client.pin_chat_message` + - :meth:`~Client.unpin_chat_message` + - :meth:`~Client.get_chat` + - :meth:`~Client.get_chat_member` + - :meth:`~Client.get_chat_members` + - :meth:`~Client.get_chat_members_count` + - :meth:`~Client.iter_chat_members` + - :meth:`~Client.get_dialogs` + - :meth:`~Client.iter_dialogs` + - :meth:`~Client.get_dialogs_count` + - :meth:`~Client.restrict_chat` + - :meth:`~Client.update_chat_username` + - :meth:`~Client.archive_chats` + - :meth:`~Client.unarchive_chats` + +Users +^^^^^ + +.. hlist:: + :columns: 3 + + - :meth:`~Client.get_me` + - :meth:`~Client.get_users` + - :meth:`~Client.get_profile_photos` + - :meth:`~Client.get_profile_photos_count` + - :meth:`~Client.iter_profile_photos` + - :meth:`~Client.set_profile_photo` + - :meth:`~Client.delete_profile_photos` + - :meth:`~Client.update_username` + - :meth:`~Client.get_user_dc` + +Contacts +^^^^^^^^ + +.. hlist:: + :columns: 3 + + - :meth:`~Client.add_contacts` + - :meth:`~Client.get_contacts` + - :meth:`~Client.get_contacts_count` + - :meth:`~Client.delete_contacts` + +Password +^^^^^^^^ + +.. hlist:: + :columns: 3 + + - :meth:`~Client.enable_cloud_password` + - :meth:`~Client.change_cloud_password` + - :meth:`~Client.remove_cloud_password` + +Bots +^^^^ + +.. hlist:: + :columns: 3 + + - :meth:`~Client.get_inline_bot_results` + - :meth:`~Client.send_inline_bot_result` + - :meth:`~Client.answer_callback_query` + - :meth:`~Client.answer_inline_query` + - :meth:`~Client.request_callback_answer` + - :meth:`~Client.send_game` + - :meth:`~Client.set_game_score` + - :meth:`~Client.get_game_high_scores` + +Advanced Usage (Raw API) +^^^^^^^^^^^^^^^^^^^^^^^^ + +Learn more about these methods at :doc:`Advanced Usage <../topics/advanced-usage>`. + +.. hlist:: + :columns: 4 + + - :meth:`~Client.send` + - :meth:`~Client.resolve_peer` + - :meth:`~Client.save_file` + +----- + +Details +------- + +.. Utilities +.. automethod:: Client.start() +.. automethod:: Client.stop() +.. automethod:: Client.restart() +.. automethod:: Client.idle() +.. automethod:: Client.run() +.. automethod:: Client.add_handler() +.. automethod:: Client.remove_handler() +.. automethod:: Client.stop_transmission() + +.. Messages +.. automethod:: Client.send_message() +.. automethod:: Client.forward_messages() +.. automethod:: Client.send_photo() +.. automethod:: Client.send_audio() +.. automethod:: Client.send_document() +.. automethod:: Client.send_sticker() +.. automethod:: Client.send_animated_sticker() +.. automethod:: Client.send_video() +.. automethod:: Client.send_animation() +.. automethod:: Client.send_voice() +.. automethod:: Client.send_video_note() +.. automethod:: Client.send_media_group() +.. automethod:: Client.send_location() +.. automethod:: Client.send_venue() +.. automethod:: Client.send_contact() +.. automethod:: Client.send_cached_media() +.. automethod:: Client.send_chat_action() +.. automethod:: Client.edit_message_text() +.. automethod:: Client.edit_message_caption() +.. automethod:: Client.edit_message_media() +.. automethod:: Client.edit_message_reply_markup() +.. automethod:: Client.edit_inline_text() +.. automethod:: Client.edit_inline_caption() +.. automethod:: Client.edit_inline_media() +.. automethod:: Client.edit_inline_reply_markup() +.. automethod:: Client.delete_messages() +.. automethod:: Client.get_messages() +.. automethod:: Client.get_history() +.. automethod:: Client.get_history_count() +.. automethod:: Client.read_history() +.. automethod:: Client.iter_history() +.. automethod:: Client.send_poll() +.. automethod:: Client.vote_poll() +.. automethod:: Client.stop_poll() +.. automethod:: Client.retract_vote() +.. automethod:: Client.download_media() + +.. Chats +.. automethod:: Client.join_chat() +.. automethod:: Client.leave_chat() +.. automethod:: Client.kick_chat_member() +.. automethod:: Client.unban_chat_member() +.. automethod:: Client.restrict_chat_member() +.. automethod:: Client.promote_chat_member() +.. automethod:: Client.export_chat_invite_link() +.. automethod:: Client.set_chat_photo() +.. automethod:: Client.delete_chat_photo() +.. automethod:: Client.set_chat_title() +.. automethod:: Client.set_chat_description() +.. automethod:: Client.pin_chat_message() +.. automethod:: Client.unpin_chat_message() +.. automethod:: Client.get_chat() +.. automethod:: Client.get_chat_member() +.. automethod:: Client.get_chat_members() +.. automethod:: Client.get_chat_members_count() +.. automethod:: Client.iter_chat_members() +.. automethod:: Client.get_dialogs() +.. automethod:: Client.iter_dialogs() +.. automethod:: Client.get_dialogs_count() +.. automethod:: Client.restrict_chat() +.. automethod:: Client.update_chat_username() +.. automethod:: Client.archive_chats() +.. automethod:: Client.unarchive_chats() + +.. Users +.. automethod:: Client.get_me() +.. automethod:: Client.get_users() +.. automethod:: Client.get_profile_photos() +.. automethod:: Client.get_profile_photos_count() +.. automethod:: Client.iter_profile_photos() +.. automethod:: Client.set_profile_photo() +.. automethod:: Client.delete_profile_photos() +.. automethod:: Client.update_username() +.. automethod:: Client.get_user_dc() + +.. Contacts +.. automethod:: Client.add_contacts() +.. automethod:: Client.get_contacts() +.. automethod:: Client.get_contacts_count() +.. automethod:: Client.delete_contacts() + +.. Password +.. automethod:: Client.enable_cloud_password() +.. automethod:: Client.change_cloud_password() +.. automethod:: Client.remove_cloud_password() + +.. Bots +.. automethod:: Client.get_inline_bot_results() +.. automethod:: Client.send_inline_bot_result() +.. automethod:: Client.answer_callback_query() +.. automethod:: Client.answer_inline_query() +.. automethod:: Client.request_callback_answer() +.. automethod:: Client.send_game() +.. automethod:: Client.set_game_score() +.. automethod:: Client.get_game_high_scores() + +.. Advanced Usage +.. automethod:: Client.send() +.. automethod:: Client.resolve_peer() +.. automethod:: Client.save_file() \ No newline at end of file diff --git a/docs/source/api/types.rst b/docs/source/api/types.rst new file mode 100644 index 00000000..644f8bb2 --- /dev/null +++ b/docs/source/api/types.rst @@ -0,0 +1,170 @@ +Available Types +=============== + +All Pyrogram types listed here are accessible through the main package directly. + +.. code-block:: python + :emphasize-lines: 1 + + from pyrogram import User, Message, ... + +.. note:: + + **Optional** fields may not exist when irrelevant -- i.e.: they will contain the value of ``None`` and aren't shown + when, for example, using ``print()``. + +.. currentmodule:: pyrogram + +Index +----- + +Users & Chats +^^^^^^^^^^^^^ + +.. hlist:: + :columns: 5 + + - :class:`User` + - :class:`UserStatus` + - :class:`Chat` + - :class:`ChatPreview` + - :class:`ChatPhoto` + - :class:`ChatMember` + - :class:`ChatPermissions` + - :class:`Dialog` + +Messages & Media +^^^^^^^^^^^^^^^^ + +.. hlist:: + :columns: 5 + + - :class:`Message` + - :class:`MessageEntity` + - :class:`Photo` + - :class:`Thumbnail` + - :class:`Audio` + - :class:`Document` + - :class:`Animation` + - :class:`Video` + - :class:`Voice` + - :class:`VideoNote` + - :class:`Contact` + - :class:`Location` + - :class:`Venue` + - :class:`Sticker` + - :class:`Game` + - :class:`Poll` + - :class:`PollOption` + +Bots & Keyboards +^^^^^^^^^^^^^^^^ + +.. hlist:: + :columns: 4 + + - :class:`ReplyKeyboardMarkup` + - :class:`KeyboardButton` + - :class:`ReplyKeyboardRemove` + - :class:`InlineKeyboardMarkup` + - :class:`InlineKeyboardButton` + - :class:`ForceReply` + - :class:`CallbackQuery` + - :class:`GameHighScore` + - :class:`CallbackGame` + +Input Media +^^^^^^^^^^^ + +.. hlist:: + :columns: 4 + + - :class:`InputMedia` + - :class:`InputMediaPhoto` + - :class:`InputMediaVideo` + - :class:`InputMediaAudio` + - :class:`InputMediaAnimation` + - :class:`InputMediaDocument` + - :class:`InputPhoneContact` + +Inline Mode +^^^^^^^^^^^ + +.. hlist:: + :columns: 3 + + - :class:`InlineQuery` + - :class:`InlineQueryResult` + - :class:`InlineQueryResultArticle` + +InputMessageContent +^^^^^^^^^^^^^^^^^^^ + +.. hlist:: + :columns: 3 + + - :class:`InputMessageContent` + - :class:`InputTextMessageContent` + +----- + +Details +------- + +.. User & Chats +.. autoclass:: User() +.. autoclass:: UserStatus() +.. autoclass:: Chat() +.. autoclass:: ChatPreview() +.. autoclass:: ChatPhoto() +.. autoclass:: ChatMember() +.. autoclass:: ChatPermissions() +.. autoclass:: Dialog() + +.. Messages & Media +.. autoclass:: Message() +.. autoclass:: MessageEntity() +.. autoclass:: Photo() +.. autoclass:: Thumbnail() +.. autoclass:: Audio() +.. autoclass:: Document() +.. autoclass:: Animation() +.. autoclass:: Video() +.. autoclass:: Voice() +.. autoclass:: VideoNote() +.. autoclass:: Contact() +.. autoclass:: Location() +.. autoclass:: Venue() +.. autoclass:: Sticker() +.. autoclass:: Game() +.. autoclass:: Poll() +.. autoclass:: PollOption() + +.. Bots & Keyboards +.. autoclass:: ReplyKeyboardMarkup() +.. autoclass:: KeyboardButton() +.. autoclass:: ReplyKeyboardRemove() +.. autoclass:: InlineKeyboardMarkup() +.. autoclass:: InlineKeyboardButton() +.. autoclass:: ForceReply() +.. autoclass:: CallbackQuery() +.. autoclass:: GameHighScore() +.. autoclass:: CallbackGame() + +.. Input Media +.. autoclass:: InputMedia() +.. autoclass:: InputMediaPhoto() +.. autoclass:: InputMediaVideo() +.. autoclass:: InputMediaAudio() +.. autoclass:: InputMediaAnimation() +.. autoclass:: InputMediaDocument() +.. autoclass:: InputPhoneContact() + +.. Inline Mode +.. autoclass:: InlineQuery() +.. autoclass:: InlineQueryResult() +.. autoclass:: InlineQueryResultArticle() + +.. InputMessageContent +.. autoclass:: InputMessageContent() +.. autoclass:: InputTextMessageContent() diff --git a/docs/source/conf.py b/docs/source/conf.py index 8acfde42..01fbe6de 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,198 +1,68 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-2019 Dan Tès # -# Pyrogram documentation build configuration file, created by -# sphinx-quickstart on Fri Dec 29 11:35:55 2017. +# This file is part of Pyrogram. # -# This file is execfile()d with the current directory set to its -# containing dir. +# 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. # -# Note that not all possible configuration values are present in this -# autogenerated file. +# 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. # -# All configuration values have a default; values that are commented out -# serve to show the default. +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# import os import sys -sys.path.insert(0, os.path.abspath('../..')) +sys.path.insert(0, os.path.abspath("../..")) -# Import after sys.path.insert() to avoid issues from pyrogram import __version__ from pygments.styles.friendly import FriendlyStyle FriendlyStyle.background_color = "#f3f2f1" -# -- General configuration ------------------------------------------------ +project = "Pyrogram" +copyright = "2017-2019, Dan" +author = "Dan" -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.napoleon', - 'sphinx.ext.autosummary' + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.autosummary" ] -# Don't show source files on docs -html_show_sourcelink = True +master_doc = "index" +source_suffix = ".rst" +autodoc_member_order = "bysource" -# Order by source, not alphabetically -autodoc_member_order = 'bysource' - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = 'Pyrogram' -copyright = '2017-2019, Dan Tès' -author = 'Dan Tès' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = "version " + __version__ -# The full version, including alpha/beta/rc tags. +version = __version__ release = version -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None +templates_path = ["_templates"] -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [] +napoleon_use_rtype = False -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'friendly' - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False - -# -- Options for HTML output ---------------------------------------------- +pygments_style = "friendly" html_title = "Pyrogram Documentation" - -# Overridden by template +html_theme = "sphinx_rtd_theme" +html_static_path = ["_static"] +html_show_sourcelink = True html_show_copyright = False - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# html_theme_options = { - 'canonical_url': "https://docs.pyrogram.ml/", - 'collapse_navigation': False, - 'sticky_navigation': False, - 'logo_only': True, - 'display_version': True + "canonical_url": "https://docs.pyrogram.org/", + "collapse_navigation": True, + "sticky_navigation": True, + "logo_only": True, + "display_version": True, + "style_external_links": True } -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -html_logo = '_images/logo.png' - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -html_favicon = '_images/favicon.ico' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = ['_static'] - -# Custom sidebar templates, must be a dictionary that maps document names -# to template names. -# -# This is required for the alabaster theme -# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars -html_sidebars = { - '**': [ - 'relations.html', # needs 'show_related': True theme option to display - 'searchbox.html', - ] -} - -# -- Options for HTMLHelp output ------------------------------------------ - -# Output file base name for HTML help builder. -htmlhelp_basename = 'Pyrogramdoc' - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'Pyrogram.tex', 'Pyrogram Documentation', - 'Dan Tès', 'manual'), -] - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'pyrogram', 'Pyrogram Documentation', - [author], 1) -] - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'Pyrogram', 'Pyrogram Documentation', - author, 'Pyrogram', 'One line description of project.', - 'Miscellaneous'), -] +html_logo = "_images/pyrogram.png" +html_favicon = "_images/favicon.ico" diff --git a/docs/source/errors/BadRequest.rst b/docs/source/errors/BadRequest.rst deleted file mode 100644 index 2d56434c..00000000 --- a/docs/source/errors/BadRequest.rst +++ /dev/null @@ -1,7 +0,0 @@ -400 - Bad Request -================= - -.. module:: pyrogram.errors.BadRequest - -.. automodule:: pyrogram.errors.exceptions.bad_request_400 - :members: diff --git a/docs/source/errors/Flood.rst b/docs/source/errors/Flood.rst deleted file mode 100644 index 55098cbb..00000000 --- a/docs/source/errors/Flood.rst +++ /dev/null @@ -1,7 +0,0 @@ -420 - Flood -=========== - -.. module:: pyrogram.errors.Flood - -.. automodule:: pyrogram.errors.exceptions.flood_420 - :members: diff --git a/docs/source/errors/Forbidden.rst b/docs/source/errors/Forbidden.rst deleted file mode 100644 index cd794979..00000000 --- a/docs/source/errors/Forbidden.rst +++ /dev/null @@ -1,7 +0,0 @@ -403 - Forbidden -=============== - -.. module:: pyrogram.errors.Forbidden - -.. automodule:: pyrogram.errors.exceptions.forbidden_403 - :members: diff --git a/docs/source/errors/InternalServerError.rst b/docs/source/errors/InternalServerError.rst deleted file mode 100644 index 7f78d519..00000000 --- a/docs/source/errors/InternalServerError.rst +++ /dev/null @@ -1,7 +0,0 @@ -500 - Internal Server Error -=========================== - -.. module:: pyrogram.errors.InternalServerError - -.. automodule:: pyrogram.errors.exceptions.internal_server_error_500 - :members: diff --git a/docs/source/errors/NotAcceptable.rst b/docs/source/errors/NotAcceptable.rst deleted file mode 100644 index 5a8365fc..00000000 --- a/docs/source/errors/NotAcceptable.rst +++ /dev/null @@ -1,7 +0,0 @@ -406 - Not Acceptable -==================== - -.. module:: pyrogram.errors.NotAcceptable - -.. automodule:: pyrogram.errors.exceptions.not_acceptable_406 - :members: diff --git a/docs/source/errors/SeeOther.rst b/docs/source/errors/SeeOther.rst deleted file mode 100644 index f90902d0..00000000 --- a/docs/source/errors/SeeOther.rst +++ /dev/null @@ -1,7 +0,0 @@ -303 - See Other -=============== - -.. module:: pyrogram.errors.SeeOther - -.. automodule:: pyrogram.errors.exceptions.see_other_303 - :members: diff --git a/docs/source/errors/Unauthorized.rst b/docs/source/errors/Unauthorized.rst deleted file mode 100644 index d47ed3fb..00000000 --- a/docs/source/errors/Unauthorized.rst +++ /dev/null @@ -1,7 +0,0 @@ -401 - Unauthorized -================== - -.. module:: pyrogram.errors.Unauthorized - -.. automodule:: pyrogram.errors.exceptions.unauthorized_401 - :members: diff --git a/docs/source/errors/UnknownError.rst b/docs/source/errors/UnknownError.rst deleted file mode 100644 index 21495957..00000000 --- a/docs/source/errors/UnknownError.rst +++ /dev/null @@ -1,7 +0,0 @@ -520 - Unknown Error -=================== - -.. module:: pyrogram.errors.UnknownError - -.. autoexception:: pyrogram.errors.rpc_error.UnknownError - :members: diff --git a/docs/source/faq.rst b/docs/source/faq.rst new file mode 100644 index 00000000..449076af --- /dev/null +++ b/docs/source/faq.rst @@ -0,0 +1,273 @@ +Pyrogram FAQ +============ + +This FAQ page provides answers to common questions about Pyrogram and, to some extent, Telegram in general. + +.. tip:: + + If you think something interesting could be added here, feel free to propose it by opening a `Feature Request`_. + +.. contents:: Contents + :backlinks: none + :local: + :depth: 1 + +What is Pyrogram? +----------------- + +**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and +C. It enables you to easily create custom applications for both user and bot identities (bot API alternative) via the +:doc:`MTProto API ` with the Python programming language. + +.. _Telegram: https://telegram.org + +Where does the name come from? +------------------------------ + +The name "Pyrogram" is composed by **pyro**, which comes from the Greek word *πῦρ (pyr)*, meaning fire, and **gram**, +from *Telegram*. The word *pyro* itself is built from *Python*, **py** for short, and the suffix **ro** to come up with +the word *fire*, which also inspired the project logo. + +How old is Pyrogram? +-------------------- + +Pyrogram was first released on December 12, 2017. The actual work on the framework began roughly three months prior the +initial public release on `GitHub`_. + +.. _GitHub: https://github.com/pyrogram/pyrogram + +Why Pyrogram? +------------- + +- **Easy**: You can install Pyrogram with pip and start building your applications right away. +- **Elegant**: Low-level details are abstracted and re-presented in a much nicer and easier way. +- **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. +- **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted. +- **Updated**, to make use of the latest Telegram API version and features. +- **Bot API-like**: Similar to the Bot API in its simplicity, but much more powerful and detailed. +- **Pluggable**: The :doc:`Smart Plugin ` system allows to write components with minimal + boilerplate code. +- **Comprehensive**: Execute any :doc:`advanced action ` an official client is able to do, and + even more. + +.. _TgCrypto: https://github.com/pyrogram/tgcrypto + +How stable and reliable is Pyrogram? +------------------------------------ + +So far, since its first public release, Pyrogram has always shown itself to be quite reliable in handling client-server +interconnections and just as stable when keeping long running applications online. The only annoying issues faced are +actually coming from Telegram servers internal errors and down times, from which Pyrogram is able to recover itself +automatically. + +To challenge the framework, the creator is constantly keeping a public +`welcome bot `_ online 24/7 on his own, +relatively-busy account for well over a year now. + +In addition to that, about six months ago, one of the most popular Telegram bot has been rewritten +:doc:`using Pyrogram ` and is serving more than 200,000 Monthly Active Users since +then, uninterruptedly and without any need for restarting it. + +What can MTProto do more than the Bot API? +------------------------------------------ + +For a detailed answer, please refer to the :doc:`MTProto vs. Bot API ` page. + +Why do I need an API key for bots? +---------------------------------- + +Requests against the official bot API endpoint are made via JSON/HTTP, but are handled by an intermediate server +application that implements the MTProto protocol -- just like Pyrogram -- and uses its own API key, which is always +required, but hidden to the public. + +.. figure:: https://i.imgur.com/C108qkX.png + :align: center + +Using MTProto is the only way to communicate with the actual Telegram servers, and the main API requires developers to +identify applications by means of a unique key; the bot token identifies a bot as a user and replaces the user's phone +number only. + +Can I use the same file_id across different accounts? +----------------------------------------------------- + +No, Telegram doesn't allow this. + +File ids are personal and bound to a specific user/bot -- and an attempt in using a foreign file id will result in +errors such as ``[400 MEDIA_EMPTY]``. + +The only exception are stickers' file ids; you can use them across different accounts without any problem, like this +one: ``CAADBAADyg4AAvLQYAEYD4F7vcZ43AI``. + +Can I use Bot API's file_ids in Pyrogram? +----------------------------------------- + +Definitely! All file ids you might have taken from the Bot API are 100% compatible and re-usable in Pyrogram... + +...at least for now. + +Telegram is slowly changing some server's internals and it's doing it in such a way that file ids are going to break +inevitably. Not only this, but it seems that the new, hypothetical, file ids could also possibly expire at anytime, thus +losing the *persistence* feature. + +This change will most likely affect the official :doc:`Bot API ` too (unless Telegram +implements some workarounds server-side to keep backwards compatibility, which Pyrogram could in turn make use of) and +we can expect a proper notice from Telegram. + +Can I use multiple clients at once on the same account? +------------------------------------------------------- + +Yes, you can. Both user and bot accounts are able to run multiple sessions in parallel (up to 10 per account). However, +you must pay attention and not use the *same* exact session in more than one client at the same time. In other words: + +- Avoid copying your session file: even if you rename the file, the copied sessions will still point to a specific one + stored in the server. + +- Make sure that only one instance of your script runs, using your session file. + +If you -- even accidentally -- fail to do so, all the previous session copies will immediately stop receiving updates +and eventually the server will start throwing the error ``[406 AUTH_KEY_DUPLICATED]``, inviting you to login again. + +Why is that so? Because the server has recognized two identical sessions are running in two different locations, and +concludes it could possibly be due to a cloned/stolen device. Having the session ended in such occasions will protect +the user's privacy. + +So, the only correct way to run multiple clients on the same account is authorizing your account (either user or bot) +from the beginning every time, and use one separate session for each parallel client you are going to use. + +I started a client and nothing happens! +--------------------------------------- + +If you are connecting from Russia, China or Iran :doc:`you need a proxy `, because Telegram could be +partially or totally blocked in those countries. + +Another possible cause might be network issues, either yours or Telegram's. To confirm this, add the following code on +the top of your script and run it again. You should see some error mentioning a socket timeout or an unreachable network +in a bunch of seconds: + +.. code-block:: python + + import logging + logging.basicConfig(level=logging.INFO) + +Another way to confirm you aren't able to connect to Telegram is by pinging the IP addresses below and see whether ping +fails or not. + +What are the IP addresses of Telegram Data Centers? +--------------------------------------------------- + +The Telegram cloud is currently composed by a decentralized, multi-DC infrastructure (each of which can work +independently) spread in 5 different locations. However, some of the less busy DCs have been lately dismissed and their +IP addresses are now kept as aliases. + +.. csv-table:: Production Environment + :header: ID, Location, IPv4, IPv6 + :widths: auto + :align: center + + DC1, "MIA, Miami FL, USA", ``149.154.175.50``, ``2001:b28:f23d:f001::a`` + DC2, "AMS, Amsterdam, NL", ``149.154.167.51``, ``2001:67c:4e8:f002::a`` + DC3*, "MIA, Miami FL, USA", ``149.154.175.100``, ``2001:b28:f23d:f003::a`` + DC4, "AMS, Amsterdam, NL", ``149.154.167.91``, ``2001:67c:4e8:f004::a`` + DC5, "SIN, Singapore, SG", ``91.108.56.149``, ``2001:b28:f23f:f005::a`` + +.. csv-table:: Test Environment + :header: ID, Location, IPv4, IPv6 + :widths: auto + :align: center + + DC1, "MIA, Miami FL, USA", ``149.154.175.10``, ``2001:b28:f23d:f001::e`` + DC2, "AMS, Amsterdam, NL", ``149.154.167.40``, ``2001:67c:4e8:f002::e`` + DC3*, "MIA, Miami FL, USA", ``149.154.175.117``, ``2001:b28:f23d:f003::e`` + +***** Alias DC + +More info about the Test Environment can be found :doc:`here `. + +I want to migrate my account from DCX to DCY. +--------------------------------------------- + +This question is often asked by people who find their account(s) always being connected to DC1 - USA (for example), but +are connecting from a place far away (e.g DC4 - Europe), thus resulting in slower interactions when using the API +because of the great physical distance between the user and its associated DC. + +When registering an account for the first time, is up to Telegram to decide which DC the new user is going to be created +in, based on the phone number origin. + +Even though Telegram `documentations `_ state the server might +decide to automatically migrate a user in case of prolonged usages from a distant, unusual location and albeit this +mechanism is also `confirmed `_ to exist by Telegram itself, +it's currently not possible to have your account migrated, in any way, simply because the feature was once planned but +not yet implemented. + +I keep getting PEER_ID_INVALID error! +------------------------------------- + +The error in question is ``[400 PEER_ID_INVALID]``, and could mean several things: + +- The chat id you tried to use is simply wrong, double check it. +- The chat id refers to a group or channel you are not a member of. +- The chat id refers to a user you have't seen yet (from contacts, groups in common, forwarded messages or private + chats). +- The chat id argument you passed is in form of a string; you have to convert it into an integer with ``int(chat_id)``. + +UnicodeEncodeError: '' codec can't encode … +----------------------------------------------------- + +Where ```` might be *ascii*, *cp932*, *charmap* or anything else other than **utf-8**. This error usually +shows up when you try to print something and has very little to do with Pyrogram itself as it is strictly related to +your own terminal. To fix it, either find a way to change the encoding settings of your terminal to UTF-8 or switch to a +better one. + +My verification code expires immediately! +----------------------------------------- + +That is because you likely shared it across any of your Telegram chats. Yes, that's right: the server keeps scanning the +messages you send and if an active verification code is found it will immediately expire, automatically. + +The reason behind this is to protect unaware users from giving their account access to any potential scammer, but if you +legitimately want to share your account(s) verification codes, consider scrambling them, e.g. ``12345`` → ``1-2-3-4-5``. + +My account has been deactivated/limited! +---------------------------------------- + +First of all, you should understand that Telegram wants to be a safe place for people to stay in, and to pursue this +goal there are automatic protection systems running to prevent flood and spam, as well as a moderation team of humans +who review reports. + +.. centered:: Pyrogram is a tool at your commands; it only does what you tell it to do, the rest is up to you. + +Having said that, here's a list of what Telegram definitely doesn't like: + +- Flood, abusing the API. +- Spam, sending unsolicited messages or adding people to unwanted groups and channels. +- Virtual/VoIP and cheap real numbers, because they are relatively easy to get and likely used for spam/flood. + +And here's a good explanation of how, probably, the system works: + +.. raw:: html + + + +.. centered:: Join the discussion at `@Pyrogram `_ + +However, you might be right, and your account was deactivated/limited without any good reason. This could happen because +of mistakes by either the automatic systems or a moderator. In such cases you can kindly email Telegram at +recover@telegram.org, contact `@smstelegram`_ on Twitter or use `this form`_. + +Are there any secret easter eggs? +--------------------------------- + +Yes. If you found one, `let me know`_! + +.. _let me know: https://t.me/pyrogram + +.. _@smstelegram: https://twitter.com/smstelegram +.. _this form: https://telegram.org/support + +.. _Bug Report: https://github.com/pyrogram/pyrogram/issues/new?labels=bug&template=bug_report.md +.. _Feature Request: https://github.com/pyrogram/pyrogram/issues/new?labels=enhancement&template=feature_request.md diff --git a/docs/source/glossary.rst b/docs/source/glossary.rst new file mode 100644 index 00000000..bcb1193c --- /dev/null +++ b/docs/source/glossary.rst @@ -0,0 +1,79 @@ +Pyrogram Glossary +================= + +This page contains a list of common words with brief explanations related to Pyrogram and, to some extent, Telegram in +general. Some words may as well link to dedicated articles in case the topic is covered in a more detailed fashion. + +.. tip:: + + If you think something interesting could be added here, feel free to propose it by opening a `Feature Request`_. + + +Terms +----- + +.. glossary:: + :sorted: + + API + Application Programming Interface: a set of methods, protocols and tools that make it easier to develop programs + by providing useful building blocks to the developer. + + API key + A secret code used to authenticate and/or authorize a specific application to Telegram in order for it to + control how the API is being used, for example, to prevent abuses of the API. + :doc:`More on API keys `. + + DC + Also known as *data center*, is a place where lots of computer systems are housed and used together in order to + achieve high quality and availability for services. + + RPC + Acronym for Remote Procedure call, that is, a function which gets executed at some remote place (i.e. Telegram + server) and not in your local machine. + + RPCError + An error caused by an RPC which must be returned in place of the successful result in order to let the caller + know something went wrong. :doc:`More on RPCError `. + + MTProto + The name of the custom-made, open and encrypted protocol by Telegram, implemented in Pyrogram. + :doc:`More on MTProto `. + + MTProto API + The Telegram main API Pyrogram makes use of, which is able to connect both users and normal bots to Telegram + using MTProto as application layer protocol and execute any method Telegram provides from its public TL-schema. + :doc:`More on MTProto API `. + + Bot API + The Telegram Bot API that is able to only connect normal bots only to Telegram using HTTP as application layer + protocol and allows to execute a sub-set of the main Telegram API. + :doc:`More on Bot API `. + + Pyrogrammer + A developer that uses Pyrogram to build Telegram applications. + + Userbot + Also known as *user bot* or *ubot* for short, is a user logged in by third-party Telegram libraries --- such as + Pyrogram --- to automate some behaviours, like sending messages or reacting to text commands or any other event. + + Session + Also known as *login session*, is a strictly personal piece of information created and held by both parties + (client and server) which is used to grant permission into a single account without having to start a new + authorization process from scratch. + + Callback + Also known as *callback function*, is a user-defined generic function that *can be* registered to and then + called-back by the framework when specific events occurs. + + Handler + An object that wraps around a callback function that is *actually meant* to be registered into the framework, + which will then be able to handle a specific kind of events, such as a new incoming message, for example. + :doc:`More on Handlers `. + + Decorator + Also known as *function decorator*, in Python, is a callable object that is used to modify another function. + Decorators in Pyrogram are used to automatically register callback functions for handling updates. + :doc:`More on Decorators `. + +.. _Feature Request: https://github.com/pyrogram/pyrogram/issues/new?labels=enhancement&template=feature_request.md diff --git a/docs/source/index.rst b/docs/source/index.rst index bd62547e..0bc175ee 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -4,8 +4,8 @@ Welcome to Pyrogram .. raw:: html @@ -13,26 +13,17 @@ Welcome to Pyrogram Telegram MTProto API Framework for Python
- - Documentation + + Source Code - Changelog + Releases • - + Community -
- - Schema Layer - - - TgCrypto Version -

.. code-block:: python @@ -49,73 +40,122 @@ Welcome to Pyrogram app.run() -Welcome to Pyrogram's Documentation! Here you can find resources for learning how to use the framework. -Contents are organized into self-contained topics and can be accessed from the sidebar, or by following them in order -using the Next button at the end of each page. But first, here's a brief overview of what is this all about. +**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and +C. It enables you to easily create custom apps for both user and bot identities (bot API alternative) via the +:doc:`MTProto API `. -About ------ +.. _Telegram: https://telegram.org -**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and C. -It enables you to easily create custom apps using both user and bot identities (bot API alternative) via the `MTProto API`_. +How the Documentation is Organized +---------------------------------- -Features --------- +Contents are organized into self-contained topics and can be all accessed from the sidebar, or by following them in +order using the :guilabel:`Next` button at the end of each page. Here below you can, instead, find a list of the most +relevant pages for a quick access. -- **Easy**: You can install Pyrogram with pip and start building your applications right away. -- **Elegant**: Low-level details are abstracted and re-presented in a much nicer and easier way. -- **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. -- **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted. -- **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. -- **Comprehensive**: Execute any advanced action an official client is able to do, and even more. +First Steps +----------- -To get started, press the Next button. +.. hlist:: + :columns: 2 + + - :doc:`Quick Start `: Overview to get you started quickly. + - :doc:`Calling Methods `: How to call Pyrogram's methods. + - :doc:`Handling Updates `: How to handle Telegram updates. + - :doc:`Error Handling `: How to handle API errors correctly. + +API Reference +------------- + +.. hlist:: + :columns: 2 + + - :doc:`Pyrogram Client `: Reference details about the Client class. + - :doc:`Available Methods `: List of available high-level methods. + - :doc:`Available Types `: List of available high-level types. + - :doc:`Bound Methods `: List of convenient bound methods. + +Meta +---- + +.. hlist:: + :columns: 2 + + - :doc:`Pyrogram FAQ `: Answers to common Pyrogram questions. + - :doc:`Pyrogram Glossary `: List of words with brief explanations. + - :doc:`Powered by Pyrogram `: Collection of Pyrogram Projects. + - :doc:`Support Pyrogram `: Ways to show your appreciation. + - :doc:`About the License `: Information about the Project license. + - :doc:`Release Notes `: Release notes for Pyrogram releases. .. toctree:: :hidden: - :caption: Quick Start + :caption: Introduction - start/Installation - start/Setup - start/Usage + intro/quickstart + intro/install + intro/setup .. toctree:: :hidden: - :caption: Resources + :caption: Getting Started - resources/UpdateHandling - resources/UsingFilters - resources/MoreOnUpdates - resources/ConfigurationFile - resources/SmartPlugins - resources/AutoAuthorization - resources/CustomizeSessions - resources/TgCrypto - resources/TextFormatting - resources/SOCKS5Proxy - resources/BotsInteraction - resources/ErrorHandling - resources/TestServers - resources/AdvancedUsage - resources/VoiceCalls - resources/Changelog + start/auth + start/invoking + start/updates + start/errors .. toctree:: :hidden: - :caption: Main Package + :caption: API Reference - pyrogram/index + api/client + api/methods + api/types + api/bound-methods + api/handlers + api/decorators + api/filters + api/errors + +.. toctree:: + :hidden: + :caption: Topic Guides + + topics/use-filters + topics/create-filters + topics/more-on-updates + topics/config-file + topics/smart-plugins + topics/auto-auth + topics/session-settings + topics/tgcrypto + topics/text-formatting + topics/serialize + topics/proxy + topics/bots-interaction + topics/mtproto-vs-botapi + topics/debugging + topics/test-servers + topics/advanced-usage + topics/voice-calls + +.. toctree:: + :hidden: + :caption: Meta + + faq + glossary + powered-by + support-pyrogram + license + releases/index .. toctree:: :hidden: :caption: Telegram API - functions/index - types/index + telegram/functions/index + telegram/types/index -.. _`Telegram`: https://telegram.org -.. _TgCrypto: https://docs.pyrogram.ml/resources/TgCrypto -.. _`MTProto API`: https://core.telegram.org/api#telegram-api -.. _`MTProto 2.0`: https://core.telegram.org/mtproto +Last updated on |today| \ No newline at end of file diff --git a/docs/source/start/Installation.rst b/docs/source/intro/install.rst similarity index 70% rename from docs/source/start/Installation.rst rename to docs/source/intro/install.rst index 079e1b1f..82ab4c0b 100644 --- a/docs/source/start/Installation.rst +++ b/docs/source/intro/install.rst @@ -1,8 +1,8 @@ -Installation -============ +Install Guide +============= Being a Python library, **Pyrogram** requires Python to be installed in your system. -We recommend using the latest version of Python 3 and pip. +We recommend using the latest versions of both Python 3 and pip. - Get **Python 3** from https://www.python.org/downloads/ (or with your package manager) - Get **pip** by following the instructions at https://pip.pypa.io/en/latest/installing/. @@ -20,7 +20,7 @@ Install Pyrogram $ pip3 install -U pyrogram -- or, with TgCrypto_ as extra requirement (recommended): +- or, with :doc:`TgCrypto <../topics/tgcrypto>` as extra requirement (recommended): .. code-block:: text @@ -29,12 +29,12 @@ Install Pyrogram Bleeding Edge ------------- -Things are constantly evolving in Pyrogram, although new releases are published only when enough changes are added, -but this doesn't mean you can't try new features right now! +Pyrogram is always evolving, although new releases on PyPI are published only when enough changes are added, but this +doesn't mean you can't try new features right now! -In case you would like to try out the latest Pyrogram features and additions, the `GitHub repo`_ is always kept updated -with new changes; you can install the development version straight from the ``develop`` branch using this command -(note "develop.zip" in the link): +In case you'd like to try out the latest Pyrogram features, the `GitHub repo`_ is always kept updated with new changes; +you can install the development version straight from the ``develop`` branch using this command (note "develop.zip" in +the link): .. code-block:: text @@ -44,7 +44,8 @@ Asynchronous ------------ Pyrogram heavily depends on IO-bound network code (it's a cloud-based messaging framework after all), and here's -where asyncio shines the most by providing extra performance while running on a single OS-level thread only. +where asyncio shines the most by providing extra performance and efficiency while running on a single OS-level thread +only. **A fully asynchronous variant of Pyrogram is therefore available** (Python 3.5.3+ required). Use this command to install (note "asyncio.zip" in the link): @@ -54,7 +55,7 @@ Use this command to install (note "asyncio.zip" in the link): $ pip3 install -U https://github.com/pyrogram/pyrogram/archive/asyncio.zip -Pyrogram API remains the same and features are kept up to date from the non-async, default develop branch, but you +Pyrogram's API remains the same and features are kept up to date from the non-async, default develop branch, but you are obviously required Python asyncio knowledge in order to take full advantage of it. @@ -82,11 +83,10 @@ Verifying To verify that Pyrogram is correctly installed, open a Python shell and import it. If no error shows up you are good to go. -.. code-block:: python +.. parsed-literal:: >>> import pyrogram >>> pyrogram.__version__ - '0.12.0' + '|version|' -.. _TgCrypto: https://docs.pyrogram.ml/resources/TgCrypto .. _`Github repo`: http://github.com/pyrogram/pyrogram diff --git a/docs/source/intro/quickstart.rst b/docs/source/intro/quickstart.rst new file mode 100644 index 00000000..a7a7e377 --- /dev/null +++ b/docs/source/intro/quickstart.rst @@ -0,0 +1,49 @@ +Quick Start +=========== + +The next few steps serve as a quick start for all new Pyrogrammers that want to get something done as fast as possible. +Let's go! + +Get Pyrogram Real Fast +---------------------- + +1. Install Pyrogram with ``pip3 install -U pyrogram``. + +2. Get your own Telegram API key from https://my.telegram.org/apps. + +3. Open your best text editor and paste the following: + + .. code-block:: python + + from pyrogram import Client + + api_id = 12345 + api_hash = "0123456789abcdef0123456789abcdef" + + with Client("my_account", api_id, api_hash) as app: + app.send_message("me", "Greetings from **Pyrogram**!") + +4. Replace *api_id* and *api_hash* values with your own. + +5. Save the file as ``pyro.py``. + +6. Run the script with ``python3 pyro.py`` + +7. Follow the instructions on your terminal to login. + +8. Watch Pyrogram send a message to yourself. + +9. Join our `community`_. + +10. Say, "hi!". + +Enjoy the API +------------- + +That was just a quick overview that barely scratched the surface! +In the next few pages of the introduction, we'll take a much more in-depth look of what we have just done above. + +Feeling eager to continue? You can take a shortcut to :doc:`Calling Methods <../start/invoking>` and come back later to +learn some more details. + +.. _community: //t.me/Pyrogram diff --git a/docs/source/intro/setup.rst b/docs/source/intro/setup.rst new file mode 100644 index 00000000..6273b2b2 --- /dev/null +++ b/docs/source/intro/setup.rst @@ -0,0 +1,59 @@ +Project Setup +============= + +We have just :doc:`installed Pyrogram `. In this page we'll discuss what you need to do in order to set up a +project with the library. Let's see how it's done. + +API Keys +-------- + +The very first step requires you to obtain a valid Telegram API key (API id/hash pair): + +#. Visit https://my.telegram.org/apps and log in with your Telegram Account. +#. Fill out the form to register a new Telegram application. +#. Done! The API key consists of two parts: **api_id** and **api_hash**. + +.. important:: + + The API key is personal and must be kept secret. + +.. note:: + + The API key is unique for each user, but defines a token for a Telegram *application* you are going to build. This + means that you are able to authorize multiple users (and bots too) to access the Telegram database through the + MTProto API by a single API key. + +Configuration +------------- + +Having the API key from the previous step in handy, we can now begin to configure a Pyrogram project. +There are two ways to do so, and you can choose what fits better for you: + +- First option (recommended): create a new ``config.ini`` file at the root of your working directory, copy-paste the + following and replace the **api_id** and **api_hash** values with your own. This is the preferred method because + allows you to keep your credentials out of your code without having to deal with how to load them: + + .. code-block:: ini + + [pyrogram] + api_id = 12345 + api_hash = 0123456789abcdef0123456789abcdef + +- Alternatively, you can pass your API key to Pyrogram by simply using the *api_id* and *api_hash* parameters of the + Client class. This way you can have full control on how to store and load your credentials (e.g., you can load the + credentials from the environment variables and directly pass the values into Pyrogram): + + .. code-block:: python + + from pyrogram import Client + + app = Client( + "my_account", + api_id=12345, + api_hash="0123456789abcdef0123456789abcdef" + ) + +.. note:: + + To keep code snippets clean and concise, from now on it is assumed you are making use of the ``config.ini`` file, + thus, the *api_id* and *api_hash* parameters usage won't be shown anymore. diff --git a/docs/source/license.rst b/docs/source/license.rst new file mode 100644 index 00000000..38302bdc --- /dev/null +++ b/docs/source/license.rst @@ -0,0 +1,15 @@ +About the License +================= + +.. image:: https://www.gnu.org/graphics/lgplv3-with-text-154x68.png + :align: right + +Pyrogram is free software and is currently licensed under the terms of the +`GNU Lesser General Public License v3 or later (LGPLv3+)`_. In short: you may use, redistribute and/or modify it +provided that modifications are described and licensed for free under LGPLv3+. + +In other words: you can use and integrate Pyrogram into your own code --- either open source, under the same or a +different license, or even proprietary --- without being required to release the source code of your own applications. +However, any modifications to the library itself are required to be published for free under the same LGPLv3+ license. + +.. _GNU Lesser General Public License v3 or later (LGPLv3+): https://github.com/pyrogram/pyrogram/blob/develop/COPYING.lesser \ No newline at end of file diff --git a/docs/source/powered-by.rst b/docs/source/powered-by.rst new file mode 100644 index 00000000..03e6decd --- /dev/null +++ b/docs/source/powered-by.rst @@ -0,0 +1,69 @@ +Powered by Pyrogram +=================== + +This is a collection of remarkable projects made with Pyrogram. + +.. A collection of Pyrojects :^) + +.. tip:: + + If you'd like to propose a project that's worth being listed here, feel free to open a `Feature Request`_. + +Projects Showcase +----------------- + +`YTAudioBot `_ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +| **A YouTube audio downloader on Telegram, serving over 200k MAU.** +| --- by `Dan `_ + +- Main: https://t.me/ytaudiobot +- Mirror: https://t.me/ytaudio_bot +- Website: https://ytaudiobot.ml + +----- + +`Pyrogram Assistant `_ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +| **The assistant bot that helps people with Pyrogram directly on Telegram** +| --- by `Dan `_ + +- Bot: https://t.me/pyrogrambot +- Source Code: https://github.com/pyrogram/assistant + +----- + +`PyroBot `_ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +| **A Telegram userbot based on Pyrogram** +| --- by `Colin `_ + +- Source Code: https://git.colinshark.de/PyroBot/PyroBot + +----- + +`TgIntegration `_ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +| **Integration Test Library for Telegram Messenger Bots in Python** +| --- by `JosXa `_ + +- Source Code: https://github.com/JosXa/tgintegration + +----- + +`BotListBot `_ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +| **A bot which partly uses Pyrogram to check if other bots are still alive** +| --- by `JosXa `_ + +- Source Code: https://github.com/JosXa/BotListBot + +----- + +.. _Feature Request: https://github.com/pyrogram/pyrogram/issues/new?labels=enhancement&template=feature_request.md + diff --git a/docs/source/pyrogram/ChatAction.rst b/docs/source/pyrogram/ChatAction.rst deleted file mode 100644 index dfa56945..00000000 --- a/docs/source/pyrogram/ChatAction.rst +++ /dev/null @@ -1,5 +0,0 @@ -ChatAction -========== - -.. autoclass:: pyrogram.ChatAction - :members: diff --git a/docs/source/pyrogram/Client.rst b/docs/source/pyrogram/Client.rst deleted file mode 100644 index dcf8bb79..00000000 --- a/docs/source/pyrogram/Client.rst +++ /dev/null @@ -1,158 +0,0 @@ -Client -====== - -.. currentmodule:: pyrogram.Client - -.. autoclass:: pyrogram.Client - -Utilities ---------- - -.. autosummary:: - :nosignatures: - - start - stop - restart - idle - run - add_handler - remove_handler - send - resolve_peer - save_file - stop_transmission - -Decorators ----------- - -.. autosummary:: - :nosignatures: - - on_message - on_callback_query - on_inline_query - on_deleted_messages - on_user_status - on_disconnect - on_raw_update - -Messages --------- - -.. autosummary:: - :nosignatures: - - send_message - forward_messages - send_photo - send_audio - send_document - send_sticker - send_video - send_animation - send_voice - send_video_note - send_media_group - send_location - send_venue - send_contact - send_cached_media - send_chat_action - edit_message_text - edit_message_caption - edit_message_reply_markup - edit_message_media - delete_messages - get_messages - get_history - iter_history - send_poll - vote_poll - close_poll - retract_vote - download_media - -Chats ------ - -.. autosummary:: - :nosignatures: - - join_chat - leave_chat - kick_chat_member - unban_chat_member - restrict_chat_member - promote_chat_member - export_chat_invite_link - set_chat_photo - delete_chat_photo - set_chat_title - set_chat_description - pin_chat_message - unpin_chat_message - get_chat - get_chat_preview - get_chat_member - get_chat_members - get_chat_members_count - iter_chat_members - get_dialogs - iter_dialogs - restrict_chat - update_chat_username - -Users ------ - -.. autosummary:: - :nosignatures: - - get_me - get_users - get_user_profile_photos - set_user_profile_photo - delete_user_profile_photos - update_username - -Contacts --------- - -.. autosummary:: - :nosignatures: - - add_contacts - get_contacts - delete_contacts - -Password --------- - -.. autosummary:: - :nosignatures: - - enable_cloud_password - change_cloud_password - remove_cloud_password - -Bots ----- - -.. autosummary:: - :nosignatures: - - get_inline_bot_results - send_inline_bot_result - answer_callback_query - answer_inline_query - request_callback_answer - send_game - set_game_score - get_game_high_scores - answer_inline_query - - -.. autoclass:: pyrogram.Client - :inherited-members: - :members: diff --git a/docs/source/pyrogram/Handlers.rst b/docs/source/pyrogram/Handlers.rst deleted file mode 100644 index 1bb16ece..00000000 --- a/docs/source/pyrogram/Handlers.rst +++ /dev/null @@ -1,37 +0,0 @@ -Handlers -======== - -.. currentmodule:: pyrogram - -.. autosummary:: - :nosignatures: - - MessageHandler - DeletedMessagesHandler - CallbackQueryHandler - InlineQueryHandler - UserStatusHandler - DisconnectHandler - RawUpdateHandler - -.. autoclass:: MessageHandler - :members: - -.. autoclass:: DeletedMessagesHandler - :members: - -.. autoclass:: CallbackQueryHandler - :members: - -.. autoclass:: InlineQueryHandler - :members: - -.. autoclass:: UserStatusHandler - :members: - -.. autoclass:: DisconnectHandler - :members: - -.. autoclass:: RawUpdateHandler - :members: - diff --git a/docs/source/pyrogram/ParseMode.rst b/docs/source/pyrogram/ParseMode.rst deleted file mode 100644 index 6a4e0bbb..00000000 --- a/docs/source/pyrogram/ParseMode.rst +++ /dev/null @@ -1,6 +0,0 @@ -ParseMode -========= - -.. autoclass:: pyrogram.ParseMode - :members: - :undoc-members: diff --git a/docs/source/pyrogram/RPCError.rst b/docs/source/pyrogram/RPCError.rst deleted file mode 100644 index a47c9b9c..00000000 --- a/docs/source/pyrogram/RPCError.rst +++ /dev/null @@ -1,15 +0,0 @@ -RPCError -======== - -.. autoexception:: pyrogram.RPCError - :members: - -.. toctree:: - ../errors/SeeOther - ../errors/BadRequest - ../errors/Unauthorized - ../errors/Forbidden - ../errors/NotAcceptable - ../errors/Flood - ../errors/InternalServerError - ../errors/UnknownError diff --git a/docs/source/pyrogram/Types.rst b/docs/source/pyrogram/Types.rst deleted file mode 100644 index 5deb58b2..00000000 --- a/docs/source/pyrogram/Types.rst +++ /dev/null @@ -1,263 +0,0 @@ -Types -===== - -.. currentmodule:: pyrogram - -Users & Chats -------------- - -.. autosummary:: - :nosignatures: - - User - UserStatus - Chat - ChatPreview - ChatPhoto - ChatMember - ChatMembers - ChatPermissions - Dialog - Dialogs - -Messages & Media ----------------- - -.. autosummary:: - :nosignatures: - - Message - Messages - MessageEntity - Photo - PhotoSize - UserProfilePhotos - Audio - Document - Animation - Video - Voice - VideoNote - Contact - Location - Venue - Sticker - Poll - PollOption - -Bots ----- - -.. autosummary:: - :nosignatures: - - ReplyKeyboardMarkup - KeyboardButton - ReplyKeyboardRemove - InlineKeyboardMarkup - InlineKeyboardButton - ForceReply - CallbackQuery - Game - -Input Media ------------ - -.. autosummary:: - :nosignatures: - - InputMedia - InputMediaPhoto - InputMediaVideo - InputMediaAudio - InputMediaAnimation - InputMediaDocument - InputPhoneContact - -Inline Mode ------------- - -.. autosummary:: - :nosignatures: - - InlineQuery - InlineQueryResult - InlineQueryResultArticle - -InputMessageContent -------------------- - -.. autosummary:: - :nosignatures: - - InputMessageContent - InputTextMessageContent - -.. User & Chats - ------------ - -.. autoclass:: User - :members: - -.. autoclass:: UserStatus - :members: - -.. autoclass:: Chat - :members: - -.. autoclass:: ChatPreview - :members: - -.. autoclass:: ChatPhoto - :members: - -.. autoclass:: ChatMember - :members: - -.. autoclass:: ChatMembers - :members: - -.. autoclass:: ChatPermissions - :members: - -.. autoclass:: Dialog - :members: - -.. autoclass:: Dialogs - :members: - -.. Messages & Media - ---------------- - -.. autoclass:: Message - :members: - -.. autoclass:: Messages - :members: - -.. autoclass:: MessageEntity - :members: - -.. autoclass:: Photo - :members: - -.. autoclass:: PhotoSize - :members: - -.. autoclass:: UserProfilePhotos - :members: - -.. autoclass:: Audio - :members: - -.. autoclass:: Document - :members: - -.. autoclass:: Animation - :members: - -.. autoclass:: Video - :members: - -.. autoclass:: Voice - :members: - -.. autoclass:: VideoNote - :members: - -.. autoclass:: Contact - :members: - -.. autoclass:: Location - :members: - -.. autoclass:: Venue - :members: - -.. autoclass:: Sticker - :members: - -.. autoclass:: Poll - :members: - -.. autoclass:: PollOption - :members: - -.. Bots - ---- - -.. autoclass:: ReplyKeyboardMarkup - :members: - -.. autoclass:: KeyboardButton - :members: - -.. autoclass:: ReplyKeyboardRemove - :members: - -.. autoclass:: InlineKeyboardMarkup - :members: - -.. autoclass:: InlineKeyboardButton - :members: - -.. autoclass:: ForceReply - :members: - -.. autoclass:: CallbackQuery - :members: - -.. autoclass:: Game - :members: - -.. autoclass:: GameHighScore - :members: - -.. autoclass:: GameHighScores - :members: - -.. Input Media - ----------- - -.. autoclass:: InputMedia - :members: - -.. autoclass:: InputMediaPhoto - :members: - -.. autoclass:: InputMediaVideo - :members: - -.. autoclass:: InputMediaAudio - :members: - -.. autoclass:: InputMediaAnimation - :members: - -.. autoclass:: InputMediaDocument - :members: - -.. autoclass:: InputPhoneContact - :members: - - -.. Inline Mode - ----------- - -.. autoclass:: InlineQuery - :members: - -.. autoclass:: InlineQueryResult - :members: - -.. autoclass:: InlineQueryResultArticle - :members: - -.. InputMessageContent - ------------------- - -.. autoclass:: InputMessageContent - :members: - -.. autoclass:: InputTextMessageContent - :members: diff --git a/docs/source/pyrogram/index.rst b/docs/source/pyrogram/index.rst deleted file mode 100644 index 286b5db1..00000000 --- a/docs/source/pyrogram/index.rst +++ /dev/null @@ -1,20 +0,0 @@ -Pyrogram -======== - -In this section you can find a detailed description of the Pyrogram package and its API. - -:class:`Client ` is the main class. It exposes easy-to-use methods that are named -after the well established `Telegram Bot API`_ methods, thus offering a familiar look to Bot developers. - -.. toctree:: - :maxdepth: 1 - - Client - Types - Handlers - Filters - ChatAction - ParseMode - RPCError - -.. _Telegram Bot API: https://core.telegram.org/bots/api#available-methods diff --git a/docs/source/resources/Changelog.rst b/docs/source/resources/Changelog.rst deleted file mode 100644 index 732a1311..00000000 --- a/docs/source/resources/Changelog.rst +++ /dev/null @@ -1,11 +0,0 @@ -Changelog -========= - -Currently, all Pyrogram release notes live inside the GitHub repository web page: -https://github.com/pyrogram/pyrogram/releases - -(You will be automatically redirected in 10 seconds.) - -.. raw:: html - - \ No newline at end of file diff --git a/docs/source/resources/ErrorHandling.rst b/docs/source/resources/ErrorHandling.rst deleted file mode 100644 index 7e87b94a..00000000 --- a/docs/source/resources/ErrorHandling.rst +++ /dev/null @@ -1,59 +0,0 @@ -Error Handling -============== - -Errors are inevitable when working with the API, and they must be correctly handled with ``try..except`` blocks. - -There are many errors that Telegram could return, but they all fall in one of these categories -(which are in turn children of the :obj:`RPCError ` superclass): - -- :obj:`303 - See Other ` -- :obj:`400 - Bad Request ` -- :obj:`401 - Unauthorized ` -- :obj:`403 - Forbidden ` -- :obj:`406 - Not Acceptable ` -- :obj:`420 - Flood ` -- :obj:`500 - Internal Server Error ` - -As stated above, there are really many (too many) errors, and in case Pyrogram does not know anything yet about a -specific one, it raises a special :obj:`520 Unknown Error ` exception and logs it -in the ``unknown_errors.txt`` file. Users are invited to report these unknown errors; in later versions of Pyrogram -some kind of automatic error reporting module might be implemented. - -Examples --------- - -.. code-block:: python - - from pyrogram.errors import ( - BadRequest, Flood, InternalServerError, - SeeOther, Unauthorized, UnknownError - ) - - try: - ... - except BadRequest: - pass - except Flood: - pass - except InternalServerError: - pass - except SeeOther: - pass - except Unauthorized: - pass - except UnknownError: - pass - -Exception objects may also contain some informative values. -E.g.: :obj:`FloodWait ` holds the amount of seconds you have to wait -before you can try again. The value is always stored in the ``x`` field of the returned exception object: - -.. code-block:: python - - import time - from pyrogram.errors import FloodWait - - try: - ... - except FloodWait as e: - time.sleep(e.x) diff --git a/docs/source/resources/UpdateHandling.rst b/docs/source/resources/UpdateHandling.rst deleted file mode 100644 index ed0ad909..00000000 --- a/docs/source/resources/UpdateHandling.rst +++ /dev/null @@ -1,72 +0,0 @@ -Update Handling -=============== - -Let's now dive right into the core of the framework. - -Updates are events that happen in your Telegram account (incoming messages, new channel posts, new members join, ...) -and are handled by registering one or more callback functions in your app using `Handlers <../pyrogram/Handlers.html>`_. - -Each handler deals with a specific event and once a matching update arrives from Telegram, your registered callback -function will be called. - -Registering an Handler ----------------------- - -To explain how handlers work let's have a look at the most used one, the -:obj:`MessageHandler `, which will be in charge for handling :obj:`Message ` -updates coming from all around your chats. Every other handler shares the same setup logic; you should not have troubles -settings them up once you learn from this section. - -Using add_handler() -------------------- - -The :meth:`add_handler() ` method takes any handler instance that wraps around your defined -callback function and registers it in your Client. Here's a full example that prints out the content of a message as -soon as it arrives: - -.. code-block:: python - - from pyrogram import Client, MessageHandler - - - def my_function(client, message): - print(message) - - - app = Client("my_account") - - my_handler = MessageHandler(my_function) - app.add_handler(my_handler) - - app.run() - -Using Decorators ----------------- - -A much nicer way to register a MessageHandler is by decorating your callback function with the -:meth:`on_message() ` decorator, which will still make use of add_handler() under the hood. - -.. code-block:: python - - from pyrogram import Client - - app = Client("my_account") - - - @app.on_message() - def my_handler(client, message): - print(message) - - - app.run() - - -.. note:: - - Due to how these decorators work in Pyrogram, they will wrap your defined callback function in a tuple consisting of - ``(handler, group)``; this will be the value held by your function identifier (e.g.: *my_function* from the example - above). - - In case, for some reason, you want to get your own function back after it has been decorated, you need to access - ``my_function[0].callback``, that is, the *callback* field of the *handler* object which is the first element in the - tuple. \ No newline at end of file diff --git a/docs/source/resources/UsingFilters.rst b/docs/source/resources/UsingFilters.rst deleted file mode 100644 index ec3e2e10..00000000 --- a/docs/source/resources/UsingFilters.rst +++ /dev/null @@ -1,194 +0,0 @@ -Using Filters -============= - -So far we've seen how to register a callback function that executes every time a specific update comes from the server, -but there's much more than that to come. - -Here we'll discuss about :class:`Filters `. Filters enable a fine-grain control over what kind of -updates are allowed or not to be passed in your callback functions, based on their inner details. - -Let's start right away with a simple example: - -- This example will show you how to **only** handle messages containing an :obj:`Audio ` object and - ignore any other message. Filters are passed as the first argument of the decorator: - - .. code-block:: python - :emphasize-lines: 4 - - from pyrogram import Filters - - - @app.on_message(Filters.audio) - def my_handler(client, message): - print(message) - -- or, without decorators. Here filters are passed as the second argument of the handler constructor: - - .. code-block:: python - :emphasize-lines: 8 - - from pyrogram import Filters, MessageHandler - - - def my_handler(client, message): - print(message) - - - app.add_handler(MessageHandler(my_handler, Filters.audio)) - -Combining Filters ------------------ - -Filters can also be used in a more advanced way by inverting and combining more filters together using bitwise -operators ``~``, ``&`` and ``|``: - -- Use ``~`` to invert a filter (behaves like the ``not`` operator). -- Use ``&`` and ``|`` to merge two filters (behave like ``and``, ``or`` operators respectively). - -Here are some examples: - -- Message is a **text** message **and** is **not edited**. - - .. code-block:: python - - @app.on_message(Filters.text & ~Filters.edited) - def my_handler(client, message): - print(message) - -- Message is a **sticker** **and** is coming from a **channel or** a **private** chat. - - .. code-block:: python - - @app.on_message(Filters.sticker & (Filters.channel | Filters.private)) - def my_handler(client, message): - print(message) - -Advanced Filters ----------------- - -Some filters, like :meth:`command() ` or :meth:`regex() ` -can also accept arguments: - -- Message is either a */start* or */help* **command**. - - .. code-block:: python - - @app.on_message(Filters.command(["start", "help"])) - def my_handler(client, message): - print(message) - -- Message is a **text** message or a media **caption** matching the given **regex** pattern. - - .. code-block:: python - - @app.on_message(Filters.regex("pyrogram")) - def my_handler(client, message): - print(message) - -More handlers using different filters can also live together. - -.. code-block:: python - - @app.on_message(Filters.command("start")) - def start_command(client, message): - print("This is the /start command") - - - @app.on_message(Filters.command("help")) - def help_command(client, message): - print("This is the /help command") - - - @app.on_message(Filters.chat("PyrogramChat")) - def from_pyrogramchat(client, message): - print("New message in @PyrogramChat") - -Custom Filters --------------- - -Pyrogram already provides lots of built-in :class:`Filters ` to work with, but in case you can't find -a specific one for your needs or want to build a custom filter by yourself (to be used in a different kind of handler, -for example) you can use :meth:`Filters.create() `. - -.. note:: - At the moment, the built-in filters are intended to be used with the :obj:`MessageHandler ` - only. - -An example to demonstrate how custom filters work is to show how to create and use one for the -:obj:`CallbackQueryHandler `. Note that callback queries updates are only received by -bots; create and `authorize your bot <../start/Setup.html#bot-authorization>`_, then send a message with an inline -keyboard to yourself. This allows you to test your filter by pressing the inline button: - -.. code-block:: python - - from pyrogram import InlineKeyboardMarkup, InlineKeyboardButton - - app.send_message( - "username", # Change this to your username or id - "Pyrogram's custom filter test", - reply_markup=InlineKeyboardMarkup( - [[InlineKeyboardButton("Press me", b"pyrogram")]] - ) - ) - -Basic Filters -^^^^^^^^^^^^^ - -For this basic filter we will be using only the first two parameters of :meth:`Filters.create() `. - -The code below creates a simple filter for hardcoded, static callback data. This filter will only allow callback queries -containing "Pyrogram" as data, that is, the function *func* you pass returns True in case the callback query data -equals to ``b"Pyrogram"``. - -.. code-block:: python - - static_data = Filters.create( - name="StaticdData", - func=lambda flt, callback_query: callback_query.data == b"Pyrogram" - ) - -The ``lambda`` operator in python is used to create small anonymous functions and is perfect for this example, the same -could be achieved with a normal function, but we don't really need it as it makes sense only inside the filter's scope: - -.. code-block:: python - - def func(flt, callback_query): - return callback_query.data == b"Pyrogram" - - static_data = Filters.create( - name="StaticData", - func=func - ) - -The filter usage remains the same: - -.. code-block:: python - - @app.on_callback_query(static_data) - def pyrogram_data(client, callback_query): - client.answer_callback_query(callback_query.id, "it works!") - -Filters with Arguments -^^^^^^^^^^^^^^^^^^^^^^ - -A much cooler filter would be one that accepts "Pyrogram" or any other data as argument at usage time. -A dynamic filter like this will make use of the third parameter of :meth:`Filters.create() `. - -This is how a dynamic custom filter looks like: - -.. code-block:: python - - def dynamic_data(data): - return Filters.create( - name="DynamicData", - func=lambda flt, callback_query: flt.data == callback_query.data, - data=data # "data" kwarg is accessed with "filter.data" - ) - -And its usage: - -.. code-block:: python - - @app.on_callback_query(dynamic_data(b"Pyrogram")) - def pyrogram_data(client, callback_query): - client.answer_callback_query(callback_query.id, "it works!") \ No newline at end of file diff --git a/docs/source/start/Setup.rst b/docs/source/start/Setup.rst deleted file mode 100644 index 45a40d16..00000000 --- a/docs/source/start/Setup.rst +++ /dev/null @@ -1,120 +0,0 @@ -Setup -===== - -Once you successfully `installed Pyrogram`_, you will still have to follow a few steps before you can actually use -the library to make API calls. This section provides all the information you need in order to set up a project -with Pyrogram. - -API Keys --------- - -The very first step requires you to obtain a valid Telegram API key (API id/hash pair). -If you already have one you can skip this step, otherwise: - -#. Visit https://my.telegram.org/apps and log in with your Telegram Account. -#. Fill out the form to register a new Telegram application. -#. Done. The API key consists of two parts: **App api_id** and **App api_hash**. - -.. important:: - - This API key is personal and must be kept secret. - -Configuration -------------- - -The API key obtained in the `previous step <#api-keys>`_ defines a token for your application allowing you to access -the Telegram database using the MTProto API — **it is therefore required for all authorizations of both users and bots**. - -Having it handy, it's time to configure your Pyrogram project. There are two ways to do so, and you can choose what -fits better for you: - -- Create a new ``config.ini`` file at the root of your working directory, copy-paste the following and replace the - **api_id** and **api_hash** values with your own. This is the preferred method because allows you to keep your - credentials out of your code without having to deal with how to load them: - - .. code-block:: ini - - [pyrogram] - api_id = 12345 - api_hash = 0123456789abcdef0123456789abcdef - -- Alternatively, you can pass your API key to Pyrogram by simply using the *api_id* and *api_hash* parameters of the - Client class. This way you can have full control on how to store and load your credentials: - - .. code-block:: python - - from pyrogram import Client - - app = Client( - "my_account", - api_id=12345, - api_hash="0123456789abcdef0123456789abcdef" - ) - -.. note:: - - From now on, the code snippets assume you are using the ``config.ini`` file, thus they won't show the *api_id* and - *api_hash* parameters usage to keep them as clean as possible. - -User Authorization ------------------- - -In order to use the API, Telegram requires that users be authorized via their phone numbers. -Pyrogram automatically manages this access, all you need to do is create an instance of the -:class:`Client ` class by passing to it a ``session_name`` of your choice (e.g.: "my_account") and call -the :meth:`run() ` method: - -.. code-block:: python - - from pyrogram import Client - - app = Client("my_account") - app.run() - -This starts an interactive shell asking you to input your **phone number** (including your `Country Code`_) -and the **phone code** you will receive: - -.. code-block:: text - - Enter phone number: +39********** - Is "+39**********" correct? (y/n): y - Enter phone code: 32768 - Logged in successfully as Dan - -After successfully authorizing yourself, a new file called ``my_account.session`` will be created allowing Pyrogram -executing API calls with your identity. This file will be loaded again when you restart your app, and as long as you -keep the session alive, Pyrogram won't ask you again to enter your phone number. - -.. important:: - - Your ``*.session`` files are personal and must be kept secret. - -.. note:: - - The code above does nothing except asking for credentials and keeping the client online, hit ``CTRL+C`` now to stop - your application and keep reading. - -Bot Authorization ------------------ - -Bots are a special kind of users that are authorized via their tokens (instead of phone numbers), which are created by -BotFather_. Bot tokens replace the users' phone numbers only — you still need to -`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, -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. - -.. code-block:: python - - from pyrogram import Client - - app = Client( - "pyrogrambot", - bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11" - ) - app.run() - -.. _installed Pyrogram: Installation.html -.. _`Country Code`: https://en.wikipedia.org/wiki/List_of_country_calling_codes -.. _BotFather: https://t.me/botfather \ No newline at end of file diff --git a/docs/source/start/Usage.rst b/docs/source/start/Usage.rst deleted file mode 100644 index 35ae79a0..00000000 --- a/docs/source/start/Usage.rst +++ /dev/null @@ -1,51 +0,0 @@ -Usage -===== - -Having your `project set up`_ and your account authorized_, it's time to start playing with the API. Let's start! - -High-level API --------------- - -The easiest and recommended way to interact with Telegram is via the high-level Pyrogram methods_ and types_, which are -named after the `Telegram Bot API`_. - -Here's a simple example: - -.. code-block:: python - - from pyrogram import Client - - app = Client("my_account") - - app.start() - - print(app.get_me()) - app.send_message("me", "Hi there! I'm using **Pyrogram**") - app.send_location("me", 51.500729, -0.124583) - app.send_sticker("me", "CAADBAADyg4AAvLQYAEYD4F7vcZ43AI") - - app.stop() - -You can also use Pyrogram in a context manager with the ``with`` statement. The Client will automatically -:meth:`start ` and :meth:`stop ` gracefully, even in case of unhandled -exceptions in your code: - -.. code-block:: python - - from pyrogram import Client - - app = Client("my_account") - - with app: - print(app.get_me()) - app.send_message("me", "Hi there! I'm using **Pyrogram**") - app.send_location("me", 51.500729, -0.124583) - app.send_sticker("me", "CAADBAADyg4AAvLQYAEYD4F7vcZ43AI") - -More examples on `GitHub `_. - -.. _project set up: Setup.html -.. _authorized: Setup.html#user-authorization -.. _Telegram Bot API: https://core.telegram.org/bots/api -.. _methods: ../pyrogram/Client.html#messages -.. _types: ../pyrogram/Types.html diff --git a/docs/source/start/auth.rst b/docs/source/start/auth.rst new file mode 100644 index 00000000..ca1ddd8f --- /dev/null +++ b/docs/source/start/auth.rst @@ -0,0 +1,68 @@ +Authorization +============= + +Once a :doc:`project is set up <../intro/setup>`, you will still have to follow a few steps before you can actually use Pyrogram to make +API calls. This section provides all the information you need in order to authorize yourself as user or bot. + +User Authorization +------------------ + +In order to use the API, Telegram requires that users be authorized via their phone numbers. +Pyrogram automatically manages this process, all you need to do is create an instance of the +:class:`~pyrogram.Client` class by passing to it a ``session_name`` of your choice (e.g.: "my_account") and call +the :meth:`~pyrogram.Client.run` method: + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + app.run() + +This starts an interactive shell asking you to input your **phone number** (including your `Country Code`_) and the +**phone code** you will receive in your devices that are already authorized or via SMS: + +.. code-block:: text + + Enter phone number: +39********** + Is "+39**********" correct? (y/n): y + Enter phone code: 32768 + Logged in successfully as Dan + +After successfully authorizing yourself, a new file called ``my_account.session`` will be created allowing Pyrogram to +execute API calls with your identity. This file will be loaded again when you restart your app, and as long as you +keep the session alive, Pyrogram won't ask you again to enter your phone number. + +.. important:: + + Your ``*.session`` files are personal and must be kept secret. + +.. note:: + + The code above does nothing except asking for credentials and keeping the client online, hit :guilabel:`CTRL+C` now + to stop your application and keep reading. + +Bot Authorization +----------------- + +Bots are a special kind of users that are authorized via their tokens (instead of phone numbers), which are created by +the `Bot Father`_. Bot tokens replace the users' phone numbers only — you still need to +:doc:`configure a Telegram API key <../intro/setup>` 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, +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 ``my_bot.session`` for the example below. + +.. code-block:: python + + from pyrogram import Client + + app = Client( + "my_bot", + bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11" + ) + + app.run() + +.. _Country Code: https://en.wikipedia.org/wiki/List_of_country_calling_codes +.. _Bot Father: https://t.me/botfather \ No newline at end of file diff --git a/docs/source/start/errors.rst b/docs/source/start/errors.rst new file mode 100644 index 00000000..cf329947 --- /dev/null +++ b/docs/source/start/errors.rst @@ -0,0 +1,91 @@ +Error Handling +============== + +Errors are inevitable when working with the API, and they must be correctly handled with ``try..except`` blocks in order +to control the behaviour of your application. Pyrogram errors all live inside the ``errors`` package: + +.. code-block:: python + + from pyrogram import errors + +RPCError +-------- + +The father of all errors is named ``RPCError``. This error exists in form of a Python exception which is directly +subclass-ed from Python's main ``Exception`` and is able to catch all Telegram API related errors. This error is raised +every time a method call against Telegram's API was unsuccessful. + +.. code-block:: python + + from pyrogram.errors import RPCError + +.. warning:: + + It must be noted that catching this error is bad practice, especially when no feedback is given (i.e. by + logging/printing the full error traceback), because it makes it impossible to understand what went wrong. + +Error Categories +---------------- + +The ``RPCError`` packs together all the possible errors Telegram could raise, but to make things tidier, Pyrogram +provides categories of errors, which are named after the common HTTP errors and subclass-ed from the RPCError: + +.. code-block:: python + + from pyrogram.errors import BadRequest, Forbidden, ... + +- `303 - SeeOther <../api/errors#seeother>`_ +- `400 - BadRequest <../api/errors#badrequest>`_ +- `401 - Unauthorized <../api/errors#unauthorized>`_ +- `403 - Forbidden <../api/errors#forbidden>`_ +- `406 - NotAcceptable <../api/errors#notacceptable>`_ +- `420 - Flood <../api/errors#flood>`_ +- `500 - InternalServerError <../api/errors#internalservererror>`_ + +Single Errors +------------- + +For a fine-grained control over every single error, Pyrogram does also expose errors that deal each with a specific +issue. For example: + +.. code-block:: python + + from pyrogram.errors import FloodWait + +These errors subclass directly from the category of errors they belong to, which in turn subclass from the father +RPCError, thus building a class of error hierarchy such as this: + +- RPCError + - BadRequest + - ``MessageEmpty`` + - ``UsernameOccupied`` + - ``...`` + - InternalServerError + - ``RpcCallFail`` + - ``InterDcCallError`` + - ``...`` + - ``...`` + +.. _Errors: api/errors + +Unknown Errors +-------------- + +In case Pyrogram does not know anything yet about a specific error, it raises a special ``520 - UnknownError`` exception +and logs it in the ``unknown_errors.txt`` file. Users are invited to report these unknown errors. + +Errors with Values +------------------ + +Exception objects may also contain some informative values. For example, ``FloodWait`` holds the amount of seconds you +have to wait before you can try again. The value is always stored in the ``x`` field of the returned exception object: + +.. code-block:: python + + import time + from pyrogram.errors import FloodWait + + try: + ... + except FloodWait as e: + time.sleep(e.x) # Wait before trying again diff --git a/docs/source/start/invoking.rst b/docs/source/start/invoking.rst new file mode 100644 index 00000000..5cb6817b --- /dev/null +++ b/docs/source/start/invoking.rst @@ -0,0 +1,81 @@ +Calling Methods +=============== + +At this point, we have successfully :doc:`installed Pyrogram <../intro/install>` and :doc:`authorized ` our +account; we are now aiming towards the core of the library. It's time to start playing with the API! + +Basic Usage +----------- + +Making API method calls with Pyrogram is very simple. Here's an example we are going to examine: + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + app.start() + + print(app.get_me()) + app.send_message("me", "Hi, it's me!") + app.send_location("me", 51.500729, -0.124583) + app.send_sticker("me", "CAADBAADyg4AAvLQYAEYD4F7vcZ43AI") + + app.stop() + +#. Let's begin by importing the Client class from the Pyrogram package: + + .. code-block:: python + + from pyrogram import Client + +#. Now instantiate a new Client object, "my_account" is a session name of your choice: + + .. code-block:: python + + app = Client("my_account") + +#. To actually make use of any method, the client has to be started first: + + .. code-block:: python + + app.start() + +#. Now, you can call any method you like: + + .. code-block:: python + + print(app.get_me()) # Print information about yourself + + # Send messages to yourself: + app.send_message("me", "Hi!") # Text message + app.send_location("me", 51.500729, -0.124583) # Location + app.send_sticker("me", "CAADBAADyg4AAvLQYAEYD4F7vcZ43AI") # Sticker + +#. Finally, when done, simply stop the client: + + .. code-block:: python + + app.stop() + +Context Manager +--------------- + +You can also use Pyrogram's Client in a context manager with the ``with`` statement. The client will automatically +:meth:`~pyrogram.Client.start` and :meth:`~pyrogram.Client.stop` gracefully, even in case of unhandled exceptions in +your code. The example above can be therefore rewritten in a much nicer way: + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + with app: + print(app.get_me()) + app.send_message("me", "Hi there! I'm using **Pyrogram**") + app.send_location("me", 51.500729, -0.124583) + app.send_sticker("me", "CAADBAADyg4AAvLQYAEYD4F7vcZ43AI") + +More examples can be found on `GitHub `_. diff --git a/docs/source/start/updates.rst b/docs/source/start/updates.rst new file mode 100644 index 00000000..9ac428b3 --- /dev/null +++ b/docs/source/start/updates.rst @@ -0,0 +1,109 @@ +Handling Updates +================ + +Calling :doc:`API methods ` sequentially is cool, but how to react when, for example, a new message arrives? +This page deals with updates and how to handle such events in Pyrogram. Let's have a look at how they work. + +Defining Updates +---------------- + +First, let's define what are these updates. As hinted already, updates are simply events that happen in your Telegram +account (incoming messages, new members join, bot button presses, etc...), which are meant to notify you about a new +specific state that has changed. These updates are handled by registering one or more callback functions in your app +using :doc:`Handlers <../api/handlers>`. + +Each handler deals with a specific event and once a matching update arrives from Telegram, your registered callback +function will be called back by the framework and its body executed. + +Registering a Handler +--------------------- + +To explain how handlers work let's have a look at the most used one, the :class:`~pyrogram.MessageHandler`, which will +be in charge for handling :class:`~pyrogram.Message` updates coming from all around your chats. Every other handler shares +the same setup logic; you should not have troubles settings them up once you learn from this section. + +Using add_handler() +------------------- + +The :meth:`~pyrogram.Client.add_handler` method takes any handler instance that wraps around your defined callback +function and registers it in your Client. Here's a full example that prints out the content of a message as soon as it +arrives: + +.. code-block:: python + + from pyrogram import Client, MessageHandler + + + def my_function(client, message): + print(message) + + + app = Client("my_account") + + my_handler = MessageHandler(my_function) + app.add_handler(my_handler) + + app.run() + +#. Let's examine these four new pieces. First one: a callback function we defined which accepts two arguments - + *(client, message)*. This will be the function that gets executed every time a new message arrives and Pyrogram will + call that function by passing the client instance and the new message instance as argument. + + .. code-block:: python + + def my_function(client, message): + print(message) + +#. Second one: the :class:`~pyrogram.MessageHandler`. This object tells Pyrogram the function we defined above must + only handle updates that are in form of a :class:`~pyrogram.Message`: + + .. code-block:: python + + my_handler = MessageHandler(my_function) + +#. Third: the method :meth:`~pyrogram.Client.add_handler`. This method is used to actually register the handler and let + Pyrogram know it needs to be taken into consideration when new updates arrive and the internal dispatching phase + begins. + + .. code-block:: python + + app.add_handler(my_handler) + +#. Last one, the :meth:`~pyrogram.Client.run` method. What this does is simply call :meth:`~pyrogram.Client.start` and + a special method :meth:`~pyrogram.Client.idle` that keeps your main scripts alive until you press ``CTRL+C``; the + client will be automatically stopped after that. + + .. code-block:: python + + app.run() + +Using Decorators +---------------- + +All of the above will become quite verbose, especially in case you have lots of handlers to register. A much nicer way +to do so is by decorating your callback function with the :meth:`~pyrogram.Client.on_message` decorator. + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + + @app.on_message() + def my_handler(client, message): + print(message) + + + app.run() + + +.. note:: + + Due to how these decorators work in Pyrogram, they will wrap your defined callback function in a tuple consisting of + ``(handler, group)``; this will be the value held by your function identifier (e.g.: *my_function* from the example + above). + + In case, for some reason, you want to get your own function back after it has been decorated, you need to access + ``my_function[0].callback``, that is, the *callback* field of the *handler* object which is the first element in the + tuple, accessed by bracket notation *[0]*. diff --git a/docs/source/support-pyrogram.rst b/docs/source/support-pyrogram.rst new file mode 100644 index 00000000..81a0e533 --- /dev/null +++ b/docs/source/support-pyrogram.rst @@ -0,0 +1,27 @@ +Support Pyrogram +================ + +Pyrogram is free and open source software, and thus powered by your love and support! If you like the project and have +found it to be useful, give Pyrogram a `Star on GitHub`_. Your appreciation means a lot and helps staying motivated. + +.. raw:: html + + Star +

+ +Donate +------ + +As a developer, you probably understand that "open source" doesn't mean "free work". A lot of time and resources has +been put into the project and if you'd like to tip me for Pyrogram -- or any of my `other works`_ -- you can use the +PayPal button below. Thank you! + +.. image:: https://i.imgur.com/fasFTzK.png + :target: https://paypal.me/delivrance + :width: 128 + +--- `Dan`_ + +.. _Star on GitHub: https://github.com/pyrogram/pyrogram +.. _other works: https://github.com/delivrance +.. _Dan: https://t.me/haskell diff --git a/docs/source/resources/AdvancedUsage.rst b/docs/source/topics/advanced-usage.rst similarity index 66% rename from docs/source/resources/AdvancedUsage.rst rename to docs/source/topics/advanced-usage.rst index 8b722b2a..9c794be0 100644 --- a/docs/source/resources/AdvancedUsage.rst +++ b/docs/source/topics/advanced-usage.rst @@ -1,8 +1,9 @@ Advanced Usage ============== -Pyrogram's API, which consists of well documented convenience methods_ and facade types_, exists to provide a much -easier interface to the undocumented and often confusing Telegram API. +Pyrogram's API, which consists of well documented convenience :doc:`methods <../api/methods>` and facade +:doc:`types <../api/types>`, exists to provide a much easier interface to the undocumented and often confusing Telegram +API. In this section, you'll be shown the alternative way of communicating with Telegram using Pyrogram: the main "raw" Telegram API with its functions and types. @@ -11,7 +12,7 @@ Telegram Raw API ---------------- If you can't find a high-level method for your needs or if you want complete, low-level access to the whole -Telegram API, you have to use the raw :mod:`functions ` and :mod:`types `. +Telegram API, you have to use the raw :mod:`~pyrogram.api.functions` and :mod:`~pyrogram.api.types`. As already hinted, raw functions and types can be really confusing, mainly because people don't realize soon enough they accept *only* the right types and that all required parameters must be filled in. This section will therefore explain @@ -21,24 +22,25 @@ some pitfalls to take into consideration when working with the raw API. Every available high-level methods in Pyrogram is built on top of these raw functions. - Nothing stops you from using the raw functions only, but they are rather complex and `plenty of them`_ are already - re-implemented by providing a much simpler and cleaner interface which is very similar to the Bot API (yet much more - powerful). + Nothing stops you from using the raw functions only, but they are rather complex and + :doc:`plenty of them <../api/methods>` are already re-implemented by providing a much simpler and cleaner interface + which is very similar to the Bot API (yet much more powerful). If you think a raw function should be wrapped and added as a high-level method, feel free to ask in our Community_! Invoking Functions ^^^^^^^^^^^^^^^^^^ -Unlike the methods_ found in Pyrogram's API, which can be called in the usual simple way, functions to be invoked from -the raw Telegram API have a different way of usage and are more complex. +Unlike the :doc:`methods <../api/methods>` found in Pyrogram's API, which can be called in the usual simple way, +functions to be invoked from the raw Telegram API have a different way of usage and are more complex. -First of all, both `raw functions`_ and `raw types`_ live in their respective packages (and sub-packages): -``pyrogram.api.functions``, ``pyrogram.api.types``. They all exist as Python classes, meaning you need to create an -instance of each every time you need them and fill them in with the correct values using named arguments. +First of all, both :doc:`raw functions <../telegram/functions/index>` and :doc:`raw types <../telegram/types/index>` live in their +respective packages (and sub-packages): ``pyrogram.api.functions``, ``pyrogram.api.types``. They all exist as Python +classes, meaning you need to create an instance of each every time you need them and fill them in with the correct +values using named arguments. -Next, to actually invoke the raw function you have to use the :meth:`send() ` method provided by -the Client class and pass the function object you created. +Next, to actually invoke the raw function you have to use the :meth:`~pyrogram.Client.send` method provided by the +Client class and pass the function object you created. Here's some examples: @@ -101,12 +103,12 @@ sending messages with IDs only thanks to cached access hashes. There are three different InputPeer types, one for each kind of Telegram entity. Whenever an InputPeer is needed you must pass one of these: - - `InputPeerUser `_ - Users - - `InputPeerChat `_ - Basic Chats - - `InputPeerChannel `_ - Either Channels or Supergroups +- :class:`~pyrogram.api.types.InputPeerUser` - Users +- :class:`~pyrogram.api.types.InputPeerChat` - Basic Chats +- :class:`~pyrogram.api.types.InputPeerChannel` - Either Channels or Supergroups But you don't necessarily have to manually instantiate each object because, luckily for you, Pyrogram already provides -:meth:`resolve_peer() ` as a convenience utility method that returns the correct InputPeer +:meth:`~pyrogram.Client.resolve_peer` as a convenience utility method that returns the correct InputPeer by accepting a peer ID only. Another thing to take into consideration about chat IDs is the way they are represented: they are all integers and @@ -118,19 +120,11 @@ kind of ID. For example, given the ID *123456789*, here's how Pyrogram can tell entities apart: - - ``+ID`` User: *123456789* - - ``-ID`` Chat: *-123456789* - - ``-100ID`` Channel (and Supergroup): *-100123456789* +- ``+ID`` User: *123456789* +- ``-ID`` Chat: *-123456789* +- ``-100ID`` Channel or Supergroup: *-100123456789* So, every time you take a raw ID, make sure to translate it into the correct ID when you want to use it with an high-level method. - - - -.. _methods: ../pyrogram/Client.html#messages -.. _types: ../pyrogram/Types.html -.. _plenty of them: ../pyrogram/Client.html#messages -.. _raw functions: ../pyrogram/functions -.. _raw types: ../pyrogram/types -.. _Community: https://t.me/PyrogramChat \ No newline at end of file +.. _Community: https://t.me/Pyrogram \ No newline at end of file diff --git a/docs/source/resources/AutoAuthorization.rst b/docs/source/topics/auto-auth.rst similarity index 97% rename from docs/source/resources/AutoAuthorization.rst rename to docs/source/topics/auto-auth.rst index b5f3a94a..abeaf1fb 100644 --- a/docs/source/resources/AutoAuthorization.rst +++ b/docs/source/topics/auto-auth.rst @@ -3,7 +3,7 @@ Auto Authorization Manually writing phone number, phone code and password on the terminal every time you want to login can be tedious. Pyrogram is able to automate both **Log In** and **Sign Up** processes, all you need to do is pass the relevant -parameters when creating a new :class:`Client `. +parameters when creating a new :class:`~pyrogram.Client`. .. note:: If you omit any of the optional parameter required for the authorization, Pyrogram will ask you to manually write it. For instance, if you don't want to set a ``last_name`` when creating a new account you diff --git a/docs/source/resources/BotsInteraction.rst b/docs/source/topics/bots-interaction.rst similarity index 82% rename from docs/source/resources/BotsInteraction.rst rename to docs/source/topics/bots-interaction.rst index de7925a2..ad993050 100644 --- a/docs/source/resources/BotsInteraction.rst +++ b/docs/source/topics/bots-interaction.rst @@ -7,8 +7,7 @@ Inline Bots ----------- - If a bot accepts inline queries, you can call it by using - :meth:`get_inline_bot_results() ` to get the list of its inline results - for a query: + :meth:`~pyrogram.Client.get_inline_bot_results` to get the list of its inline results for a query: .. code-block:: python @@ -24,7 +23,7 @@ Inline Bots results list. - After you retrieved the bot results, you can use - :meth:`send_inline_bot_result() ` to send a chosen result to any chat: + :meth:`~pyrogram.Client.send_inline_bot_result` to send a chosen result to any chat: .. code-block:: python diff --git a/docs/source/resources/ConfigurationFile.rst b/docs/source/topics/config-file.rst similarity index 81% rename from docs/source/resources/ConfigurationFile.rst rename to docs/source/topics/config-file.rst index 2a50277f..a28025db 100644 --- a/docs/source/resources/ConfigurationFile.rst +++ b/docs/source/topics/config-file.rst @@ -1,14 +1,14 @@ Configuration File ================== -As already mentioned in previous sections, Pyrogram can be configured by the use of an INI file. -This page explains how this file is structured in Pyrogram, how to use it and why. +As already mentioned in previous pages, Pyrogram can be configured by the use of an INI file. +This page explains how this file is structured, how to use it and why. Introduction ------------ The idea behind using a configuration file is to help keeping your code free of private settings information such as -the API Key and Proxy without having you to even deal with how to load such settings. The configuration file, usually +the API Key and Proxy, without having you to even deal with how to load such settings. The configuration file, usually referred as ``config.ini`` file, is automatically loaded from the root of your working directory; all you need to do is fill in the necessary parts. @@ -54,7 +54,7 @@ The ``[pyrogram]`` section contains your Telegram API credentials: *api_id* and api_id = 12345 api_hash = 0123456789abcdef0123456789abcdef -`More info about API Key. <../start/Setup.html#configuration>`_ +`More info about API Key. <../intro/setup#api-keys>`_ Proxy ^^^^^ @@ -70,7 +70,7 @@ The ``[proxy]`` section contains settings about your SOCKS5 proxy. username = password = -`More info about SOCKS5 Proxy. `_ +`More info about SOCKS5 Proxy. `_ Plugins ^^^^^^^ @@ -87,4 +87,4 @@ The ``[plugins]`` section contains settings about Smart Plugins. exclude = module fn2 -`More info about Smart Plugins. `_ +`More info about Smart Plugins. `_ diff --git a/docs/source/topics/create-filters.rst b/docs/source/topics/create-filters.rst new file mode 100644 index 00000000..6cb33a50 --- /dev/null +++ b/docs/source/topics/create-filters.rst @@ -0,0 +1,93 @@ +Creating Filters +================ + +Pyrogram already provides lots of built-in :class:`~pyrogram.Filters` to work with, but in case you can't find +a specific one for your needs or want to build a custom filter by yourself (to be used in a different kind of handler, +for example) you can use :meth:`~pyrogram.Filters.create`. + +.. note:: + + At the moment, the built-in filters are intended to be used with the :class:`~pyrogram.MessageHandler` only. + +Custom Filters +-------------- + +An example to demonstrate how custom filters work is to show how to create and use one for the +:class:`~pyrogram.CallbackQueryHandler`. Note that callback queries updates are only received by bots as result of a +user pressing an inline button attached to the bot's message; create and :doc:`authorize your bot <../start/auth>`, +then send a message with an inline keyboard to yourself. This allows you to test your filter by pressing the inline +button: + +.. code-block:: python + + from pyrogram import InlineKeyboardMarkup, InlineKeyboardButton + + app.send_message( + "username", # Change this to your username or id + "Pyrogram's custom filter test", + reply_markup=InlineKeyboardMarkup( + [[InlineKeyboardButton("Press me", "pyrogram")]] + ) + ) + +Basic Filters +------------- + +For this basic filter we will be using only the first two parameters of :meth:`~pyrogram.Filters.create`. + +The code below creates a simple filter for hardcoded, static callback data. This filter will only allow callback queries +containing "Pyrogram" as data, that is, the function *func* you pass returns True in case the callback query data +equals to ``"Pyrogram"``. + +.. code-block:: python + + static_data = Filters.create( + name="StaticdData", + func=lambda flt, query: query.data == "Pyrogram" + ) + +The ``lambda`` operator in python is used to create small anonymous functions and is perfect for this example, the same +could be achieved with a normal function, but we don't really need it as it makes sense only inside the filter's scope: + +.. code-block:: python + + def func(flt, query): + return query.data == "Pyrogram" + + static_data = Filters.create( + name="StaticData", + func=func + ) + +The filter usage remains the same: + +.. code-block:: python + + @app.on_callback_query(static_data) + def pyrogram_data(_, query): + query.answer("it works!") + +Filters with Arguments +---------------------- + +A much cooler filter would be one that accepts "Pyrogram" or any other data as argument at usage time. +A dynamic filter like this will make use of the third parameter of :meth:`~pyrogram.Filters.create`. + +This is how a dynamic custom filter looks like: + +.. code-block:: python + + def dynamic_data(data): + return Filters.create( + name="DynamicData", + func=lambda flt, query: flt.data == query.data, + data=data # "data" kwarg is accessed with "flt.data" + ) + +And its usage: + +.. code-block:: python + + @app.on_callback_query(dynamic_data("Pyrogram")) + def pyrogram_data(_, query): + query.answer("it works!") diff --git a/docs/source/topics/debugging.rst b/docs/source/topics/debugging.rst new file mode 100644 index 00000000..153c0927 --- /dev/null +++ b/docs/source/topics/debugging.rst @@ -0,0 +1,135 @@ +Debugging +========= + +When working with the API, chances are you'll stumble upon bugs, get stuck and start wondering how to continue. Nothing +to actually worry about -- that's normal -- and luckily for you, Pyrogram provides some commodities to help you in this. + +Caveman Debugging +----------------- + + *The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.* + + -- Brian Kernighan, "Unix for Beginners" (1979) + +Adding ``print()`` statements in crucial parts of your code is by far the most ancient, yet efficient technique for +debugging programs, especially considering the concurrent nature of the framework itself. Pyrogram goodness in this +respect comes with the fact that any object can be nicely printed just by calling ``print(obj)``, thus giving to you +an insight of all its inner details. + +Consider the following code: + +.. code-block:: python + + dan = app.get_users("haskell") + print(dan) # User + +This will show a JSON representation of the object returned by :meth:`~pyrogram.Client.get_users`, which is a +:class:`~pyrogram.User` instance, in this case. The output on your terminal will be something similar to this: + +.. code-block:: json + + { + "_": "pyrogram.User", + "id": 23122162, + "is_self": false, + "is_contact": false, + "is_mutual_contact": false, + "is_deleted": false, + "is_bot": false, + "is_verified": false, + "is_restricted": false, + "is_support": false, + "is_scam": false, + "first_name": "Dan", + "status": { + "_": "pyrogram.UserStatus", + "user_id": 23122162, + "recently": true + }, + "username": "haskell", + "language_code": "en", + "photo": { + "_": "pyrogram.ChatPhoto", + "small_file_id": "AQADBAAD8tBgAQAEJjCxGgAEo5IBAAIC", + "big_file_id": "AQADBAAD8tBgAQAEJjCxGgAEpZIBAAEBAg" + } + } + +As you've probably guessed already, Pyrogram objects can be nested. That's how compound data are built, and nesting +keeps going until we are left with base data types only, such as ``str``, ``int``, ``bool``, etc. + +Accessing Attributes +-------------------- + +Even though you see a JSON output, it doesn't mean we are dealing with dictionaries; in fact, all Pyrogram types are +full-fledged Python objects and the correct way to access any attribute of them is by using the dot notation ``.``: + +.. code-block:: python + + dan_photo = dan.photo + print(dan_photo) # ChatPhoto + +.. code-block:: json + + { + "_": "pyrogram.ChatPhoto", + "small_file_id": "AQADBAAD8tBgAQAEJjCxGgAEo5IBAAIC", + "big_file_id": "AQADBAAD8tBgAQAEJjCxGgAEpZIBAAEBAg" + } + +However, the bracket notation ``[]`` is also supported, but its usage is discouraged: + +.. warning:: + + Bracket notation in Python is not commonly used for getting/setting object attributes. While it works for Pyrogram + objects, it might not work for anything else and you should not rely on this. + +.. code-block:: python + + dan_photo_big = dan["photo"]["big_file_id"] + print(dan_photo_big) # str + +.. code-block:: text + + AQADBAAD8tBgAQAEJjCxGgAEpZIBAAEBAg + +Checking an Object's Type +------------------------- + +Another thing worth talking about is how to tell and check for an object's type. + +As you noticed already, when printing an object you'll see the special attribute ``"_"``. This is just a visual thing +useful to show humans the object type, but doesn't really exist anywhere; any attempt in accessing it will lead to an +error. The correct way to get the object type is by using the built-in function ``type()``: + +.. code-block:: python + + dan_status = dan.status + print(type(dan_status)) + +.. code-block:: text + + + +And to check if an object is an instance of a given class, you use the built-in function ``isinstance()``: + +.. code-block:: python + :name: this-py + + from pyrogram import UserStatus + + dan_status = dan.status + print(isinstance(dan_status, UserStatus)) + +.. code-block:: text + + True + +.. raw:: html + + \ No newline at end of file diff --git a/docs/source/resources/MoreOnUpdates.rst b/docs/source/topics/more-on-updates.rst similarity index 89% rename from docs/source/resources/MoreOnUpdates.rst rename to docs/source/topics/more-on-updates.rst index f3658c6e..f23e692e 100644 --- a/docs/source/resources/MoreOnUpdates.rst +++ b/docs/source/topics/more-on-updates.rst @@ -1,7 +1,8 @@ More on Updates =============== -Here we'll show some advanced usages when working with `update handlers`_ and `filters`_. +Here we'll show some advanced usages when working with :doc:`update handlers <../start/updates>` and +:doc:`filters `. Handler Groups -------------- @@ -28,7 +29,7 @@ For example, take these two handlers: print("Just Text") Here, ``just_text`` is never executed because ``text_or_sticker``, which has been registered first, already handles -texts (``Filters.text`` is shared and conflicting). To enable it, register the function using a different group: +texts (``Filters.text`` is shared and conflicting). To enable it, register the handler using a different group: .. code-block:: python @@ -36,7 +37,7 @@ texts (``Filters.text`` is shared and conflicting). To enable it, register the f def just_text(client, message): print("Just Text") -Or, if you want ``just_text`` to be fired *before* ``text_or_sticker`` (note ``-1``, which is less than ``0``): +Or, if you want ``just_text`` to be executed *before* ``text_or_sticker`` (note ``-1``, which is less than ``0``): .. code-block:: python @@ -44,7 +45,7 @@ Or, if you want ``just_text`` to be fired *before* ``text_or_sticker`` (note ``- def just_text(client, message): print("Just Text") -With :meth:`add_handler() ` (without decorators) the same can be achieved with: +With :meth:`~pyrogram.Client.add_handler` (without decorators) the same can be achieved with: .. code-block:: python @@ -151,9 +152,9 @@ Continue Propagation As opposed to `stopping the update propagation <#stop-propagation>`_ and also as an alternative to the `handler groups <#handler-groups>`_, you can signal the internal dispatcher to continue the update propagation within -**the same group** regardless of the next handler's filters. This allows you to register multiple handlers with -overlapping filters in the same group; to let the dispatcher process the next handler you can do *one* of the following -in each handler you want to grant permission to continue: +**the same group** despite having conflicting filters in the next registered handler. This allows you to register +multiple handlers with overlapping filters in the same group; to let the dispatcher process the next handler you can do +*one* of the following in each handler you want to grant permission to continue: - Call the update's bound-method ``.continue_propagation()`` (preferred way). - Manually ``raise ContinuePropagation`` exception (more suitable for raw updates only). @@ -217,6 +218,3 @@ The output of both (equivalent) examples will be: 0 1 2 - -.. _`update handlers`: UpdateHandling.html -.. _`filters`: UsingFilters.html \ No newline at end of file diff --git a/docs/source/topics/mtproto-vs-botapi.rst b/docs/source/topics/mtproto-vs-botapi.rst new file mode 100644 index 00000000..cad84251 --- /dev/null +++ b/docs/source/topics/mtproto-vs-botapi.rst @@ -0,0 +1,110 @@ +MTProto vs. Bot API +=================== + +Pyrogram is a framework that acts as a fully-fledged Telegram client based on MTProto, and this very feature makes it +already superior to, what is usually called, the official Bot API, in many respects. This page will therefore show you +why Pyrogram might be a better choice for your project by comparing the two APIs, but first, let's make it clear what +actually is the MTProto and the Bot API. + +What is the MTProto API? +------------------------ + +`MTProto`_, took alone, is the name of the custom-made, open and encrypted communication protocol created by Telegram +itself --- it's the only protocol used to exchange information between a client and the actual Telegram servers. + +The MTProto **API** on the other hand, is what people, for convenience, call the main Telegram API as a whole. This API +is able to authorize both users and bots and is built on top of the MTProto encryption protocol by means of +`binary data serialized`_ in a specific way, as described by the `TL language`_, and delivered using UDP, TCP or even +HTTP as transport-layer protocol. + +.. _MTProto: https://core.telegram.org/mtproto +.. _binary data serialized: https://core.telegram.org/mtproto/serialize +.. _TL language: https://core.telegram.org/mtproto/TL + +What is the Bot API? +-------------------- + +The `Bot API`_ is an HTTP(S) interface for building normal bots using a sub-set of the main MTProto API. Bots are special +accounts that are authorized via tokens instead of phone numbers. The Bot API is built yet again on top of the main +Telegram API, but runs on an intermediate server application that in turn communicates with the actual Telegram servers +using MTProto. + +.. figure:: https://i.imgur.com/C108qkX.png + :align: center + +.. _Bot API: https://core.telegram.org/bots/api + +Advantages of the MTProto API +----------------------------- + +Here is a list of all the advantages in using MTProto-based libraries -- such as Pyrogram -- instead of the official +HTTP Bot API. Using Pyrogram you can: + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Authorize both user and bot identities** + - :guilabel:`--` The Bot API only allows bot accounts + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Upload & download any file, up to 1500 MB each (~1.5 GB)** + - :guilabel:`--` The Bot API allows uploads and downloads of files only up to 50 MB / 20 MB in size (respectively). + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Has less overhead due to direct connections to Telegram** + - :guilabel:`--` The Bot API uses an intermediate server to handle HTTP requests before they are sent to the actual + Telegram servers. + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Run multiple sessions at once, up to 10 per account (either bot or user)** + - :guilabel:`--` The Bot API intermediate server will terminate any other session in case you try to use the same + bot again in a parallel connection. + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Has much more detailed types and powerful methods** + - :guilabel:`--` The Bot API types often miss some useful information about Telegram entities and some of the + methods are limited as well. + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Get information about any public chat by usernames, even if not a member** + - :guilabel:`--` The Bot API simply doesn't support this + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Obtain information about any message existing in a chat using their ids** + - :guilabel:`--` The Bot API simply doesn't support this + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Retrieve the whole chat members list of either public or private chats** + - :guilabel:`--` The Bot API simply doesn't support this + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Receive extra updates, such as the one about a user name change** + - :guilabel:`--` The Bot API simply doesn't support this + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Has more meaningful errors in case something went wrong** + - :guilabel:`--` The Bot API reports less detailed errors + +.. hlist:: + :columns: 1 + + - :guilabel:`+` **Get API version updates, and thus new features, sooner** + - :guilabel:`--` The Bot API is simply slower in implementing new features diff --git a/docs/source/resources/SOCKS5Proxy.rst b/docs/source/topics/proxy.rst similarity index 100% rename from docs/source/resources/SOCKS5Proxy.rst rename to docs/source/topics/proxy.rst diff --git a/docs/source/topics/serialize.rst b/docs/source/topics/serialize.rst new file mode 100644 index 00000000..a238f8dc --- /dev/null +++ b/docs/source/topics/serialize.rst @@ -0,0 +1,52 @@ +Object Serialization +==================== + +Serializing means converting a Pyrogram object, which exists as Python class instance, to a text string that can be +easily shared and stored anywhere. Pyrogram provides two formats for serializing its objects: one good looking for +humans and another more compact for machines that is able to recover the original structures. + +For Humans - str(obj) +--------------------- + +If you want a nicely formatted, human readable JSON representation of any object in the API -- namely, any object from +:doc:`Pyrogram types <../api/types>`, :doc:`raw functions <../telegram/functions/index>` and +:doc:`raw types <../telegram/types/index>` -- you can use use ``str(obj)``. + +.. code-block:: python + + ... + + with app: + r = app.get_chat("haskell") + + print(str(r)) + +.. tip:: + + When using ``print()`` you don't actually need to use ``str()`` on the object because it is called automatically, we + have done that above just to show you how to explicitly convert a Pyrogram object to JSON. + +For Machines - repr(obj) +------------------------ + +If you want to share or store objects for future references in a more compact way, you can use ``repr(obj)``. While +still pretty much readable, this format is not intended for humans. The advantage of this format is that once you +serialize your object, you can use ``eval()`` to get back the original structure; just make sure to ``import pyrogram``, +as the process requires the package to be in scope. + +.. code-block:: python + + import pyrogram + + ... + + with app: + r = app.get_chat("haskell") + + print(repr(r)) + print(eval(repr(r)) == r) # True + +.. note:: + + Type definitions are subject to changes between versions. You should make sure to store and load objects using the + same Pyrogram version. \ No newline at end of file diff --git a/docs/source/resources/CustomizeSessions.rst b/docs/source/topics/session-settings.rst similarity index 75% rename from docs/source/resources/CustomizeSessions.rst rename to docs/source/topics/session-settings.rst index 77765287..dd777bda 100644 --- a/docs/source/resources/CustomizeSessions.rst +++ b/docs/source/topics/session-settings.rst @@ -1,24 +1,23 @@ -Customize Sessions -================== +Session Settings +================ As you may probably know, Telegram allows users (and bots) having more than one session (authorizations) registered in the system at the same time. Briefly explaining, sessions are simply new logins in your account. They can be reviewed in the settings of an official -app (or by invoking `GetAuthorizations <../functions/account/GetAuthorizations.html>`_ with Pyrogram). They store some -useful information such as the client who's using them and from which country and IP address. +app (or by invoking :class:`~pyrogram.api.functions.account.GetAuthorizations` with Pyrogram). They +store some useful information such as the client who's using them and from which country and IP address. - -.. figure:: https://i.imgur.com/lzGPCdZ.png - :width: 70% +.. figure:: https://i.imgur.com/YaqtMLO.png + :width: 600 :align: center - **A Pyrogram session running on Linux, Python 3.6.** + **A Pyrogram session running on Linux, Python 3.7.** That's how a session looks like on the Android app, showing the three main pieces of information. -- ``app_version``: **Pyrogram 🔥 0.7.5** -- ``device_model``: **CPython 3.6.5** +- ``app_version``: **Pyrogram 0.13.0** +- ``device_model``: **CPython 3.7.2** - ``system_version``: **Linux 4.15.0-23-generic** Set Custom Values diff --git a/docs/source/resources/SmartPlugins.rst b/docs/source/topics/smart-plugins.rst similarity index 87% rename from docs/source/resources/SmartPlugins.rst rename to docs/source/topics/smart-plugins.rst index 6f266590..8e59b971 100644 --- a/docs/source/resources/SmartPlugins.rst +++ b/docs/source/topics/smart-plugins.rst @@ -30,7 +30,7 @@ after importing your modules, like this: handlers.py main.py -- ``handlers.py`` +- ``handlers.py`` .. code-block:: python @@ -41,7 +41,7 @@ after importing your modules, like this: def echo_reversed(client, message): message.reply(message.text[::-1]) -- ``main.py`` +- ``main.py`` .. code-block:: python @@ -65,8 +65,8 @@ after importing your modules, like this: app.run() This is already nice and doesn't add *too much* boilerplate code, but things can get boring still; you have to -manually ``import``, manually :meth:`add_handler ` and manually instantiate each -:obj:`MessageHandler ` object because **you can't use those cool decorators** for your +manually ``import``, manually :meth:`~pyrogram.Client.add_handler` and manually instantiate each +:class:`~pyrogram.MessageHandler` object because **you can't use those cool decorators** for your functions. So, what if you could? Smart Plugins solve this issue by taking care of handlers registration automatically. Using Smart Plugins @@ -80,7 +80,7 @@ Setting up your Pyrogram project to accommodate Smart Plugins is pretty straight .. note:: - This is the same example application `as shown above <#introduction>`_, written using the Smart Plugin system. + This is the same example application as shown above, written using the Smart Plugin system. .. code-block:: text :emphasize-lines: 2, 3 @@ -91,7 +91,7 @@ Setting up your Pyrogram project to accommodate Smart Plugins is pretty straight config.ini main.py -- ``plugins/handlers.py`` +- ``plugins/handlers.py`` .. code-block:: python :emphasize-lines: 4, 9 @@ -108,14 +108,14 @@ Setting up your Pyrogram project to accommodate Smart Plugins is pretty straight def echo_reversed(client, message): message.reply(message.text[::-1]) -- ``config.ini`` +- ``config.ini`` .. code-block:: ini [plugins] root = plugins -- ``main.py`` +- ``main.py`` .. code-block:: python @@ -156,7 +156,7 @@ found inside each module will be, instead, loaded in the order they are defined, .. note:: Remember: there can be at most one handler, within a group, dealing with a specific update. Plugins with overlapping - filters included a second time will not work. Learn more at `More on Updates `_. + filters included a second time will not work. Learn more at :doc:`More on Updates `. This default loading behaviour is usually enough, but sometimes you want to have more control on what to include (or exclude) and in which exact order to load plugins. The way to do this is to make use of ``include`` and ``exclude`` @@ -199,8 +199,8 @@ also organized in subfolders: ... ... -- Load every handler from every module, namely *plugins0.py*, *plugins1.py* and *plugins2.py* in alphabetical order - (files) and definition order (handlers inside files): +- Load every handler from every module, namely *plugins0.py*, *plugins1.py* and *plugins2.py* in alphabetical order + (files) and definition order (handlers inside files): Using *config.ini* file: @@ -217,7 +217,7 @@ also organized in subfolders: Client("my_account", plugins=plugins).run() -- Load only handlers defined inside *plugins2.py* and *plugins0.py*, in this order: +- Load only handlers defined inside *plugins2.py* and *plugins0.py*, in this order: Using *config.ini* file: @@ -243,7 +243,7 @@ also organized in subfolders: Client("my_account", plugins=plugins).run() -- Load everything except the handlers inside *plugins2.py*: +- Load everything except the handlers inside *plugins2.py*: Using *config.ini* file: @@ -264,7 +264,7 @@ also organized in subfolders: Client("my_account", plugins=plugins).run() -- Load only *fn3*, *fn1* and *fn2* (in this order) from *plugins1.py*: +- Load only *fn3*, *fn1* and *fn2* (in this order) from *plugins1.py*: Using *config.ini* file: @@ -288,16 +288,15 @@ also organized in subfolders: Load/Unload Plugins at Runtime ------------------------------ -In the `previous section <#specifying-the-plugins-to-include>`_ we've explained how to specify which plugins to load and -which to ignore before your Client starts. Here we'll show, instead, how to unload and load again a previously -registered plugin at runtime. +In the previous section we've explained how to specify which plugins to load and which to ignore before your Client +starts. Here we'll show, instead, how to unload and load again a previously registered plugin at runtime. Each function decorated with the usual ``on_message`` decorator (or any other decorator that deals with Telegram updates ) will be modified in such a way that, when you reference them later on, they will be actually pointing to a tuple of *(handler: Handler, group: int)*. The actual callback function is therefore stored inside the handler's *callback* attribute. Here's an example: -- ``plugins/handlers.py`` +- ``plugins/handlers.py`` .. code-block:: python :emphasize-lines: 5, 6 @@ -318,10 +317,10 @@ Unloading ^^^^^^^^^ In order to unload a plugin, or any other handler, all you need to do is obtain a reference to it by importing the -relevant module and call :meth:`remove_handler() ` Client's method with your function +relevant module and call :meth:`~pyrogram.Client.remove_handler` Client's method with your function name preceded by the star ``*`` operator as argument. Example: -- ``main.py`` +- ``main.py`` .. code-block:: python @@ -343,9 +342,9 @@ Loading ^^^^^^^ Similarly to the unloading process, in order to load again a previously unloaded plugin you do the same, but this time -using :meth:`add_handler() ` instead. Example: +using :meth:`~pyrogram.Client.add_handler` instead. Example: -- ``main.py`` +- ``main.py`` .. code-block:: python diff --git a/docs/source/resources/TestServers.rst b/docs/source/topics/test-servers.rst similarity index 100% rename from docs/source/resources/TestServers.rst rename to docs/source/topics/test-servers.rst diff --git a/docs/source/resources/TextFormatting.rst b/docs/source/topics/text-formatting.rst similarity index 75% rename from docs/source/resources/TextFormatting.rst rename to docs/source/topics/text-formatting.rst index 0ab08694..bc74d562 100644 --- a/docs/source/resources/TextFormatting.rst +++ b/docs/source/topics/text-formatting.rst @@ -11,8 +11,8 @@ Beside bold, italic, and pre-formatted code, **Pyrogram does also support inline Markdown Style -------------- -To use this mode, pass :obj:`MARKDOWN ` or "markdown" in the *parse_mode* field when using -:obj:`send_message() `. Use the following syntax in your message: +To use this mode, pass "markdown" in the *parse_mode* field when using +:meth:`~pyrogram.Client.send_message`. Use the following syntax in your message: .. code-block:: text @@ -20,7 +20,7 @@ To use this mode, pass :obj:`MARKDOWN ` or "markdow __italic text__ - [inline URL](https://docs.pyrogram.ml/) + [inline URL](https://docs.pyrogram.org/) [inline mention of a user](tg://user?id=23122162) @@ -34,8 +34,8 @@ To use this mode, pass :obj:`MARKDOWN ` or "markdow HTML Style ---------- -To use this mode, pass :obj:`HTML ` or "html" in the *parse_mode* field when using -:obj:`send_message() `. The following tags are currently supported: +To use this mode, pass "html" in the *parse_mode* field when using :meth:`~pyrogram.Client.send_message`. +The following tags are currently supported: .. code-block:: text @@ -43,7 +43,7 @@ To use this mode, pass :obj:`HTML ` or "html" in the *p italic, italic - inline URL + inline URL inline mention of a user @@ -66,7 +66,7 @@ Examples "**bold**, " "__italic__, " "[mention](tg://user?id=23122162), " - "[URL](https://docs.pyrogram.ml), " + "[URL](https://docs.pyrogram.org), " "`code`, " "```" "for i in range(10):\n" @@ -84,7 +84,7 @@ Examples "bold, " "italic, " "mention, " - "URL, " + "URL, " "code, " "
"
                 "for i in range(10):\n"
diff --git a/docs/source/resources/TgCrypto.rst b/docs/source/topics/tgcrypto.rst
similarity index 87%
rename from docs/source/resources/TgCrypto.rst
rename to docs/source/topics/tgcrypto.rst
index 2af09a06..454bf05c 100644
--- a/docs/source/resources/TgCrypto.rst
+++ b/docs/source/topics/tgcrypto.rst
@@ -2,7 +2,7 @@ Fast Crypto
 ===========
 
 Pyrogram's speed can be *dramatically* boosted up by TgCrypto_, a high-performance, easy-to-install Telegram Crypto
-Library specifically written in C for Pyrogram [#f1]_ as a Python extension.
+Library specifically written in C for Pyrogram [1]_ as a Python extension.
 
 TgCrypto is a replacement for the much slower PyAES and implements the crypto algorithms Telegram requires, namely
 **AES-IGE 256 bit** (used in MTProto v2.0) and **AES-CTR 256 bit** (used for CDN encrypted files).
@@ -28,5 +28,5 @@ what you should do next:
 
 .. _TgCrypto: https://github.com/pyrogram/tgcrypto
 
-.. [#f1] Although TgCrypto is intended for Pyrogram, it is shipped as a standalone package and can thus be used for
+.. [1] Although TgCrypto is intended for Pyrogram, it is shipped as a standalone package and can thus be used for
    other Python projects too.
diff --git a/docs/source/topics/use-filters.rst b/docs/source/topics/use-filters.rst
new file mode 100644
index 00000000..d481b393
--- /dev/null
+++ b/docs/source/topics/use-filters.rst
@@ -0,0 +1,108 @@
+Using Filters
+=============
+
+So far we've seen how to register a callback function that executes every time a specific update comes from the server,
+but there's much more than that to come.
+
+Here we'll discuss about :class:`~pyrogram.Filters`. Filters enable a fine-grain control over what kind of
+updates are allowed or not to be passed in your callback functions, based on their inner details.
+
+Single Filters
+--------------
+
+Let's start right away with a simple example:
+
+-   This example will show you how to **only** handle messages containing an :class:`~pyrogram.Audio` object and
+    ignore any other message. Filters are passed as the first argument of the decorator:
+
+    .. code-block:: python
+        :emphasize-lines: 4
+
+        from pyrogram import Filters
+
+
+        @app.on_message(Filters.audio)
+        def my_handler(client, message):
+            print(message)
+
+-   or, without decorators. Here filters are passed as the second argument of the handler constructor; the first is the
+    callback function itself:
+
+    .. code-block:: python
+        :emphasize-lines: 8
+
+        from pyrogram import Filters, MessageHandler
+
+
+        def my_handler(client, message):
+            print(message)
+
+
+        app.add_handler(MessageHandler(my_handler, Filters.audio))
+
+Combining Filters
+-----------------
+
+Filters can also be used in a more advanced way by inverting and combining more filters together using bitwise
+operators ``~``, ``&`` and ``|``:
+
+-   Use ``~`` to invert a filter (behaves like the ``not`` operator).
+-   Use ``&`` and ``|`` to merge two filters (behave like ``and``, ``or`` operators respectively).
+
+Here are some examples:
+
+-   Message is a **text** message **and** is **not edited**.
+
+    .. code-block:: python
+
+        @app.on_message(Filters.text & ~Filters.edited)
+        def my_handler(client, message):
+            print(message)
+
+-   Message is a **sticker** **and** is coming from a **channel or** a **private** chat.
+
+    .. code-block:: python
+
+        @app.on_message(Filters.sticker & (Filters.channel | Filters.private))
+        def my_handler(client, message):
+            print(message)
+
+Advanced Filters
+----------------
+
+Some filters, like :meth:`~pyrogram.Filters.command` or :meth:`~pyrogram.Filters.regex`
+can also accept arguments:
+
+-   Message is either a */start* or */help* **command**.
+
+    .. code-block:: python
+
+        @app.on_message(Filters.command(["start", "help"]))
+        def my_handler(client, message):
+            print(message)
+
+-   Message is a **text** message or a media **caption** matching the given **regex** pattern.
+
+    .. code-block:: python
+
+        @app.on_message(Filters.regex("pyrogram"))
+        def my_handler(client, message):
+            print(message)
+
+More handlers using different filters can also live together.
+
+.. code-block:: python
+
+    @app.on_message(Filters.command("start"))
+    def start_command(client, message):
+        print("This is the /start command")
+
+
+    @app.on_message(Filters.command("help"))
+    def help_command(client, message):
+        print("This is the /help command")
+
+
+    @app.on_message(Filters.chat("PyrogramChat"))
+    def from_pyrogramchat(client, message):
+        print("New message in @PyrogramChat")
diff --git a/docs/source/resources/VoiceCalls.rst b/docs/source/topics/voice-calls.rst
similarity index 100%
rename from docs/source/resources/VoiceCalls.rst
rename to docs/source/topics/voice-calls.rst
diff --git a/examples/README.md b/examples/README.md
index 643fe56d..b8898a71 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -12,12 +12,12 @@ Example | Description
 ---: | :---
 [**hello_world**](hello_world.py) | Demonstration of basic API usage
 [**echobot**](echobot.py) | Echo every private text message
-[**welcome**](welcome.py) | The Welcome Bot in [@PyrogramChat](https://t.me/pyrogramchat)
-[**history**](history.py) | Get the full message history of a chat
-[**chat_members**](chat_members.py) | Get all the members of a chat
-[**dialogs**](dialogs.py) | Get all of your dialog chats
-[**using_inline_bots**](using_inline_bots.py) | Query an inline bot (as user) and send a result to a chat
-[**keyboards**](keyboards.py) | Send normal and inline keyboards using regular bots
-[**callback_queries**](callback_queries.py) | Handle queries coming from inline button presses
-[**inline_queries**](inline_queries.py) | Handle inline queries
+[**welcomebot**](welcomebot.py) | The Welcome Bot in [@PyrogramChat](https://t.me/pyrogramchat)
+[**get_history**](get_history.py) | Get the full message history of a chat
+[**get_chat_members**](get_chat_members.py) | Get all the members of a chat
+[**get_dialogs**](get_dialogs.py) | Get all of your dialog chats
+[**callback_queries**](callback_queries.py) | Handle callback queries (as bot) coming from inline button presses
+[**inline_queries**](inline_queries.py) | Handle inline queries (as bot) and answer with results
+[**use_inline_bots**](use_inline_bots.py) | Query an inline bot (as user) and send a result to a chat
+[**bot_keyboards**](bot_keyboards.py) | Send normal and inline keyboards using regular bots
 [**raw_updates**](raw_updates.py) | Handle raw updates (old, should be avoided)
diff --git a/examples/keyboards.py b/examples/bot_keyboards.py
similarity index 96%
rename from examples/keyboards.py
rename to examples/bot_keyboards.py
index 1a1140b6..e1ff1e7e 100644
--- a/examples/keyboards.py
+++ b/examples/bot_keyboards.py
@@ -1,4 +1,4 @@
-"""This example will show you how to send normal and inline keyboards.
+"""This example will show you how to send normal and inline keyboards (as bot).
 
 You must log-in as a regular bot in order to send keyboards (use the token from @BotFather).
 Any attempt in sending keyboards with a user account will be simply ignored by the server.
@@ -39,7 +39,7 @@ with app:
                     ),
                     InlineKeyboardButton(  # Opens a web URL
                         "URL",
-                        url="https://docs.pyrogram.ml"
+                        url="https://docs.pyrogram.org"
                     ),
                 ],
                 [  # Second row
diff --git a/examples/chat_members.py b/examples/get_chat_members.py
similarity index 100%
rename from examples/chat_members.py
rename to examples/get_chat_members.py
diff --git a/examples/dialogs.py b/examples/get_dialogs.py
similarity index 72%
rename from examples/dialogs.py
rename to examples/get_dialogs.py
index 08c769e2..92da8834 100644
--- a/examples/dialogs.py
+++ b/examples/get_dialogs.py
@@ -1,4 +1,4 @@
-"""This example shows how to get the full dialogs list of a user."""
+"""This example shows how to get the full dialogs list (as user)."""
 
 from pyrogram import Client
 
diff --git a/examples/history.py b/examples/get_history.py
similarity index 100%
rename from examples/history.py
rename to examples/get_history.py
diff --git a/examples/inline_queries.py b/examples/inline_queries.py
index c1727fe6..d86d90d5 100644
--- a/examples/inline_queries.py
+++ b/examples/inline_queries.py
@@ -22,12 +22,12 @@ def answer(client, inline_query):
                 input_message_content=InputTextMessageContent(
                     "Here's how to install **Pyrogram**"
                 ),
-                url="https://docs.pyrogram.ml/start/Installation",
+                url="https://docs.pyrogram.org/intro/install",
                 description="How to install Pyrogram",
                 thumb_url="https://i.imgur.com/JyxrStE.png",
                 reply_markup=InlineKeyboardMarkup(
                     [
-                        [InlineKeyboardButton("Open website", url="https://docs.pyrogram.ml/start/Installation")]
+                        [InlineKeyboardButton("Open website", url="https://docs.pyrogram.org/intro/install")]
                     ]
                 )
             ),
@@ -37,12 +37,12 @@ def answer(client, inline_query):
                 input_message_content=InputTextMessageContent(
                     "Here's how to use **Pyrogram**"
                 ),
-                url="https://docs.pyrogram.ml/start/Usage",
+                url="https://docs.pyrogram.org/start/invoking",
                 description="How to use Pyrogram",
                 thumb_url="https://i.imgur.com/JyxrStE.png",
                 reply_markup=InlineKeyboardMarkup(
                     [
-                        [InlineKeyboardButton("Open website", url="https://docs.pyrogram.ml/start/Usage")]
+                        [InlineKeyboardButton("Open website", url="https://docs.pyrogram.org/start/invoking")]
                     ]
                 )
             )
diff --git a/examples/use_inline_bots.py b/examples/use_inline_bots.py
new file mode 100644
index 00000000..5681df87
--- /dev/null
+++ b/examples/use_inline_bots.py
@@ -0,0 +1,13 @@
+"""This example shows how to query an inline bot (as user)"""
+
+from pyrogram import Client
+
+# Create a new Client
+app = Client("my_account")
+
+with app:
+    # Get bot results for "Fuzz Universe" from the inline bot @vid
+    bot_results = app.get_inline_bot_results("vid", "Fuzz Universe")
+
+    # Send the first result (bot_results.results[0]) to your own chat (Saved Messages)
+    app.send_inline_bot_result("me", bot_results.query_id, bot_results.results[0].id)
diff --git a/examples/using_inline_bots.py b/examples/using_inline_bots.py
deleted file mode 100644
index c3b48874..00000000
--- a/examples/using_inline_bots.py
+++ /dev/null
@@ -1,17 +0,0 @@
-"""This example shows how to query an inline bot"""
-
-from pyrogram import Client
-
-# Create a new Client
-app = Client("my_account")
-
-# Start the Client
-app.start()
-
-# Get bot results for "Fuzz Universe" from the inline bot @vid
-bot_results = app.get_inline_bot_results("vid", "Fuzz Universe")
-# Send the first result (bot_results.results[0]) to your own chat (Saved Messages)
-app.send_inline_bot_result("me", bot_results.query_id, bot_results.results[0].id)
-
-# Stop the client
-app.stop()
diff --git a/examples/welcome.py b/examples/welcomebot.py
similarity index 91%
rename from examples/welcome.py
rename to examples/welcomebot.py
index ab252672..35f72aff 100644
--- a/examples/welcome.py
+++ b/examples/welcomebot.py
@@ -8,7 +8,7 @@ from pyrogram import Client, Emoji, Filters
 
 TARGET = "PyrogramChat"  # Target chat. Can also be a list of multiple chat ids/usernames
 MENTION = "[{}](tg://user?id={})"  # User mention markup
-MESSAGE = "{} Welcome to [Pyrogram](https://docs.pyrogram.ml/)'s group chat {}!"  # Welcome message
+MESSAGE = "{} Welcome to [Pyrogram](https://docs.pyrogram.org/)'s group chat {}!"  # Welcome message
 
 app = Client("my_account")
 
diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py
index 44dbe231..ac184844 100644
--- a/pyrogram/__init__.py
+++ b/pyrogram/__init__.py
@@ -24,11 +24,9 @@ if sys.version_info[:3] in [(3, 5, 0), (3, 5, 1), (3, 5, 2)]:
     # Monkey patch the standard "typing" module because Python versions from 3.5.0 to 3.5.2 have a broken one.
     sys.modules["typing"] = typing
 
-__version__ = "0.12.0"
+__version__ = "0.15.0-develop"
 __license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
-__copyright__ = "Copyright (C) 2017-2019 Dan Tès ".replace(
-    "\xe8", "e" if sys.getfilesystemencoding() != "utf-8" else "\xe8"
-)
+__copyright__ = "Copyright (C) 2017-2019 Dan "
 
 from .errors import RPCError
 from .client import *
diff --git a/pyrogram/api/__init__.py b/pyrogram/api/__init__.py
index e57f0661..8d7831ff 100644
--- a/pyrogram/api/__init__.py
+++ b/pyrogram/api/__init__.py
@@ -19,8 +19,8 @@
 from importlib import import_module
 
 from .all import objects
-from .core.object import Object
+from .core.tl_object import TLObject
 
 for k, v in objects.items():
     path, name = v.rsplit(".", 1)
-    Object.all[k] = getattr(import_module(path), name)
+    TLObject.all[k] = getattr(import_module(path), name)
diff --git a/pyrogram/api/core/__init__.py b/pyrogram/api/core/__init__.py
index daba6b7c..aaf5a324 100644
--- a/pyrogram/api/core/__init__.py
+++ b/pyrogram/api/core/__init__.py
@@ -19,10 +19,11 @@
 from .future_salt import FutureSalt
 from .future_salts import FutureSalts
 from .gzip_packed import GzipPacked
+from .list import List
 from .message import Message
 from .msg_container import MsgContainer
-from .object import Object
 from .primitives import (
     Bool, BoolTrue, BoolFalse, Bytes, Double,
     Int, Long, Int128, Int256, Null, String, Vector
 )
+from .tl_object import TLObject
diff --git a/pyrogram/api/core/future_salt.py b/pyrogram/api/core/future_salt.py
index 4ee8197b..ab387f6c 100644
--- a/pyrogram/api/core/future_salt.py
+++ b/pyrogram/api/core/future_salt.py
@@ -16,29 +16,28 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from datetime import datetime
 from io import BytesIO
 
-from .object import Object
 from .primitives import Int, Long
+from .tl_object import TLObject
 
 
-class FutureSalt(Object):
+class FutureSalt(TLObject):
     ID = 0x0949d9dc
 
     __slots__ = ["valid_since", "valid_until", "salt"]
 
     QUALNAME = "FutureSalt"
 
-    def __init__(self, valid_since: int or datetime, valid_until: int or datetime, salt: int):
+    def __init__(self, valid_since: int, valid_until: int, salt: int):
         self.valid_since = valid_since
         self.valid_until = valid_until
         self.salt = salt
 
     @staticmethod
     def read(b: BytesIO, *args) -> "FutureSalt":
-        valid_since = datetime.fromtimestamp(Int.read(b))
-        valid_until = datetime.fromtimestamp(Int.read(b))
+        valid_since = Int.read(b)
+        valid_until = Int.read(b)
         salt = Long.read(b)
 
         return FutureSalt(valid_since, valid_until, salt)
diff --git a/pyrogram/api/core/future_salts.py b/pyrogram/api/core/future_salts.py
index cf6a9902..a97b9d2a 100644
--- a/pyrogram/api/core/future_salts.py
+++ b/pyrogram/api/core/future_salts.py
@@ -16,22 +16,21 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from datetime import datetime
 from io import BytesIO
 
 from . import FutureSalt
-from .object import Object
 from .primitives import Int, Long
+from .tl_object import TLObject
 
 
-class FutureSalts(Object):
+class FutureSalts(TLObject):
     ID = 0xae500895
 
     __slots__ = ["req_msg_id", "now", "salts"]
 
     QUALNAME = "FutureSalts"
 
-    def __init__(self, req_msg_id: int, now: int or datetime, salts: list):
+    def __init__(self, req_msg_id: int, now: int, salts: list):
         self.req_msg_id = req_msg_id
         self.now = now
         self.salts = salts
@@ -39,7 +38,7 @@ class FutureSalts(Object):
     @staticmethod
     def read(b: BytesIO, *args) -> "FutureSalts":
         req_msg_id = Long.read(b)
-        now = datetime.fromtimestamp(Int.read(b))
+        now = Int.read(b)
 
         count = Int.read(b)
         salts = [FutureSalt.read(b) for _ in range(count)]
diff --git a/pyrogram/api/core/gzip_packed.py b/pyrogram/api/core/gzip_packed.py
index 135c36bf..5a8e76da 100644
--- a/pyrogram/api/core/gzip_packed.py
+++ b/pyrogram/api/core/gzip_packed.py
@@ -19,24 +19,24 @@
 from gzip import compress, decompress
 from io import BytesIO
 
-from .object import Object
 from .primitives import Int, Bytes
+from .tl_object import TLObject
 
 
-class GzipPacked(Object):
+class GzipPacked(TLObject):
     ID = 0x3072cfa1
 
     __slots__ = ["packed_data"]
 
     QUALNAME = "GzipPacked"
 
-    def __init__(self, packed_data: Object):
+    def __init__(self, packed_data: TLObject):
         self.packed_data = packed_data
 
     @staticmethod
     def read(b: BytesIO, *args) -> "GzipPacked":
         # Return the Object itself instead of a GzipPacked wrapping it
-        return Object.read(
+        return TLObject.read(
             BytesIO(
                 decompress(
                     Bytes.read(b)
diff --git a/pyrogram/client/ext/parse_mode.py b/pyrogram/api/core/list.py
similarity index 71%
rename from pyrogram/client/ext/parse_mode.py
rename to pyrogram/api/core/list.py
index 46ed97e3..4b309a6d 100644
--- a/pyrogram/client/ext/parse_mode.py
+++ b/pyrogram/api/core/list.py
@@ -16,14 +16,13 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
+from .tl_object import TLObject
 
-class ParseMode:
-    """This class provides a convenient access to Parse Modes.
-    Parse Modes are intended to be used with any method that accepts the optional argument **parse_mode**.
-    """
 
-    HTML = "html"
-    """Set the parse mode to HTML style"""
+class List(list, TLObject):
+    __slots__ = []
 
-    MARKDOWN = "markdown"
-    """Set the parse mode to Markdown style"""
+    def __repr__(self):
+        return "pyrogram.api.core.List([{}])".format(
+            ",".join(TLObject.__repr__(i) for i in self)
+        )
diff --git a/pyrogram/api/core/message.py b/pyrogram/api/core/message.py
index 5b2e5b64..1b9b55f1 100644
--- a/pyrogram/api/core/message.py
+++ b/pyrogram/api/core/message.py
@@ -18,18 +18,18 @@
 
 from io import BytesIO
 
-from .object import Object
 from .primitives import Int, Long
+from .tl_object import TLObject
 
 
-class Message(Object):
+class Message(TLObject):
     ID = 0x5bb8e511  # hex(crc32(b"message msg_id:long seqno:int bytes:int body:Object = Message"))
 
     __slots__ = ["msg_id", "seq_no", "length", "body"]
 
     QUALNAME = "Message"
 
-    def __init__(self, body: Object, msg_id: int, seq_no: int, length: int):
+    def __init__(self, body: TLObject, msg_id: int, seq_no: int, length: int):
         self.msg_id = msg_id
         self.seq_no = seq_no
         self.length = length
@@ -42,7 +42,7 @@ class Message(Object):
         length = Int.read(b)
         body = b.read(length)
 
-        return Message(Object.read(BytesIO(body)), msg_id, seq_no, length)
+        return Message(TLObject.read(BytesIO(body)), msg_id, seq_no, length)
 
     def write(self) -> bytes:
         b = BytesIO()
diff --git a/pyrogram/api/core/msg_container.py b/pyrogram/api/core/msg_container.py
index bfc41333..58732403 100644
--- a/pyrogram/api/core/msg_container.py
+++ b/pyrogram/api/core/msg_container.py
@@ -19,11 +19,11 @@
 from io import BytesIO
 
 from .message import Message
-from .object import Object
 from .primitives import Int
+from .tl_object import TLObject
 
 
-class MsgContainer(Object):
+class MsgContainer(TLObject):
     ID = 0x73f1f8dc
 
     __slots__ = ["messages"]
diff --git a/pyrogram/api/core/object.py b/pyrogram/api/core/object.py
deleted file mode 100644
index a479fb6e..00000000
--- a/pyrogram/api/core/object.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017-2019 Dan Tès 
-#
-# 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 .
-
-from collections import OrderedDict
-from datetime import datetime
-from io import BytesIO
-from json import dumps
-
-
-class Object:
-    all = {}
-
-    __slots__ = []
-
-    QUALNAME = "Base"
-
-    @staticmethod
-    def read(b: BytesIO, *args):
-        return Object.all[int.from_bytes(b.read(4), "little")].read(b, *args)
-
-    def write(self, *args) -> bytes:
-        pass
-
-    def __str__(self) -> str:
-        return dumps(self, indent=4, default=default, ensure_ascii=False)
-
-    def __len__(self) -> int:
-        return len(self.write())
-
-    def __getitem__(self, item):
-        return getattr(self, item)
-
-
-def remove_none(obj):
-    if isinstance(obj, (list, tuple, set)):
-        return type(obj)(remove_none(x) for x in obj if x is not None)
-    elif isinstance(obj, dict):
-        return type(obj)((remove_none(k), remove_none(v)) for k, v in obj.items() if k is not None and v is not None)
-    else:
-        return obj
-
-
-def default(o: "Object"):
-    try:
-        content = {i: getattr(o, i) for i in o.__slots__}
-
-        return remove_none(
-            OrderedDict(
-                [("_", o.QUALNAME)]
-                + [i for i in content.items()]
-            )
-        )
-    except AttributeError:
-        if isinstance(o, datetime):
-            return o.strftime("%d-%b-%Y %H:%M:%S")
-        else:
-            return repr(o)
diff --git a/pyrogram/api/core/primitives/bool.py b/pyrogram/api/core/primitives/bool.py
index 117ee7a4..0d3732e0 100644
--- a/pyrogram/api/core/primitives/bool.py
+++ b/pyrogram/api/core/primitives/bool.py
@@ -18,10 +18,10 @@
 
 from io import BytesIO
 
-from ..object import Object
+from ..tl_object import TLObject
 
 
-class BoolFalse(Object):
+class BoolFalse(TLObject):
     ID = 0xbc799737
     value = False
 
@@ -38,7 +38,7 @@ class BoolTrue(BoolFalse):
     value = True
 
 
-class Bool(Object):
+class Bool(TLObject):
     @classmethod
     def read(cls, b: BytesIO) -> bool:
         return int.from_bytes(b.read(4), "little") == BoolTrue.ID
diff --git a/pyrogram/api/core/primitives/bytes.py b/pyrogram/api/core/primitives/bytes.py
index 8030b598..f511fef3 100644
--- a/pyrogram/api/core/primitives/bytes.py
+++ b/pyrogram/api/core/primitives/bytes.py
@@ -18,10 +18,10 @@
 
 from io import BytesIO
 
-from ..object import Object
+from ..tl_object import TLObject
 
 
-class Bytes(Object):
+class Bytes(TLObject):
     @staticmethod
     def read(b: BytesIO, *args) -> bytes:
         length = int.from_bytes(b.read(1), "little")
diff --git a/pyrogram/api/core/primitives/double.py b/pyrogram/api/core/primitives/double.py
index 3dcaa461..067d08bd 100644
--- a/pyrogram/api/core/primitives/double.py
+++ b/pyrogram/api/core/primitives/double.py
@@ -19,10 +19,10 @@
 from io import BytesIO
 from struct import unpack, pack
 
-from ..object import Object
+from ..tl_object import TLObject
 
 
-class Double(Object):
+class Double(TLObject):
     @staticmethod
     def read(b: BytesIO, *args) -> float:
         return unpack("d", b.read(8))[0]
diff --git a/pyrogram/api/core/primitives/int.py b/pyrogram/api/core/primitives/int.py
index 7833a610..ea43983c 100644
--- a/pyrogram/api/core/primitives/int.py
+++ b/pyrogram/api/core/primitives/int.py
@@ -18,10 +18,10 @@
 
 from io import BytesIO
 
-from ..object import Object
+from ..tl_object import TLObject
 
 
-class Int(Object):
+class Int(TLObject):
     SIZE = 4
 
     @classmethod
diff --git a/pyrogram/api/core/primitives/null.py b/pyrogram/api/core/primitives/null.py
index d2d3b1c0..ffddea94 100644
--- a/pyrogram/api/core/primitives/null.py
+++ b/pyrogram/api/core/primitives/null.py
@@ -18,10 +18,10 @@
 
 from io import BytesIO
 
-from ..object import Object
+from ..tl_object import TLObject
 
 
-class Null(Object):
+class Null(TLObject):
     ID = 0x56730bcc
 
     @staticmethod
diff --git a/pyrogram/api/core/primitives/vector.py b/pyrogram/api/core/primitives/vector.py
index cd24ec35..641b33ef 100644
--- a/pyrogram/api/core/primitives/vector.py
+++ b/pyrogram/api/core/primitives/vector.py
@@ -19,31 +19,32 @@
 from io import BytesIO
 
 from . import Int
-from ..object import Object
+from ..list import List
+from ..tl_object import TLObject
 
 
-class Vector(Object):
+class Vector(TLObject):
     ID = 0x1cb5c415
 
     # Method added to handle the special case when a query returns a bare Vector (of Ints);
     # i.e., RpcResult body starts with 0x1cb5c415 (Vector Id) - e.g., messages.GetMessagesViews.
     @staticmethod
-    def _read(b: BytesIO) -> Object or int:
+    def _read(b: BytesIO) -> TLObject or int:
         try:
-            return Object.read(b)
+            return TLObject.read(b)
         except KeyError:
             b.seek(-4, 1)
             return Int.read(b)
 
     @staticmethod
-    def read(b: BytesIO, t: Object = None) -> list:
-        return [
+    def read(b: BytesIO, t: TLObject = None) -> list:
+        return List(
             t.read(b) if t
             else Vector._read(b)
             for _ in range(Int.read(b))
-        ]
+        )
 
-    def __new__(cls, value: list, t: Object = None) -> bytes:
+    def __new__(cls, value: list, t: TLObject = None) -> bytes:
         return b"".join(
             [Int(cls.ID, False), Int(len(value))]
             + [
diff --git a/pyrogram/api/core/tl_object.py b/pyrogram/api/core/tl_object.py
new file mode 100644
index 00000000..4b951404
--- /dev/null
+++ b/pyrogram/api/core/tl_object.py
@@ -0,0 +1,82 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from collections import OrderedDict
+from io import BytesIO
+from json import dumps
+
+
+class TLObject:
+    all = {}
+
+    __slots__ = []
+
+    QUALNAME = "Base"
+
+    @staticmethod
+    def read(b: BytesIO, *args):  # TODO: Rename b -> data
+        return TLObject.all[int.from_bytes(b.read(4), "little")].read(b, *args)
+
+    def write(self, *args) -> bytes:
+        pass
+
+    @staticmethod
+    def default(obj: "TLObject"):
+        if isinstance(obj, bytes):
+            return repr(obj)
+
+        return OrderedDict(
+            [("_", obj.QUALNAME)]
+            + [
+                (attr, getattr(obj, attr))
+                for attr in obj.__slots__
+                if getattr(obj, attr) is not None
+            ]
+        )
+
+    def __str__(self) -> str:
+        return dumps(self, indent=4, default=TLObject.default, ensure_ascii=False)
+
+    def __repr__(self) -> str:
+        return "pyrogram.api.{}({})".format(
+            self.QUALNAME,
+            ", ".join(
+                "{}={}".format(attr, repr(getattr(self, attr)))
+                for attr in self.__slots__
+                if getattr(self, attr) is not None
+            )
+        )
+
+    def __eq__(self, other: "TLObject") -> bool:
+        for attr in self.__slots__:
+            try:
+                if getattr(self, attr) != getattr(other, attr):
+                    return False
+            except AttributeError:
+                return False
+
+        return True
+
+    def __len__(self) -> int:
+        return len(self.write())
+
+    def __getitem__(self, item):
+        return getattr(self, item)
+
+    def __setitem__(self, key, value):
+        setattr(self, key, value)
diff --git a/pyrogram/client/__init__.py b/pyrogram/client/__init__.py
index d43511d2..f4a954c6 100644
--- a/pyrogram/client/__init__.py
+++ b/pyrogram/client/__init__.py
@@ -17,9 +17,9 @@
 # along with Pyrogram.  If not, see .
 
 from .client import Client
-from .ext import BaseClient, ChatAction, Emoji, ParseMode
+from .ext import BaseClient, Emoji
 from .filters import Filters
 
 __all__ = [
-    "Client", "BaseClient", "ChatAction", "Emoji", "ParseMode", "Filters",
+    "Client", "BaseClient", "Emoji", "Filters",
 ]
diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py
index 7ea06b3e..1aa436b5 100644
--- a/pyrogram/client/client.py
+++ b/pyrogram/client/client.py
@@ -23,13 +23,11 @@ import mimetypes
 import os
 import re
 import shutil
-import struct
 import tempfile
 import threading
 import time
 import warnings
 from configparser import ConfigParser
-from datetime import datetime
 from hashlib import sha256, md5
 from importlib import import_module
 from pathlib import Path
@@ -38,7 +36,7 @@ from threading import Thread
 from typing import Union, List, Type
 
 from pyrogram.api import functions, types
-from pyrogram.api.core import Object
+from pyrogram.api.core import TLObject
 from pyrogram.client.handlers import DisconnectHandler
 from pyrogram.client.handlers.handler import Handler
 from pyrogram.client.methods.password.utils import compute_check
@@ -48,7 +46,7 @@ from pyrogram.errors import (
     PhoneNumberUnoccupied, PhoneCodeInvalid, PhoneCodeHashEmpty,
     PhoneCodeExpired, PhoneCodeEmpty, SessionPasswordNeeded,
     PasswordHashInvalid, FloodWait, PeerIdInvalid, FirstnameInvalid, PhoneNumberBanned,
-    VolumeLocNotFound, UserMigrate, FileIdInvalid, ChannelPrivate, PhoneNumberOccupied,
+    VolumeLocNotFound, UserMigrate, ChannelPrivate, PhoneNumberOccupied,
     PasswordRecoveryNa, PasswordEmpty
 )
 from pyrogram.session import Auth, Session
@@ -63,27 +61,23 @@ log = logging.getLogger(__name__)
 
 
 class Client(Methods, BaseClient):
-    """This class represents a Client, the main mean for interacting with Telegram.
-    It exposes bot-like methods for an easy access to the API as well as a simple way to
-    invoke every single Telegram API method available.
+    """Pyrogram Client, the main means for interacting with Telegram.
 
-    Args:
+    Parameters:
         session_name (``str``):
             Name to uniquely identify a session of either a User or a Bot, e.g.: "my_account". This name will be used
             to save a file to disk that stores details needed for reconnecting without asking again for credentials.
-            Note for bots: You can pass a bot token here, but this usage will be deprecated in next releases.
-            Use *bot_token* instead.
 
         api_id (``int``, *optional*):
             The *api_id* part of your Telegram API Key, as integer. E.g.: 12345
             This is an alternative way to pass it if you don't want to use the *config.ini* file.
 
         api_hash (``str``, *optional*):
-            The *api_hash* part of your Telegram API Key, as string. E.g.: "0123456789abcdef0123456789abcdef"
+            The *api_hash* part of your Telegram API Key, as string. E.g.: "0123456789abcdef0123456789abcdef".
             This is an alternative way to pass it if you don't want to use the *config.ini* file.
 
         app_version (``str``, *optional*):
-            Application version. Defaults to "Pyrogram \U0001f525 vX.Y.Z"
+            Application version. Defaults to "Pyrogram X.Y.Z"
             This is an alternative way to set it if you don't want to use the *config.ini* file.
 
         device_model (``str``, *optional*):
@@ -109,10 +103,14 @@ class Client(Methods, BaseClient):
             This is an alternative way to setup a proxy if you don't want to use the *config.ini* file.
 
         test_mode (``bool``, *optional*):
-            Enable or disable log-in to testing servers. Defaults to False.
+            Enable or disable login to the test servers. Defaults to False.
             Only applicable for new sessions and will be ignored in case previously
             created sessions are loaded.
 
+        bot_token (``str``, *optional*):
+            Pass your Bot API token to create a bot session, e.g.: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
+            Only applicable for new sessions.
+
         phone_number (``str`` | ``callable``, *optional*):
             Pass your phone number as string (with your Country Code prefix included) to avoid entering it manually.
             Or pass a callback function which accepts no arguments and must return the correct phone number as string
@@ -146,10 +144,6 @@ class Client(Methods, BaseClient):
             a new Telegram account in case the phone number you passed is not registered yet.
             Only applicable for new sessions.
 
-        bot_token (``str``, *optional*):
-            Pass your Bot API token to create a bot session, e.g.: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
-            Only applicable for new sessions.
-
         last_name (``str``, *optional*):
             Same purpose as *first_name*; pass a Last Name to avoid entering it manually. It can
             be an empty string: "". Only applicable for new sessions.
@@ -175,7 +169,7 @@ class Client(Methods, BaseClient):
             Defaults to False (updates enabled and always received).
 
         takeout (``bool``, *optional*):
-            Pass True to let the client use a takeout session instead of a normal one, implies no_updates.
+            Pass True to let the client use a takeout session instead of a normal one, implies *no_updates=True*.
             Useful for exporting your Telegram data. Methods invoked inside a takeout session (such as get_history,
             download_media, ...) are less prone to throw FloodWait exceptions.
             Only available for users, bots will ignore this parameter.
@@ -196,12 +190,12 @@ class Client(Methods, BaseClient):
         ipv6: bool = False,
         proxy: dict = None,
         test_mode: bool = False,
+        bot_token: str = None,
         phone_number: str = None,
         phone_code: Union[str, callable] = None,
         password: str = None,
         recovery_code: callable = None,
         force_sms: bool = False,
-        bot_token: str = None,
         first_name: str = None,
         last_name: str = None,
         workers: int = BaseClient.WORKERS,
@@ -239,12 +233,12 @@ class Client(Methods, BaseClient):
         # TODO: Make code consistent, use underscore for private/protected fields
         self._proxy = proxy
         self.session_storage.test_mode = test_mode
+        self.bot_token = bot_token
         self.phone_number = phone_number
         self.phone_code = phone_code
         self.password = password
         self.recovery_code = recovery_code
         self.force_sms = force_sms
-        self.bot_token = bot_token
         self.first_name = first_name
         self.last_name = last_name
         self.workers = workers
@@ -279,12 +273,11 @@ class Client(Methods, BaseClient):
         self._proxy.update(value)
 
     def start(self):
-        """Use this method to start the Client after creating it.
-        Requires no parameters.
+        """Start the Client.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ConnectionError`` in case you try to start an already started Client.
+            RPCError: In case of a Telegram RPC error.
+            ConnectionError: In case you try to start an already started Client.
         """
         if self.is_started:
             raise ConnectionError("Client has already been started")
@@ -297,7 +290,7 @@ class Client(Methods, BaseClient):
                 warnings.warn('\nWARNING: You are using a bot token as session name!\n'
                               'This usage will be deprecated soon. Please use a session file name to load '
                               'an existing session and the bot_token argument to create new sessions.\n'
-                              'More info: https://docs.pyrogram.ml/start/Setup#bot-authorization\n')
+                              'More info: https://docs.pyrogram.org/intro/auth#bot-authorization\n')
 
         self.load_config()
         self.load_session()
@@ -336,7 +329,7 @@ class Client(Methods, BaseClient):
                     self.get_initial_dialogs()
                     self.get_contacts()
                 else:
-                    self.send(functions.messages.GetPinnedDialogs())
+                    self.send(functions.messages.GetPinnedDialogs(folder_id=0))
                     self.get_initial_dialogs_chunk()
             else:
                 self.send(functions.updates.GetState())
@@ -373,11 +366,10 @@ class Client(Methods, BaseClient):
         return self
 
     def stop(self):
-        """Use this method to manually stop the Client.
-        Requires no parameters.
+        """Stop the Client.
 
         Raises:
-            ``ConnectionError`` in case you try to stop an already stopped Client.
+            ConnectionError: In case you try to stop an already stopped Client.
         """
         if not self.is_started:
             raise ConnectionError("Client is already stopped")
@@ -416,25 +408,34 @@ class Client(Methods, BaseClient):
         return self
 
     def restart(self):
-        """Use this method to restart the Client.
-        Requires no parameters.
+        """Restart the Client.
 
         Raises:
-            ``ConnectionError`` in case you try to restart a stopped Client.
+            ConnectionError: In case you try to restart a stopped Client.
         """
         self.stop()
         self.start()
 
     def idle(self, stop_signals: tuple = (SIGINT, SIGTERM, SIGABRT)):
-        """Blocks the program execution until one of the signals are received,
-        then gently stop the Client by closing the underlying connection.
+        """Block the main script execution until a signal (e.g.: from CTRL+C) is received.
+        Once the signal is received, the client will automatically stop and the main script will continue its execution.
 
-        Args:
+        This is used after starting one or more clients and is useful for event-driven applications only, that are,
+        applications which react upon incoming Telegram updates through handlers, rather than executing a set of methods
+        sequentially.
+
+        The way Pyrogram works, will keep your handlers in a pool of workers, which are executed concurrently outside
+        the main script; calling idle() will ensure the client(s) will be kept alive by not letting the main script to
+        end, until you decide to quit.
+
+        Parameters:
             stop_signals (``tuple``, *optional*):
                 Iterable containing signals the signal handler will listen to.
                 Defaults to (SIGINT, SIGTERM, SIGABRT).
         """
 
+        # TODO: Maybe make this method static and don't automatically stop
+
         def signal_handler(*args):
             self.is_idle = False
 
@@ -449,23 +450,26 @@ class Client(Methods, BaseClient):
         self.stop()
 
     def run(self):
-        """Use this method to automatically start and idle a Client.
-        Requires no parameters.
+        """Start the Client and automatically idle the main script.
+
+        This is a convenience method that literally just calls :meth:`~Client.start` and :meth:`~Client.idle`. It makes
+        running a client less verbose, but is not suitable in case you want to run more than one client in a single main
+        script, since :meth:`~Client.idle` will block.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         self.start()
         self.idle()
 
     def add_handler(self, handler: Handler, group: int = 0):
-        """Use this method to register an update handler.
+        """Register an update handler.
 
         You can register multiple handlers, but at most one handler within a group
         will be used for a single update. To handle the same update more than once, register
         your handler using a different group id (lower group id == higher priority).
 
-        Args:
+        Parameters:
             handler (``Handler``):
                 The handler to be registered.
 
@@ -473,7 +477,7 @@ class Client(Methods, BaseClient):
                 The group identifier, defaults to 0.
 
         Returns:
-            A tuple of (handler, group)
+            ``tuple``: A tuple consisting of (handler, group).
         """
         if isinstance(handler, DisconnectHandler):
             self.disconnect_handler = handler.callback
@@ -483,13 +487,13 @@ class Client(Methods, BaseClient):
         return handler, group
 
     def remove_handler(self, handler: Handler, group: int = 0):
-        """Removes a previously-added update handler.
+        """Remove a previously-registered update handler.
 
         Make sure to provide the right group that the handler was added in. You can use
-        the return value of the :meth:`add_handler` method, a tuple of (handler, group), and
+        the return value of the :meth:`~Client.add_handler` method, a tuple of (handler, group), and
         pass it directly.
 
-        Args:
+        Parameters:
             handler (``Handler``):
                 The handler to be removed.
 
@@ -502,7 +506,7 @@ class Client(Methods, BaseClient):
             self.dispatcher.remove_handler(handler, group)
 
     def stop_transmission(self):
-        """Use this method to stop downloading or uploading a file.
+        """Stop downloading or uploading a file.
         Must be called inside a progress callback function.
         """
         raise Client.StopTransmission
@@ -771,96 +775,52 @@ class Client(Methods, BaseClient):
 
         print("Logged in successfully as {}".format(r.user.first_name))
 
-    def fetch_peers(self, entities: List[Union[types.User,
-                                               types.Chat, types.ChatForbidden,
-                                               types.Channel, types.ChannelForbidden]]):
+    def fetch_peers(
+        self,
+        entities: List[
+            Union[
+                types.User,
+                types.Chat, types.ChatForbidden,
+                types.Channel, types.ChannelForbidden
+            ]
+        ]
+    ) -> bool:
+        is_min = False
+
         for entity in entities:
             if isinstance(entity, (types.User, types.Channel, types.ChannelForbidden)) and not entity.access_hash:
                 continue
             self.session_storage.cache_peer(entity)
 
+        return is_min
+
     def download_worker(self):
         name = threading.current_thread().name
         log.debug("{} started".format(name))
 
         while True:
-            media = self.download_queue.get()
+            packet = self.download_queue.get()
 
-            if media is None:
+            if packet is None:
                 break
 
             temp_file_path = ""
             final_file_path = ""
 
             try:
-                media, file_name, done, progress, progress_args, path = media
-
-                file_id = media.file_id
-                size = media.file_size
-
-                directory, file_name = os.path.split(file_name)
-                directory = directory or "downloads"
-
-                try:
-                    decoded = utils.decode(file_id)
-                    fmt = " 24 else " 24:
-                        volume_id = unpacked[4]
-                        secret = unpacked[5]
-                        local_id = unpacked[6]
-
-                    media_type_str = Client.MEDIA_TYPE_ID.get(media_type, None)
-
-                    if media_type_str is None:
-                        raise FileIdInvalid("Unknown media type: {}".format(unpacked[0]))
-
-                file_name = file_name or getattr(media, "file_name", None)
-
-                if not file_name:
-                    if media_type == 3:
-                        extension = ".ogg"
-                    elif media_type in (4, 10, 13):
-                        extension = mimetypes.guess_extension(media.mime_type) or ".mp4"
-                    elif media_type == 5:
-                        extension = mimetypes.guess_extension(media.mime_type) or ".unknown"
-                    elif media_type == 8:
-                        extension = ".webp"
-                    elif media_type == 9:
-                        extension = mimetypes.guess_extension(media.mime_type) or ".mp3"
-                    elif media_type in (0, 1, 2):
-                        extension = ".jpg"
-                    else:
-                        continue
-
-                    file_name = "{}_{}_{}{}".format(
-                        media_type_str,
-                        datetime.fromtimestamp(
-                            getattr(media, "date", None) or time.time()
-                        ).strftime("%Y-%m-%d_%H-%M-%S"),
-                        self.rnd_id(),
-                        extension
-                    )
+                data, directory, file_name, done, progress, progress_args, path = packet
 
                 temp_file_path = self.get_file(
-                    dc_id=dc_id,
-                    id=id,
-                    access_hash=access_hash,
-                    volume_id=volume_id,
-                    local_id=local_id,
-                    secret=secret,
-                    size=size,
+                    media_type=data.media_type,
+                    dc_id=data.dc_id,
+                    document_id=data.document_id,
+                    access_hash=data.access_hash,
+                    thumb_size=data.thumb_size,
+                    peer_id=data.peer_id,
+                    volume_id=data.volume_id,
+                    local_id=data.local_id,
+                    file_size=data.file_size,
+                    is_big=data.is_big,
                     progress=progress,
                     progress_args=progress_args
                 )
@@ -898,8 +858,10 @@ class Client(Methods, BaseClient):
 
             try:
                 if isinstance(updates, (types.Update, types.UpdatesCombined)):
-                    self.fetch_peers(updates.users)
-                    self.fetch_peers(updates.chats)
+                    is_min = self.fetch_peers(updates.users) or self.fetch_peers(updates.chats)
+
+                    users = {u.id: u for u in updates.users}
+                    chats = {c.id: c for c in updates.chats}
 
                     for update in updates.updates:
                         channel_id = getattr(
@@ -916,7 +878,7 @@ class Client(Methods, BaseClient):
                         if isinstance(update, types.UpdateChannelTooLong):
                             log.warning(update)
 
-                        if isinstance(update, types.UpdateNewChannelMessage):
+                        if isinstance(update, types.UpdateNewChannelMessage) and is_min:
                             message = update.message
 
                             if not isinstance(message, types.MessageEmpty):
@@ -938,22 +900,10 @@ class Client(Methods, BaseClient):
                                     pass
                                 else:
                                     if not isinstance(diff, types.updates.ChannelDifferenceEmpty):
-                                        updates.users += diff.users
-                                        updates.chats += diff.chats
+                                        users.update({u.id: u for u in diff.users})
+                                        chats.update({c.id: c for c in diff.chats})
 
-                        if channel_id and pts:
-                            if channel_id not in self.channels_pts:
-                                self.channels_pts[channel_id] = []
-
-                            if pts in self.channels_pts[channel_id]:
-                                continue
-
-                            self.channels_pts[channel_id].append(pts)
-
-                            if len(self.channels_pts[channel_id]) > 50:
-                                self.channels_pts[channel_id] = self.channels_pts[channel_id][25:]
-
-                        self.dispatcher.updates_queue.put((update, updates.users, updates.chats))
+                        self.dispatcher.updates_queue.put((update, users, chats))
                 elif isinstance(updates, (types.UpdateShortMessage, types.UpdateShortChatMessage)):
                     diff = self.send(
                         functions.updates.GetDifference(
@@ -970,13 +920,13 @@ class Client(Methods, BaseClient):
                                 pts=updates.pts,
                                 pts_count=updates.pts_count
                             ),
-                            diff.users,
-                            diff.chats
+                            {u.id: u for u in diff.users},
+                            {c.id: c for c in diff.chats}
                         ))
                     else:
-                        self.dispatcher.updates_queue.put((diff.other_updates[0], [], []))
+                        self.dispatcher.updates_queue.put((diff.other_updates[0], {}, {}))
                 elif isinstance(updates, types.UpdateShort):
-                    self.dispatcher.updates_queue.put((updates.update, [], []))
+                    self.dispatcher.updates_queue.put((updates.update, {}, {}))
                 elif isinstance(updates, types.UpdatesTooLong):
                     log.warning(updates)
             except Exception as e:
@@ -984,18 +934,21 @@ class Client(Methods, BaseClient):
 
         log.debug("{} stopped".format(name))
 
-    def send(self,
-             data: Object,
-             retries: int = Session.MAX_RETRIES,
-             timeout: float = Session.WAIT_TIMEOUT):
-        """Use this method to send Raw Function queries.
+    def send(self, data: TLObject, retries: int = Session.MAX_RETRIES, timeout: float = Session.WAIT_TIMEOUT):
+        """Send raw Telegram queries.
 
-        This method makes possible to manually call every single Telegram API method in a low-level manner.
+        This method makes it possible to manually call every single Telegram API method in a low-level manner.
         Available functions are listed in the :obj:`functions ` package and may accept compound
         data types from :obj:`types ` as well as bare types such as ``int``, ``str``, etc...
 
-        Args:
-            data (``Object``):
+        .. note::
+
+            This is a utility method intended to be used **only** when working with raw
+            :obj:`functions ` (i.e: a Telegram API method you wish to use which is not
+            available yet in the Client class as an easy-to-use method).
+
+        Parameters:
+            data (``RawFunction``):
                 The API Schema function filled with proper arguments.
 
             retries (``int``):
@@ -1004,8 +957,11 @@ class Client(Methods, BaseClient):
             timeout (``float``):
                 Timeout in seconds.
 
+        Returns:
+            ``RawType``: The raw type response generated by the query.
+
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if not self.is_started:
             raise ConnectionError("Client has not been started")
@@ -1036,7 +992,7 @@ class Client(Methods, BaseClient):
             else:
                 raise AttributeError(
                     "No API Key found. "
-                    "More info: https://docs.pyrogram.ml/start/ProjectSetup#configuration"
+                    "More info: https://docs.pyrogram.org/intro/setup#configuration"
                 )
 
         for option in ["app_version", "device_model", "system_version", "lang_code"]:
@@ -1065,29 +1021,34 @@ class Client(Methods, BaseClient):
                 self._proxy["password"] = parser.get("proxy", "password", fallback=None) or None
 
         if self.plugins:
-            self.plugins["enabled"] = bool(self.plugins.get("enabled", True))
-            self.plugins["include"] = "\n".join(self.plugins.get("include", [])) or None
-            self.plugins["exclude"] = "\n".join(self.plugins.get("exclude", [])) or None
+            self.plugins = {
+                "enabled": bool(self.plugins.get("enabled", True)),
+                "root": self.plugins.get("root", None),
+                "include": self.plugins.get("include", []),
+                "exclude": self.plugins.get("exclude", [])
+            }
         else:
             try:
                 section = parser["plugins"]
 
                 self.plugins = {
                     "enabled": section.getboolean("enabled", True),
-                    "root": section.get("root"),
-                    "include": section.get("include") or None,
-                    "exclude": section.get("exclude") or None
+                    "root": section.get("root", None),
+                    "include": section.get("include", []),
+                    "exclude": section.get("exclude", [])
                 }
-            except KeyError:
-                self.plugins = {}
 
-        if self.plugins:
-            for option in ["include", "exclude"]:
-                if self.plugins[option] is not None:
-                    self.plugins[option] = [
-                        (i.split()[0], i.split()[1:] or None)
-                        for i in self.plugins[option].strip().split("\n")
-                    ]
+                include = self.plugins["include"]
+                exclude = self.plugins["exclude"]
+
+                if include:
+                    self.plugins["include"] = include.strip().split("\n")
+
+                if exclude:
+                    self.plugins["exclude"] = exclude.strip().split("\n")
+
+            except KeyError:
+                self.plugins = None
 
     def load_session(self):
         try:
@@ -1098,14 +1059,26 @@ class Client(Methods, BaseClient):
                                                  self.ipv6, self._proxy).create()
 
     def load_plugins(self):
-        if self.plugins.get("enabled", False):
-            root = self.plugins["root"]
-            include = self.plugins["include"]
-            exclude = self.plugins["exclude"]
+        if self.plugins:
+            plugins = self.plugins.copy()
+
+            for option in ["include", "exclude"]:
+                if plugins[option]:
+                    plugins[option] = [
+                        (i.split()[0], i.split()[1:] or None)
+                        for i in self.plugins[option]
+                    ]
+        else:
+            return
+
+        if plugins.get("enabled", False):
+            root = plugins["root"]
+            include = plugins["include"]
+            exclude = plugins["exclude"]
 
             count = 0
 
-            if include is None:
+            if not include:
                 for path in sorted(Path(root).rglob("*.py")):
                     module_path = '.'.join(path.parent.parts + (path.stem,))
                     module = import_module(module_path)
@@ -1118,8 +1091,8 @@ class Client(Methods, BaseClient):
                             if isinstance(handler, Handler) and isinstance(group, int):
                                 self.add_handler(handler, group)
 
-                                log.info('[LOAD] {}("{}") in group {} from "{}"'.format(
-                                    type(handler).__name__, name, group, module_path))
+                                log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format(
+                                    self.session_name, type(handler).__name__, name, group, module_path))
 
                                 count += 1
                         except Exception:
@@ -1132,11 +1105,13 @@ class Client(Methods, BaseClient):
                     try:
                         module = import_module(module_path)
                     except ImportError:
-                        log.warning('[LOAD] Ignoring non-existent module "{}"'.format(module_path))
+                        log.warning('[{}] [LOAD] Ignoring non-existent module "{}"'.format(
+                            self.session_name, module_path))
                         continue
 
                     if "__path__" in dir(module):
-                        log.warning('[LOAD] Ignoring namespace "{}"'.format(module_path))
+                        log.warning('[{}] [LOAD] Ignoring namespace "{}"'.format(
+                            self.session_name, module_path))
                         continue
 
                     if handlers is None:
@@ -1151,16 +1126,16 @@ class Client(Methods, BaseClient):
                             if isinstance(handler, Handler) and isinstance(group, int):
                                 self.add_handler(handler, group)
 
-                                log.info('[LOAD] {}("{}") in group {} from "{}"'.format(
-                                    type(handler).__name__, name, group, module_path))
+                                log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format(
+                                    self.session_name, type(handler).__name__, name, group, module_path))
 
                                 count += 1
                         except Exception:
                             if warn_non_existent_functions:
-                                log.warning('[LOAD] Ignoring non-existent function "{}" from "{}"'.format(
-                                    name, module_path))
+                                log.warning('[{}] [LOAD] Ignoring non-existent function "{}" from "{}"'.format(
+                                    self.session_name, name, module_path))
 
-            if exclude is not None:
+            if exclude:
                 for path, handlers in exclude:
                     module_path = root + "." + path
                     warn_non_existent_functions = True
@@ -1168,11 +1143,13 @@ class Client(Methods, BaseClient):
                     try:
                         module = import_module(module_path)
                     except ImportError:
-                        log.warning('[UNLOAD] Ignoring non-existent module "{}"'.format(module_path))
+                        log.warning('[{}] [UNLOAD] Ignoring non-existent module "{}"'.format(
+                            self.session_name, module_path))
                         continue
 
                     if "__path__" in dir(module):
-                        log.warning('[UNLOAD] Ignoring namespace "{}"'.format(module_path))
+                        log.warning('[{}] [UNLOAD] Ignoring namespace "{}"'.format(
+                            self.session_name, module_path))
                         continue
 
                     if handlers is None:
@@ -1187,25 +1164,26 @@ class Client(Methods, BaseClient):
                             if isinstance(handler, Handler) and isinstance(group, int):
                                 self.remove_handler(handler, group)
 
-                                log.info('[UNLOAD] {}("{}") from group {} in "{}"'.format(
-                                    type(handler).__name__, name, group, module_path))
+                                log.info('[{}] [UNLOAD] {}("{}") from group {} in "{}"'.format(
+                                    self.session_name, type(handler).__name__, name, group, module_path))
 
                                 count -= 1
                         except Exception:
                             if warn_non_existent_functions:
-                                log.warning('[UNLOAD] Ignoring non-existent function "{}" from "{}"'.format(
-                                    name, module_path))
+                                log.warning('[{}] [UNLOAD] Ignoring non-existent function "{}" from "{}"'.format(
+                                    self.session_name, name, module_path))
 
             if count > 0:
-                log.warning('Successfully loaded {} plugin{} from "{}"'.format(count, "s" if count > 1 else "", root))
+                log.warning('[{}] Successfully loaded {} plugin{} from "{}"'.format(
+                    self.session_name, count, "s" if count > 1 else "", root))
             else:
-                log.warning('No plugin loaded from "{}"'.format(root))
+                log.warning('[{}] No plugin loaded from "{}"'.format(
+                    self.session_name, root))
 
     def save_session(self):
         self.session_storage.save()
 
-    def get_initial_dialogs_chunk(self,
-                                  offset_date: int = 0):
+    def get_initial_dialogs_chunk(self, offset_date: int = 0):
         while True:
             try:
                 r = self.send(
@@ -1226,7 +1204,7 @@ class Client(Methods, BaseClient):
                 return r
 
     def get_initial_dialogs(self):
-        self.send(functions.messages.GetPinnedDialogs())
+        self.send(functions.messages.GetPinnedDialogs(folder_id=0))
 
         dialogs = self.get_initial_dialogs_chunk()
         offset_date = utils.get_offset_date(dialogs)
@@ -1237,25 +1215,27 @@ class Client(Methods, BaseClient):
 
         self.get_initial_dialogs_chunk()
 
-    def resolve_peer(self,
-                     peer_id: Union[int, str]):
-        """Use this method to get the InputPeer of a known peer_id.
+    def resolve_peer(self, peer_id: Union[int, str]):
+        """Get the InputPeer of a known peer id.
+        Useful whenever an InputPeer type is required.
 
-        This is a utility method intended to be used **only** when working with Raw Functions (i.e: a Telegram API
-        method you wish to use which is not available yet in the Client class as an easy-to-use method), whenever an
-        InputPeer type is required.
+        .. note::
 
-        Args:
+            This is a utility method intended to be used **only** when working with raw
+            :obj:`functions ` (i.e: a Telegram API method you wish to use which is not
+            available yet in the Client class as an easy-to-use method).
+
+        Parameters:
             peer_id (``int`` | ``str``):
                 The peer id you want to extract the InputPeer from.
                 Can be a direct id (int), a username (str) or a phone number (str).
 
         Returns:
-            On success, the resolved peer id is returned in form of an InputPeer object.
+            ``InputPeer``: On success, the resolved peer id is returned in form of an InputPeer object.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``KeyError`` in case the peer doesn't exist in the internal database.
+            RPCError: In case of a Telegram RPC error.
+            KeyError: In case the peer doesn't exist in the internal database.
         """
         try:
             return self.session_storage.get_peer_by_id(peer_id)
@@ -1312,19 +1292,24 @@ class Client(Methods, BaseClient):
             except KeyError:
                 raise PeerIdInvalid
 
-    def save_file(self,
-                  path: str,
-                  file_id: int = None,
-                  file_part: int = 0,
-                  progress: callable = None,
-                  progress_args: tuple = ()):
-        """Use this method to upload a file onto Telegram servers, without actually sending the message to anyone.
+    def save_file(
+        self,
+        path: str,
+        file_id: int = None,
+        file_part: int = 0,
+        progress: callable = None,
+        progress_args: tuple = ()
+    ):
+        """Upload a file onto Telegram servers, without actually sending the message to anyone.
+        Useful whenever an InputFile type is required.
 
-        This is a utility method intended to be used **only** when working with Raw Functions (i.e: a Telegram API
-        method you wish to use which is not available yet in the Client class as an easy-to-use method), whenever an
-        InputFile type is required.
+        .. note::
 
-        Args:
+            This is a utility method intended to be used **only** when working with raw
+            :obj:`functions ` (i.e: a Telegram API method you wish to use which is not
+            available yet in the Client class as an easy-to-use method).
+
+        Parameters:
             path (``str``):
                 The path of the file you want to upload that exists on your local machine.
 
@@ -1344,7 +1329,7 @@ class Client(Methods, BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -1358,10 +1343,10 @@ class Client(Methods, BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the uploaded file is returned in form of an InputFile object.
+            ``InputFile``: On success, the uploaded file is returned in form of an InputFile object.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         part_size = 512 * 1024
         file_size = os.path.getsize(path)
@@ -1445,16 +1430,21 @@ class Client(Methods, BaseClient):
         finally:
             session.stop()
 
-    def get_file(self,
-                 dc_id: int,
-                 id: int = None,
-                 access_hash: int = None,
-                 volume_id: int = None,
-                 local_id: int = None,
-                 secret: int = None,
-                 size: int = None,
-                 progress: callable = None,
-                 progress_args: tuple = ()) -> str:
+    def get_file(
+        self,
+        media_type: int,
+        dc_id: int,
+        document_id: int,
+        access_hash: int,
+        thumb_size: str,
+        peer_id: int,
+        volume_id: int,
+        local_id: int,
+        file_size: int,
+        is_big: bool,
+        progress: callable,
+        progress_args: tuple = ()
+    ) -> str:
         with self.media_sessions_lock:
             session = self.media_sessions.get(dc_id, None)
 
@@ -1495,18 +1485,33 @@ class Client(Methods, BaseClient):
 
                     self.media_sessions[dc_id] = session
 
-        if volume_id:  # Photos are accessed by volume_id, local_id, secret
-            location = types.InputFileLocation(
+        if media_type == 1:
+            location = types.InputPeerPhotoFileLocation(
+                peer=self.resolve_peer(peer_id),
                 volume_id=volume_id,
                 local_id=local_id,
-                secret=secret,
-                file_reference=b""
+                big=is_big or None
             )
-        else:  # Any other file can be more easily accessed by id and access_hash
-            location = types.InputDocumentFileLocation(
-                id=id,
+        elif media_type in (0, 2):
+            location = types.InputPhotoFileLocation(
+                id=document_id,
                 access_hash=access_hash,
-                file_reference=b""
+                file_reference=b"",
+                thumb_size=thumb_size
+            )
+        elif media_type == 14:
+            location = types.InputDocumentFileLocation(
+                id=document_id,
+                access_hash=access_hash,
+                file_reference=b"",
+                thumb_size=thumb_size
+            )
+        else:
+            location = types.InputDocumentFileLocation(
+                id=document_id,
+                access_hash=access_hash,
+                file_reference=b"",
+                thumb_size=""
             )
 
         limit = 1024 * 1024
@@ -1537,7 +1542,14 @@ class Client(Methods, BaseClient):
                         offset += limit
 
                         if progress:
-                            progress(self, min(offset, size) if size != 0 else offset, size, *progress_args)
+                            progress(
+                                self,
+                                min(offset, file_size)
+                                if file_size != 0
+                                else offset,
+                                file_size,
+                                *progress_args
+                            )
 
                         r = session.send(
                             functions.upload.GetFile(
@@ -1619,7 +1631,14 @@ class Client(Methods, BaseClient):
                             offset += limit
 
                             if progress:
-                                progress(self, min(offset, size) if size != 0 else offset, size, *progress_args)
+                                progress(
+                                    self,
+                                    min(offset, file_size)
+                                    if file_size != 0
+                                    else offset,
+                                    file_size,
+                                    *progress_args
+                                )
 
                             if len(chunk) < limit:
                                 break
@@ -1637,3 +1656,13 @@ class Client(Methods, BaseClient):
             return ""
         else:
             return file_name
+
+    def guess_mime_type(self, filename: str):
+        extension = os.path.splitext(filename)[1]
+        return self.extensions_to_mime_types.get(extension)
+
+    def guess_extension(self, mime_type: str):
+        extensions = self.mime_types_to_extensions.get(mime_type)
+
+        if extensions:
+            return extensions.split(" ")[0]
diff --git a/pyrogram/client/ext/__init__.py b/pyrogram/client/ext/__init__.py
index 18c28ac3..dde1952e 100644
--- a/pyrogram/client/ext/__init__.py
+++ b/pyrogram/client/ext/__init__.py
@@ -17,8 +17,7 @@
 # along with Pyrogram.  If not, see .
 
 from .base_client import BaseClient
-from .chat_action import ChatAction
 from .dispatcher import Dispatcher
 from .emoji import Emoji
-from .parse_mode import ParseMode
+from .file_data import FileData
 from .syncer import Syncer
diff --git a/pyrogram/client/ext/base_client.py b/pyrogram/client/ext/base_client.py
index a8922846..aaf87823 100644
--- a/pyrogram/client/ext/base_client.py
+++ b/pyrogram/client/ext/base_client.py
@@ -16,8 +16,11 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
+import os
 import platform
 import re
+import sys
+from pathlib import Path
 from queue import Queue
 from threading import Lock
 
@@ -31,7 +34,7 @@ class BaseClient:
     class StopTransmission(StopIteration):
         pass
 
-    APP_VERSION = "Pyrogram \U0001f525 {}".format(__version__)
+    APP_VERSION = "Pyrogram {}".format(__version__)
 
     DEVICE_MODEL = "{} {}".format(
         platform.python_implementation(),
@@ -45,18 +48,20 @@ class BaseClient:
 
     LANG_CODE = "en"
 
+    PARENT_DIR = Path(sys.argv[0]).parent
+
     INVITE_LINK_RE = re.compile(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/joinchat/)([\w-]+)$")
     BOT_TOKEN_RE = re.compile(r"^\d+:[\w-]+$")
     DIALOGS_AT_ONCE = 100
     UPDATES_WORKERS = 1
     DOWNLOAD_WORKERS = 1
-    OFFLINE_SLEEP = 300
+    OFFLINE_SLEEP = 900
     WORKERS = 4
-    WORKDIR = "."
-    CONFIG_FILE = "./config.ini"
+    WORKDIR = PARENT_DIR
+    CONFIG_FILE = PARENT_DIR / "config.ini"
 
     MEDIA_TYPE_ID = {
-        0: "thumbnail",
+        0: "photo_thumbnail",
         1: "chat_photo",
         2: "photo",
         3: "voice",
@@ -65,14 +70,28 @@ class BaseClient:
         8: "sticker",
         9: "audio",
         10: "animation",
-        13: "video_note"
+        13: "video_note",
+        14: "document_thumbnail"
     }
 
+    mime_types_to_extensions = {}
+    extensions_to_mime_types = {}
+
+    with open("{}/mime.types".format(os.path.dirname(__file__)), "r", encoding="UTF-8") as f:
+        for match in re.finditer(r"^([^#\s]+)\s+(.+)$", f.read(), flags=re.M):
+            mime_type, extensions = match.groups()
+
+            extensions = [".{}".format(ext) for ext in extensions.split(" ")]
+
+            for ext in extensions:
+                extensions_to_mime_types[ext] = mime_type
+
+            mime_types_to_extensions[mime_type] = " ".join(extensions)
+
     def __init__(self, session_storage: SessionStorage):
         self.session_storage = session_storage
 
         self.rnd_id = MsgId
-        self.channels_pts = {}
 
         self.markdown = Markdown(self.session_storage, self)
         self.html = HTML(self.session_storage, self)
@@ -125,3 +144,30 @@ class BaseClient:
 
     def answer_inline_query(self, *args, **kwargs):
         pass
+
+    def guess_mime_type(self, *args, **kwargs):
+        pass
+
+    def guess_extension(self, *args, **kwargs):
+        pass
+
+    def get_profile_photos(self, *args, **kwargs):
+        pass
+
+    def edit_message_text(self, *args, **kwargs):
+        pass
+
+    def edit_inline_text(self, *args, **kwargs):
+        pass
+
+    def edit_message_media(self, *args, **kwargs):
+        pass
+
+    def edit_inline_media(self, *args, **kwargs):
+        pass
+
+    def edit_message_reply_markup(self, *args, **kwargs):
+        pass
+
+    def edit_inline_reply_markup(self, *args, **kwargs):
+        pass
diff --git a/pyrogram/client/ext/chat_action.py b/pyrogram/client/ext/chat_action.py
deleted file mode 100644
index c0ee0585..00000000
--- a/pyrogram/client/ext/chat_action.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017-2019 Dan Tès 
-#
-# 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 .
-
-from enum import Enum
-
-from pyrogram.api import types
-
-
-class ChatAction(Enum):
-    """This enumeration provides a convenient access to all Chat Actions available.
-    Chat Actions are intended to be used with
-    :meth:`send_chat_action() `.
-    """
-
-    CANCEL = types.SendMessageCancelAction
-    """Cancels any chat action currently displayed."""
-
-    TYPING = types.SendMessageTypingAction
-    """User is typing a text message."""
-
-    PLAYING = types.SendMessageGamePlayAction
-    """User is playing a game."""
-
-    CHOOSE_CONTACT = types.SendMessageChooseContactAction
-    """User is choosing a contact to share."""
-
-    UPLOAD_PHOTO = types.SendMessageUploadPhotoAction
-    """User is uploading a photo."""
-
-    RECORD_VIDEO = types.SendMessageRecordVideoAction
-    """User is recording a video."""
-
-    UPLOAD_VIDEO = types.SendMessageUploadVideoAction
-    """User is uploading a video."""
-
-    RECORD_AUDIO = types.SendMessageRecordAudioAction
-    """User is recording an audio message."""
-
-    UPLOAD_AUDIO = types.SendMessageUploadAudioAction
-    """User is uploading an audio message."""
-
-    UPLOAD_DOCUMENT = types.SendMessageUploadDocumentAction
-    """User is uploading a generic document."""
-
-    FIND_LOCATION = types.SendMessageGeoLocationAction
-    """User is searching for a location on the map."""
-
-    RECORD_VIDEO_NOTE = types.SendMessageRecordRoundAction
-    """User is recording a round video note."""
-
-    UPLOAD_VIDEO_NOTE = types.SendMessageUploadRoundAction
-    """User is uploading a round video note."""
-
-    @staticmethod
-    def from_string(action: str) -> "ChatAction":
-        for a in ChatAction:
-            if a.name.lower() == action.lower():
-                return a
-
-        raise ValueError("Invalid ChatAction: '{}'. Possible types are {}".format(
-            action, [x.name.lower() for x in ChatAction]
-        ))
diff --git a/pyrogram/client/ext/dispatcher.py b/pyrogram/client/ext/dispatcher.py
index 7552b034..56cdead6 100644
--- a/pyrogram/client/ext/dispatcher.py
+++ b/pyrogram/client/ext/dispatcher.py
@@ -24,9 +24,10 @@ from threading import Thread
 
 import pyrogram
 from pyrogram.api import types
+from . import utils
 from ..handlers import (
     CallbackQueryHandler, MessageHandler, DeletedMessagesHandler,
-    UserStatusHandler, RawUpdateHandler, InlineQueryHandler
+    UserStatusHandler, RawUpdateHandler, InlineQueryHandler, PollHandler
 )
 
 log = logging.getLogger(__name__)
@@ -68,7 +69,7 @@ class Dispatcher:
                 lambda upd, usr, cht: (pyrogram.Message._parse(self.client, upd.message, usr, cht), MessageHandler),
 
             Dispatcher.DELETE_MESSAGES_UPDATES:
-                lambda upd, usr, cht: (pyrogram.Messages._parse_deleted(self.client, upd), DeletedMessagesHandler),
+                lambda upd, usr, cht: (utils.parse_deleted_messages(self.client, upd), DeletedMessagesHandler),
 
             Dispatcher.CALLBACK_QUERY_UPDATES:
                 lambda upd, usr, cht: (pyrogram.CallbackQuery._parse(self.client, upd, usr), CallbackQueryHandler),
@@ -79,7 +80,10 @@ class Dispatcher:
                 ),
 
             (types.UpdateBotInlineQuery,):
-                lambda upd, usr, cht: (pyrogram.InlineQuery._parse(self.client, upd, usr), InlineQueryHandler)
+                lambda upd, usr, cht: (pyrogram.InlineQuery._parse(self.client, upd, usr), InlineQueryHandler),
+
+            (types.UpdateMessagePoll,):
+                lambda upd, usr, cht: (pyrogram.Poll._parse_update(self.client, upd), PollHandler)
         }
 
         self.update_parsers = {key: value for key_tuple, value in self.update_parsers.items() for key in key_tuple}
@@ -103,6 +107,7 @@ class Dispatcher:
             worker.join()
 
         self.workers_list.clear()
+        self.groups.clear()
 
     def add_handler(self, handler, group: int):
         if group not in self.groups:
@@ -122,16 +127,13 @@ class Dispatcher:
         log.debug("{} started".format(name))
 
         while True:
-            update = self.updates_queue.get()
+            packet = self.updates_queue.get()
 
-            if update is None:
+            if packet is None:
                 break
 
             try:
-                users = {i.id: i for i in update[1]}
-                chats = {i.id: i for i in update[2]}
-                update = update[0]
-
+                update, users, chats = packet
                 parser = self.update_parsers.get(type(update), None)
 
                 parsed_update, handler_type = (
diff --git a/pyrogram/client/ext/file_data.py b/pyrogram/client/ext/file_data.py
new file mode 100644
index 00000000..9a19cd5d
--- /dev/null
+++ b/pyrogram/client/ext/file_data.py
@@ -0,0 +1,38 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+
+class FileData:
+    def __init__(
+        self, *, media_type: int = None, dc_id: int = None, document_id: int = None, access_hash: int = None,
+        thumb_size: str = None, peer_id: int = None, volume_id: int = None, local_id: int = None, is_big: bool = None,
+        file_size: int = None, mime_type: str = None, file_name: str = None, date: int = None
+    ):
+        self.media_type = media_type
+        self.dc_id = dc_id
+        self.document_id = document_id
+        self.access_hash = access_hash
+        self.thumb_size = thumb_size
+        self.peer_id = peer_id
+        self.volume_id = volume_id
+        self.local_id = local_id
+        self.is_big = is_big
+        self.file_size = file_size
+        self.mime_type = mime_type
+        self.file_name = file_name
+        self.date = date
diff --git a/pyrogram/client/ext/mime.types b/pyrogram/client/ext/mime.types
new file mode 100644
index 00000000..50ec065d
--- /dev/null
+++ b/pyrogram/client/ext/mime.types
@@ -0,0 +1,1858 @@
+# This file maps Internet media types to unique file extension(s).
+# Although created for httpd, this file is used by many software systems
+# and has been placed in the public domain for unlimited redisribution.
+#
+# The table below contains both registered and (common) unregistered types.
+# A type that has no unique extension can be ignored -- they are listed
+# here to guide configurations toward known types and to make it easier to
+# identify "new" types.  File extensions are also commonly used to indicate
+# content languages and encodings, so choose them carefully.
+#
+# Internet media types should be registered as described in RFC 4288.
+# The registry is at .
+#
+# MIME type (lowercased)			Extensions
+# ============================================	==========
+# application/1d-interleaved-parityfec
+# application/3gpdash-qoe-report+xml
+# application/3gpp-ims+xml
+# application/a2l
+# application/activemessage
+# application/alto-costmap+json
+# application/alto-costmapfilter+json
+# application/alto-directory+json
+# application/alto-endpointcost+json
+# application/alto-endpointcostparams+json
+# application/alto-endpointprop+json
+# application/alto-endpointpropparams+json
+# application/alto-error+json
+# application/alto-networkmap+json
+# application/alto-networkmapfilter+json
+# application/aml
+application/andrew-inset			ez
+# application/applefile
+application/applixware				aw
+# application/atf
+# application/atfx
+application/atom+xml				atom
+application/atomcat+xml				atomcat
+# application/atomdeleted+xml
+# application/atomicmail
+application/atomsvc+xml				atomsvc
+# application/atxml
+# application/auth-policy+xml
+# application/bacnet-xdd+zip
+# application/batch-smtp
+# application/beep+xml
+# application/calendar+json
+# application/calendar+xml
+# application/call-completion
+# application/cals-1840
+# application/cbor
+# application/ccmp+xml
+application/ccxml+xml				ccxml
+# application/cdfx+xml
+application/cdmi-capability			cdmia
+application/cdmi-container			cdmic
+application/cdmi-domain				cdmid
+application/cdmi-object				cdmio
+application/cdmi-queue				cdmiq
+# application/cdni
+# application/cea
+# application/cea-2018+xml
+# application/cellml+xml
+# application/cfw
+# application/cms
+# application/cnrp+xml
+# application/coap-group+json
+# application/commonground
+# application/conference-info+xml
+# application/cpl+xml
+# application/csrattrs
+# application/csta+xml
+# application/cstadata+xml
+# application/csvm+json
+application/cu-seeme				cu
+# application/cybercash
+# application/dash+xml
+# application/dashdelta
+application/davmount+xml			davmount
+# application/dca-rft
+# application/dcd
+# application/dec-dx
+# application/dialog-info+xml
+# application/dicom
+# application/dii
+# application/dit
+# application/dns
+application/docbook+xml				dbk
+# application/dskpp+xml
+application/dssc+der				dssc
+application/dssc+xml				xdssc
+# application/dvcs
+application/ecmascript				ecma
+# application/edi-consent
+# application/edi-x12
+# application/edifact
+# application/efi
+# application/emergencycalldata.comment+xml
+# application/emergencycalldata.deviceinfo+xml
+# application/emergencycalldata.providerinfo+xml
+# application/emergencycalldata.serviceinfo+xml
+# application/emergencycalldata.subscriberinfo+xml
+application/emma+xml				emma
+# application/emotionml+xml
+# application/encaprtp
+# application/epp+xml
+application/epub+zip				epub
+# application/eshop
+# application/example
+application/exi					exi
+# application/fastinfoset
+# application/fastsoap
+# application/fdt+xml
+# application/fits
+application/font-tdpfr				pfr
+# application/framework-attributes+xml
+# application/geo+json
+application/gml+xml				gml
+application/gpx+xml				gpx
+application/gxf					gxf
+# application/gzip
+# application/h224
+# application/held+xml
+# application/http
+application/hyperstudio				stk
+# application/ibe-key-request+xml
+# application/ibe-pkg-reply+xml
+# application/ibe-pp-data
+# application/iges
+# application/im-iscomposing+xml
+# application/index
+# application/index.cmd
+# application/index.obj
+# application/index.response
+# application/index.vnd
+application/inkml+xml				ink inkml
+# application/iotp
+application/ipfix				ipfix
+# application/ipp
+# application/isup
+# application/its+xml
+application/java-archive			jar
+application/java-serialized-object		ser
+application/java-vm				class
+application/javascript				js
+# application/jose
+# application/jose+json
+# application/jrd+json
+application/json				json
+# application/json-patch+json
+# application/json-seq
+application/jsonml+json				jsonml
+# application/jwk+json
+# application/jwk-set+json
+# application/jwt
+# application/kpml-request+xml
+# application/kpml-response+xml
+# application/ld+json
+# application/lgr+xml
+# application/link-format
+# application/load-control+xml
+application/lost+xml				lostxml
+# application/lostsync+xml
+# application/lxf
+application/mac-binhex40			hqx
+application/mac-compactpro			cpt
+# application/macwriteii
+application/mads+xml				mads
+application/marc				mrc
+application/marcxml+xml				mrcx
+application/mathematica				ma nb mb
+application/mathml+xml				mathml
+# application/mathml-content+xml
+# application/mathml-presentation+xml
+# application/mbms-associated-procedure-description+xml
+# application/mbms-deregister+xml
+# application/mbms-envelope+xml
+# application/mbms-msk+xml
+# application/mbms-msk-response+xml
+# application/mbms-protection-description+xml
+# application/mbms-reception-report+xml
+# application/mbms-register+xml
+# application/mbms-register-response+xml
+# application/mbms-schedule+xml
+# application/mbms-user-service-description+xml
+application/mbox				mbox
+# application/media-policy-dataset+xml
+# application/media_control+xml
+application/mediaservercontrol+xml		mscml
+# application/merge-patch+json
+application/metalink+xml			metalink
+application/metalink4+xml			meta4
+application/mets+xml				mets
+# application/mf4
+# application/mikey
+application/mods+xml				mods
+# application/moss-keys
+# application/moss-signature
+# application/mosskey-data
+# application/mosskey-request
+application/mp21				m21 mp21
+application/mp4					mp4s
+# application/mpeg4-generic
+# application/mpeg4-iod
+# application/mpeg4-iod-xmt
+# application/mrb-consumer+xml
+# application/mrb-publish+xml
+# application/msc-ivr+xml
+# application/msc-mixer+xml
+application/msword				doc dot
+application/mxf					mxf
+# application/nasdata
+# application/news-checkgroups
+# application/news-groupinfo
+# application/news-transmission
+# application/nlsml+xml
+# application/nss
+# application/ocsp-request
+# application/ocsp-response
+application/octet-stream	bin dms lrf mar so dist distz pkg bpk dump elc deploy
+application/oda					oda
+# application/odx
+application/oebps-package+xml			opf
+application/ogg					ogx
+application/omdoc+xml				omdoc
+application/onenote				onetoc onetoc2 onetmp onepkg
+application/oxps				oxps
+# application/p2p-overlay+xml
+# application/parityfec
+application/patch-ops-error+xml			xer
+application/pdf					pdf
+# application/pdx
+application/pgp-encrypted			pgp
+# application/pgp-keys
+application/pgp-signature			asc sig
+application/pics-rules				prf
+# application/pidf+xml
+# application/pidf-diff+xml
+application/pkcs10				p10
+# application/pkcs12
+application/pkcs7-mime				p7m p7c
+application/pkcs7-signature			p7s
+application/pkcs8				p8
+application/pkix-attr-cert			ac
+application/pkix-cert				cer
+application/pkix-crl				crl
+application/pkix-pkipath			pkipath
+application/pkixcmp				pki
+application/pls+xml				pls
+# application/poc-settings+xml
+application/postscript				ai eps ps
+# application/ppsp-tracker+json
+# application/problem+json
+# application/problem+xml
+# application/provenance+xml
+# application/prs.alvestrand.titrax-sheet
+application/prs.cww				cww
+# application/prs.hpub+zip
+# application/prs.nprend
+# application/prs.plucker
+# application/prs.rdf-xml-crypt
+# application/prs.xsf+xml
+application/pskc+xml				pskcxml
+# application/qsig
+# application/raptorfec
+# application/rdap+json
+application/rdf+xml				rdf
+application/reginfo+xml				rif
+application/relax-ng-compact-syntax		rnc
+# application/remote-printing
+# application/reputon+json
+application/resource-lists+xml			rl
+application/resource-lists-diff+xml		rld
+# application/rfc+xml
+# application/riscos
+# application/rlmi+xml
+application/rls-services+xml			rs
+application/rpki-ghostbusters			gbr
+application/rpki-manifest			mft
+application/rpki-roa				roa
+# application/rpki-updown
+application/rsd+xml				rsd
+application/rss+xml				rss
+application/rtf					rtf
+# application/rtploopback
+# application/rtx
+# application/samlassertion+xml
+# application/samlmetadata+xml
+application/sbml+xml				sbml
+# application/scaip+xml
+# application/scim+json
+application/scvp-cv-request			scq
+application/scvp-cv-response			scs
+application/scvp-vp-request			spq
+application/scvp-vp-response			spp
+application/sdp					sdp
+# application/sep+xml
+# application/sep-exi
+# application/session-info
+# application/set-payment
+application/set-payment-initiation		setpay
+# application/set-registration
+application/set-registration-initiation		setreg
+# application/sgml
+# application/sgml-open-catalog
+application/shf+xml				shf
+# application/sieve
+# application/simple-filter+xml
+# application/simple-message-summary
+# application/simplesymbolcontainer
+# application/slate
+# application/smil
+application/smil+xml				smi smil
+# application/smpte336m
+# application/soap+fastinfoset
+# application/soap+xml
+application/sparql-query			rq
+application/sparql-results+xml			srx
+# application/spirits-event+xml
+# application/sql
+application/srgs				gram
+application/srgs+xml				grxml
+application/sru+xml				sru
+application/ssdl+xml				ssdl
+application/ssml+xml				ssml
+# application/tamp-apex-update
+# application/tamp-apex-update-confirm
+# application/tamp-community-update
+# application/tamp-community-update-confirm
+# application/tamp-error
+# application/tamp-sequence-adjust
+# application/tamp-sequence-adjust-confirm
+# application/tamp-status-query
+# application/tamp-status-response
+# application/tamp-update
+# application/tamp-update-confirm
+application/tei+xml				tei teicorpus
+application/thraud+xml				tfi
+# application/timestamp-query
+# application/timestamp-reply
+application/timestamped-data			tsd
+# application/ttml+xml
+# application/tve-trigger
+# application/ulpfec
+# application/urc-grpsheet+xml
+# application/urc-ressheet+xml
+# application/urc-targetdesc+xml
+# application/urc-uisocketdesc+xml
+# application/vcard+json
+# application/vcard+xml
+# application/vemmi
+# application/vividence.scriptfile
+# application/vnd.3gpp-prose+xml
+# application/vnd.3gpp-prose-pc3ch+xml
+# application/vnd.3gpp.access-transfer-events+xml
+# application/vnd.3gpp.bsf+xml
+# application/vnd.3gpp.mid-call+xml
+application/vnd.3gpp.pic-bw-large		plb
+application/vnd.3gpp.pic-bw-small		psb
+application/vnd.3gpp.pic-bw-var			pvb
+# application/vnd.3gpp.sms
+# application/vnd.3gpp.sms+xml
+# application/vnd.3gpp.srvcc-ext+xml
+# application/vnd.3gpp.srvcc-info+xml
+# application/vnd.3gpp.state-and-event-info+xml
+# application/vnd.3gpp.ussd+xml
+# application/vnd.3gpp2.bcmcsinfo+xml
+# application/vnd.3gpp2.sms
+application/vnd.3gpp2.tcap			tcap
+# application/vnd.3lightssoftware.imagescal
+application/vnd.3m.post-it-notes		pwn
+application/vnd.accpac.simply.aso		aso
+application/vnd.accpac.simply.imp		imp
+application/vnd.acucobol			acu
+application/vnd.acucorp				atc acutc
+application/vnd.adobe.air-application-installer-package+zip	air
+# application/vnd.adobe.flash.movie
+application/vnd.adobe.formscentral.fcdt		fcdt
+application/vnd.adobe.fxp			fxp fxpl
+# application/vnd.adobe.partial-upload
+application/vnd.adobe.xdp+xml			xdp
+application/vnd.adobe.xfdf			xfdf
+# application/vnd.aether.imp
+# application/vnd.ah-barcode
+application/vnd.ahead.space			ahead
+application/vnd.airzip.filesecure.azf		azf
+application/vnd.airzip.filesecure.azs		azs
+application/vnd.amazon.ebook			azw
+# application/vnd.amazon.mobi8-ebook
+application/vnd.americandynamics.acc		acc
+application/vnd.amiga.ami			ami
+# application/vnd.amundsen.maze+xml
+application/vnd.android.package-archive		apk
+# application/vnd.anki
+application/vnd.anser-web-certificate-issue-initiation	cii
+application/vnd.anser-web-funds-transfer-initiation	fti
+application/vnd.antix.game-component		atx
+# application/vnd.apache.thrift.binary
+# application/vnd.apache.thrift.compact
+# application/vnd.apache.thrift.json
+# application/vnd.api+json
+application/vnd.apple.installer+xml		mpkg
+application/vnd.apple.mpegurl			m3u8
+# application/vnd.arastra.swi
+application/vnd.aristanetworks.swi		swi
+# application/vnd.artsquare
+application/vnd.astraea-software.iota		iota
+application/vnd.audiograph			aep
+# application/vnd.autopackage
+# application/vnd.avistar+xml
+# application/vnd.balsamiq.bmml+xml
+# application/vnd.balsamiq.bmpr
+# application/vnd.bekitzur-stech+json
+# application/vnd.biopax.rdf+xml
+application/vnd.blueice.multipass		mpm
+# application/vnd.bluetooth.ep.oob
+# application/vnd.bluetooth.le.oob
+application/vnd.bmi				bmi
+application/vnd.businessobjects			rep
+# application/vnd.cab-jscript
+# application/vnd.canon-cpdl
+# application/vnd.canon-lips
+# application/vnd.cendio.thinlinc.clientconf
+# application/vnd.century-systems.tcp_stream
+application/vnd.chemdraw+xml			cdxml
+# application/vnd.chess-pgn
+application/vnd.chipnuts.karaoke-mmd		mmd
+application/vnd.cinderella			cdy
+# application/vnd.cirpack.isdn-ext
+# application/vnd.citationstyles.style+xml
+application/vnd.claymore			cla
+application/vnd.cloanto.rp9			rp9
+application/vnd.clonk.c4group			c4g c4d c4f c4p c4u
+application/vnd.cluetrust.cartomobile-config		c11amc
+application/vnd.cluetrust.cartomobile-config-pkg	c11amz
+# application/vnd.coffeescript
+# application/vnd.collection+json
+# application/vnd.collection.doc+json
+# application/vnd.collection.next+json
+# application/vnd.comicbook+zip
+# application/vnd.commerce-battelle
+application/vnd.commonspace			csp
+application/vnd.contact.cmsg			cdbcmsg
+# application/vnd.coreos.ignition+json
+application/vnd.cosmocaller			cmc
+application/vnd.crick.clicker			clkx
+application/vnd.crick.clicker.keyboard		clkk
+application/vnd.crick.clicker.palette		clkp
+application/vnd.crick.clicker.template		clkt
+application/vnd.crick.clicker.wordbank		clkw
+application/vnd.criticaltools.wbs+xml		wbs
+application/vnd.ctc-posml			pml
+# application/vnd.ctct.ws+xml
+# application/vnd.cups-pdf
+# application/vnd.cups-postscript
+application/vnd.cups-ppd			ppd
+# application/vnd.cups-raster
+# application/vnd.cups-raw
+# application/vnd.curl
+application/vnd.curl.car			car
+application/vnd.curl.pcurl			pcurl
+# application/vnd.cyan.dean.root+xml
+# application/vnd.cybank
+application/vnd.dart				dart
+application/vnd.data-vision.rdz			rdz
+# application/vnd.debian.binary-package
+application/vnd.dece.data			uvf uvvf uvd uvvd
+application/vnd.dece.ttml+xml			uvt uvvt
+application/vnd.dece.unspecified		uvx uvvx
+application/vnd.dece.zip			uvz uvvz
+application/vnd.denovo.fcselayout-link		fe_launch
+# application/vnd.desmume.movie
+# application/vnd.dir-bi.plate-dl-nosuffix
+# application/vnd.dm.delegation+xml
+application/vnd.dna				dna
+# application/vnd.document+json
+application/vnd.dolby.mlp			mlp
+# application/vnd.dolby.mobile.1
+# application/vnd.dolby.mobile.2
+# application/vnd.doremir.scorecloud-binary-document
+application/vnd.dpgraph				dpg
+application/vnd.dreamfactory			dfac
+# application/vnd.drive+json
+application/vnd.ds-keypoint			kpxx
+# application/vnd.dtg.local
+# application/vnd.dtg.local.flash
+# application/vnd.dtg.local.html
+application/vnd.dvb.ait				ait
+# application/vnd.dvb.dvbj
+# application/vnd.dvb.esgcontainer
+# application/vnd.dvb.ipdcdftnotifaccess
+# application/vnd.dvb.ipdcesgaccess
+# application/vnd.dvb.ipdcesgaccess2
+# application/vnd.dvb.ipdcesgpdd
+# application/vnd.dvb.ipdcroaming
+# application/vnd.dvb.iptv.alfec-base
+# application/vnd.dvb.iptv.alfec-enhancement
+# application/vnd.dvb.notif-aggregate-root+xml
+# application/vnd.dvb.notif-container+xml
+# application/vnd.dvb.notif-generic+xml
+# application/vnd.dvb.notif-ia-msglist+xml
+# application/vnd.dvb.notif-ia-registration-request+xml
+# application/vnd.dvb.notif-ia-registration-response+xml
+# application/vnd.dvb.notif-init+xml
+# application/vnd.dvb.pfr
+application/vnd.dvb.service			svc
+# application/vnd.dxr
+application/vnd.dynageo				geo
+# application/vnd.dzr
+# application/vnd.easykaraoke.cdgdownload
+# application/vnd.ecdis-update
+application/vnd.ecowin.chart			mag
+# application/vnd.ecowin.filerequest
+# application/vnd.ecowin.fileupdate
+# application/vnd.ecowin.series
+# application/vnd.ecowin.seriesrequest
+# application/vnd.ecowin.seriesupdate
+# application/vnd.emclient.accessrequest+xml
+application/vnd.enliven				nml
+# application/vnd.enphase.envoy
+# application/vnd.eprints.data+xml
+application/vnd.epson.esf			esf
+application/vnd.epson.msf			msf
+application/vnd.epson.quickanime		qam
+application/vnd.epson.salt			slt
+application/vnd.epson.ssf			ssf
+# application/vnd.ericsson.quickcall
+application/vnd.eszigno3+xml			es3 et3
+# application/vnd.etsi.aoc+xml
+# application/vnd.etsi.asic-e+zip
+# application/vnd.etsi.asic-s+zip
+# application/vnd.etsi.cug+xml
+# application/vnd.etsi.iptvcommand+xml
+# application/vnd.etsi.iptvdiscovery+xml
+# application/vnd.etsi.iptvprofile+xml
+# application/vnd.etsi.iptvsad-bc+xml
+# application/vnd.etsi.iptvsad-cod+xml
+# application/vnd.etsi.iptvsad-npvr+xml
+# application/vnd.etsi.iptvservice+xml
+# application/vnd.etsi.iptvsync+xml
+# application/vnd.etsi.iptvueprofile+xml
+# application/vnd.etsi.mcid+xml
+# application/vnd.etsi.mheg5
+# application/vnd.etsi.overload-control-policy-dataset+xml
+# application/vnd.etsi.pstn+xml
+# application/vnd.etsi.sci+xml
+# application/vnd.etsi.simservs+xml
+# application/vnd.etsi.timestamp-token
+# application/vnd.etsi.tsl+xml
+# application/vnd.etsi.tsl.der
+# application/vnd.eudora.data
+application/vnd.ezpix-album			ez2
+application/vnd.ezpix-package			ez3
+# application/vnd.f-secure.mobile
+# application/vnd.fastcopy-disk-image
+application/vnd.fdf				fdf
+application/vnd.fdsn.mseed			mseed
+application/vnd.fdsn.seed			seed dataless
+# application/vnd.ffsns
+# application/vnd.filmit.zfc
+# application/vnd.fints
+# application/vnd.firemonkeys.cloudcell
+application/vnd.flographit			gph
+application/vnd.fluxtime.clip			ftc
+# application/vnd.font-fontforge-sfd
+application/vnd.framemaker			fm frame maker book
+application/vnd.frogans.fnc			fnc
+application/vnd.frogans.ltf			ltf
+application/vnd.fsc.weblaunch			fsc
+application/vnd.fujitsu.oasys			oas
+application/vnd.fujitsu.oasys2			oa2
+application/vnd.fujitsu.oasys3			oa3
+application/vnd.fujitsu.oasysgp			fg5
+application/vnd.fujitsu.oasysprs		bh2
+# application/vnd.fujixerox.art-ex
+# application/vnd.fujixerox.art4
+application/vnd.fujixerox.ddd			ddd
+application/vnd.fujixerox.docuworks		xdw
+application/vnd.fujixerox.docuworks.binder	xbd
+# application/vnd.fujixerox.docuworks.container
+# application/vnd.fujixerox.hbpl
+# application/vnd.fut-misnet
+application/vnd.fuzzysheet			fzs
+application/vnd.genomatix.tuxedo		txd
+# application/vnd.geo+json
+# application/vnd.geocube+xml
+application/vnd.geogebra.file			ggb
+application/vnd.geogebra.tool			ggt
+application/vnd.geometry-explorer		gex gre
+application/vnd.geonext				gxt
+application/vnd.geoplan				g2w
+application/vnd.geospace			g3w
+# application/vnd.gerber
+# application/vnd.globalplatform.card-content-mgt
+# application/vnd.globalplatform.card-content-mgt-response
+application/vnd.gmx				gmx
+application/vnd.google-earth.kml+xml		kml
+application/vnd.google-earth.kmz		kmz
+# application/vnd.gov.sk.e-form+xml
+# application/vnd.gov.sk.e-form+zip
+# application/vnd.gov.sk.xmldatacontainer+xml
+application/vnd.grafeq				gqf gqs
+# application/vnd.gridmp
+application/vnd.groove-account			gac
+application/vnd.groove-help			ghf
+application/vnd.groove-identity-message		gim
+application/vnd.groove-injector			grv
+application/vnd.groove-tool-message		gtm
+application/vnd.groove-tool-template		tpl
+application/vnd.groove-vcard			vcg
+# application/vnd.hal+json
+application/vnd.hal+xml				hal
+application/vnd.handheld-entertainment+xml	zmm
+application/vnd.hbci				hbci
+# application/vnd.hcl-bireports
+# application/vnd.hdt
+# application/vnd.heroku+json
+application/vnd.hhe.lesson-player		les
+application/vnd.hp-hpgl				hpgl
+application/vnd.hp-hpid				hpid
+application/vnd.hp-hps				hps
+application/vnd.hp-jlyt				jlt
+application/vnd.hp-pcl				pcl
+application/vnd.hp-pclxl			pclxl
+# application/vnd.httphone
+application/vnd.hydrostatix.sof-data		sfd-hdstx
+# application/vnd.hyperdrive+json
+# application/vnd.hzn-3d-crossword
+# application/vnd.ibm.afplinedata
+# application/vnd.ibm.electronic-media
+application/vnd.ibm.minipay			mpy
+application/vnd.ibm.modcap			afp listafp list3820
+application/vnd.ibm.rights-management		irm
+application/vnd.ibm.secure-container		sc
+application/vnd.iccprofile			icc icm
+# application/vnd.ieee.1905
+application/vnd.igloader			igl
+application/vnd.immervision-ivp			ivp
+application/vnd.immervision-ivu			ivu
+# application/vnd.ims.imsccv1p1
+# application/vnd.ims.imsccv1p2
+# application/vnd.ims.imsccv1p3
+# application/vnd.ims.lis.v2.result+json
+# application/vnd.ims.lti.v2.toolconsumerprofile+json
+# application/vnd.ims.lti.v2.toolproxy+json
+# application/vnd.ims.lti.v2.toolproxy.id+json
+# application/vnd.ims.lti.v2.toolsettings+json
+# application/vnd.ims.lti.v2.toolsettings.simple+json
+# application/vnd.informedcontrol.rms+xml
+# application/vnd.informix-visionary
+# application/vnd.infotech.project
+# application/vnd.infotech.project+xml
+# application/vnd.innopath.wamp.notification
+application/vnd.insors.igm			igm
+application/vnd.intercon.formnet		xpw xpx
+application/vnd.intergeo			i2g
+# application/vnd.intertrust.digibox
+# application/vnd.intertrust.nncp
+application/vnd.intu.qbo			qbo
+application/vnd.intu.qfx			qfx
+# application/vnd.iptc.g2.catalogitem+xml
+# application/vnd.iptc.g2.conceptitem+xml
+# application/vnd.iptc.g2.knowledgeitem+xml
+# application/vnd.iptc.g2.newsitem+xml
+# application/vnd.iptc.g2.newsmessage+xml
+# application/vnd.iptc.g2.packageitem+xml
+# application/vnd.iptc.g2.planningitem+xml
+application/vnd.ipunplugged.rcprofile		rcprofile
+application/vnd.irepository.package+xml		irp
+application/vnd.is-xpr				xpr
+application/vnd.isac.fcs			fcs
+application/vnd.jam				jam
+# application/vnd.japannet-directory-service
+# application/vnd.japannet-jpnstore-wakeup
+# application/vnd.japannet-payment-wakeup
+# application/vnd.japannet-registration
+# application/vnd.japannet-registration-wakeup
+# application/vnd.japannet-setstore-wakeup
+# application/vnd.japannet-verification
+# application/vnd.japannet-verification-wakeup
+application/vnd.jcp.javame.midlet-rms		rms
+application/vnd.jisp				jisp
+application/vnd.joost.joda-archive		joda
+# application/vnd.jsk.isdn-ngn
+application/vnd.kahootz				ktz ktr
+application/vnd.kde.karbon			karbon
+application/vnd.kde.kchart			chrt
+application/vnd.kde.kformula			kfo
+application/vnd.kde.kivio			flw
+application/vnd.kde.kontour			kon
+application/vnd.kde.kpresenter			kpr kpt
+application/vnd.kde.kspread			ksp
+application/vnd.kde.kword			kwd kwt
+application/vnd.kenameaapp			htke
+application/vnd.kidspiration			kia
+application/vnd.kinar				kne knp
+application/vnd.koan				skp skd skt skm
+application/vnd.kodak-descriptor		sse
+application/vnd.las.las+xml			lasxml
+# application/vnd.liberty-request+xml
+application/vnd.llamagraphics.life-balance.desktop	lbd
+application/vnd.llamagraphics.life-balance.exchange+xml	lbe
+application/vnd.lotus-1-2-3			123
+application/vnd.lotus-approach			apr
+application/vnd.lotus-freelance			pre
+application/vnd.lotus-notes			nsf
+application/vnd.lotus-organizer			org
+application/vnd.lotus-screencam			scm
+application/vnd.lotus-wordpro			lwp
+application/vnd.macports.portpkg		portpkg
+# application/vnd.mapbox-vector-tile
+# application/vnd.marlin.drm.actiontoken+xml
+# application/vnd.marlin.drm.conftoken+xml
+# application/vnd.marlin.drm.license+xml
+# application/vnd.marlin.drm.mdcf
+# application/vnd.mason+json
+# application/vnd.maxmind.maxmind-db
+application/vnd.mcd				mcd
+application/vnd.medcalcdata			mc1
+application/vnd.mediastation.cdkey		cdkey
+# application/vnd.meridian-slingshot
+application/vnd.mfer				mwf
+application/vnd.mfmp				mfm
+# application/vnd.micro+json
+application/vnd.micrografx.flo			flo
+application/vnd.micrografx.igx			igx
+# application/vnd.microsoft.portable-executable
+# application/vnd.miele+json
+application/vnd.mif				mif
+# application/vnd.minisoft-hp3000-save
+# application/vnd.mitsubishi.misty-guard.trustweb
+application/vnd.mobius.daf			daf
+application/vnd.mobius.dis			dis
+application/vnd.mobius.mbk			mbk
+application/vnd.mobius.mqy			mqy
+application/vnd.mobius.msl			msl
+application/vnd.mobius.plc			plc
+application/vnd.mobius.txf			txf
+application/vnd.mophun.application		mpn
+application/vnd.mophun.certificate		mpc
+# application/vnd.motorola.flexsuite
+# application/vnd.motorola.flexsuite.adsi
+# application/vnd.motorola.flexsuite.fis
+# application/vnd.motorola.flexsuite.gotap
+# application/vnd.motorola.flexsuite.kmr
+# application/vnd.motorola.flexsuite.ttc
+# application/vnd.motorola.flexsuite.wem
+# application/vnd.motorola.iprm
+application/vnd.mozilla.xul+xml			xul
+# application/vnd.ms-3mfdocument
+application/vnd.ms-artgalry			cil
+# application/vnd.ms-asf
+application/vnd.ms-cab-compressed		cab
+# application/vnd.ms-color.iccprofile
+application/vnd.ms-excel			xls xlm xla xlc xlt xlw
+application/vnd.ms-excel.addin.macroenabled.12		xlam
+application/vnd.ms-excel.sheet.binary.macroenabled.12	xlsb
+application/vnd.ms-excel.sheet.macroenabled.12		xlsm
+application/vnd.ms-excel.template.macroenabled.12	xltm
+application/vnd.ms-fontobject			eot
+application/vnd.ms-htmlhelp			chm
+application/vnd.ms-ims				ims
+application/vnd.ms-lrm				lrm
+# application/vnd.ms-office.activex+xml
+application/vnd.ms-officetheme			thmx
+# application/vnd.ms-opentype
+# application/vnd.ms-package.obfuscated-opentype
+application/vnd.ms-pki.seccat			cat
+application/vnd.ms-pki.stl			stl
+# application/vnd.ms-playready.initiator+xml
+application/vnd.ms-powerpoint			ppt pps pot
+application/vnd.ms-powerpoint.addin.macroenabled.12		ppam
+application/vnd.ms-powerpoint.presentation.macroenabled.12	pptm
+application/vnd.ms-powerpoint.slide.macroenabled.12		sldm
+application/vnd.ms-powerpoint.slideshow.macroenabled.12		ppsm
+application/vnd.ms-powerpoint.template.macroenabled.12		potm
+# application/vnd.ms-printdevicecapabilities+xml
+# application/vnd.ms-printing.printticket+xml
+# application/vnd.ms-printschematicket+xml
+application/vnd.ms-project			mpp mpt
+# application/vnd.ms-tnef
+# application/vnd.ms-windows.devicepairing
+# application/vnd.ms-windows.nwprinting.oob
+# application/vnd.ms-windows.printerpairing
+# application/vnd.ms-windows.wsd.oob
+# application/vnd.ms-wmdrm.lic-chlg-req
+# application/vnd.ms-wmdrm.lic-resp
+# application/vnd.ms-wmdrm.meter-chlg-req
+# application/vnd.ms-wmdrm.meter-resp
+application/vnd.ms-word.document.macroenabled.12	docm
+application/vnd.ms-word.template.macroenabled.12	dotm
+application/vnd.ms-works			wps wks wcm wdb
+application/vnd.ms-wpl				wpl
+application/vnd.ms-xpsdocument			xps
+# application/vnd.msa-disk-image
+application/vnd.mseq				mseq
+# application/vnd.msign
+# application/vnd.multiad.creator
+# application/vnd.multiad.creator.cif
+# application/vnd.music-niff
+application/vnd.musician			mus
+application/vnd.muvee.style			msty
+application/vnd.mynfc				taglet
+# application/vnd.ncd.control
+# application/vnd.ncd.reference
+# application/vnd.nervana
+# application/vnd.netfpx
+application/vnd.neurolanguage.nlu		nlu
+# application/vnd.nintendo.nitro.rom
+# application/vnd.nintendo.snes.rom
+application/vnd.nitf				ntf nitf
+application/vnd.noblenet-directory		nnd
+application/vnd.noblenet-sealer			nns
+application/vnd.noblenet-web			nnw
+# application/vnd.nokia.catalogs
+# application/vnd.nokia.conml+wbxml
+# application/vnd.nokia.conml+xml
+# application/vnd.nokia.iptv.config+xml
+# application/vnd.nokia.isds-radio-presets
+# application/vnd.nokia.landmark+wbxml
+# application/vnd.nokia.landmark+xml
+# application/vnd.nokia.landmarkcollection+xml
+# application/vnd.nokia.n-gage.ac+xml
+application/vnd.nokia.n-gage.data		ngdat
+application/vnd.nokia.n-gage.symbian.install	n-gage
+# application/vnd.nokia.ncd
+# application/vnd.nokia.pcd+wbxml
+# application/vnd.nokia.pcd+xml
+application/vnd.nokia.radio-preset		rpst
+application/vnd.nokia.radio-presets		rpss
+application/vnd.novadigm.edm			edm
+application/vnd.novadigm.edx			edx
+application/vnd.novadigm.ext			ext
+# application/vnd.ntt-local.content-share
+# application/vnd.ntt-local.file-transfer
+# application/vnd.ntt-local.ogw_remote-access
+# application/vnd.ntt-local.sip-ta_remote
+# application/vnd.ntt-local.sip-ta_tcp_stream
+application/vnd.oasis.opendocument.chart		odc
+application/vnd.oasis.opendocument.chart-template	otc
+application/vnd.oasis.opendocument.database		odb
+application/vnd.oasis.opendocument.formula		odf
+application/vnd.oasis.opendocument.formula-template	odft
+application/vnd.oasis.opendocument.graphics		odg
+application/vnd.oasis.opendocument.graphics-template	otg
+application/vnd.oasis.opendocument.image		odi
+application/vnd.oasis.opendocument.image-template	oti
+application/vnd.oasis.opendocument.presentation		odp
+application/vnd.oasis.opendocument.presentation-template	otp
+application/vnd.oasis.opendocument.spreadsheet		ods
+application/vnd.oasis.opendocument.spreadsheet-template	ots
+application/vnd.oasis.opendocument.text			odt
+application/vnd.oasis.opendocument.text-master		odm
+application/vnd.oasis.opendocument.text-template	ott
+application/vnd.oasis.opendocument.text-web		oth
+# application/vnd.obn
+# application/vnd.oftn.l10n+json
+# application/vnd.oipf.contentaccessdownload+xml
+# application/vnd.oipf.contentaccessstreaming+xml
+# application/vnd.oipf.cspg-hexbinary
+# application/vnd.oipf.dae.svg+xml
+# application/vnd.oipf.dae.xhtml+xml
+# application/vnd.oipf.mippvcontrolmessage+xml
+# application/vnd.oipf.pae.gem
+# application/vnd.oipf.spdiscovery+xml
+# application/vnd.oipf.spdlist+xml
+# application/vnd.oipf.ueprofile+xml
+# application/vnd.oipf.userprofile+xml
+application/vnd.olpc-sugar			xo
+# application/vnd.oma-scws-config
+# application/vnd.oma-scws-http-request
+# application/vnd.oma-scws-http-response
+# application/vnd.oma.bcast.associated-procedure-parameter+xml
+# application/vnd.oma.bcast.drm-trigger+xml
+# application/vnd.oma.bcast.imd+xml
+# application/vnd.oma.bcast.ltkm
+# application/vnd.oma.bcast.notification+xml
+# application/vnd.oma.bcast.provisioningtrigger
+# application/vnd.oma.bcast.sgboot
+# application/vnd.oma.bcast.sgdd+xml
+# application/vnd.oma.bcast.sgdu
+# application/vnd.oma.bcast.simple-symbol-container
+# application/vnd.oma.bcast.smartcard-trigger+xml
+# application/vnd.oma.bcast.sprov+xml
+# application/vnd.oma.bcast.stkm
+# application/vnd.oma.cab-address-book+xml
+# application/vnd.oma.cab-feature-handler+xml
+# application/vnd.oma.cab-pcc+xml
+# application/vnd.oma.cab-subs-invite+xml
+# application/vnd.oma.cab-user-prefs+xml
+# application/vnd.oma.dcd
+# application/vnd.oma.dcdc
+application/vnd.oma.dd2+xml			dd2
+# application/vnd.oma.drm.risd+xml
+# application/vnd.oma.group-usage-list+xml
+# application/vnd.oma.lwm2m+json
+# application/vnd.oma.lwm2m+tlv
+# application/vnd.oma.pal+xml
+# application/vnd.oma.poc.detailed-progress-report+xml
+# application/vnd.oma.poc.final-report+xml
+# application/vnd.oma.poc.groups+xml
+# application/vnd.oma.poc.invocation-descriptor+xml
+# application/vnd.oma.poc.optimized-progress-report+xml
+# application/vnd.oma.push
+# application/vnd.oma.scidm.messages+xml
+# application/vnd.oma.xcap-directory+xml
+# application/vnd.omads-email+xml
+# application/vnd.omads-file+xml
+# application/vnd.omads-folder+xml
+# application/vnd.omaloc-supl-init
+# application/vnd.onepager
+# application/vnd.openblox.game+xml
+# application/vnd.openblox.game-binary
+# application/vnd.openeye.oeb
+application/vnd.openofficeorg.extension		oxt
+# application/vnd.openxmlformats-officedocument.custom-properties+xml
+# application/vnd.openxmlformats-officedocument.customxmlproperties+xml
+# application/vnd.openxmlformats-officedocument.drawing+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chart+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml
+# application/vnd.openxmlformats-officedocument.extended-properties+xml
+# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml
+# application/vnd.openxmlformats-officedocument.presentationml.comments+xml
+# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml
+application/vnd.openxmlformats-officedocument.presentationml.presentation	pptx
+# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml
+application/vnd.openxmlformats-officedocument.presentationml.slide	sldx
+# application/vnd.openxmlformats-officedocument.presentationml.slide+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml
+application/vnd.openxmlformats-officedocument.presentationml.slideshow	ppsx
+# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tags+xml
+application/vnd.openxmlformats-officedocument.presentationml.template	potx
+# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.sheet	xlsx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.template	xltx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml
+# application/vnd.openxmlformats-officedocument.theme+xml
+# application/vnd.openxmlformats-officedocument.themeoverride+xml
+# application/vnd.openxmlformats-officedocument.vmldrawing
+# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.document	docx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.template	dotx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml
+# application/vnd.openxmlformats-package.core-properties+xml
+# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml
+# application/vnd.openxmlformats-package.relationships+xml
+# application/vnd.oracle.resource+json
+# application/vnd.orange.indata
+# application/vnd.osa.netdeploy
+application/vnd.osgeo.mapguide.package		mgp
+# application/vnd.osgi.bundle
+application/vnd.osgi.dp				dp
+application/vnd.osgi.subsystem			esa
+# application/vnd.otps.ct-kip+xml
+# application/vnd.oxli.countgraph
+# application/vnd.pagerduty+json
+application/vnd.palm				pdb pqa oprc
+# application/vnd.panoply
+# application/vnd.paos.xml
+application/vnd.pawaafile			paw
+# application/vnd.pcos
+application/vnd.pg.format			str
+application/vnd.pg.osasli			ei6
+# application/vnd.piaccess.application-licence
+application/vnd.picsel				efif
+application/vnd.pmi.widget			wg
+# application/vnd.poc.group-advertisement+xml
+application/vnd.pocketlearn			plf
+application/vnd.powerbuilder6			pbd
+# application/vnd.powerbuilder6-s
+# application/vnd.powerbuilder7
+# application/vnd.powerbuilder7-s
+# application/vnd.powerbuilder75
+# application/vnd.powerbuilder75-s
+# application/vnd.preminet
+application/vnd.previewsystems.box		box
+application/vnd.proteus.magazine		mgz
+application/vnd.publishare-delta-tree		qps
+application/vnd.pvi.ptid1			ptid
+# application/vnd.pwg-multiplexed
+# application/vnd.pwg-xhtml-print+xml
+# application/vnd.qualcomm.brew-app-res
+# application/vnd.quarantainenet
+application/vnd.quark.quarkxpress		qxd qxt qwd qwt qxl qxb
+# application/vnd.quobject-quoxdocument
+# application/vnd.radisys.moml+xml
+# application/vnd.radisys.msml+xml
+# application/vnd.radisys.msml-audit+xml
+# application/vnd.radisys.msml-audit-conf+xml
+# application/vnd.radisys.msml-audit-conn+xml
+# application/vnd.radisys.msml-audit-dialog+xml
+# application/vnd.radisys.msml-audit-stream+xml
+# application/vnd.radisys.msml-conf+xml
+# application/vnd.radisys.msml-dialog+xml
+# application/vnd.radisys.msml-dialog-base+xml
+# application/vnd.radisys.msml-dialog-fax-detect+xml
+# application/vnd.radisys.msml-dialog-fax-sendrecv+xml
+# application/vnd.radisys.msml-dialog-group+xml
+# application/vnd.radisys.msml-dialog-speech+xml
+# application/vnd.radisys.msml-dialog-transform+xml
+# application/vnd.rainstor.data
+# application/vnd.rapid
+# application/vnd.rar
+application/vnd.realvnc.bed			bed
+application/vnd.recordare.musicxml		mxl
+application/vnd.recordare.musicxml+xml		musicxml
+# application/vnd.renlearn.rlprint
+application/vnd.rig.cryptonote			cryptonote
+application/vnd.rim.cod				cod
+application/vnd.rn-realmedia			rm
+application/vnd.rn-realmedia-vbr		rmvb
+application/vnd.route66.link66+xml		link66
+# application/vnd.rs-274x
+# application/vnd.ruckus.download
+# application/vnd.s3sms
+application/vnd.sailingtracker.track		st
+# application/vnd.sbm.cid
+# application/vnd.sbm.mid2
+# application/vnd.scribus
+# application/vnd.sealed.3df
+# application/vnd.sealed.csf
+# application/vnd.sealed.doc
+# application/vnd.sealed.eml
+# application/vnd.sealed.mht
+# application/vnd.sealed.net
+# application/vnd.sealed.ppt
+# application/vnd.sealed.tiff
+# application/vnd.sealed.xls
+# application/vnd.sealedmedia.softseal.html
+# application/vnd.sealedmedia.softseal.pdf
+application/vnd.seemail				see
+application/vnd.sema				sema
+application/vnd.semd				semd
+application/vnd.semf				semf
+application/vnd.shana.informed.formdata		ifm
+application/vnd.shana.informed.formtemplate	itp
+application/vnd.shana.informed.interchange	iif
+application/vnd.shana.informed.package		ipk
+application/vnd.simtech-mindmapper		twd twds
+# application/vnd.siren+json
+application/vnd.smaf				mmf
+# application/vnd.smart.notebook
+application/vnd.smart.teacher			teacher
+# application/vnd.software602.filler.form+xml
+# application/vnd.software602.filler.form-xml-zip
+application/vnd.solent.sdkm+xml			sdkm sdkd
+application/vnd.spotfire.dxp			dxp
+application/vnd.spotfire.sfs			sfs
+# application/vnd.sss-cod
+# application/vnd.sss-dtf
+# application/vnd.sss-ntf
+application/vnd.stardivision.calc		sdc
+application/vnd.stardivision.draw		sda
+application/vnd.stardivision.impress		sdd
+application/vnd.stardivision.math		smf
+application/vnd.stardivision.writer		sdw vor
+application/vnd.stardivision.writer-global	sgl
+application/vnd.stepmania.package		smzip
+application/vnd.stepmania.stepchart		sm
+# application/vnd.street-stream
+# application/vnd.sun.wadl+xml
+application/vnd.sun.xml.calc			sxc
+application/vnd.sun.xml.calc.template		stc
+application/vnd.sun.xml.draw			sxd
+application/vnd.sun.xml.draw.template		std
+application/vnd.sun.xml.impress			sxi
+application/vnd.sun.xml.impress.template	sti
+application/vnd.sun.xml.math			sxm
+application/vnd.sun.xml.writer			sxw
+application/vnd.sun.xml.writer.global		sxg
+application/vnd.sun.xml.writer.template		stw
+application/vnd.sus-calendar			sus susp
+application/vnd.svd				svd
+# application/vnd.swiftview-ics
+application/vnd.symbian.install			sis sisx
+application/vnd.syncml+xml			xsm
+application/vnd.syncml.dm+wbxml			bdm
+application/vnd.syncml.dm+xml			xdm
+# application/vnd.syncml.dm.notification
+# application/vnd.syncml.dmddf+wbxml
+# application/vnd.syncml.dmddf+xml
+# application/vnd.syncml.dmtnds+wbxml
+# application/vnd.syncml.dmtnds+xml
+# application/vnd.syncml.ds.notification
+application/vnd.tao.intent-module-archive	tao
+application/vnd.tcpdump.pcap			pcap cap dmp
+# application/vnd.tmd.mediaflex.api+xml
+# application/vnd.tml
+application/vnd.tmobile-livetv			tmo
+application/vnd.trid.tpt			tpt
+application/vnd.triscape.mxs			mxs
+application/vnd.trueapp				tra
+# application/vnd.truedoc
+# application/vnd.ubisoft.webplayer
+application/vnd.ufdl				ufd ufdl
+application/vnd.uiq.theme			utz
+application/vnd.umajin				umj
+application/vnd.unity				unityweb
+application/vnd.uoml+xml			uoml
+# application/vnd.uplanet.alert
+# application/vnd.uplanet.alert-wbxml
+# application/vnd.uplanet.bearer-choice
+# application/vnd.uplanet.bearer-choice-wbxml
+# application/vnd.uplanet.cacheop
+# application/vnd.uplanet.cacheop-wbxml
+# application/vnd.uplanet.channel
+# application/vnd.uplanet.channel-wbxml
+# application/vnd.uplanet.list
+# application/vnd.uplanet.list-wbxml
+# application/vnd.uplanet.listcmd
+# application/vnd.uplanet.listcmd-wbxml
+# application/vnd.uplanet.signal
+# application/vnd.uri-map
+# application/vnd.valve.source.material
+application/vnd.vcx				vcx
+# application/vnd.vd-study
+# application/vnd.vectorworks
+# application/vnd.vel+json
+# application/vnd.verimatrix.vcas
+# application/vnd.vidsoft.vidconference
+application/vnd.visio				vsd vst vss vsw
+application/vnd.visionary			vis
+# application/vnd.vividence.scriptfile
+application/vnd.vsf				vsf
+# application/vnd.wap.sic
+# application/vnd.wap.slc
+application/vnd.wap.wbxml			wbxml
+application/vnd.wap.wmlc			wmlc
+application/vnd.wap.wmlscriptc			wmlsc
+application/vnd.webturbo			wtb
+# application/vnd.wfa.p2p
+# application/vnd.wfa.wsc
+# application/vnd.windows.devicepairing
+# application/vnd.wmc
+# application/vnd.wmf.bootstrap
+# application/vnd.wolfram.mathematica
+# application/vnd.wolfram.mathematica.package
+application/vnd.wolfram.player			nbp
+application/vnd.wordperfect			wpd
+application/vnd.wqd				wqd
+# application/vnd.wrq-hp3000-labelled
+application/vnd.wt.stf				stf
+# application/vnd.wv.csp+wbxml
+# application/vnd.wv.csp+xml
+# application/vnd.wv.ssp+xml
+# application/vnd.xacml+json
+application/vnd.xara				xar
+application/vnd.xfdl				xfdl
+# application/vnd.xfdl.webform
+# application/vnd.xmi+xml
+# application/vnd.xmpie.cpkg
+# application/vnd.xmpie.dpkg
+# application/vnd.xmpie.plan
+# application/vnd.xmpie.ppkg
+# application/vnd.xmpie.xlim
+application/vnd.yamaha.hv-dic			hvd
+application/vnd.yamaha.hv-script		hvs
+application/vnd.yamaha.hv-voice			hvp
+application/vnd.yamaha.openscoreformat			osf
+application/vnd.yamaha.openscoreformat.osfpvg+xml	osfpvg
+# application/vnd.yamaha.remote-setup
+application/vnd.yamaha.smaf-audio		saf
+application/vnd.yamaha.smaf-phrase		spf
+# application/vnd.yamaha.through-ngn
+# application/vnd.yamaha.tunnel-udpencap
+# application/vnd.yaoweme
+application/vnd.yellowriver-custom-menu		cmp
+application/vnd.zul				zir zirz
+application/vnd.zzazz.deck+xml			zaz
+application/voicexml+xml			vxml
+# application/vq-rtcpxr
+# application/watcherinfo+xml
+# application/whoispp-query
+# application/whoispp-response
+application/widget				wgt
+application/winhlp				hlp
+# application/wita
+# application/wordperfect5.1
+application/wsdl+xml				wsdl
+application/wspolicy+xml			wspolicy
+application/x-7z-compressed			7z
+application/x-abiword				abw
+application/x-ace-compressed			ace
+# application/x-amf
+application/x-apple-diskimage			dmg
+application/x-authorware-bin			aab x32 u32 vox
+application/x-authorware-map			aam
+application/x-authorware-seg			aas
+application/x-bcpio				bcpio
+application/x-bittorrent			torrent
+application/x-blorb				blb blorb
+application/x-bzip				bz
+application/x-bzip2				bz2 boz
+application/x-cbr				cbr cba cbt cbz cb7
+application/x-cdlink				vcd
+application/x-cfs-compressed			cfs
+application/x-chat				chat
+application/x-chess-pgn				pgn
+# application/x-compress
+application/x-conference			nsc
+application/x-cpio				cpio
+application/x-csh				csh
+application/x-debian-package			deb udeb
+application/x-dgc-compressed			dgc
+application/x-director			dir dcr dxr cst cct cxt w3d fgd swa
+application/x-doom				wad
+application/x-dtbncx+xml			ncx
+application/x-dtbook+xml			dtb
+application/x-dtbresource+xml			res
+application/x-dvi				dvi
+application/x-envoy				evy
+application/x-eva				eva
+application/x-font-bdf				bdf
+# application/x-font-dos
+# application/x-font-framemaker
+application/x-font-ghostscript			gsf
+# application/x-font-libgrx
+application/x-font-linux-psf			psf
+application/x-font-pcf				pcf
+application/x-font-snf				snf
+# application/x-font-speedo
+# application/x-font-sunos-news
+application/x-font-type1			pfa pfb pfm afm
+# application/x-font-vfont
+application/x-freearc				arc
+application/x-futuresplash			spl
+application/x-gca-compressed			gca
+application/x-glulx				ulx
+application/x-gnumeric				gnumeric
+application/x-gramps-xml			gramps
+application/x-gtar				gtar
+# application/x-gzip
+application/x-hdf				hdf
+application/x-install-instructions		install
+application/x-iso9660-image			iso
+application/x-java-jnlp-file			jnlp
+application/x-latex				latex
+application/x-lzh-compressed			lzh lha
+application/x-mie				mie
+application/x-mobipocket-ebook			prc mobi
+application/x-ms-application			application
+application/x-ms-shortcut			lnk
+application/x-ms-wmd				wmd
+application/x-ms-wmz				wmz
+application/x-ms-xbap				xbap
+application/x-msaccess				mdb
+application/x-msbinder				obd
+application/x-mscardfile			crd
+application/x-msclip				clp
+application/x-msdownload			exe dll com bat msi
+application/x-msmediaview			mvb m13 m14
+application/x-msmetafile			wmf wmz emf emz
+application/x-msmoney				mny
+application/x-mspublisher			pub
+application/x-msschedule			scd
+application/x-msterminal			trm
+application/x-mswrite				wri
+application/x-netcdf				nc cdf
+application/x-nzb				nzb
+application/x-pkcs12				p12 pfx
+application/x-pkcs7-certificates		p7b spc
+application/x-pkcs7-certreqresp			p7r
+application/x-rar-compressed			rar
+application/x-research-info-systems		ris
+application/x-sh				sh
+application/x-shar				shar
+application/x-shockwave-flash			swf
+application/x-silverlight-app			xap
+application/x-sql				sql
+application/x-stuffit				sit
+application/x-stuffitx				sitx
+application/x-subrip				srt
+application/x-sv4cpio				sv4cpio
+application/x-sv4crc				sv4crc
+application/x-t3vm-image			t3
+application/x-tads				gam
+application/x-tar				tar
+application/x-tcl				tcl
+application/x-tex				tex
+application/x-tex-tfm				tfm
+application/x-texinfo				texinfo texi
+application/x-tgif				obj
+application/x-ustar				ustar
+application/x-wais-source			src
+# application/x-www-form-urlencoded
+application/x-x509-ca-cert			der crt
+application/x-xfig				fig
+application/x-xliff+xml				xlf
+application/x-xpinstall				xpi
+application/x-xz				xz
+application/x-zmachine				z1 z2 z3 z4 z5 z6 z7 z8
+# application/x400-bp
+# application/xacml+xml
+application/xaml+xml				xaml
+# application/xcap-att+xml
+# application/xcap-caps+xml
+application/xcap-diff+xml			xdf
+# application/xcap-el+xml
+# application/xcap-error+xml
+# application/xcap-ns+xml
+# application/xcon-conference-info+xml
+# application/xcon-conference-info-diff+xml
+application/xenc+xml				xenc
+application/xhtml+xml				xhtml xht
+# application/xhtml-voice+xml
+application/xml					xml xsl
+application/xml-dtd				dtd
+# application/xml-external-parsed-entity
+# application/xml-patch+xml
+# application/xmpp+xml
+application/xop+xml				xop
+application/xproc+xml				xpl
+application/xslt+xml				xslt
+application/xspf+xml				xspf
+application/xv+xml				mxml xhvml xvml xvm
+application/yang				yang
+application/yin+xml				yin
+application/zip					zip
+# application/zlib
+# audio/1d-interleaved-parityfec
+# audio/32kadpcm
+# audio/3gpp
+# audio/3gpp2
+# audio/ac3
+audio/adpcm					adp
+# audio/amr
+# audio/amr-wb
+# audio/amr-wb+
+# audio/aptx
+# audio/asc
+# audio/atrac-advanced-lossless
+# audio/atrac-x
+# audio/atrac3
+audio/basic					au snd
+# audio/bv16
+# audio/bv32
+# audio/clearmode
+# audio/cn
+# audio/dat12
+# audio/dls
+# audio/dsr-es201108
+# audio/dsr-es202050
+# audio/dsr-es202211
+# audio/dsr-es202212
+# audio/dv
+# audio/dvi4
+# audio/eac3
+# audio/encaprtp
+# audio/evrc
+# audio/evrc-qcp
+# audio/evrc0
+# audio/evrc1
+# audio/evrcb
+# audio/evrcb0
+# audio/evrcb1
+# audio/evrcnw
+# audio/evrcnw0
+# audio/evrcnw1
+# audio/evrcwb
+# audio/evrcwb0
+# audio/evrcwb1
+# audio/evs
+# audio/example
+# audio/fwdred
+# audio/g711-0
+# audio/g719
+# audio/g722
+# audio/g7221
+# audio/g723
+# audio/g726-16
+# audio/g726-24
+# audio/g726-32
+# audio/g726-40
+# audio/g728
+# audio/g729
+# audio/g7291
+# audio/g729d
+# audio/g729e
+# audio/gsm
+# audio/gsm-efr
+# audio/gsm-hr-08
+# audio/ilbc
+# audio/ip-mr_v2.5
+# audio/isac
+# audio/l16
+# audio/l20
+# audio/l24
+# audio/l8
+# audio/lpc
+audio/midi					mid midi kar rmi
+# audio/mobile-xmf
+audio/mp4					m4a mp4a
+# audio/mp4a-latm
+# audio/mpa
+# audio/mpa-robust
+audio/mpeg					mp3 mpga mp2 mp2a m2a m3a
+# audio/mpeg4-generic
+# audio/musepack
+audio/ogg					ogg oga spx
+# audio/opus
+# audio/parityfec
+# audio/pcma
+# audio/pcma-wb
+# audio/pcmu
+# audio/pcmu-wb
+# audio/prs.sid
+# audio/qcelp
+# audio/raptorfec
+# audio/red
+# audio/rtp-enc-aescm128
+# audio/rtp-midi
+# audio/rtploopback
+# audio/rtx
+audio/s3m					s3m
+audio/silk					sil
+# audio/smv
+# audio/smv-qcp
+# audio/smv0
+# audio/sp-midi
+# audio/speex
+# audio/t140c
+# audio/t38
+# audio/telephone-event
+# audio/tone
+# audio/uemclip
+# audio/ulpfec
+# audio/vdvi
+# audio/vmr-wb
+# audio/vnd.3gpp.iufp
+# audio/vnd.4sb
+# audio/vnd.audiokoz
+# audio/vnd.celp
+# audio/vnd.cisco.nse
+# audio/vnd.cmles.radio-events
+# audio/vnd.cns.anp1
+# audio/vnd.cns.inf1
+audio/vnd.dece.audio				uva uvva
+audio/vnd.digital-winds				eol
+# audio/vnd.dlna.adts
+# audio/vnd.dolby.heaac.1
+# audio/vnd.dolby.heaac.2
+# audio/vnd.dolby.mlp
+# audio/vnd.dolby.mps
+# audio/vnd.dolby.pl2
+# audio/vnd.dolby.pl2x
+# audio/vnd.dolby.pl2z
+# audio/vnd.dolby.pulse.1
+audio/vnd.dra					dra
+audio/vnd.dts					dts
+audio/vnd.dts.hd				dtshd
+# audio/vnd.dvb.file
+# audio/vnd.everad.plj
+# audio/vnd.hns.audio
+audio/vnd.lucent.voice				lvp
+audio/vnd.ms-playready.media.pya		pya
+# audio/vnd.nokia.mobile-xmf
+# audio/vnd.nortel.vbk
+audio/vnd.nuera.ecelp4800			ecelp4800
+audio/vnd.nuera.ecelp7470			ecelp7470
+audio/vnd.nuera.ecelp9600			ecelp9600
+# audio/vnd.octel.sbc
+# audio/vnd.qcelp
+# audio/vnd.rhetorex.32kadpcm
+audio/vnd.rip					rip
+# audio/vnd.sealedmedia.softseal.mpeg
+# audio/vnd.vmx.cvsd
+# audio/vorbis
+# audio/vorbis-config
+audio/webm					weba
+audio/x-aac					aac
+audio/x-aiff					aif aiff aifc
+audio/x-caf					caf
+audio/x-flac					flac
+audio/x-matroska				mka
+audio/x-mpegurl					m3u
+audio/x-ms-wax					wax
+audio/x-ms-wma					wma
+audio/x-pn-realaudio				ram ra
+audio/x-pn-realaudio-plugin			rmp
+# audio/x-tta
+audio/x-wav					wav
+audio/xm					xm
+chemical/x-cdx					cdx
+chemical/x-cif					cif
+chemical/x-cmdf					cmdf
+chemical/x-cml					cml
+chemical/x-csml					csml
+# chemical/x-pdb
+chemical/x-xyz					xyz
+font/collection					ttc
+font/otf					otf
+# font/sfnt
+font/ttf					ttf
+font/woff					woff
+font/woff2					woff2
+image/bmp					bmp
+image/cgm					cgm
+# image/dicom-rle
+# image/emf
+# image/example
+# image/fits
+image/g3fax					g3
+image/gif					gif
+image/ief					ief
+# image/jls
+# image/jp2
+image/jpeg					jpg jpeg jpe
+# image/jpm
+# image/jpx
+image/ktx					ktx
+# image/naplps
+image/png					png
+image/prs.btif					btif
+# image/prs.pti
+# image/pwg-raster
+image/sgi					sgi
+image/svg+xml					svg svgz
+# image/t38
+image/tiff					tiff tif
+# image/tiff-fx
+image/vnd.adobe.photoshop			psd
+# image/vnd.airzip.accelerator.azv
+# image/vnd.cns.inf2
+image/vnd.dece.graphic				uvi uvvi uvg uvvg
+image/vnd.djvu					djvu djv
+image/vnd.dvb.subtitle				sub
+image/vnd.dwg					dwg
+image/vnd.dxf					dxf
+image/vnd.fastbidsheet				fbs
+image/vnd.fpx					fpx
+image/vnd.fst					fst
+image/vnd.fujixerox.edmics-mmr			mmr
+image/vnd.fujixerox.edmics-rlc			rlc
+# image/vnd.globalgraphics.pgb
+# image/vnd.microsoft.icon
+# image/vnd.mix
+# image/vnd.mozilla.apng
+image/vnd.ms-modi				mdi
+image/vnd.ms-photo				wdp
+image/vnd.net-fpx				npx
+# image/vnd.radiance
+# image/vnd.sealed.png
+# image/vnd.sealedmedia.softseal.gif
+# image/vnd.sealedmedia.softseal.jpg
+# image/vnd.svf
+# image/vnd.tencent.tap
+# image/vnd.valve.source.texture
+image/vnd.wap.wbmp				wbmp
+image/vnd.xiff					xif
+# image/vnd.zbrush.pcx
+image/webp					webp
+# image/wmf
+image/x-3ds					3ds
+image/x-cmu-raster				ras
+image/x-cmx					cmx
+image/x-freehand				fh fhc fh4 fh5 fh7
+image/x-icon					ico
+image/x-mrsid-image				sid
+image/x-pcx					pcx
+image/x-pict					pic pct
+image/x-portable-anymap				pnm
+image/x-portable-bitmap				pbm
+image/x-portable-graymap			pgm
+image/x-portable-pixmap				ppm
+image/x-rgb					rgb
+image/x-tga					tga
+image/x-xbitmap					xbm
+image/x-xpixmap					xpm
+image/x-xwindowdump				xwd
+# message/cpim
+# message/delivery-status
+# message/disposition-notification
+# message/example
+# message/external-body
+# message/feedback-report
+# message/global
+# message/global-delivery-status
+# message/global-disposition-notification
+# message/global-headers
+# message/http
+# message/imdn+xml
+# message/news
+# message/partial
+message/rfc822					eml mime
+# message/s-http
+# message/sip
+# message/sipfrag
+# message/tracking-status
+# message/vnd.si.simp
+# message/vnd.wfa.wsc
+# model/example
+# model/gltf+json
+model/iges					igs iges
+model/mesh					msh mesh silo
+model/vnd.collada+xml				dae
+model/vnd.dwf					dwf
+# model/vnd.flatland.3dml
+model/vnd.gdl					gdl
+# model/vnd.gs-gdl
+# model/vnd.gs.gdl
+model/vnd.gtw					gtw
+# model/vnd.moml+xml
+model/vnd.mts					mts
+# model/vnd.opengex
+# model/vnd.parasolid.transmit.binary
+# model/vnd.parasolid.transmit.text
+# model/vnd.rosette.annotated-data-model
+# model/vnd.valve.source.compiled-map
+model/vnd.vtu					vtu
+model/vrml					wrl vrml
+model/x3d+binary				x3db x3dbz
+# model/x3d+fastinfoset
+model/x3d+vrml					x3dv x3dvz
+model/x3d+xml					x3d x3dz
+# model/x3d-vrml
+# multipart/alternative
+# multipart/appledouble
+# multipart/byteranges
+# multipart/digest
+# multipart/encrypted
+# multipart/example
+# multipart/form-data
+# multipart/header-set
+# multipart/mixed
+# multipart/parallel
+# multipart/related
+# multipart/report
+# multipart/signed
+# multipart/voice-message
+# multipart/x-mixed-replace
+# text/1d-interleaved-parityfec
+text/cache-manifest				appcache
+text/calendar					ics ifb
+text/css					css
+text/csv					csv
+# text/csv-schema
+# text/directory
+# text/dns
+# text/ecmascript
+# text/encaprtp
+# text/enriched
+# text/example
+# text/fwdred
+# text/grammar-ref-list
+text/html					html htm
+# text/javascript
+# text/jcr-cnd
+# text/markdown
+# text/mizar
+text/n3						n3
+# text/parameters
+# text/parityfec
+text/plain					txt text conf def list log in
+# text/provenance-notation
+# text/prs.fallenstein.rst
+text/prs.lines.tag				dsc
+# text/prs.prop.logic
+# text/raptorfec
+# text/red
+# text/rfc822-headers
+text/richtext					rtx
+# text/rtf
+# text/rtp-enc-aescm128
+# text/rtploopback
+# text/rtx
+text/sgml					sgml sgm
+# text/t140
+text/tab-separated-values			tsv
+text/troff					t tr roff man me ms
+text/turtle					ttl
+# text/ulpfec
+text/uri-list					uri uris urls
+text/vcard					vcard
+# text/vnd.a
+# text/vnd.abc
+text/vnd.curl					curl
+text/vnd.curl.dcurl				dcurl
+text/vnd.curl.mcurl				mcurl
+text/vnd.curl.scurl				scurl
+# text/vnd.debian.copyright
+# text/vnd.dmclientscript
+text/vnd.dvb.subtitle				sub
+# text/vnd.esmertec.theme-descriptor
+text/vnd.fly					fly
+text/vnd.fmi.flexstor				flx
+text/vnd.graphviz				gv
+text/vnd.in3d.3dml				3dml
+text/vnd.in3d.spot				spot
+# text/vnd.iptc.newsml
+# text/vnd.iptc.nitf
+# text/vnd.latex-z
+# text/vnd.motorola.reflex
+# text/vnd.ms-mediapackage
+# text/vnd.net2phone.commcenter.command
+# text/vnd.radisys.msml-basic-layout
+# text/vnd.si.uricatalogue
+text/vnd.sun.j2me.app-descriptor		jad
+# text/vnd.trolltech.linguist
+# text/vnd.wap.si
+# text/vnd.wap.sl
+text/vnd.wap.wml				wml
+text/vnd.wap.wmlscript				wmls
+text/x-asm					s asm
+text/x-c					c cc cxx cpp h hh dic
+text/x-fortran					f for f77 f90
+text/x-java-source				java
+text/x-nfo					nfo
+text/x-opml					opml
+text/x-pascal					p pas
+text/x-setext					etx
+text/x-sfv					sfv
+text/x-uuencode					uu
+text/x-vcalendar				vcs
+text/x-vcard					vcf
+# text/xml
+# text/xml-external-parsed-entity
+# video/1d-interleaved-parityfec
+video/3gpp					3gp
+# video/3gpp-tt
+video/3gpp2					3g2
+# video/bmpeg
+# video/bt656
+# video/celb
+# video/dv
+# video/encaprtp
+# video/example
+video/h261					h261
+video/h263					h263
+# video/h263-1998
+# video/h263-2000
+video/h264					h264
+# video/h264-rcdo
+# video/h264-svc
+# video/h265
+# video/iso.segment
+video/jpeg					jpgv
+# video/jpeg2000
+video/jpm					jpm jpgm
+video/mj2					mj2 mjp2
+# video/mp1s
+# video/mp2p
+# video/mp2t
+video/mp4					mp4 mp4v mpg4
+# video/mp4v-es
+video/mpeg					mpeg mpg mpe m1v m2v
+# video/mpeg4-generic
+# video/mpv
+# video/nv
+video/ogg					ogv
+# video/parityfec
+# video/pointer
+video/quicktime					qt mov
+# video/raptorfec
+# video/raw
+# video/rtp-enc-aescm128
+# video/rtploopback
+# video/rtx
+# video/smpte292m
+# video/ulpfec
+# video/vc1
+# video/vnd.cctv
+video/vnd.dece.hd				uvh uvvh
+video/vnd.dece.mobile				uvm uvvm
+# video/vnd.dece.mp4
+video/vnd.dece.pd				uvp uvvp
+video/vnd.dece.sd				uvs uvvs
+video/vnd.dece.video				uvv uvvv
+# video/vnd.directv.mpeg
+# video/vnd.directv.mpeg-tts
+# video/vnd.dlna.mpeg-tts
+video/vnd.dvb.file				dvb
+video/vnd.fvt					fvt
+# video/vnd.hns.video
+# video/vnd.iptvforum.1dparityfec-1010
+# video/vnd.iptvforum.1dparityfec-2005
+# video/vnd.iptvforum.2dparityfec-1010
+# video/vnd.iptvforum.2dparityfec-2005
+# video/vnd.iptvforum.ttsavc
+# video/vnd.iptvforum.ttsmpeg2
+# video/vnd.motorola.video
+# video/vnd.motorola.videop
+video/vnd.mpegurl				mxu m4u
+video/vnd.ms-playready.media.pyv		pyv
+# video/vnd.nokia.interleaved-multimedia
+# video/vnd.nokia.videovoip
+# video/vnd.objectvideo
+# video/vnd.radgamettools.bink
+# video/vnd.radgamettools.smacker
+# video/vnd.sealed.mpeg1
+# video/vnd.sealed.mpeg4
+# video/vnd.sealed.swf
+# video/vnd.sealedmedia.softseal.mov
+video/vnd.uvvu.mp4				uvu uvvu
+video/vnd.vivo					viv
+# video/vp8
+video/webm					webm
+video/x-f4v					f4v
+video/x-fli					fli
+video/x-flv					flv
+video/x-m4v					m4v
+video/x-matroska				mkv mk3d mks
+video/x-mng					mng
+video/x-ms-asf					asf asx
+video/x-ms-vob					vob
+video/x-ms-wm					wm
+video/x-ms-wmv					wmv
+video/x-ms-wmx					wmx
+video/x-ms-wvx					wvx
+video/x-msvideo					avi
+video/x-sgi-movie				movie
+video/x-smv					smv
+x-conference/x-cooltalk				ice
+
+# Telegram animated stickers
+application/x-tgsticker     tgs
\ No newline at end of file
diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py
index 981752fa..fa107fab 100644
--- a/pyrogram/client/ext/utils.py
+++ b/pyrogram/client/ext/utils.py
@@ -16,8 +16,13 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
+import base64
+import struct
 from base64 import b64decode, b64encode
+from typing import Union, List
 
+import pyrogram
+from . import BaseClient
 from ...api import types
 
 
@@ -82,3 +87,119 @@ def get_offset_date(dialogs):
             return m.date
     else:
         return 0
+
+
+def get_input_media_from_file_id(
+    file_id_str: str,
+    expected_media_type: int = None
+) -> Union[types.InputMediaPhoto, types.InputMediaDocument]:
+    try:
+        decoded = decode(file_id_str)
+    except Exception:
+        raise ValueError("Failed to decode file_id: {}".format(file_id_str))
+    else:
+        media_type = decoded[0]
+
+        if expected_media_type is not None:
+            if media_type != expected_media_type:
+                media_type_str = BaseClient.MEDIA_TYPE_ID.get(media_type, None)
+                expected_media_type_str = BaseClient.MEDIA_TYPE_ID.get(expected_media_type, None)
+
+                raise ValueError(
+                    'Expected: "{}", got "{}" file_id instead'.format(expected_media_type_str, media_type_str)
+                )
+
+        if media_type in (0, 1, 14):
+            raise ValueError("This file_id can only be used for download: {}".format(file_id_str))
+
+        if media_type == 2:
+            unpacked = struct.unpack(" List["pyrogram.Message"]:
+    users = {i.id: i for i in messages.users}
+    chats = {i.id: i for i in messages.chats}
+
+    if not messages.messages:
+        return pyrogram.List()
+
+    parsed_messages = [
+        pyrogram.Message._parse(client, message, users, chats, replies=0)
+        for message in messages.messages
+    ]
+
+    if replies:
+        messages_with_replies = {i.id: getattr(i, "reply_to_msg_id", None) for i in messages.messages}
+        reply_message_ids = [i[0] for i in filter(lambda x: x[1] is not None, messages_with_replies.items())]
+
+        if reply_message_ids:
+            reply_messages = client.get_messages(
+                parsed_messages[0].chat.id,
+                reply_to_message_ids=reply_message_ids,
+                replies=replies - 1
+            )
+
+            for message in parsed_messages:
+                reply_id = messages_with_replies[message.message_id]
+
+                for reply in reply_messages:
+                    if reply.message_id == reply_id:
+                        message.reply_to_message = reply
+
+    return pyrogram.List(parsed_messages)
+
+
+def parse_deleted_messages(client, update) -> List["pyrogram.Message"]:
+    messages = update.messages
+    channel_id = getattr(update, "channel_id", None)
+
+    parsed_messages = []
+
+    for message in messages:
+        parsed_messages.append(
+            pyrogram.Message(
+                message_id=message,
+                chat=pyrogram.Chat(
+                    id=int("-100" + str(channel_id)),
+                    type="channel",
+                    client=client
+                ) if channel_id is not None else None,
+                client=client
+            )
+        )
+
+    return pyrogram.List(parsed_messages)
+
+
+def unpack_inline_message_id(inline_message_id: str) -> types.InputBotInlineMessageID:
+    r = inline_message_id + "=" * (-len(inline_message_id) % 4)
+    r = struct.unpack(" type:
-    """Use this method to create a Filter.
+    """Create a Filter.
 
     Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.
 
-    Args:
+    Parameters:
         name (``str``):
             Your filter's name. Can be anything you like.
 
@@ -35,14 +35,14 @@ def create(name: str, func: callable, **kwargs) -> type:
             A function that accepts two arguments *(filter, update)* and returns a Boolean: True if the update should be
             handled, False otherwise.
             The "update" argument type will vary depending on which `Handler `_ is coming from.
-            For example, in a :obj:`MessageHandler ` the update type will be
-            a :obj:`Message `; in a :obj:`CallbackQueryHandler ` the
-            update type will be a :obj:`CallbackQuery `. Your function body can then access the
+            For example, in a :obj:`MessageHandler` the update type will be
+            a :obj:`Message`; in a :obj:`CallbackQueryHandler` the
+            update type will be a :obj:`CallbackQuery`. Your function body can then access the
             incoming update and decide whether to allow it or not.
 
         **kwargs (``any``, *optional*):
             Any keyword argument you would like to pass. Useful for custom filters that accept parameters (e.g.:
-            :meth:`Filters.command`, :meth:`Filters.regex`).
+            :meth:`~Filters.command`, :meth:`~Filters.regex`).
     """
     # TODO: unpack kwargs using **kwargs into the dict itself. For Python 3.5+ only
     d = {"__call__": func}
@@ -54,9 +54,9 @@ def create(name: str, func: callable, **kwargs) -> type:
 class Filters:
     """This class provides access to all library-defined Filters available in Pyrogram.
 
-    The Filters listed here are intended to be used with the :obj:`MessageHandler ` only.
+    The Filters listed here are intended to be used with the :obj:`MessageHandler` only.
     At the moment, if you want to filter updates coming from different `Handlers `_ you have to create
-    your own filters with :meth:`Filters.create` and use them in the same way.
+    your own filters with :meth:`~Filters.create` and use them in the same way.
     """
 
     create = create
@@ -89,49 +89,49 @@ class Filters:
     """Filter edited messages."""
 
     audio = create("Audio", lambda _, m: bool(m.audio))
-    """Filter messages that contain :obj:`Audio ` objects."""
+    """Filter messages that contain :obj:`Audio` objects."""
 
     document = create("Document", lambda _, m: bool(m.document))
-    """Filter messages that contain :obj:`Document ` objects."""
+    """Filter messages that contain :obj:`Document` objects."""
 
     photo = create("Photo", lambda _, m: bool(m.photo))
-    """Filter messages that contain :obj:`Photo ` objects."""
+    """Filter messages that contain :obj:`Photo` objects."""
 
     sticker = create("Sticker", lambda _, m: bool(m.sticker))
-    """Filter messages that contain :obj:`Sticker ` objects."""
+    """Filter messages that contain :obj:`Sticker` objects."""
 
     animation = create("Animation", lambda _, m: bool(m.animation))
-    """Filter messages that contain :obj:`Animation ` objects."""
+    """Filter messages that contain :obj:`Animation` objects."""
 
     game = create("Game", lambda _, m: bool(m.game))
-    """Filter messages that contain :obj:`Game ` objects."""
+    """Filter messages that contain :obj:`Game` objects."""
 
     video = create("Video", lambda _, m: bool(m.video))
-    """Filter messages that contain :obj:`Video ` objects."""
+    """Filter messages that contain :obj:`Video` objects."""
 
     media_group = create("MediaGroup", lambda _, m: bool(m.media_group_id))
     """Filter messages containing photos or videos being part of an album."""
 
     voice = create("Voice", lambda _, m: bool(m.voice))
-    """Filter messages that contain :obj:`Voice ` note objects."""
+    """Filter messages that contain :obj:`Voice` note objects."""
 
     video_note = create("VideoNote", lambda _, m: bool(m.video_note))
-    """Filter messages that contain :obj:`VideoNote ` objects."""
+    """Filter messages that contain :obj:`VideoNote` objects."""
 
     contact = create("Contact", lambda _, m: bool(m.contact))
-    """Filter messages that contain :obj:`Contact ` objects."""
+    """Filter messages that contain :obj:`Contact` objects."""
 
     location = create("Location", lambda _, m: bool(m.location))
-    """Filter messages that contain :obj:`Location ` objects."""
+    """Filter messages that contain :obj:`Location` objects."""
 
     venue = create("Venue", lambda _, m: bool(m.venue))
-    """Filter messages that contain :obj:`Venue ` objects."""
+    """Filter messages that contain :obj:`Venue` objects."""
 
     web_page = create("WebPage", lambda _, m: m.web_page)
     """Filter messages sent with a webpage preview."""
 
     poll = create("Poll", lambda _, m: m.poll)
-    """Filter messages that contain :obj:`Poll ` objects."""
+    """Filter messages that contain :obj:`Poll` objects."""
 
     private = create("Private", lambda _, m: bool(m.chat and m.chat.type == "private"))
     """Filter messages sent in private chats."""
@@ -191,35 +191,19 @@ class Filters:
     """Filter messages sent via inline bots"""
 
     service = create("Service", lambda _, m: bool(m.service))
-    """Filter service messages. A service message contains any of the following fields set
+    """Filter service messages.
     
-    - left_chat_member
-    - new_chat_title
-    - new_chat_photo
-    - delete_chat_photo
-    - group_chat_created
-    - supergroup_chat_created
-    - channel_chat_created
-    - migrate_to_chat_id
-    - migrate_from_chat_id
-    - pinned_message
-    - game_score"""
+    A service message contains any of the following fields set: *left_chat_member*,
+    *new_chat_title*, *new_chat_photo*, *delete_chat_photo*, *group_chat_created*, *supergroup_chat_created*,
+    *channel_chat_created*, *migrate_to_chat_id*, *migrate_from_chat_id*, *pinned_message*, *game_score*.
+    """
 
     media = create("Media", lambda _, m: bool(m.media))
-    """Filter media messages. A media message contains any of the following fields set
+    """Filter media messages.
     
-    - audio
-    - document
-    - photo
-    - sticker
-    - video
-    - animation
-    - voice
-    - video_note
-    - contact
-    - location
-    - venue
-    - poll"""
+    A media message contains any of the following fields set: *audio*, *document*, *photo*, *sticker*, *video*,
+    *animation*, *voice*, *video_note*, *contact*, *location*, *venue*, *poll*.
+    """
 
     @staticmethod
     def command(
@@ -230,12 +214,12 @@ class Filters:
     ):
         """Filter commands, i.e.: text messages starting with "/" or any other custom prefix.
 
-        Args:
+        Parameters:
             commands (``str`` | ``list``):
                 The command or list of commands as string the filter should look for.
                 Examples: "start", ["start", "help", "settings"]. When a message text containing
                 a command arrives, the command itself and its arguments will be stored in the *command*
-                field of the :class:`Message `.
+                field of the :obj:`Message`.
 
             prefix (``str`` | ``list``, *optional*):
                 A prefix or a list of prefixes as string the filter should look for.
@@ -275,11 +259,11 @@ class Filters:
     def regex(pattern, flags: int = 0):
         """Filter messages that match a given RegEx pattern.
 
-        Args:
+        Parameters:
             pattern (``str``):
                 The RegEx pattern as string, it will be applied to the text of a message. When a pattern matches,
                 all the `Match Objects `_
-                are stored in the *matches* field of the :class:`Message ` itself.
+                are stored in the *matches* field of the :obj:`Message` itself.
 
             flags (``int``, *optional*):
                 RegEx flags.
@@ -298,7 +282,7 @@ class Filters:
         You can use `set bound methods `_ to manipulate the
         users container.
 
-        Args:
+        Parameters:
             users (``int`` | ``str`` | ``list``):
                 Pass one or more user ids/usernames to filter users.
                 For you yourself, "me" or "self" can be used as well. 
@@ -329,7 +313,7 @@ class Filters:
         You can use `set bound methods `_ to manipulate the
         chats container.
 
-        Args:
+        Parameters:
             chats (``int`` | ``str`` | ``list``):
                 Pass one or more chat ids/usernames to filter chats.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -355,4 +339,15 @@ class Filters:
                              and message.from_user.is_self
                              and not message.outgoing)))
 
+    @staticmethod
+    def callback_data(data: str or bytes):
+        """Filter callback queries for their data.
+        
+        Parameters:
+            data (``str`` | ``bytes``):
+                Pass the data you want to filter for.
+        """
+
+        return create("CallbackData", lambda flt, cb: cb.data == flt.data, data=data)
+
     dan = create("Dan", lambda _, m: bool(m.from_user and m.from_user.id == 23122162))
diff --git a/pyrogram/client/handlers/__init__.py b/pyrogram/client/handlers/__init__.py
index 5e392949..c88c12fe 100644
--- a/pyrogram/client/handlers/__init__.py
+++ b/pyrogram/client/handlers/__init__.py
@@ -21,10 +21,11 @@ from .deleted_messages_handler import DeletedMessagesHandler
 from .disconnect_handler import DisconnectHandler
 from .inline_query_handler import InlineQueryHandler
 from .message_handler import MessageHandler
+from .poll_handler import PollHandler
 from .raw_update_handler import RawUpdateHandler
 from .user_status_handler import UserStatusHandler
 
 __all__ = [
     "MessageHandler", "DeletedMessagesHandler", "CallbackQueryHandler", "RawUpdateHandler", "DisconnectHandler",
-    "UserStatusHandler", "InlineQueryHandler"
+    "UserStatusHandler", "InlineQueryHandler", "PollHandler"
 ]
diff --git a/pyrogram/client/handlers/callback_query_handler.py b/pyrogram/client/handlers/callback_query_handler.py
index 88ddd5a0..9e17296b 100644
--- a/pyrogram/client/handlers/callback_query_handler.py
+++ b/pyrogram/client/handlers/callback_query_handler.py
@@ -21,22 +21,22 @@ from .handler import Handler
 
 class CallbackQueryHandler(Handler):
     """The CallbackQuery handler class. Used to handle callback queries coming from inline buttons.
-    It is intended to be used with :meth:`add_handler() `
+    It is intended to be used with :meth:`~Client.add_handler`
 
     For a nicer way to register this handler, have a look at the
-    :meth:`on_callback_query() ` decorator.
+    :meth:`~Client.on_callback_query` decorator.
 
-    Args:
+    Parameters:
         callback (``callable``):
             Pass a function that will be called when a new CallbackQuery arrives. It takes *(client, callback_query)*
             as positional arguments (look at the section below for a detailed description).
 
-        filters (:obj:`Filters `):
+        filters (:obj:`Filters`):
             Pass one or more filters to allow only a subset of callback queries to be passed
             in your callback function.
 
     Other parameters:
-        client (:obj:`Client `):
+        client (:obj:`Client`):
             The Client itself, useful when you want to call other API methods inside the message handler.
 
         callback_query (:obj:`CallbackQuery `):
diff --git a/pyrogram/client/handlers/deleted_messages_handler.py b/pyrogram/client/handlers/deleted_messages_handler.py
index 52177dcc..3230b9bd 100644
--- a/pyrogram/client/handlers/deleted_messages_handler.py
+++ b/pyrogram/client/handlers/deleted_messages_handler.py
@@ -20,32 +20,31 @@ from .handler import Handler
 
 
 class DeletedMessagesHandler(Handler):
-    """The deleted Messages handler class. Used to handle deleted messages coming from any chat
-    (private, group, channel). It is intended to be used with
-    :meth:`add_handler() `
+    """The deleted messages handler class. Used to handle deleted messages coming from any chat
+    (private, group, channel). It is intended to be used with :meth:`~Client.add_handler`
 
     For a nicer way to register this handler, have a look at the
-    :meth:`on_deleted_messages() ` decorator.
+    :meth:`~Client.on_deleted_messages` decorator.
 
-    Args:
+    Parameters:
         callback (``callable``):
-            Pass a function that will be called when one or more Messages have been deleted.
+            Pass a function that will be called when one or more messages have been deleted.
             It takes *(client, messages)* as positional arguments (look at the section below for a detailed description).
 
-        filters (:obj:`Filters `):
+        filters (:obj:`Filters`):
             Pass one or more filters to allow only a subset of messages to be passed
             in your callback function.
 
     Other parameters:
-        client (:obj:`Client `):
+        client (:obj:`Client`):
             The Client itself, useful when you want to call other API methods inside the message handler.
 
-        messages (:obj:`Messages `):
-            The deleted messages.
+        messages (List of :obj:`Message`):
+            The deleted messages, as list.
     """
 
     def __init__(self, callback: callable, filters=None):
         super().__init__(callback, filters)
 
     def check(self, messages):
-        return super().check(messages.messages[0])
+        return super().check(messages[0])
diff --git a/pyrogram/client/handlers/disconnect_handler.py b/pyrogram/client/handlers/disconnect_handler.py
index 1e88a7ee..1b4801b2 100644
--- a/pyrogram/client/handlers/disconnect_handler.py
+++ b/pyrogram/client/handlers/disconnect_handler.py
@@ -21,18 +21,18 @@ from .handler import Handler
 
 class DisconnectHandler(Handler):
     """The Disconnect handler class. Used to handle disconnections. It is intended to be used with
-    :meth:`add_handler() `
+    :meth:~Client.add_handler`
 
     For a nicer way to register this handler, have a look at the
-    :meth:`on_disconnect() ` decorator.
+    :meth:`~Client.on_disconnect` decorator.
 
-    Args:
+    Parameters:
         callback (``callable``):
             Pass a function that will be called when a disconnection occurs. It takes *(client)*
             as positional argument (look at the section below for a detailed description).
 
     Other parameters:
-        client (:obj:`Client `):
+        client (:obj:`Client`):
             The Client itself. Useful, for example, when you want to change the proxy before a new connection
             is established.
     """
diff --git a/pyrogram/client/handlers/inline_query_handler.py b/pyrogram/client/handlers/inline_query_handler.py
index e59514c0..dbd86df7 100644
--- a/pyrogram/client/handlers/inline_query_handler.py
+++ b/pyrogram/client/handlers/inline_query_handler.py
@@ -21,34 +21,27 @@ from .handler import Handler
 
 class InlineQueryHandler(Handler):
     """The InlineQuery handler class. Used to handle inline queries.
-    It is intended to be used with :meth:`add_handler() `
+    It is intended to be used with :meth:`~Client.add_handler`
 
     For a nicer way to register this handler, have a look at the
-    :meth:`on_inline_query() ` decorator.
+    :meth:`~Client.on_inline_query` decorator.
 
-    Args:
+    Parameters:
         callback (``callable``):
             Pass a function that will be called when a new InlineQuery arrives. It takes *(client, inline_query)*
             as positional arguments (look at the section below for a detailed description).
 
-        filters (:obj:`Filters `):
+        filters (:obj:`Filters`):
             Pass one or more filters to allow only a subset of inline queries to be passed
             in your callback function.
 
     Other parameters:
-        client (:obj:`Client `):
+        client (:obj:`Client`):
             The Client itself, useful when you want to call other API methods inside the inline query handler.
 
-        inline_query (:obj:`InlineQuery `):
+        inline_query (:obj:`InlineQuery`):
             The received inline query.
     """
 
     def __init__(self, callback: callable, filters=None):
         super().__init__(callback, filters)
-
-    def check(self, callback_query):
-        return (
-            self.filters(callback_query)
-            if callable(self.filters)
-            else True
-        )
diff --git a/pyrogram/client/handlers/message_handler.py b/pyrogram/client/handlers/message_handler.py
index 67b4587e..ea091ca4 100644
--- a/pyrogram/client/handlers/message_handler.py
+++ b/pyrogram/client/handlers/message_handler.py
@@ -21,26 +21,25 @@ from .handler import Handler
 
 class MessageHandler(Handler):
     """The Message handler class. Used to handle text, media and service messages coming from
-    any chat (private, group, channel). It is intended to be used with
-    :meth:`add_handler() `
+    any chat (private, group, channel). It is intended to be used with :meth:`~Client.add_handler`
 
     For a nicer way to register this handler, have a look at the
-    :meth:`on_message() ` decorator.
+    :meth:`~Client.on_message` decorator.
 
-    Args:
+    Parameters:
         callback (``callable``):
             Pass a function that will be called when a new Message arrives. It takes *(client, message)*
             as positional arguments (look at the section below for a detailed description).
 
-        filters (:obj:`Filters `):
+        filters (:obj:`Filters`):
             Pass one or more filters to allow only a subset of messages to be passed
             in your callback function.
 
     Other parameters:
-        client (:obj:`Client `):
+        client (:obj:`Client`):
             The Client itself, useful when you want to call other API methods inside the message handler.
 
-        message (:obj:`Message `):
+        message (:obj:`Message`):
             The received message.
     """
 
diff --git a/pyrogram/client/handlers/poll_handler.py b/pyrogram/client/handlers/poll_handler.py
new file mode 100644
index 00000000..d46fb5be
--- /dev/null
+++ b/pyrogram/client/handlers/poll_handler.py
@@ -0,0 +1,48 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from .handler import Handler
+
+
+class PollHandler(Handler):
+    """The Poll handler class. Used to handle polls updates.
+
+    It is intended to be used with :meth:`~Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~Client.on_poll` decorator.
+
+    Parameters:
+        callback (``callable``):
+            Pass a function that will be called when a new poll update arrives. It takes *(client, poll)*
+            as positional arguments (look at the section below for a detailed description).
+
+        filters (:obj:`Filters`):
+            Pass one or more filters to allow only a subset of polls to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`Client`):
+            The Client itself, useful when you want to call other API methods inside the poll handler.
+
+        poll (:obj:`Poll`):
+            The received poll.
+    """
+
+    def __init__(self, callback: callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/client/handlers/raw_update_handler.py b/pyrogram/client/handlers/raw_update_handler.py
index 3a5dea50..485c6339 100644
--- a/pyrogram/client/handlers/raw_update_handler.py
+++ b/pyrogram/client/handlers/raw_update_handler.py
@@ -21,19 +21,19 @@ from .handler import Handler
 
 class RawUpdateHandler(Handler):
     """The Raw Update handler class. Used to handle raw updates. It is intended to be used with
-    :meth:`add_handler() `
+    :meth:`~Client.add_handler`
 
     For a nicer way to register this handler, have a look at the
-    :meth:`on_raw_update() ` decorator.
+    :meth:`~Client.on_raw_update` decorator.
 
-    Args:
+    Parameters:
         callback (``callable``):
             A function that will be called when a new update is received from the server. It takes
             *(client, update, users, chats)* as positional arguments (look at the section below for
             a detailed description).
 
     Other Parameters:
-        client (:class:`Client `):
+        client (:obj:`Client`):
             The Client itself, useful when you want to call other API methods inside the update handler.
 
         update (``Update``):
diff --git a/pyrogram/client/handlers/user_status_handler.py b/pyrogram/client/handlers/user_status_handler.py
index 856ef81d..9b39aab6 100644
--- a/pyrogram/client/handlers/user_status_handler.py
+++ b/pyrogram/client/handlers/user_status_handler.py
@@ -21,25 +21,25 @@ from .handler import Handler
 
 class UserStatusHandler(Handler):
     """The UserStatus handler class. Used to handle user status updates (user going online or offline).
-    It is intended to be used with :meth:`add_handler() `
+    It is intended to be used with :meth:`~Client.add_handler`
 
     For a nicer way to register this handler, have a look at the
-    :meth:`on_user_status() ` decorator.
+    :meth:`~Client.on_user_status` decorator.
 
-    Args:
+    Parameters:
         callback (``callable``):
             Pass a function that will be called when a new UserStatus update arrives. It takes *(client, user_status)*
             as positional arguments (look at the section below for a detailed description).
 
-        filters (:obj:`Filters `):
+        filters (:obj:`Filters`):
             Pass one or more filters to allow only a subset of messages to be passed
             in your callback function.
 
     Other parameters:
-        client (:obj:`Client `):
+        client (:obj:`Client`):
             The Client itself, useful when you want to call other API methods inside the user status handler.
 
-        user_status (:obj:`UserStatus `):
+        user_status (:obj:`UserStatus`):
             The received UserStatus update.
     """
 
diff --git a/pyrogram/client/methods/bots/answer_callback_query.py b/pyrogram/client/methods/bots/answer_callback_query.py
index 33458db9..010c29ea 100644
--- a/pyrogram/client/methods/bots/answer_callback_query.py
+++ b/pyrogram/client/methods/bots/answer_callback_query.py
@@ -29,10 +29,10 @@ class AnswerCallbackQuery(BaseClient):
         url: str = None,
         cache_time: int = 0
     ):
-        """Use this method to send answers to callback queries sent from inline keyboards.
+        """Send answers to callback queries sent from inline keyboards.
         The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
 
-        Args:
+        Parameters:
             callback_query_id (``str``):
                 Unique identifier for the query to be answered.
 
@@ -54,10 +54,10 @@ class AnswerCallbackQuery(BaseClient):
                 Telegram apps will support caching starting in version 3.14. Defaults to 0.
 
         Returns:
-            True, on success.
+            ``bool``: True, on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         return self.send(
             functions.messages.SetBotCallbackAnswer(
diff --git a/pyrogram/client/methods/bots/answer_inline_query.py b/pyrogram/client/methods/bots/answer_inline_query.py
index 7b3524b2..38ed99c3 100644
--- a/pyrogram/client/methods/bots/answer_inline_query.py
+++ b/pyrogram/client/methods/bots/answer_inline_query.py
@@ -34,10 +34,10 @@ class AnswerInlineQuery(BaseClient):
         switch_pm_text: str = "",
         switch_pm_parameter: str = ""
     ):
-        """Use this method to send answers to an inline query.
+        """Send answers to an inline query.
         No more than 50 results per query are allowed.
 
-        Args:
+        Parameters:
             inline_query_id (``str``):
                 Unique identifier for the answered query.
 
@@ -73,7 +73,10 @@ class AnswerInlineQuery(BaseClient):
                 where they wanted to use the bot's inline capabilities.
 
         Returns:
-            On success, True is returned.
+            ``bool``: True, on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
         """
         return self.send(
             functions.messages.SetInlineBotResults(
diff --git a/pyrogram/client/methods/bots/get_game_high_scores.py b/pyrogram/client/methods/bots/get_game_high_scores.py
index bb2e99db..e6459bac 100644
--- a/pyrogram/client/methods/bots/get_game_high_scores.py
+++ b/pyrogram/client/methods/bots/get_game_high_scores.py
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from typing import Union
+from typing import Union, List
 
 import pyrogram
 from pyrogram.api import functions
@@ -29,10 +29,10 @@ class GetGameHighScores(BaseClient):
         user_id: Union[int, str],
         chat_id: Union[int, str],
         message_id: int = None
-    ):
-        """Use this method to get data for high score tables.
+    ) -> List["pyrogram.GameHighScore"]:
+        """Get data for high score tables.
 
-        Args:
+        Parameters:
             user_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -49,20 +49,19 @@ class GetGameHighScores(BaseClient):
                 Required if inline_message_id is not specified.
 
         Returns:
-            On success, a :obj:`GameHighScores ` object is returned.
+            List of :obj:`GameHighScore`: On success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         # TODO: inline_message_id
 
-        return pyrogram.GameHighScores._parse(
-            self,
-            self.send(
-                functions.messages.GetGameHighScores(
-                    peer=self.resolve_peer(chat_id),
-                    id=message_id,
-                    user_id=self.resolve_peer(user_id)
-                )
+        r = self.send(
+            functions.messages.GetGameHighScores(
+                peer=self.resolve_peer(chat_id),
+                id=message_id,
+                user_id=self.resolve_peer(user_id)
             )
         )
+
+        return pyrogram.List(pyrogram.GameHighScore._parse(self, score, r.users) for score in r.scores)
diff --git a/pyrogram/client/methods/bots/get_inline_bot_results.py b/pyrogram/client/methods/bots/get_inline_bot_results.py
index b12c0439..cc0fc1b1 100644
--- a/pyrogram/client/methods/bots/get_inline_bot_results.py
+++ b/pyrogram/client/methods/bots/get_inline_bot_results.py
@@ -19,8 +19,8 @@
 from typing import Union
 
 from pyrogram.api import functions, types
-from pyrogram.errors import UnknownError
 from pyrogram.client.ext import BaseClient
+from pyrogram.errors import UnknownError
 
 
 class GetInlineBotResults(BaseClient):
@@ -32,10 +32,10 @@ class GetInlineBotResults(BaseClient):
         latitude: float = None,
         longitude: float = None
     ):
-        """Use this method to get bot results via inline queries.
+        """Get bot results via inline queries.
         You can then send a result using :obj:`send_inline_bot_result `
 
-        Args:
+        Parameters:
             bot (``int`` | ``str``):
                 Unique identifier of the inline bot you want to get results from. You can specify
                 a @username (str) or a bot ID (int).
@@ -55,11 +55,11 @@ class GetInlineBotResults(BaseClient):
                 Useful for location-based results only.
 
         Returns:
-            On Success, :obj:`BotResults ` is returned.
+            :obj:`BotResults `: On Success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``TimeoutError`` if the bot fails to answer within 10 seconds
+            RPCError: In case of a Telegram RPC error.
+            TimeoutError: In case the bot fails to answer within 10 seconds.
         """
         # TODO: Don't return the raw type
 
diff --git a/pyrogram/client/methods/bots/request_callback_answer.py b/pyrogram/client/methods/bots/request_callback_answer.py
index 7b37f51a..97d8d42b 100644
--- a/pyrogram/client/methods/bots/request_callback_answer.py
+++ b/pyrogram/client/methods/bots/request_callback_answer.py
@@ -27,12 +27,13 @@ class RequestCallbackAnswer(BaseClient):
         self,
         chat_id: Union[int, str],
         message_id: int,
-        callback_data: bytes
+        callback_data: Union[str, bytes],
+        timeout: int = 10
     ):
-        """Use this method to request a callback answer from bots.
+        """Request a callback answer from bots.
         This is the equivalent of clicking an inline button containing callback data.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -41,23 +42,30 @@ class RequestCallbackAnswer(BaseClient):
             message_id (``int``):
                 The message id the inline keyboard is attached on.
 
-            callback_data (``bytes``):
+            callback_data (``str`` | ``bytes``):
                 Callback data associated with the inline button you want to get the answer from.
 
+            timeout (``int``, *optional*):
+                Timeout in seconds.
+
         Returns:
             The answer containing info useful for clients to display a notification at the top of the chat screen
             or as an alert.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``TimeoutError`` if the bot fails to answer within 10 seconds.
+            RPCError: In case of a Telegram RPC error.
+            TimeoutError: In case the bot fails to answer within 10 seconds.
         """
+
+        # Telegram only wants bytes, but we are allowed to pass strings too.
+        data = bytes(callback_data, "utf-8") if isinstance(callback_data, str) else callback_data
+
         return self.send(
             functions.messages.GetBotCallbackAnswer(
                 peer=self.resolve_peer(chat_id),
                 msg_id=message_id,
-                data=callback_data
+                data=data
             ),
             retries=0,
-            timeout=10
+            timeout=timeout
         )
diff --git a/pyrogram/client/methods/bots/send_game.py b/pyrogram/client/methods/bots/send_game.py
index a690c960..c10d328a 100644
--- a/pyrogram/client/methods/bots/send_game.py
+++ b/pyrogram/client/methods/bots/send_game.py
@@ -37,9 +37,9 @@ class SendGame(BaseClient):
             "pyrogram.ForceReply"
         ] = None
     ) -> "pyrogram.Message":
-        """Use this method to send a game.
+        """Send a game.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -60,10 +60,10 @@ class SendGame(BaseClient):
                 If not empty, the first button must launch the game.
 
         Returns:
-            On success, the sent :obj:`Message` is returned.
+            :obj:`Message`: On success, the sent game message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         r = self.send(
             functions.messages.SendMedia(
diff --git a/pyrogram/client/methods/bots/send_inline_bot_result.py b/pyrogram/client/methods/bots/send_inline_bot_result.py
index 9b375a0a..411ab462 100644
--- a/pyrogram/client/methods/bots/send_inline_bot_result.py
+++ b/pyrogram/client/methods/bots/send_inline_bot_result.py
@@ -32,10 +32,10 @@ class SendInlineBotResult(BaseClient):
         reply_to_message_id: int = None,
         hide_via: bool = None
     ):
-        """Use this method to send an inline bot result.
+        """Send an inline bot result.
         Bot results can be retrieved using :obj:`get_inline_bot_results `
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -58,10 +58,10 @@ class SendInlineBotResult(BaseClient):
                 Sends the message with *via @bot* hidden.
 
         Returns:
-            On success, the sent Message is returned.
+            :obj:`Message`: On success, the sent inline result message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         return self.send(
             functions.messages.SendInlineBotResult(
diff --git a/pyrogram/client/methods/bots/set_game_score.py b/pyrogram/client/methods/bots/set_game_score.py
index 434720c6..f9115b74 100644
--- a/pyrogram/client/methods/bots/set_game_score.py
+++ b/pyrogram/client/methods/bots/set_game_score.py
@@ -32,11 +32,11 @@ class SetGameScore(BaseClient):
         disable_edit_message: bool = None,
         chat_id: Union[int, str] = None,
         message_id: int = None
-    ):
+    ) -> Union["pyrogram.Message", bool]:
         # inline_message_id: str = None):  TODO Add inline_message_id
-        """Use this method to set the score of the specified user in a game.
+        """Set the score of the specified user in a game.
 
-        Args:
+        Parameters:
             user_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -63,12 +63,11 @@ class SetGameScore(BaseClient):
                 Required if inline_message_id is not specified.
 
         Returns:
-            On success, if the message was sent by the bot, returns the edited :obj:`Message `,
-            otherwise returns True.
+            :obj:`Message` | ``bool``: On success, if the message was sent by the bot, the edited message is returned,
+            True otherwise.
 
         Raises:
-            :class:`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.
+            RPCError: In case of a Telegram RPC error.
         """
         r = self.send(
             functions.messages.SetGameScore(
diff --git a/pyrogram/client/methods/chats/__init__.py b/pyrogram/client/methods/chats/__init__.py
index c708453f..969628ee 100644
--- a/pyrogram/client/methods/chats/__init__.py
+++ b/pyrogram/client/methods/chats/__init__.py
@@ -16,14 +16,15 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
+from .archive_chats import ArchiveChats
 from .delete_chat_photo import DeleteChatPhoto
 from .export_chat_invite_link import ExportChatInviteLink
 from .get_chat import GetChat
 from .get_chat_member import GetChatMember
 from .get_chat_members import GetChatMembers
 from .get_chat_members_count import GetChatMembersCount
-from .get_chat_preview import GetChatPreview
 from .get_dialogs import GetDialogs
+from .get_dialogs_count import GetDialogsCount
 from .iter_chat_members import IterChatMembers
 from .iter_dialogs import IterDialogs
 from .join_chat import JoinChat
@@ -36,6 +37,7 @@ from .restrict_chat_member import RestrictChatMember
 from .set_chat_description import SetChatDescription
 from .set_chat_photo import SetChatPhoto
 from .set_chat_title import SetChatTitle
+from .unarchive_chats import UnarchiveChats
 from .unban_chat_member import UnbanChatMember
 from .unpin_chat_message import UnpinChatMessage
 from .update_chat_username import UpdateChatUsername
@@ -60,10 +62,12 @@ class Chats(
     UnpinChatMessage,
     GetDialogs,
     GetChatMembersCount,
-    GetChatPreview,
     IterDialogs,
     IterChatMembers,
     UpdateChatUsername,
-    RestrictChat
+    RestrictChat,
+    GetDialogsCount,
+    ArchiveChats,
+    UnarchiveChats
 ):
     pass
diff --git a/pyrogram/client/methods/chats/archive_chats.py b/pyrogram/client/methods/chats/archive_chats.py
new file mode 100644
index 00000000..3c929983
--- /dev/null
+++ b/pyrogram/client/methods/chats/archive_chats.py
@@ -0,0 +1,58 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from typing import Union, List
+
+from pyrogram.api import functions, types
+from ...ext import BaseClient
+
+
+class ArchiveChats(BaseClient):
+    def archive_chats(
+        self,
+        chat_ids: Union[int, str, List[Union[int, str]]],
+    ) -> bool:
+        """Archive one or more chats.
+
+        Parameters:
+            chat_ids (``int`` | ``str`` | List[``int``, ``str``]):
+                Unique identifier (int) or username (str) of the target chat.
+                You can also pass a list of ids (int) or usernames (str).
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        if not isinstance(chat_ids, list):
+            chat_ids = [chat_ids]
+
+        self.send(
+            functions.folders.EditPeerFolders(
+                folder_peers=[
+                    types.InputFolderPeer(
+                        peer=self.resolve_peer(chat),
+                        folder_id=1
+                    ) for chat in chat_ids
+                ]
+            )
+        )
+
+        return True
diff --git a/pyrogram/client/methods/chats/delete_chat_photo.py b/pyrogram/client/methods/chats/delete_chat_photo.py
index c11a0d13..88d97506 100644
--- a/pyrogram/client/methods/chats/delete_chat_photo.py
+++ b/pyrogram/client/methods/chats/delete_chat_photo.py
@@ -27,7 +27,7 @@ class DeleteChatPhoto(BaseClient):
         self,
         chat_id: Union[int, str]
     ) -> bool:
-        """Use this method to delete a chat photo.
+        """Delete a chat photo.
         Photos can't be changed for private chats.
         You must be an administrator in the chat for this to work and must have the appropriate admin rights.
 
@@ -35,15 +35,15 @@ class DeleteChatPhoto(BaseClient):
             In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
             setting is off.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
             ``ValueError`` if a chat_id belongs to user.
         """
         peer = self.resolve_peer(chat_id)
diff --git a/pyrogram/client/methods/chats/export_chat_invite_link.py b/pyrogram/client/methods/chats/export_chat_invite_link.py
index b84b1d3c..9266183d 100644
--- a/pyrogram/client/methods/chats/export_chat_invite_link.py
+++ b/pyrogram/client/methods/chats/export_chat_invite_link.py
@@ -27,27 +27,34 @@ class ExportChatInviteLink(BaseClient):
         self,
         chat_id: Union[int, str]
     ) -> str:
-        """Use this method to generate a new invite link for a chat; any previously generated link is revoked.
+        """Generate a new invite link for a chat; any previously generated link is revoked.
 
         You must be an administrator in the chat for this to work and have the appropriate admin rights.
 
-        Args:
+        .. note ::
+
+            Each administrator in a chat generates their own invite links. Bots can't use invite links generated by
+            other administrators. If you want your bot to work with invite links, it will need to generate its own link
+            using this method – after this the link will become available to the bot via the :meth:`~Client.get_chat`
+            method. If your bot needs to generate a new invite link replacing its previous one, use this method again.
+
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier for the target chat or username of the target channel/supergroup
                 (in the format @username).
 
         Returns:
-            On success, the exported invite link as string is returned.
+            ``str``: On success, the exported invite link is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         peer = self.resolve_peer(chat_id)
 
         if isinstance(peer, types.InputPeerChat):
             return self.send(
                 functions.messages.ExportChatInvite(
-                    peer=peer.chat_id
+                    peer=peer
                 )
             ).link
         elif isinstance(peer, types.InputPeerChannel):
diff --git a/pyrogram/client/methods/chats/get_chat.py b/pyrogram/client/methods/chats/get_chat.py
index 38653459..4f71c3b3 100644
--- a/pyrogram/client/methods/chats/get_chat.py
+++ b/pyrogram/client/methods/chats/get_chat.py
@@ -27,37 +27,37 @@ class GetChat(BaseClient):
     def get_chat(
         self,
         chat_id: Union[int, str]
-    ) -> "pyrogram.Chat":
-        """Use this method to get up to date information about the chat.
+    ) -> Union["pyrogram.Chat", "pyrogram.ChatPreview"]:
+        """Get up to date information about a chat.
+
         Information include current name of the user for one-on-one conversations, current username of a user, group or
         channel, etc.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 Unique identifier for the target chat in form of a *t.me/joinchat/* link, identifier (int) or username
                 of the target channel/supergroup (in the format @username).
 
         Returns:
-            On success, a :obj:`Chat ` object is returned.
+            :obj:`Chat` | :obj:`ChatPreview`: On success, if you've already joined the chat, a chat object is returned,
+            otherwise, a chat preview object is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` in case the chat invite link refers to a chat you haven't joined yet.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case the chat invite link points to a chat you haven't joined yet.
         """
         match = self.INVITE_LINK_RE.match(str(chat_id))
 
         if match:
-            h = match.group(1)
-
             r = self.send(
                 functions.messages.CheckChatInvite(
-                    hash=h
+                    hash=match.group(1)
                 )
             )
 
             if isinstance(r, types.ChatInvite):
-                raise ValueError("You haven't joined \"t.me/joinchat/{}\" yet".format(h))
+                return pyrogram.ChatPreview._parse(self, r)
 
             self.fetch_peers([r.chat])
 
diff --git a/pyrogram/client/methods/chats/get_chat_member.py b/pyrogram/client/methods/chats/get_chat_member.py
index aec4d233..b0d0641a 100644
--- a/pyrogram/client/methods/chats/get_chat_member.py
+++ b/pyrogram/client/methods/chats/get_chat_member.py
@@ -30,43 +30,52 @@ class GetChatMember(BaseClient):
         chat_id: Union[int, str],
         user_id: Union[int, str]
     ) -> "pyrogram.ChatMember":
-        """Use this method to get information about one member of a chat.
+        """Get information about one member of a chat.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
             user_id (``int`` | ``str``)::
-                Unique identifier (int) or username (str) of the target chat.
-                For your personal cloud (Saved Messages) you can simply use "me" or "self".
+                Unique identifier (int) or username (str) of the target user.
+                For you yourself you can simply use "me" or "self".
                 For a contact that exists in your Telegram address book you can use his phone number (str).
 
         Returns:
-            On success, a :obj:`ChatMember ` object is returned.
+            :obj:`ChatMember`: On success, a chat member is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
-        chat_id = self.resolve_peer(chat_id)
-        user_id = self.resolve_peer(user_id)
+        chat = self.resolve_peer(chat_id)
+        user = self.resolve_peer(user_id)
 
-        if isinstance(chat_id, types.InputPeerChat):
-            full_chat = self.send(
+        if isinstance(chat, types.InputPeerChat):
+            r = self.send(
                 functions.messages.GetFullChat(
-                    chat_id=chat_id.chat_id
+                    chat_id=chat.chat_id
                 )
             )
 
-            for member in pyrogram.ChatMembers._parse(self, full_chat).chat_members:
-                if member.user.is_self:
-                    return member
+            members = r.full_chat.participants.participants
+            users = {i.id: i for i in r.users}
+
+            for member in members:
+                member = pyrogram.ChatMember._parse(self, member, users)
+
+                if isinstance(user, types.InputPeerSelf):
+                    if member.user.is_self:
+                        return member
+                else:
+                    if member.user.id == user.user_id:
+                        return member
             else:
                 raise UserNotParticipant
-        elif isinstance(chat_id, types.InputPeerChannel):
+        elif isinstance(chat, types.InputPeerChannel):
             r = self.send(
                 functions.channels.GetParticipant(
-                    channel=chat_id,
-                    user_id=user_id
+                    channel=chat,
+                    user_id=user
                 )
             )
 
diff --git a/pyrogram/client/methods/chats/get_chat_members.py b/pyrogram/client/methods/chats/get_chat_members.py
index 726fd14b..0b4613d8 100644
--- a/pyrogram/client/methods/chats/get_chat_members.py
+++ b/pyrogram/client/methods/chats/get_chat_members.py
@@ -18,7 +18,7 @@
 
 import logging
 import time
-from typing import Union
+from typing import Union, List
 
 import pyrogram
 from pyrogram.api import functions, types
@@ -45,29 +45,30 @@ class GetChatMembers(BaseClient):
         limit: int = 200,
         query: str = "",
         filter: str = Filters.ALL
-    ) -> "pyrogram.ChatMembers":
-        """Use this method to get a chunk of the members list of a chat.
+    ) -> List["pyrogram.ChatMember"]:
+        """Get a chunk of the members list of a chat.
 
         You can get up to 200 chat members at once.
         A chat can be either a basic group, a supergroup or a channel.
         You must be admin to retrieve the members list of a channel (also known as "subscribers").
-        For a more convenient way of getting chat members see :meth:`iter_chat_members`.
+        For a more convenient way of getting chat members see :meth:`~Client.iter_chat_members`.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
             offset (``int``, *optional*):
                 Sequential number of the first member to be returned.
-                Defaults to 0 [1]_.
+                Only applicable to supergroups and channels. Defaults to 0 [1]_.
 
             limit (``int``, *optional*):
                 Limits the number of members to be retrieved.
+                Only applicable to supergroups and channels.
                 Defaults to 200, which is also the maximum server limit allowed per method call.
 
             query (``str``, *optional*):
                 Query string to filter members based on their display names and usernames.
-                Defaults to "" (empty string) [2]_.
+                Only applicable to supergroups and channels. Defaults to "" (empty string) [2]_.
 
             filter (``str``, *optional*):
                 Filter used to select the kind of members you want to retrieve. Only applicable for supergroups
@@ -78,6 +79,7 @@ class GetChatMembers(BaseClient):
                 *"bots"* - bots only,
                 *"recent"* - recent members only,
                 *"administrators"* - chat administrators only.
+                Only applicable to supergroups and channels.
                 Defaults to *"all"*.
 
         .. [1] Server limit: on supergroups, you can get up to 10,000 members for a single query and up to 200 members
@@ -86,23 +88,25 @@ class GetChatMembers(BaseClient):
         .. [2] A query string is applicable only for *"all"*, *"kicked"* and *"restricted"* filters only.
 
         Returns:
-            On success, a :obj:`ChatMembers` object is returned.
+            List of :obj:`ChatMember`: On success, a list of chat members is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` if you used an invalid filter or a chat_id that belongs to a user.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case you used an invalid filter or a chat id that belongs to a user.
         """
         peer = self.resolve_peer(chat_id)
 
         if isinstance(peer, types.InputPeerChat):
-            return pyrogram.ChatMembers._parse(
-                self,
-                self.send(
-                    functions.messages.GetFullChat(
-                        chat_id=peer.chat_id
-                    )
+            r = self.send(
+                functions.messages.GetFullChat(
+                    chat_id=peer.chat_id
                 )
             )
+
+            members = r.full_chat.participants.participants
+            users = {i.id: i for i in r.users}
+
+            return pyrogram.List(pyrogram.ChatMember._parse(self, member, users) for member in members)
         elif isinstance(peer, types.InputPeerChannel):
             filter = filter.lower()
 
@@ -123,18 +127,20 @@ class GetChatMembers(BaseClient):
 
             while True:
                 try:
-                    return pyrogram.ChatMembers._parse(
-                        self,
-                        self.send(
-                            functions.channels.GetParticipants(
-                                channel=peer,
-                                filter=filter,
-                                offset=offset,
-                                limit=limit,
-                                hash=0
-                            )
+                    r = self.send(
+                        functions.channels.GetParticipants(
+                            channel=peer,
+                            filter=filter,
+                            offset=offset,
+                            limit=limit,
+                            hash=0
                         )
                     )
+
+                    members = r.participants
+                    users = {i.id: i for i in r.users}
+
+                    return pyrogram.List(pyrogram.ChatMember._parse(self, member, users) for member in members)
                 except FloodWait as e:
                     log.warning("Sleeping for {}s".format(e.x))
                     time.sleep(e.x)
diff --git a/pyrogram/client/methods/chats/get_chat_members_count.py b/pyrogram/client/methods/chats/get_chat_members_count.py
index fc13ac39..4c7ab747 100644
--- a/pyrogram/client/methods/chats/get_chat_members_count.py
+++ b/pyrogram/client/methods/chats/get_chat_members_count.py
@@ -27,18 +27,18 @@ class GetChatMembersCount(BaseClient):
         self,
         chat_id: Union[int, str]
     ) -> int:
-        """Use this method to get the number of members in a chat.
+        """Get the number of members in a chat.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
         Returns:
-            On success, an integer is returned.
+            ``int``: On success, the chat members count is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` if a chat_id belongs to user.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case a chat id belongs to user.
         """
         peer = self.resolve_peer(chat_id)
 
diff --git a/pyrogram/client/methods/chats/get_chat_preview.py b/pyrogram/client/methods/chats/get_chat_preview.py
deleted file mode 100644
index 9b6c6955..00000000
--- a/pyrogram/client/methods/chats/get_chat_preview.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017-2019 Dan Tès 
-#
-# 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 .
-
-import pyrogram
-from pyrogram.api import functions, types
-from ...ext import BaseClient
-
-
-class GetChatPreview(BaseClient):
-    def get_chat_preview(
-        self,
-        invite_link: str
-    ):
-        """Use this method to get the preview of a chat using the invite link.
-
-        This method only returns a chat preview, if you want to join a chat use :meth:`join_chat`
-
-        Args:
-            invite_link (``str``):
-                Unique identifier for the target chat in form of *t.me/joinchat/* links.
-
-        Returns:
-            Either :obj:`Chat` or :obj:`ChatPreview`, depending on whether you already joined the chat or not.
-
-        Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` in case of an invalid invite_link.
-        """
-        match = self.INVITE_LINK_RE.match(invite_link)
-
-        if match:
-            r = self.send(
-                functions.messages.CheckChatInvite(
-                    hash=match.group(1)
-                )
-            )
-
-            if isinstance(r, types.ChatInvite):
-                return pyrogram.ChatPreview._parse(self, r)
-
-            if isinstance(r, types.ChatInviteAlready):
-                chat = r.chat
-
-                if isinstance(chat, types.Chat):
-                    return pyrogram.Chat._parse_chat_chat(self, chat)
-
-                if isinstance(chat, types.Channel):
-                    return pyrogram.Chat._parse_channel_chat(self, chat)
-        else:
-            raise ValueError("The invite_link is invalid")
diff --git a/pyrogram/client/methods/chats/get_dialogs.py b/pyrogram/client/methods/chats/get_dialogs.py
index 3bcf223f..8c374a44 100644
--- a/pyrogram/client/methods/chats/get_dialogs.py
+++ b/pyrogram/client/methods/chats/get_dialogs.py
@@ -18,6 +18,7 @@
 
 import logging
 import time
+from typing import List
 
 import pyrogram
 from pyrogram.api import functions, types
@@ -33,13 +34,13 @@ class GetDialogs(BaseClient):
         offset_date: int = 0,
         limit: int = 100,
         pinned_only: bool = False
-    ) -> "pyrogram.Dialogs":
-        """Use this method to get a chunk of the user's dialogs.
+    ) -> List["pyrogram.Dialog"]:
+        """Get a chunk of the user's dialogs.
 
         You can get up to 100 dialogs at once.
-        For a more convenient way of getting a user's dialogs see :meth:`iter_dialogs`.
+        For a more convenient way of getting a user's dialogs see :meth:`~Client.iter_dialogs`.
 
-        Args:
+        Parameters:
             offset_date (``int``):
                 The offset date in Unix time taken from the top message of a :obj:`Dialog`.
                 Defaults to 0. Valid for non-pinned dialogs only.
@@ -53,16 +54,16 @@ class GetDialogs(BaseClient):
                 Defaults to False.
 
         Returns:
-            On success, a :obj:`Dialogs` object is returned.
+            List of :obj:`Dialog`: On success, a list of dialogs is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
 
         while True:
             try:
                 if pinned_only:
-                    r = self.send(functions.messages.GetPinnedDialogs())
+                    r = self.send(functions.messages.GetPinnedDialogs(folder_id=0))
                 else:
                     r = self.send(
                         functions.messages.GetDialogs(
@@ -80,4 +81,32 @@ class GetDialogs(BaseClient):
             else:
                 break
 
-        return pyrogram.Dialogs._parse(self, r)
+        users = {i.id: i for i in r.users}
+        chats = {i.id: i for i in r.chats}
+
+        messages = {}
+
+        for message in r.messages:
+            to_id = message.to_id
+
+            if isinstance(to_id, types.PeerUser):
+                if message.out:
+                    chat_id = to_id.user_id
+                else:
+                    chat_id = message.from_id
+            elif isinstance(to_id, types.PeerChat):
+                chat_id = -to_id.chat_id
+            else:
+                chat_id = int("-100" + str(to_id.channel_id))
+
+            messages[chat_id] = pyrogram.Message._parse(self, message, users, chats)
+
+        parsed_dialogs = []
+
+        for dialog in r.dialogs:
+            if not isinstance(dialog, types.Dialog):
+                continue
+
+            parsed_dialogs.append(pyrogram.Dialog._parse(self, dialog, messages, users, chats))
+
+        return pyrogram.List(parsed_dialogs)
diff --git a/pyrogram/client/methods/chats/get_dialogs_count.py b/pyrogram/client/methods/chats/get_dialogs_count.py
new file mode 100644
index 00000000..c804709d
--- /dev/null
+++ b/pyrogram/client/methods/chats/get_dialogs_count.py
@@ -0,0 +1,54 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from pyrogram.api import functions, types
+from ...ext import BaseClient
+
+
+class GetDialogsCount(BaseClient):
+    def get_dialogs_count(self, pinned_only: bool = False) -> int:
+        """Get the total count of your dialogs.
+
+        pinned_only (``bool``, *optional*):
+            Pass True if you want to count only pinned dialogs.
+            Defaults to False.
+
+        Returns:
+            ``int``: On success, the dialogs count is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        if pinned_only:
+            return len(self.send(functions.messages.GetPinnedDialogs(folder_id=0)).dialogs)
+        else:
+            r = self.send(
+                functions.messages.GetDialogs(
+                    offset_date=0,
+                    offset_id=0,
+                    offset_peer=types.InputPeerEmpty(),
+                    limit=1,
+                    hash=0
+                )
+            )
+
+            if isinstance(r, types.messages.Dialogs):
+                return len(r.dialogs)
+            else:
+                return r.count
diff --git a/pyrogram/client/methods/chats/iter_chat_members.py b/pyrogram/client/methods/chats/iter_chat_members.py
index 2f41763e..fe117694 100644
--- a/pyrogram/client/methods/chats/iter_chat_members.py
+++ b/pyrogram/client/methods/chats/iter_chat_members.py
@@ -45,13 +45,13 @@ class IterChatMembers(BaseClient):
         query: str = "",
         filter: str = Filters.ALL
     ) -> Generator["pyrogram.ChatMember", None, None]:
-        """Use this method to iterate through the members of a chat sequentially.
+        """Iterate through the members of a chat sequentially.
 
-        This convenience method does the same as repeatedly calling :meth:`get_chat_members` in a loop, thus saving you
+        This convenience method does the same as repeatedly calling :meth:`~Client.get_chat_members` in a loop, thus saving you
         from the hassle of setting up boilerplate code. It is useful for getting the whole members list of a chat with
         a single call.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
@@ -75,10 +75,10 @@ class IterChatMembers(BaseClient):
                 Defaults to *"all"*.
 
         Returns:
-            A generator yielding :obj:`ChatMember ` objects.
+            ``Generator``: A generator yielding :obj:`ChatMember` objects.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         current = 0
         yielded = set()
@@ -106,7 +106,7 @@ class IterChatMembers(BaseClient):
                     limit=limit,
                     query=q,
                     filter=filter
-                ).chat_members
+                )
 
                 if not chat_members:
                     break
diff --git a/pyrogram/client/methods/chats/iter_dialogs.py b/pyrogram/client/methods/chats/iter_dialogs.py
index 99437cb4..fce9fb99 100644
--- a/pyrogram/client/methods/chats/iter_dialogs.py
+++ b/pyrogram/client/methods/chats/iter_dialogs.py
@@ -26,14 +26,15 @@ class IterDialogs(BaseClient):
     def iter_dialogs(
         self,
         offset_date: int = 0,
-        limit: int = 0
+        limit: int = None
     ) -> Generator["pyrogram.Dialog", None, None]:
-        """Use this method to iterate through a user's dialogs sequentially.
+        """Iterate through a user's dialogs sequentially.
 
-        This convenience method does the same as repeatedly calling :meth:`get_dialogs` in a loop, thus saving you from
-        the hassle of setting up boilerplate code. It is useful for getting the whole dialogs list with a single call.
+        This convenience method does the same as repeatedly calling :meth:`~Client.get_dialogs` in a loop, thus saving
+        you from the hassle of setting up boilerplate code. It is useful for getting the whole dialogs list with a
+        single call.
 
-        Args:
+        Parameters:
             offset_date (``int``):
                 The offset date in Unix time taken from the top message of a :obj:`Dialog`.
                 Defaults to 0 (most recent dialog).
@@ -43,10 +44,10 @@ class IterDialogs(BaseClient):
                 By default, no limit is applied and all dialogs are returned.
 
         Returns:
-            A generator yielding :obj:`Dialog ` objects.
+            ``Generator``: A generator yielding :obj:`Dialog` objects.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         current = 0
         total = limit or (1 << 31) - 1
@@ -54,7 +55,7 @@ class IterDialogs(BaseClient):
 
         pinned_dialogs = self.get_dialogs(
             pinned_only=True
-        ).dialogs
+        )
 
         for dialog in pinned_dialogs:
             yield dialog
@@ -68,7 +69,7 @@ class IterDialogs(BaseClient):
             dialogs = self.get_dialogs(
                 offset_date=offset_date,
                 limit=limit
-            ).dialogs
+            )
 
             if not dialogs:
                 return
diff --git a/pyrogram/client/methods/chats/join_chat.py b/pyrogram/client/methods/chats/join_chat.py
index a7933bea..ed6c69ce 100644
--- a/pyrogram/client/methods/chats/join_chat.py
+++ b/pyrogram/client/methods/chats/join_chat.py
@@ -26,18 +26,18 @@ class JoinChat(BaseClient):
         self,
         chat_id: str
     ):
-        """Use this method to join a group chat or channel.
+        """Join a group chat or channel.
 
-        Args:
+        Parameters:
             chat_id (``str``):
                 Unique identifier for the target chat in form of a *t.me/joinchat/* link or username of the target
                 channel/supergroup (in the format @username).
 
         Returns:
-            On success, a :obj:`Chat ` object is returned.
+            :obj:`Chat`: On success, a chat object is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         match = self.INVITE_LINK_RE.match(chat_id)
 
diff --git a/pyrogram/client/methods/chats/kick_chat_member.py b/pyrogram/client/methods/chats/kick_chat_member.py
index 7b10ddea..9686e754 100644
--- a/pyrogram/client/methods/chats/kick_chat_member.py
+++ b/pyrogram/client/methods/chats/kick_chat_member.py
@@ -30,7 +30,7 @@ class KickChatMember(BaseClient):
         user_id: Union[int, str],
         until_date: int = 0
     ) -> Union["pyrogram.Message", bool]:
-        """Use this method to kick a user from a group, a supergroup or a channel.
+        """Kick a user from a group, a supergroup or a channel.
         In the case of supergroups and channels, the user will not be able to return to the group on their own using
         invite links, etc., unless unbanned first. You must be an administrator in the chat for this to work and must
         have the appropriate admin rights.
@@ -40,7 +40,7 @@ class KickChatMember(BaseClient):
             off in the target group. Otherwise members may only be removed by the group's creator or by the member
             that added them.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
@@ -54,10 +54,11 @@ class KickChatMember(BaseClient):
                 considered to be banned forever. Defaults to 0 (ban forever).
 
         Returns:
-            On success, either True or a service :obj:`Message ` will be returned (when applicable).
+            :obj:`Message` | ``bool``: On success, a service message will be returned (when applicable), otherwise, in
+            case a message object couldn't be returned, True is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         chat_peer = self.resolve_peer(chat_id)
         user_peer = self.resolve_peer(user_id)
diff --git a/pyrogram/client/methods/chats/leave_chat.py b/pyrogram/client/methods/chats/leave_chat.py
index 8ba3a3d1..3ed6f10f 100644
--- a/pyrogram/client/methods/chats/leave_chat.py
+++ b/pyrogram/client/methods/chats/leave_chat.py
@@ -28,9 +28,9 @@ class LeaveChat(BaseClient):
         chat_id: Union[int, str],
         delete: bool = False
     ):
-        """Use this method to leave a group chat or channel.
+        """Leave a group chat or channel.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier for the target chat or username of the target channel/supergroup
                 (in the format @username).
@@ -39,7 +39,7 @@ class LeaveChat(BaseClient):
                 Deletes the group chat dialog after leaving (for simple group chats, not supergroups).
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         peer = self.resolve_peer(chat_id)
 
diff --git a/pyrogram/client/methods/chats/pin_chat_message.py b/pyrogram/client/methods/chats/pin_chat_message.py
index 1d5466ba..efb41e67 100644
--- a/pyrogram/client/methods/chats/pin_chat_message.py
+++ b/pyrogram/client/methods/chats/pin_chat_message.py
@@ -29,11 +29,11 @@ class PinChatMessage(BaseClient):
         message_id: int,
         disable_notification: bool = None
     ) -> bool:
-        """Use this method to pin a message in a group, channel or your own chat.
+        """Pin a message in a group, channel or your own chat.
         You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in
         the supergroup or "can_edit_messages" admin right in the channel.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
@@ -45,10 +45,10 @@ class PinChatMessage(BaseClient):
                 message. Notifications are always disabled in channels.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         self.send(
             functions.messages.UpdatePinnedMessage(
diff --git a/pyrogram/client/methods/chats/promote_chat_member.py b/pyrogram/client/methods/chats/promote_chat_member.py
index 26d49516..700b3a68 100644
--- a/pyrogram/client/methods/chats/promote_chat_member.py
+++ b/pyrogram/client/methods/chats/promote_chat_member.py
@@ -36,12 +36,12 @@ class PromoteChatMember(BaseClient):
         can_pin_messages: bool = False,
         can_promote_members: bool = False
     ) -> bool:
-        """Use this method to promote or demote a user in a supergroup or a channel.
+        """Promote or demote a user in a supergroup or a channel.
 
         You must be an administrator in the chat for this to work and must have the appropriate admin rights.
         Pass False for all boolean parameters to demote a user.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
@@ -76,10 +76,10 @@ class PromoteChatMember(BaseClient):
                 were appointed by him).
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         self.send(
             functions.channels.EditAdmin(
diff --git a/pyrogram/client/methods/chats/restrict_chat.py b/pyrogram/client/methods/chats/restrict_chat.py
index 40d46d34..8e63a9b2 100644
--- a/pyrogram/client/methods/chats/restrict_chat.py
+++ b/pyrogram/client/methods/chats/restrict_chat.py
@@ -36,10 +36,10 @@ class RestrictChat(BaseClient):
         can_invite_users: bool = False,
         can_pin_messages: bool = False
     ) -> Chat:
-        """Use this method to restrict a chat.
+        """Restrict a chat.
         Pass True for all boolean parameters to lift restrictions from a chat.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
@@ -70,10 +70,10 @@ class RestrictChat(BaseClient):
                 Pass True, if the user can pin messages.
 
         Returns:
-            On success, a :obj:`Chat ` object is returned.
+            :obj:`Chat`: On success, a chat object is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         send_messages = True
         send_media = True
diff --git a/pyrogram/client/methods/chats/restrict_chat_member.py b/pyrogram/client/methods/chats/restrict_chat_member.py
index 8688ecca..96e07d18 100644
--- a/pyrogram/client/methods/chats/restrict_chat_member.py
+++ b/pyrogram/client/methods/chats/restrict_chat_member.py
@@ -38,12 +38,12 @@ class RestrictChatMember(BaseClient):
         can_invite_users: bool = False,
         can_pin_messages: bool = False
     ) -> Chat:
-        """Use this method to restrict a user in a supergroup.
+        """Restrict a user in a supergroup.
 
         The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights.
         Pass True for all boolean parameters to lift restrictions from a user.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
@@ -83,10 +83,10 @@ class RestrictChatMember(BaseClient):
                 Pass True, if the user can pin messages.
 
         Returns:
-            On success, a :obj:`Chat ` object is returned.
+            :obj:`Chat`: On success, a chat object is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         send_messages = True
         send_media = True
diff --git a/pyrogram/client/methods/chats/set_chat_description.py b/pyrogram/client/methods/chats/set_chat_description.py
index 9d4e130b..68bf9fa2 100644
--- a/pyrogram/client/methods/chats/set_chat_description.py
+++ b/pyrogram/client/methods/chats/set_chat_description.py
@@ -28,10 +28,10 @@ class SetChatDescription(BaseClient):
         chat_id: Union[int, str],
         description: str
     ) -> bool:
-        """Use this method to change the description of a supergroup or a channel.
+        """Change the description of a supergroup or a channel.
         You must be an administrator in the chat for this to work and must have the appropriate admin rights.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
@@ -39,10 +39,10 @@ class SetChatDescription(BaseClient):
                 New chat description, 0-255 characters.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
             ``ValueError`` if a chat_id doesn't belong to a supergroup or a channel.
         """
         peer = self.resolve_peer(chat_id)
diff --git a/pyrogram/client/methods/chats/set_chat_photo.py b/pyrogram/client/methods/chats/set_chat_photo.py
index 87fe1b72..2baa29fe 100644
--- a/pyrogram/client/methods/chats/set_chat_photo.py
+++ b/pyrogram/client/methods/chats/set_chat_photo.py
@@ -31,7 +31,7 @@ class SetChatPhoto(BaseClient):
         chat_id: Union[int, str],
         photo: str
     ) -> bool:
-        """Use this method to set a new profile photo for the chat.
+        """Set a new profile photo for the chat.
         Photos can't be changed for private chats.
         You must be an administrator in the chat for this to work and must have the appropriate admin rights.
 
@@ -39,19 +39,19 @@ class SetChatPhoto(BaseClient):
             In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
             setting is off.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
             photo (``str``):
-                New chat photo. You can pass a :class:`Photo` id or a file path to upload a new photo.
+                New chat photo. You can pass a :obj:`Photo` id or a file path to upload a new photo.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` if a chat_id belongs to user.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: if a chat_id belongs to user.
         """
         peer = self.resolve_peer(chat_id)
 
diff --git a/pyrogram/client/methods/chats/set_chat_title.py b/pyrogram/client/methods/chats/set_chat_title.py
index e94f16a8..f70fa5da 100644
--- a/pyrogram/client/methods/chats/set_chat_title.py
+++ b/pyrogram/client/methods/chats/set_chat_title.py
@@ -28,7 +28,7 @@ class SetChatTitle(BaseClient):
         chat_id: Union[int, str],
         title: str
     ) -> bool:
-        """Use this method to change the title of a chat.
+        """Change the title of a chat.
         Titles can't be changed for private chats.
         You must be an administrator in the chat for this to work and must have the appropriate admin rights.
 
@@ -36,7 +36,7 @@ class SetChatTitle(BaseClient):
             In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
             setting is off.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
@@ -44,11 +44,11 @@ class SetChatTitle(BaseClient):
                 New chat title, 1-255 characters.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` if a chat_id belongs to user.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case a chat id belongs to user.
         """
         peer = self.resolve_peer(chat_id)
 
diff --git a/pyrogram/client/methods/chats/unarchive_chats.py b/pyrogram/client/methods/chats/unarchive_chats.py
new file mode 100644
index 00000000..56bcc6f8
--- /dev/null
+++ b/pyrogram/client/methods/chats/unarchive_chats.py
@@ -0,0 +1,58 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from typing import Union, List
+
+from pyrogram.api import functions, types
+from ...ext import BaseClient
+
+
+class UnarchiveChats(BaseClient):
+    def unarchive_chats(
+        self,
+        chat_ids: Union[int, str, List[Union[int, str]]],
+    ) -> bool:
+        """Unarchive one or more chats.
+
+        Parameters:
+            chat_ids (``int`` | ``str`` | List[``int``, ``str``]):
+                Unique identifier (int) or username (str) of the target chat.
+                You can also pass a list of ids (int) or usernames (str).
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        if not isinstance(chat_ids, list):
+            chat_ids = [chat_ids]
+
+        self.send(
+            functions.folders.EditPeerFolders(
+                folder_peers=[
+                    types.InputFolderPeer(
+                        peer=self.resolve_peer(chat),
+                        folder_id=0
+                    ) for chat in chat_ids
+                ]
+            )
+        )
+
+        return True
diff --git a/pyrogram/client/methods/chats/unban_chat_member.py b/pyrogram/client/methods/chats/unban_chat_member.py
index 0576c028..7e4205c9 100644
--- a/pyrogram/client/methods/chats/unban_chat_member.py
+++ b/pyrogram/client/methods/chats/unban_chat_member.py
@@ -28,11 +28,11 @@ class UnbanChatMember(BaseClient):
         chat_id: Union[int, str],
         user_id: Union[int, str]
     ) -> bool:
-        """Use this method to unban a previously kicked user in a supergroup or channel.
+        """Unban a previously kicked user in a supergroup or channel.
         The user will **not** return to the group or channel automatically, but will be able to join via link, etc.
         You must be an administrator for this to work.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
@@ -41,10 +41,10 @@ class UnbanChatMember(BaseClient):
                 For a contact that exists in your Telegram address book you can use his phone number (str).
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         self.send(
             functions.channels.EditBanned(
diff --git a/pyrogram/client/methods/chats/unpin_chat_message.py b/pyrogram/client/methods/chats/unpin_chat_message.py
index 9753d656..22639315 100644
--- a/pyrogram/client/methods/chats/unpin_chat_message.py
+++ b/pyrogram/client/methods/chats/unpin_chat_message.py
@@ -27,19 +27,19 @@ class UnpinChatMessage(BaseClient):
         self,
         chat_id: Union[int, str]
     ) -> bool:
-        """Use this method to unpin a message in a group, channel or your own chat.
+        """Unpin a message in a group, channel or your own chat.
         You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin
         right in the supergroup or "can_edit_messages" admin right in the channel.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         self.send(
             functions.messages.UpdatePinnedMessage(
diff --git a/pyrogram/client/methods/chats/update_chat_username.py b/pyrogram/client/methods/chats/update_chat_username.py
index 39cdfaeb..d06cda61 100644
--- a/pyrogram/client/methods/chats/update_chat_username.py
+++ b/pyrogram/client/methods/chats/update_chat_username.py
@@ -28,22 +28,22 @@ class UpdateChatUsername(BaseClient):
         chat_id: Union[int, str],
         username: Union[str, None]
     ) -> bool:
-        """Use this method to update a channel or a supergroup username.
+        """Update a channel or a supergroup username.
         
-        To update your own username (for users only, not bots) you can use :meth:`update_username`.
+        To update your own username (for users only, not bots) you can use :meth:`~Client.update_username`.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``)
                 Unique identifier (int) or username (str) of the target chat.
             username (``str`` | ``None``):
                 Username to set. Pass "" (empty string) or None to remove the username.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` if a chat_id belongs to a user or chat.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case a chat id belongs to a user or chat.
         """
 
         peer = self.resolve_peer(chat_id)
diff --git a/pyrogram/client/methods/contacts/__init__.py b/pyrogram/client/methods/contacts/__init__.py
index ab9ae6ef..a966d10a 100644
--- a/pyrogram/client/methods/contacts/__init__.py
+++ b/pyrogram/client/methods/contacts/__init__.py
@@ -19,11 +19,13 @@
 from .add_contacts import AddContacts
 from .delete_contacts import DeleteContacts
 from .get_contacts import GetContacts
+from .get_contacts_count import GetContactsCount
 
 
 class Contacts(
     GetContacts,
     DeleteContacts,
-    AddContacts
+    AddContacts,
+    GetContactsCount
 ):
     pass
diff --git a/pyrogram/client/methods/contacts/add_contacts.py b/pyrogram/client/methods/contacts/add_contacts.py
index d1a97c99..c7e647b0 100644
--- a/pyrogram/client/methods/contacts/add_contacts.py
+++ b/pyrogram/client/methods/contacts/add_contacts.py
@@ -28,17 +28,14 @@ class AddContacts(BaseClient):
         self,
         contacts: List["pyrogram.InputPhoneContact"]
     ):
-        """Use this method to add contacts to your Telegram address book.
+        """Add contacts to your Telegram address book.
 
-        Args:
-            contacts (List of :obj:`InputPhoneContact `):
+        Parameters:
+            contacts (List of :obj:`InputPhoneContact`):
                 The contact list to be added
 
-        Returns:
-            On success, the added contacts are returned.
-
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         imported_contacts = self.send(
             functions.contacts.ImportContacts(
diff --git a/pyrogram/client/methods/contacts/delete_contacts.py b/pyrogram/client/methods/contacts/delete_contacts.py
index af8f453e..7a5ecf55 100644
--- a/pyrogram/client/methods/contacts/delete_contacts.py
+++ b/pyrogram/client/methods/contacts/delete_contacts.py
@@ -28,18 +28,18 @@ class DeleteContacts(BaseClient):
         self,
         ids: List[int]
     ):
-        """Use this method to delete contacts from your Telegram address book.
+        """Delete contacts from your Telegram address book.
 
-        Args:
+        Parameters:
             ids (List of ``int``):
                 A list of unique identifiers for the target users.
                 Can be an ID (int), a username (string) or phone number (string).
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         contacts = []
 
diff --git a/pyrogram/client/methods/contacts/get_contacts.py b/pyrogram/client/methods/contacts/get_contacts.py
index 7eaf6906..79677563 100644
--- a/pyrogram/client/methods/contacts/get_contacts.py
+++ b/pyrogram/client/methods/contacts/get_contacts.py
@@ -18,6 +18,7 @@
 
 import logging
 import time
+from typing import List
 
 import pyrogram
 from pyrogram.api import functions
@@ -28,14 +29,15 @@ log = logging.getLogger(__name__)
 
 
 class GetContacts(BaseClient):
-    def get_contacts(self):
-        """Use this method to get contacts from your Telegram address book.
+    def get_contacts(self) -> List["pyrogram.User"]:
+        # TODO: Create a Users object and return that
+        """Get contacts from your Telegram address book.
 
         Returns:
-            On success, a list of :obj:`User` objects is returned.
+            List of :obj:`User`: On success, a list of users is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         while True:
             try:
@@ -45,4 +47,4 @@ class GetContacts(BaseClient):
                 time.sleep(e.x)
             else:
                 log.info("Total contacts: {}".format(self.session_storage.contacts_count()))
-                return [pyrogram.User._parse(self, user) for user in contacts.users]
+                return pyrogram.List(pyrogram.User._parse(self, user) for user in contacts.users)
diff --git a/pyrogram/client/methods/contacts/get_contacts_count.py b/pyrogram/client/methods/contacts/get_contacts_count.py
new file mode 100644
index 00000000..dddfe8c4
--- /dev/null
+++ b/pyrogram/client/methods/contacts/get_contacts_count.py
@@ -0,0 +1,34 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from pyrogram.api import functions
+from ...ext import BaseClient
+
+
+class GetContactsCount(BaseClient):
+    def get_contacts_count(self) -> int:
+        """Get the total count of contacts from your Telegram address book.
+
+        Returns:
+            ``int``: On success, the contacts count is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return len(self.send(functions.contacts.GetContacts(hash=0)).contacts)
diff --git a/pyrogram/client/methods/decorators/__init__.py b/pyrogram/client/methods/decorators/__init__.py
index 33f55a3d..2a2861ae 100644
--- a/pyrogram/client/methods/decorators/__init__.py
+++ b/pyrogram/client/methods/decorators/__init__.py
@@ -21,6 +21,7 @@ from .on_deleted_messages import OnDeletedMessages
 from .on_disconnect import OnDisconnect
 from .on_inline_query import OnInlineQuery
 from .on_message import OnMessage
+from .on_poll import OnPoll
 from .on_raw_update import OnRawUpdate
 from .on_user_status import OnUserStatus
 
@@ -32,6 +33,7 @@ class Decorators(
     OnRawUpdate,
     OnDisconnect,
     OnUserStatus,
-    OnInlineQuery
+    OnInlineQuery,
+    OnPoll
 ):
     pass
diff --git a/pyrogram/client/methods/decorators/on_callback_query.py b/pyrogram/client/methods/decorators/on_callback_query.py
index 3c747c5f..1552bae7 100644
--- a/pyrogram/client/methods/decorators/on_callback_query.py
+++ b/pyrogram/client/methods/decorators/on_callback_query.py
@@ -30,11 +30,13 @@ class OnCallbackQuery(BaseClient):
         filters=None,
         group: int = 0
     ) -> callable:
-        """Use this decorator to automatically register a function for handling callback queries.
-        This does the same thing as :meth:`add_handler` using the :class:`CallbackQueryHandler`.
+        """Decorator for handling callback queries.
 
-        Args:
-            filters (:obj:`Filters `):
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.CallbackQueryHandler`.
+
+        Parameters:
+            filters (:obj:`~pyrogram.Filters`, *optional*):
                 Pass one or more filters to allow only a subset of callback queries to be passed
                 in your function.
 
diff --git a/pyrogram/client/methods/decorators/on_deleted_messages.py b/pyrogram/client/methods/decorators/on_deleted_messages.py
index cf8f9cf2..0d87ba5a 100644
--- a/pyrogram/client/methods/decorators/on_deleted_messages.py
+++ b/pyrogram/client/methods/decorators/on_deleted_messages.py
@@ -30,11 +30,13 @@ class OnDeletedMessages(BaseClient):
         filters=None,
         group: int = 0
     ) -> callable:
-        """Use this decorator to automatically register a function for handling deleted messages.
-        This does the same thing as :meth:`add_handler` using the :class:`DeletedMessagesHandler`.
+        """Decorator for handling deleted messages.
 
-        Args:
-            filters (:obj:`Filters `):
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.DeletedMessagesHandler`.
+
+        Parameters:
+            filters (:obj:`~pyrogram.Filters`, *optional*):
                 Pass one or more filters to allow only a subset of messages to be passed
                 in your function.
 
diff --git a/pyrogram/client/methods/decorators/on_disconnect.py b/pyrogram/client/methods/decorators/on_disconnect.py
index 515a28c1..4a514a41 100644
--- a/pyrogram/client/methods/decorators/on_disconnect.py
+++ b/pyrogram/client/methods/decorators/on_disconnect.py
@@ -23,8 +23,9 @@ from ...ext import BaseClient
 
 class OnDisconnect(BaseClient):
     def on_disconnect(self=None) -> callable:
-        """Use this decorator to automatically register a function for handling disconnections.
-        This does the same thing as :meth:`add_handler` using the :class:`DisconnectHandler`.
+        """Decorator for handling disconnections.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the :obj:`~pyrogram.DisconnectHandler`.
         """
 
         def decorator(func: callable) -> Handler:
diff --git a/pyrogram/client/methods/decorators/on_inline_query.py b/pyrogram/client/methods/decorators/on_inline_query.py
index 81f0f676..adc65d25 100644
--- a/pyrogram/client/methods/decorators/on_inline_query.py
+++ b/pyrogram/client/methods/decorators/on_inline_query.py
@@ -30,11 +30,12 @@ class OnInlineQuery(BaseClient):
         filters=None,
         group: int = 0
     ) -> callable:
-        """Use this decorator to automatically register a function for handling inline queries.
-        This does the same thing as :meth:`add_handler` using the :class:`InlineQueryHandler`.
+        """Decorator for handling inline queries.
 
-        Args:
-            filters (:obj:`Filters `):
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the :obj:`~pyrogram.InlineQueryHandler`.
+
+        Parameters:
+            filters (:obj:`~pyrogram.Filters`, *optional*):
                 Pass one or more filters to allow only a subset of inline queries to be passed
                 in your function.
 
diff --git a/pyrogram/client/methods/decorators/on_message.py b/pyrogram/client/methods/decorators/on_message.py
index e6563893..758a6831 100644
--- a/pyrogram/client/methods/decorators/on_message.py
+++ b/pyrogram/client/methods/decorators/on_message.py
@@ -30,11 +30,12 @@ class OnMessage(BaseClient):
         filters=None,
         group: int = 0
     ) -> callable:
-        """Use this decorator to automatically register a function for handling messages.
-        This does the same thing as :meth:`add_handler` using the :class:`MessageHandler`.
+        """Decorator for handling messages.
 
-        Args:
-            filters (:obj:`Filters `):
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the :obj:`~pyrogram.MessageHandler`.
+
+        Parameters:
+            filters (:obj:`~pyrogram.Filters`, *optional*):
                 Pass one or more filters to allow only a subset of messages to be passed
                 in your function.
 
diff --git a/pyrogram/client/methods/decorators/on_poll.py b/pyrogram/client/methods/decorators/on_poll.py
new file mode 100644
index 00000000..0ade42c0
--- /dev/null
+++ b/pyrogram/client/methods/decorators/on_poll.py
@@ -0,0 +1,60 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from typing import Tuple
+
+import pyrogram
+from pyrogram.client.filters.filter import Filter
+from pyrogram.client.handlers.handler import Handler
+from ...ext import BaseClient
+
+
+class OnPoll(BaseClient):
+    def on_poll(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> callable:
+        """Decorator for handling poll updates.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the :obj:`~pyrogram.PollHandler`.
+
+        Parameters:
+            filters (:obj:`~pyrogram.Filters`, *optional*):
+                Pass one or more filters to allow only a subset of polls to be passed
+                in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: callable) -> Tuple[Handler, int]:
+            if isinstance(func, tuple):
+                func = func[0].callback
+
+            handler = pyrogram.PollHandler(func, filters)
+
+            if isinstance(self, Filter):
+                return pyrogram.PollHandler(func, self), group if filters is None else filters
+
+            if self is not None:
+                self.add_handler(handler, group)
+
+            return handler, group
+
+        return decorator
diff --git a/pyrogram/client/methods/decorators/on_raw_update.py b/pyrogram/client/methods/decorators/on_raw_update.py
index 1494a319..7dff75fa 100644
--- a/pyrogram/client/methods/decorators/on_raw_update.py
+++ b/pyrogram/client/methods/decorators/on_raw_update.py
@@ -28,10 +28,11 @@ class OnRawUpdate(BaseClient):
         self=None,
         group: int = 0
     ) -> callable:
-        """Use this decorator to automatically register a function for handling raw updates.
-        This does the same thing as :meth:`add_handler` using the :class:`RawUpdateHandler`.
+        """Decorator for handling raw updates.
 
-        Args:
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the :obj:`~pyrogram.RawUpdateHandler`.
+
+        Parameters:
             group (``int``, *optional*):
                 The group identifier, defaults to 0.
         """
diff --git a/pyrogram/client/methods/decorators/on_user_status.py b/pyrogram/client/methods/decorators/on_user_status.py
index 4d8185b1..09e037f7 100644
--- a/pyrogram/client/methods/decorators/on_user_status.py
+++ b/pyrogram/client/methods/decorators/on_user_status.py
@@ -30,11 +30,11 @@ class OnUserStatus(BaseClient):
         filters=None,
         group: int = 0
     ) -> callable:
-        """Use this decorator to automatically register a function for handling user status updates.
-        This does the same thing as :meth:`add_handler` using the :class:`UserStatusHandler`.
+        """Decorator for handling user status updates.
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the :obj:`~pyrogram.UserStatusHandler`.
 
-        Args:
-            filters (:obj:`Filters `):
+        Parameters:
+            filters (:obj:`~pyrogram.Filters`, *optional*):
                 Pass one or more filters to allow only a subset of UserStatus updated to be passed in your function.
 
             group (``int``, *optional*):
diff --git a/pyrogram/client/methods/messages/__init__.py b/pyrogram/client/methods/messages/__init__.py
index dde50b7b..aa0b0c94 100644
--- a/pyrogram/client/methods/messages/__init__.py
+++ b/pyrogram/client/methods/messages/__init__.py
@@ -16,18 +16,24 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from .close_poll import ClosePoll
 from .delete_messages import DeleteMessages
 from .download_media import DownloadMedia
+from .edit_inline_caption import EditInlineCaption
+from .edit_inline_media import EditInlineMedia
+from .edit_inline_reply_markup import EditInlineReplyMarkup
+from .edit_inline_text import EditInlineText
 from .edit_message_caption import EditMessageCaption
 from .edit_message_media import EditMessageMedia
 from .edit_message_reply_markup import EditMessageReplyMarkup
 from .edit_message_text import EditMessageText
 from .forward_messages import ForwardMessages
 from .get_history import GetHistory
+from .get_history_count import GetHistoryCount
 from .get_messages import GetMessages
 from .iter_history import IterHistory
+from .read_history import ReadHistory
 from .retract_vote import RetractVote
+from .send_animated_sticker import SendAnimatedSticker
 from .send_animation import SendAnimation
 from .send_audio import SendAudio
 from .send_cached_media import SendCachedMedia
@@ -44,6 +50,7 @@ from .send_venue import SendVenue
 from .send_video import SendVideo
 from .send_video_note import SendVideoNote
 from .send_voice import SendVoice
+from .stop_poll import StopPoll
 from .vote_poll import VotePoll
 
 
@@ -72,10 +79,17 @@ class Messages(
     SendVoice,
     SendPoll,
     VotePoll,
-    ClosePoll,
+    StopPoll,
     RetractVote,
     DownloadMedia,
     IterHistory,
-    SendCachedMedia
+    SendCachedMedia,
+    GetHistoryCount,
+    SendAnimatedSticker,
+    ReadHistory,
+    EditInlineText,
+    EditInlineCaption,
+    EditInlineMedia,
+    EditInlineReplyMarkup
 ):
     pass
diff --git a/pyrogram/client/methods/messages/delete_messages.py b/pyrogram/client/methods/messages/delete_messages.py
index bbd838ee..3667c8ee 100644
--- a/pyrogram/client/methods/messages/delete_messages.py
+++ b/pyrogram/client/methods/messages/delete_messages.py
@@ -29,9 +29,9 @@ class DeleteMessages(BaseClient):
         message_ids: Iterable[int],
         revoke: bool = True
     ) -> bool:
-        """Use this method to delete messages, including service messages.
+        """Delete messages, including service messages.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -48,27 +48,29 @@ class DeleteMessages(BaseClient):
                 Defaults to True.
 
         Returns:
-            True on success.
+            ``bool``: True on success, False otherwise.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         peer = self.resolve_peer(chat_id)
         message_ids = list(message_ids) if not isinstance(message_ids, int) else [message_ids]
 
         if isinstance(peer, types.InputPeerChannel):
-            self.send(
+            r = self.send(
                 functions.channels.DeleteMessages(
                     channel=peer,
                     id=message_ids
                 )
             )
         else:
-            self.send(
+            r = self.send(
                 functions.messages.DeleteMessages(
                     id=message_ids,
                     revoke=revoke or None
                 )
             )
 
-        return True
+        # Deleting messages you don't have right onto, won't raise any error.
+        # Check for pts_count, which is 0 in case deletes fail.
+        return bool(r.pts_count)
diff --git a/pyrogram/client/methods/messages/download_media.py b/pyrogram/client/methods/messages/download_media.py
index 35959d4a..143349f7 100644
--- a/pyrogram/client/methods/messages/download_media.py
+++ b/pyrogram/client/methods/messages/download_media.py
@@ -16,26 +16,34 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
+import binascii
+import os
+import struct
+import time
+from datetime import datetime
 from threading import Event
 from typing import Union
 
 import pyrogram
-from pyrogram.client.ext import BaseClient
+from pyrogram.client.ext import BaseClient, FileData, utils
+from pyrogram.errors import FileIdInvalid
+
+DEFAULT_DOWNLOAD_DIR = "downloads/"
 
 
 class DownloadMedia(BaseClient):
     def download_media(
         self,
         message: Union["pyrogram.Message", str],
-        file_name: str = "",
+        file_name: str = DEFAULT_DOWNLOAD_DIR,
         block: bool = True,
         progress: callable = None,
         progress_args: tuple = ()
     ) -> Union[str, None]:
-        """Use this method to download the media from a message.
+        """Download the media from a message.
 
-        Args:
-            message (:obj:`Message ` | ``str``):
+        Parameters:
+            message (:obj:`Message` | ``str``):
                 Pass a Message containing the media, the media itself (message.audio, message.video, ...) or
                 the file id as string.
 
@@ -59,7 +67,7 @@ class DownloadMedia(BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -73,75 +81,133 @@ class DownloadMedia(BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the absolute path of the downloaded file as string is returned, None otherwise.
-            In case the download is deliberately stopped with :meth:`stop_transmission`, None is returned as well.
+            ``str`` | ``None``: On success, the absolute path of the downloaded file is returned, otherwise, in case
+            the download failed or was deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
             ``ValueError`` if the message doesn't contain any downloadable media
         """
         error_message = "This message doesn't contain any downloadable media"
+        available_media = ("audio", "document", "photo", "sticker", "animation", "video", "voice", "video_note")
+
+        media_file_name = None
+        file_size = None
+        mime_type = None
+        date = None
 
         if isinstance(message, pyrogram.Message):
-            if message.photo:
-                media = pyrogram.Document(
-                    file_id=message.photo.sizes[-1].file_id,
-                    file_size=message.photo.sizes[-1].file_size,
-                    mime_type="",
-                    date=message.photo.date,
-                    client=self
-                )
-            elif message.audio:
-                media = message.audio
-            elif message.document:
-                media = message.document
-            elif message.video:
-                media = message.video
-            elif message.voice:
-                media = message.voice
-            elif message.video_note:
-                media = message.video_note
-            elif message.sticker:
-                media = message.sticker
-            elif message.animation:
-                media = message.animation
+            for kind in available_media:
+                media = getattr(message, kind, None)
+
+                if media is not None:
+                    break
             else:
                 raise ValueError(error_message)
-        elif isinstance(message, (
-            pyrogram.Photo,
-            pyrogram.PhotoSize,
-            pyrogram.Audio,
-            pyrogram.Document,
-            pyrogram.Video,
-            pyrogram.Voice,
-            pyrogram.VideoNote,
-            pyrogram.Sticker,
-            pyrogram.Animation
-        )):
-            if isinstance(message, pyrogram.Photo):
-                media = pyrogram.Document(
-                    file_id=message.sizes[-1].file_id,
-                    file_size=message.sizes[-1].file_size,
-                    mime_type="",
-                    date=message.date,
-                    client=self
+        else:
+            media = message
+
+        if isinstance(media, str):
+            file_id_str = media
+        else:
+            file_id_str = media.file_id
+            media_file_name = getattr(media, "file_name", "")
+            file_size = getattr(media, "file_size", None)
+            mime_type = getattr(media, "mime_type", None)
+            date = getattr(media, "date", None)
+
+        data = FileData(
+            file_name=media_file_name,
+            file_size=file_size,
+            mime_type=mime_type,
+            date=date
+        )
+
+        def get_existing_attributes() -> dict:
+            return dict(filter(lambda x: x[1] is not None, data.__dict__.items()))
+
+        try:
+            decoded = utils.decode(file_id_str)
+            media_type = decoded[0]
+
+            if media_type == 1:
+                unpacked = struct.unpack("
+#
+# 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 .
+
+import pyrogram
+from pyrogram.client.ext import BaseClient
+
+
+class EditInlineCaption(BaseClient):
+    def edit_inline_caption(
+        self,
+        inline_message_id: str,
+        caption: str,
+        parse_mode: str = "",
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
+    ) -> bool:
+        """Edit the caption of **inline** media messages.
+
+        Parameters:
+            inline_message_id (``str``):
+                Identifier of the inline message.
+
+            caption (``str``):
+                New caption of the media message.
+
+            parse_mode (``str``, *optional*):
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
+
+            reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return self.edit_inline_text(
+            inline_message_id=inline_message_id,
+            text=caption,
+            parse_mode=parse_mode,
+            reply_markup=reply_markup
+        )
diff --git a/pyrogram/client/methods/messages/edit_inline_media.py b/pyrogram/client/methods/messages/edit_inline_media.py
new file mode 100644
index 00000000..87e692fd
--- /dev/null
+++ b/pyrogram/client/methods/messages/edit_inline_media.py
@@ -0,0 +1,104 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+import pyrogram
+from pyrogram.api import functions, types
+from pyrogram.client.ext import BaseClient, utils
+from pyrogram.client.types import (
+    InputMediaPhoto, InputMediaVideo, InputMediaAudio,
+    InputMediaAnimation, InputMediaDocument
+)
+from pyrogram.client.types.input_media import InputMedia
+
+
+class EditInlineMedia(BaseClient):
+    def edit_inline_media(
+        self,
+        inline_message_id: str,
+        media: InputMedia,
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
+    ) -> bool:
+        """Edit **inline** animation, audio, document, photo or video messages.
+
+        When the inline message is edited, a new file can't be uploaded. Use a previously uploaded file via its file_id
+        or specify a URL.
+
+        Parameters:
+            inline_message_id (``str``):
+                Required if *chat_id* and *message_id* are not specified.
+                Identifier of the inline message.
+
+            media (:obj:`InputMedia`):
+                One of the InputMedia objects describing an animation, audio, document, photo or video.
+
+            reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        style = self.html if media.parse_mode.lower() == "html" else self.markdown
+        caption = media.caption
+
+        if isinstance(media, InputMediaPhoto):
+            if media.media.startswith("http"):
+                media = types.InputMediaPhotoExternal(
+                    url=media.media
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, 2)
+        elif isinstance(media, InputMediaVideo):
+            if media.media.startswith("http"):
+                media = types.InputMediaDocumentExternal(
+                    url=media.media
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, 4)
+        elif isinstance(media, InputMediaAudio):
+            if media.media.startswith("http"):
+                media = types.InputMediaDocumentExternal(
+                    url=media.media
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, 9)
+        elif isinstance(media, InputMediaAnimation):
+            if media.media.startswith("http"):
+                media = types.InputMediaDocumentExternal(
+                    url=media.media
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, 10)
+        elif isinstance(media, InputMediaDocument):
+            if media.media.startswith("http"):
+                media = types.InputMediaDocumentExternal(
+                    url=media.media
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, 5)
+
+        return self.send(
+            functions.messages.EditInlineBotMessage(
+                id=utils.unpack_inline_message_id(inline_message_id),
+                media=media,
+                reply_markup=reply_markup.write() if reply_markup else None,
+                **style.parse(caption)
+            )
+        )
diff --git a/pyrogram/client/methods/messages/edit_inline_reply_markup.py b/pyrogram/client/methods/messages/edit_inline_reply_markup.py
new file mode 100644
index 00000000..0326ed72
--- /dev/null
+++ b/pyrogram/client/methods/messages/edit_inline_reply_markup.py
@@ -0,0 +1,50 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+import pyrogram
+from pyrogram.api import functions
+from pyrogram.client.ext import BaseClient, utils
+
+
+class EditInlineReplyMarkup(BaseClient):
+    def edit_inline_reply_markup(
+        self,
+        inline_message_id: str,
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
+    ) -> bool:
+        """Edit only the reply markup of **inline** messages sent via the bot (for inline bots).
+
+        Parameters:
+            inline_message_id (``str``):
+                Identifier of the inline message.
+
+            reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return self.send(
+            functions.messages.EditInlineBotMessage(
+                id=utils.unpack_inline_message_id(inline_message_id),
+                reply_markup=reply_markup.write() if reply_markup else None,
+            )
+        )
diff --git a/pyrogram/client/methods/messages/edit_inline_text.py b/pyrogram/client/methods/messages/edit_inline_text.py
new file mode 100644
index 00000000..927fd80f
--- /dev/null
+++ b/pyrogram/client/methods/messages/edit_inline_text.py
@@ -0,0 +1,67 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+import pyrogram
+from pyrogram.api import functions
+from pyrogram.client.ext import BaseClient, utils
+
+
+class EditInlineText(BaseClient):
+    def edit_inline_text(
+        self,
+        inline_message_id: str,
+        text: str,
+        parse_mode: str = "",
+        disable_web_page_preview: bool = None,
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
+    ) -> bool:
+        """Edit the text of **inline** messages.
+
+        Parameters:
+            inline_message_id (``str``):
+                Identifier of the inline message.
+
+            text (``str``):
+                New text of the message.
+
+            parse_mode (``str``, *optional*):
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
+
+            disable_web_page_preview (``bool``, *optional*):
+                Disables link previews for links in this message.
+
+            reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        style = self.html if parse_mode.lower() == "html" else self.markdown
+
+        return self.send(
+            functions.messages.EditInlineBotMessage(
+                id=utils.unpack_inline_message_id(inline_message_id),
+                no_webpage=disable_web_page_preview or None,
+                reply_markup=reply_markup.write() if reply_markup else None,
+                **style.parse(text)
+            )
+        )
diff --git a/pyrogram/client/methods/messages/edit_message_caption.py b/pyrogram/client/methods/messages/edit_message_caption.py
index c7bcbd70..52c22726 100644
--- a/pyrogram/client/methods/messages/edit_message_caption.py
+++ b/pyrogram/client/methods/messages/edit_message_caption.py
@@ -19,7 +19,6 @@
 from typing import Union
 
 import pyrogram
-from pyrogram.api import functions, types
 from pyrogram.client.ext import BaseClient
 
 
@@ -32,9 +31,9 @@ class EditMessageCaption(BaseClient):
         parse_mode: str = "",
         reply_markup: "pyrogram.InlineKeyboardMarkup" = None
     ) -> "pyrogram.Message":
-        """Use this method to edit captions of messages.
+        """Edit the caption of media messages.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -44,37 +43,25 @@ class EditMessageCaption(BaseClient):
                 Message identifier in the chat specified in chat_id.
 
             caption (``str``):
-                New caption of the message.
+                New caption of the media message.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
 
             reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
                 An InlineKeyboardMarkup object.
 
         Returns:
-            On success, the edited :obj:`Message ` is returned.
+            :obj:`Message`: On success, the edited message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
-        style = self.html if parse_mode.lower() == "html" else self.markdown
-
-        r = self.send(
-            functions.messages.EditMessage(
-                peer=self.resolve_peer(chat_id),
-                id=message_id,
-                reply_markup=reply_markup.write() if reply_markup else None,
-                **style.parse(caption)
-            )
+        return self.edit_message_text(
+            chat_id=chat_id,
+            message_id=message_id,
+            text=caption,
+            parse_mode=parse_mode,
+            reply_markup=reply_markup
         )
-
-        for i in r.updates:
-            if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
-                return pyrogram.Message._parse(
-                    self, i.message,
-                    {i.id: i for i in r.users},
-                    {i.id: i for i in r.chats}
-                )
diff --git a/pyrogram/client/methods/messages/edit_message_media.py b/pyrogram/client/methods/messages/edit_message_media.py
index ea5870fc..b65804fd 100644
--- a/pyrogram/client/methods/messages/edit_message_media.py
+++ b/pyrogram/client/methods/messages/edit_message_media.py
@@ -16,14 +16,11 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-import binascii
 import os
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid
 from pyrogram.client.ext import BaseClient, utils
 from pyrogram.client.types import (
     InputMediaPhoto, InputMediaVideo, InputMediaAudio,
@@ -40,14 +37,12 @@ class EditMessageMedia(BaseClient):
         media: InputMedia,
         reply_markup: "pyrogram.InlineKeyboardMarkup" = None
     ) -> "pyrogram.Message":
-        """Use this method to edit audio, document, photo, or video messages.
+        """Edit animation, audio, document, photo or video messages.
 
-        If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise,
-        message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded.
-        Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent
-        by the bot, the edited Message is returned, otherwise True is returned.
+        If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, the
+        message type can be changed arbitrarily.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -56,17 +51,17 @@ class EditMessageMedia(BaseClient):
             message_id (``int``):
                 Message identifier in the chat specified in chat_id.
 
-            media (:obj:`InputMedia`)
+            media (:obj:`InputMedia`):
                 One of the InputMedia objects describing an animation, audio, document, photo or video.
 
             reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
                 An InlineKeyboardMarkup object.
 
         Returns:
-            On success, the edited :obj:`Message ` is returned.
+            :obj:`Message`: On success, the edited message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         style = self.html if media.parse_mode.lower() == "html" else self.markdown
         caption = media.caption
@@ -94,36 +89,14 @@ class EditMessageMedia(BaseClient):
                     url=media.media
                 )
             else:
-                try:
-                    decoded = utils.decode(media.media)
-                    fmt = " 24 else " 24 else " 24 else " 24 else " 24 else " "pyrogram.Message":
-        """Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
+        """Edit only the reply markup of messages sent by the bot.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -45,18 +45,16 @@ class EditMessageReplyMarkup(BaseClient):
                 An InlineKeyboardMarkup object.
 
         Returns:
-            On success, if edited message is sent by the bot, the edited
-            :obj:`Message ` is returned, otherwise True is returned.
+            :obj:`Message`: On success, the edited message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
-
         r = self.send(
             functions.messages.EditMessage(
                 peer=self.resolve_peer(chat_id),
                 id=message_id,
-                reply_markup=reply_markup.write() if reply_markup else None
+                reply_markup=reply_markup.write() if reply_markup else None,
             )
         )
 
diff --git a/pyrogram/client/methods/messages/edit_message_text.py b/pyrogram/client/methods/messages/edit_message_text.py
index 8e23b1de..7e4345c6 100644
--- a/pyrogram/client/methods/messages/edit_message_text.py
+++ b/pyrogram/client/methods/messages/edit_message_text.py
@@ -33,9 +33,9 @@ class EditMessageText(BaseClient):
         disable_web_page_preview: bool = None,
         reply_markup: "pyrogram.InlineKeyboardMarkup" = None
     ) -> "pyrogram.Message":
-        """Use this method to edit text messages.
+        """Edit the text of messages.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -48,9 +48,8 @@ class EditMessageText(BaseClient):
                 New text of the message.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
 
             disable_web_page_preview (``bool``, *optional*):
                 Disables link previews for links in this message.
@@ -59,10 +58,10 @@ class EditMessageText(BaseClient):
                 An InlineKeyboardMarkup object.
 
         Returns:
-            On success, the edited :obj:`Message ` is returned.
+            :obj:`Message`: On success, the edited message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         style = self.html if parse_mode.lower() == "html" else self.markdown
 
diff --git a/pyrogram/client/methods/messages/forward_messages.py b/pyrogram/client/methods/messages/forward_messages.py
index 5540b38a..c69df608 100644
--- a/pyrogram/client/methods/messages/forward_messages.py
+++ b/pyrogram/client/methods/messages/forward_messages.py
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from typing import Union, Iterable
+from typing import Union, Iterable, List
 
 import pyrogram
 from pyrogram.api import functions, types
@@ -28,14 +28,14 @@ class ForwardMessages(BaseClient):
         self,
         chat_id: Union[int, str],
         from_chat_id: Union[int, str],
-        message_ids: Iterable[int],
+        message_ids: Union[int, Iterable[int]],
         disable_notification: bool = None,
         as_copy: bool = False,
         remove_caption: bool = False
-    ) -> "pyrogram.Messages":
-        """Use this method to forward messages of any kind.
+    ) -> List["pyrogram.Message"]:
+        """Forward messages of any kind.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -64,13 +64,12 @@ class ForwardMessages(BaseClient):
                 Defaults to False.
 
         Returns:
-            On success and in case *message_ids* was an iterable, the returned value will be a list of the forwarded
-            :obj:`Messages ` even if a list contains just one element, otherwise if
-            *message_ids* was an integer, the single forwarded :obj:`Message `
-            is returned.
+            :obj:`Message` | List of :obj:`Message`: In case *message_ids* was an integer, the single forwarded message
+            is returned, otherwise, in case *message_ids* was an iterable, the returned value will be a list of
+            messages, even if such iterable contained just a single element.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
 
         is_iterable = not isinstance(message_ids, int)
@@ -80,9 +79,9 @@ class ForwardMessages(BaseClient):
             forwarded_messages = []
 
             for chunk in [message_ids[i:i + 200] for i in range(0, len(message_ids), 200)]:
-                messages = self.get_messages(chat_id=from_chat_id, message_ids=chunk)  # type: pyrogram.Messages
+                messages = self.get_messages(chat_id=from_chat_id, message_ids=chunk)
 
-                for message in messages.messages:
+                for message in messages:
                     forwarded_messages.append(
                         message.forward(
                             chat_id,
@@ -92,11 +91,7 @@ class ForwardMessages(BaseClient):
                         )
                     )
 
-            return pyrogram.Messages(
-                client=self,
-                total_count=len(forwarded_messages),
-                messages=forwarded_messages
-            ) if is_iterable else forwarded_messages[0]
+            return pyrogram.List(forwarded_messages) if is_iterable else forwarded_messages[0]
         else:
             r = self.send(
                 functions.messages.ForwardMessages(
@@ -122,8 +117,4 @@ class ForwardMessages(BaseClient):
                         )
                     )
 
-            return pyrogram.Messages(
-                client=self,
-                total_count=len(forwarded_messages),
-                messages=forwarded_messages
-            ) if is_iterable else forwarded_messages[0]
+            return pyrogram.List(forwarded_messages) if is_iterable else forwarded_messages[0]
diff --git a/pyrogram/client/methods/messages/get_history.py b/pyrogram/client/methods/messages/get_history.py
index fda8f11f..8adafe22 100644
--- a/pyrogram/client/methods/messages/get_history.py
+++ b/pyrogram/client/methods/messages/get_history.py
@@ -18,10 +18,11 @@
 
 import logging
 import time
-from typing import Union
+from typing import Union, List
 
 import pyrogram
 from pyrogram.api import functions
+from pyrogram.client.ext import utils
 from pyrogram.errors import FloodWait
 from ...ext import BaseClient
 
@@ -37,13 +38,13 @@ class GetHistory(BaseClient):
         offset_id: int = 0,
         offset_date: int = 0,
         reverse: bool = False
-    ):
-        """Use this method to retrieve a chunk of the history of a chat.
+    ) -> List["pyrogram.Message"]:
+        """Retrieve a chunk of the history of a chat.
 
         You can get up to 100 messages at once.
-        For a more convenient way of getting a chat history see :meth:`iter_history`.
+        For a more convenient way of getting a chat history see :meth:`~Client.iter_history`.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -67,15 +68,17 @@ class GetHistory(BaseClient):
                 Pass True to retrieve the messages in reversed order (from older to most recent).
 
         Returns:
-            On success, a :obj:`Messages ` object is returned.
+            List of :obj:`Message` - On success, a list of the retrieved messages is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
 
+        offset_id = offset_id or (1 if reverse else 0)
+
         while True:
             try:
-                messages = pyrogram.Messages._parse(
+                messages = utils.parse_messages(
                     self,
                     self.send(
                         functions.messages.GetHistory(
@@ -97,6 +100,6 @@ class GetHistory(BaseClient):
                 break
 
         if reverse:
-            messages.messages.reverse()
+            messages.reverse()
 
         return messages
diff --git a/pyrogram/client/methods/messages/get_history_count.py b/pyrogram/client/methods/messages/get_history_count.py
new file mode 100644
index 00000000..9f3e2637
--- /dev/null
+++ b/pyrogram/client/methods/messages/get_history_count.py
@@ -0,0 +1,68 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+import logging
+from typing import Union
+
+from pyrogram.api import types, functions
+from pyrogram.client.ext import BaseClient
+
+log = logging.getLogger(__name__)
+
+
+class GetHistoryCount(BaseClient):
+    def get_history_count(
+        self,
+        chat_id: Union[int, str]
+    ) -> int:
+        """Get the total count of messages in a chat.
+
+        .. note::
+
+            Due to Telegram latest internal changes, the server can't reliably find anymore the total count of messages
+            a **private** or a **basic group** chat has with a single method call. To overcome this limitation, Pyrogram
+            has to iterate over all the messages. Channels and supergroups are not affected by this limitation.
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+        Returns:
+            ``int``: On success, the chat history count is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        r = self.send(
+            functions.messages.GetHistory(
+                peer=self.resolve_peer(chat_id),
+                offset_id=0,
+                offset_date=0,
+                add_offset=0,
+                limit=1,
+                max_id=0,
+                min_id=0,
+                hash=0
+            )
+        )
+
+        if isinstance(r, types.messages.Messages):
+            return len(r.messages)
+        else:
+            return r.count
diff --git a/pyrogram/client/methods/messages/get_messages.py b/pyrogram/client/methods/messages/get_messages.py
index c018a9eb..0f901174 100644
--- a/pyrogram/client/methods/messages/get_messages.py
+++ b/pyrogram/client/methods/messages/get_messages.py
@@ -18,12 +18,12 @@
 
 import logging
 import time
-from typing import Union, Iterable
+from typing import Union, Iterable, List
 
 import pyrogram
 from pyrogram.api import functions, types
 from pyrogram.errors import FloodWait
-from ...ext import BaseClient
+from ...ext import BaseClient, utils
 
 log = logging.getLogger(__name__)
 
@@ -35,11 +35,11 @@ class GetMessages(BaseClient):
         message_ids: Union[int, Iterable[int]] = None,
         reply_to_message_ids: Union[int, Iterable[int]] = None,
         replies: int = 1
-    ) -> Union["pyrogram.Message", "pyrogram.Messages"]:
-        """Use this method to get one or more messages that belong to a specific chat.
+    ) -> Union["pyrogram.Message", List["pyrogram.Message"]]:
+        """Get one or more messages that belong to a specific chat.
         You can retrieve up to 200 messages at once.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -55,15 +55,17 @@ class GetMessages(BaseClient):
                 If *message_ids* is set, this argument will be ignored.
 
             replies (``int``, *optional*):
-                The number of subsequent replies to get for each message. Defaults to 1.
+                The number of subsequent replies to get for each message.
+                Pass 0 for no reply at all or -1 for unlimited replies.
+                Defaults to 1.
 
         Returns:
-            On success and in case *message_ids* or *reply_to_message_ids* was an iterable, the returned value will be a
-            :obj:`Messages ` even if a list contains just one element. Otherwise, if *message_ids* or
-            *reply_to_message_ids* was an integer, the single requested :obj:`Message ` is returned.
+            :obj:`Message` | List of :obj:`Message`: In case *message_ids* was an integer, the single requested message is
+            returned, otherwise, in case *message_ids* was an iterable, the returned value will be a list of messages,
+            even if such iterable contained just a single element.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         ids, ids_type = (
             (message_ids, types.InputMessageID) if message_ids
@@ -80,6 +82,9 @@ class GetMessages(BaseClient):
         ids = list(ids) if is_iterable else [ids]
         ids = [ids_type(id=i) for i in ids]
 
+        if replies < 0:
+            replies = (1 << 31) - 1
+
         if isinstance(peer, types.InputPeerChannel):
             rpc = functions.channels.GetMessages(channel=peer, id=ids)
         else:
@@ -94,6 +99,6 @@ class GetMessages(BaseClient):
             else:
                 break
 
-        messages = pyrogram.Messages._parse(self, r, replies=replies)
+        messages = utils.parse_messages(self, r, replies=replies)
 
-        return messages if is_iterable else messages.messages[0]
+        return messages if is_iterable else messages[0]
diff --git a/pyrogram/client/methods/messages/iter_history.py b/pyrogram/client/methods/messages/iter_history.py
index f7a8a74e..15c48c95 100644
--- a/pyrogram/client/methods/messages/iter_history.py
+++ b/pyrogram/client/methods/messages/iter_history.py
@@ -32,12 +32,13 @@ class IterHistory(BaseClient):
         offset_date: int = 0,
         reverse: bool = False
     ) -> Generator["pyrogram.Message", None, None]:
-        """Use this method to iterate through a chat history sequentially.
+        """Iterate through a chat history sequentially.
 
-        This convenience method does the same as repeatedly calling :meth:`get_history` in a loop, thus saving you from
-        the hassle of setting up boilerplate code. It is useful for getting the whole chat history with a single call.
+        This convenience method does the same as repeatedly calling :meth:`~Client.get_history` in a loop, thus saving
+        you from the hassle of setting up boilerplate code. It is useful for getting the whole chat history with a
+        single call.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -61,10 +62,10 @@ class IterHistory(BaseClient):
                 Pass True to retrieve the messages in reversed order (from older to most recent).
 
         Returns:
-            A generator yielding :obj:`Message ` objects.
+            ``Generator``: A generator yielding :obj:`Message` objects.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         offset_id = offset_id or (1 if reverse else 0)
         current = 0
@@ -79,7 +80,7 @@ class IterHistory(BaseClient):
                 offset_id=offset_id,
                 offset_date=offset_date,
                 reverse=reverse
-            ).messages
+            )
 
             if not messages:
                 return
diff --git a/pyrogram/client/methods/messages/read_history.py b/pyrogram/client/methods/messages/read_history.py
new file mode 100644
index 00000000..f0278e91
--- /dev/null
+++ b/pyrogram/client/methods/messages/read_history.py
@@ -0,0 +1,65 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from typing import Union
+
+from pyrogram.api import functions, types
+from ...ext import BaseClient
+
+
+class ReadHistory(BaseClient):
+    def read_history(
+        self,
+        chat_id: Union[int, str],
+        max_id: int = 0
+    ) -> bool:
+        """Mark a chat's message history as read.
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+                For your personal cloud (Saved Messages) you can simply use "me" or "self".
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            max_id (``int``, *optional*):
+                The id of the last message you want to mark as read; all the messages before this one will be marked as
+                read as well. Defaults to 0 (mark every unread message as read).
+
+        Returns:
+            ``bool`` - On success, True is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        peer = self.resolve_peer(chat_id)
+
+        if isinstance(peer, types.InputPeerChannel):
+            q = functions.channels.ReadHistory(
+                channel=peer,
+                max_id=max_id
+            )
+        else:
+            q = functions.messages.ReadHistory(
+                peer=peer,
+                max_id=max_id
+            )
+
+        self.send(q)
+
+        return True
diff --git a/pyrogram/client/methods/messages/retract_vote.py b/pyrogram/client/methods/messages/retract_vote.py
index 8fa8996c..b52181a6 100644
--- a/pyrogram/client/methods/messages/retract_vote.py
+++ b/pyrogram/client/methods/messages/retract_vote.py
@@ -18,6 +18,7 @@
 
 from typing import Union
 
+import pyrogram
 from pyrogram.api import functions
 from pyrogram.client.ext import BaseClient
 
@@ -26,26 +27,26 @@ class RetractVote(BaseClient):
     def retract_vote(
         self,
         chat_id: Union[int, str],
-        message_id: id
-    ) -> bool:
-        """Use this method to retract your vote in a poll.
+        message_id: int
+    ) -> "pyrogram.Poll":
+        """Retract your vote in a poll.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
                 For a contact that exists in your Telegram address book you can use his phone number (str).
 
             message_id (``int``):
-                Unique poll message identifier inside this chat.
+                Identifier of the original message with the poll.
 
         Returns:
-            On success, True is returned.
+            :obj:`Poll`: On success, the poll with the retracted vote is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
-        self.send(
+        r = self.send(
             functions.messages.SendVote(
                 peer=self.resolve_peer(chat_id),
                 msg_id=message_id,
@@ -53,4 +54,4 @@ class RetractVote(BaseClient):
             )
         )
 
-        return True
+        return pyrogram.Poll._parse(self, r.updates[0])
diff --git a/pyrogram/client/methods/messages/send_animated_sticker.py b/pyrogram/client/methods/messages/send_animated_sticker.py
new file mode 100644
index 00000000..6fd0c647
--- /dev/null
+++ b/pyrogram/client/methods/messages/send_animated_sticker.py
@@ -0,0 +1,141 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+import os
+from typing import Union
+
+import pyrogram
+from pyrogram.api import functions, types
+from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
+
+
+class SendAnimatedSticker(BaseClient):
+    def send_animated_sticker(
+        self,
+        chat_id: Union[int, str],
+        animated_sticker: str,
+        disable_notification: bool = None,
+        reply_to_message_id: int = None,
+        reply_markup: Union[
+            "pyrogram.InlineKeyboardMarkup",
+            "pyrogram.ReplyKeyboardMarkup",
+            "pyrogram.ReplyKeyboardRemove",
+            "pyrogram.ForceReply"
+        ] = None,
+        progress: callable = None,
+        progress_args: tuple = ()
+    ) -> Union["pyrogram.Message", None]:
+        """Send .tgs animated stickers.
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+                For your personal cloud (Saved Messages) you can simply use "me" or "self".
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            animated_sticker (``str``):
+                Animated sticker to send.
+                Pass a file_id as string to send a animated sticker that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get a .webp animated sticker file from the Internet, or
+                pass a file path as string to upload a new animated sticker that exists on your local machine.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_to_message_id (``int``, *optional*):
+                If the message is a reply, ID of the original message.
+
+            reply_markup (:obj:`InlineKeyboardMarkup` | :obj:`ReplyKeyboardMarkup` | :obj:`ReplyKeyboardRemove` | :obj:`ForceReply`, *optional*):
+                Additional interface options. An object for an inline keyboard, custom reply keyboard,
+                instructions to remove reply keyboard or to force a reply from the user.
+
+            progress (``callable``, *optional*):
+                Pass a callback function to view the upload progress.
+                The function must take *(client, current, total, \*args)* as positional arguments (look at the section
+                below for a detailed description).
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function. Useful, for example, if you want to pass
+                a chat_id and a message_id in order to edit a message with the updated progress.
+
+        Other Parameters:
+            client (:obj:`Client`):
+                The Client itself, useful when you want to call other API methods inside the callback function.
+
+            current (``int``):
+                The amount of bytes uploaded so far.
+
+            total (``int``):
+                The size of the file.
+
+            *args (``tuple``, *optional*):
+                Extra custom arguments as defined in the *progress_args* parameter.
+                You can either keep *\*args* or add every single extra argument in your function signature.
+
+        Returns:
+            :obj:`Message` | ``None``: On success, the sent animated sticker message is returned, otherwise, in case the
+            upload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        file = None
+
+        try:
+            if os.path.exists(animated_sticker):
+                file = self.save_file(animated_sticker, progress=progress, progress_args=progress_args)
+                media = types.InputMediaUploadedDocument(
+                    mime_type=self.guess_mime_type(animated_sticker) or "application/x-tgsticker",
+                    file=file,
+                    attributes=[
+                        types.DocumentAttributeFilename(file_name=os.path.basename(animated_sticker))
+                    ]
+                )
+            elif animated_sticker.startswith("http"):
+                media = types.InputMediaDocumentExternal(
+                    url=animated_sticker
+                )
+            else:
+                media = utils.get_input_media_from_file_id(animated_sticker, 5)
+
+            while True:
+                try:
+                    r = self.send(
+                        functions.messages.SendMedia(
+                            peer=self.resolve_peer(chat_id),
+                            media=media,
+                            silent=disable_notification or None,
+                            reply_to_msg_id=reply_to_message_id,
+                            random_id=self.rnd_id(),
+                            reply_markup=reply_markup.write() if reply_markup else None,
+                            message=""
+                        )
+                    )
+                except FilePartMissing as e:
+                    self.save_file(animated_sticker, file_id=file.id, file_part=e.x)
+                else:
+                    for i in r.updates:
+                        if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
+                            return pyrogram.Message._parse(
+                                self, i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats}
+                            )
+        except BaseClient.StopTransmission:
+            return None
diff --git a/pyrogram/client/methods/messages/send_animation.py b/pyrogram/client/methods/messages/send_animation.py
index 798d236d..0c4649dd 100644
--- a/pyrogram/client/methods/messages/send_animation.py
+++ b/pyrogram/client/methods/messages/send_animation.py
@@ -16,15 +16,13 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-import binascii
 import os
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
 from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
 
 
 class SendAnimation(BaseClient):
@@ -33,6 +31,7 @@ class SendAnimation(BaseClient):
         chat_id: Union[int, str],
         animation: str,
         caption: str = "",
+        unsave: bool = False,
         parse_mode: str = "",
         duration: int = 0,
         width: int = 0,
@@ -49,9 +48,9 @@ class SendAnimation(BaseClient):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> Union["pyrogram.Message", None]:
-        """Use this method to send animation files (animation or H.264/MPEG-4 AVC video without sound).
+        """Send animation files (animation or H.264/MPEG-4 AVC video without sound).
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -66,10 +65,13 @@ class SendAnimation(BaseClient):
             caption (``str``, *optional*):
                 Animation caption, 0-1024 characters.
 
+            unsave (``bool``, *optional*):
+                By default, the server will save into your own collection any new animation GIF you send.
+                Pass True to automatically unsave the sent animation. Defaults to False.
+
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             duration (``int``, *optional*):
                 Duration of sent animation in seconds.
@@ -83,7 +85,7 @@ class SendAnimation(BaseClient):
             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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             disable_notification (``bool``, *optional*):
@@ -107,7 +109,7 @@ class SendAnimation(BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -121,11 +123,11 @@ class SendAnimation(BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            :obj:`Message` | ``None``: On success, the sent animation message is returned, otherwise, in case the upload
+            is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         file = None
         style = self.html if parse_mode.lower() == "html" else self.markdown
@@ -135,7 +137,7 @@ class SendAnimation(BaseClient):
                 thumb = None if thumb is None else self.save_file(thumb)
                 file = self.save_file(animation, progress=progress, progress_args=progress_args)
                 media = types.InputMediaUploadedDocument(
-                    mime_type="video/mp4",
+                    mime_type=self.guess_mime_type(animation) or "video/mp4",
                     file=file,
                     thumb=thumb,
                     attributes=[
@@ -154,28 +156,7 @@ class SendAnimation(BaseClient):
                     url=animation
                 )
             else:
-                try:
-                    decoded = utils.decode(animation)
-                    fmt = " 24 else ".
 
-import binascii
 import os
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
 from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
 
 
 class SendAudio(BaseClient):
@@ -49,11 +47,11 @@ class SendAudio(BaseClient):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> Union["pyrogram.Message", None]:
-        """Use this method to send audio files.
+        """Send audio files.
 
         For sending voice messages, use the :obj:`send_voice()` method instead.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -69,9 +67,8 @@ class SendAudio(BaseClient):
                 Audio caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             duration (``int``, *optional*):
                 Duration of the audio in seconds.
@@ -85,7 +82,7 @@ class SendAudio(BaseClient):
             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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             disable_notification (``bool``, *optional*):
@@ -109,7 +106,7 @@ class SendAudio(BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -123,11 +120,11 @@ class SendAudio(BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            :obj:`Message` | ``None``: On success, the sent audio message is returned, otherwise, in case the upload
+            is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         file = None
         style = self.html if parse_mode.lower() == "html" else self.markdown
@@ -137,7 +134,7 @@ class SendAudio(BaseClient):
                 thumb = None if thumb is None else self.save_file(thumb)
                 file = self.save_file(audio, progress=progress, progress_args=progress_args)
                 media = types.InputMediaUploadedDocument(
-                    mime_type="audio/mpeg",
+                    mime_type=self.guess_mime_type(audio) or "audio/mpeg",
                     file=file,
                     thumb=thumb,
                     attributes=[
@@ -154,28 +151,7 @@ class SendAudio(BaseClient):
                     url=audio
                 )
             else:
-                try:
-                    decoded = utils.decode(audio)
-                    fmt = " 24 else ".
 
-import binascii
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid
 from pyrogram.client.ext import BaseClient, utils
 
 
@@ -42,13 +39,13 @@ class SendCachedMedia(BaseClient):
             "pyrogram.ForceReply"
         ] = None
     ) -> Union["pyrogram.Message", None]:
-        """Use this method to send any media stored on the Telegram servers using a file_id.
+        """Send any media stored on the Telegram servers using a file_id.
 
         This convenience method works with any valid file_id only.
         It does the same as calling the relevant method for sending media using a file_id, thus saving you from the
         hassle of using the correct method for the media the file_id is pointing to.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -62,9 +59,8 @@ class SendCachedMedia(BaseClient):
                 Media caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             disable_notification (``bool``, *optional*):
                 Sends the message silently.
@@ -78,46 +74,17 @@ class SendCachedMedia(BaseClient):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            :obj:`Message`: On success, the sent media message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         style = self.html if parse_mode.lower() == "html" else self.markdown
 
-        try:
-            decoded = utils.decode(file_id)
-            fmt = " 24 else ".
 
+import json
 from typing import Union
 
-from pyrogram.api import functions
-from pyrogram.client.ext import BaseClient, ChatAction
+from pyrogram.api import functions, types
+from pyrogram.client.ext import BaseClient
+
+
+class ChatAction:
+    TYPING = types.SendMessageTypingAction
+    UPLOAD_PHOTO = types.SendMessageUploadPhotoAction
+    RECORD_VIDEO = types.SendMessageRecordVideoAction
+    UPLOAD_VIDEO = types.SendMessageUploadVideoAction
+    RECORD_AUDIO = types.SendMessageRecordAudioAction
+    UPLOAD_AUDIO = types.SendMessageUploadAudioAction
+    UPLOAD_DOCUMENT = types.SendMessageUploadDocumentAction
+    FIND_LOCATION = types.SendMessageGeoLocationAction
+    RECORD_VIDEO_NOTE = types.SendMessageRecordRoundAction
+    UPLOAD_VIDEO_NOTE = types.SendMessageUploadRoundAction
+    PLAYING = types.SendMessageGamePlayAction
+    CHOOSE_CONTACT = types.SendMessageChooseContactAction
+    CANCEL = types.SendMessageCancelAction
+
+
+POSSIBLE_VALUES = list(map(lambda x: x.lower(), filter(lambda x: not x.startswith("__"), ChatAction.__dict__.keys())))
 
 
 class SendChatAction(BaseClient):
-    def send_chat_action(
-        self,
-        chat_id: Union[int, str],
-        action: Union[ChatAction, str],
-        progress: int = 0
-    ):
-        """Use this method when you need to tell the other party that something is happening on your side.
+    def send_chat_action(self, chat_id: Union[int, str], action: str) -> bool:
+        """Tell the other party that something is happening on your side.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
                 For a contact that exists in your Telegram address book you can use his phone number (str).
 
-            action (:obj:`ChatAction ` | ``str``):
-                Type of action to broadcast.
-                Choose one from the :class:`ChatAction ` enumeration,
-                depending on what the user is about to receive.
-                You can also provide a string (e.g. "typing", "upload_photo", "record_audio", ...).
-
-            progress (``int``, *optional*):
-                Progress of the upload process.
-                Currently useless because official clients don't seem to be handling this.
+            action (``str``):
+                Type of action to broadcast. Choose one, depending on what the user is about to receive: *"typing"* for
+                text messages, *"upload_photo"* for photos, *"record_video"* or *"upload_video"* for videos,
+                *"record_audio"* or *"upload_audio"* for audio files, *"upload_document"* for general files,
+                *"find_location"* for location data, *"record_video_note"* or *"upload_video_note"* for video notes,
+                *"choose_contact"* for contacts, *"playing"* for games or *"cancel"* to cancel any chat action currently
+                displayed.
 
         Returns:
-            On success, True is returned.
+            ``bool``: On success, True is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` if the provided string is not a valid ChatAction.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case the provided string is not a valid ChatAction.
         """
 
-        # Resolve Enum type
-        if isinstance(action, str):
-            action = ChatAction.from_string(action).value
-        elif isinstance(action, ChatAction):
-            action = action.value
+        try:
+            action = ChatAction.__dict__[action.upper()]
+        except KeyError:
+            raise ValueError("Invalid chat action '{}'. Possible values are: {}".format(
+                action, json.dumps(POSSIBLE_VALUES, indent=4))) from None
 
         if "Upload" in action.__name__:
-            action = action(progress=progress)
+            action = action(progress=0)
         else:
             action = action()
 
diff --git a/pyrogram/client/methods/messages/send_contact.py b/pyrogram/client/methods/messages/send_contact.py
index 9143440e..d0b6fb58 100644
--- a/pyrogram/client/methods/messages/send_contact.py
+++ b/pyrogram/client/methods/messages/send_contact.py
@@ -40,9 +40,9 @@ class SendContact(BaseClient):
             "pyrogram.ForceReply"
         ] = None
     ) -> "pyrogram.Message":
-        """Use this method to send phone contacts.
+        """Send phone contacts.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -72,10 +72,10 @@ class SendContact(BaseClient):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            :obj:`Message`: On success, the sent contact message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         r = self.send(
             functions.messages.SendMedia(
diff --git a/pyrogram/client/methods/messages/send_document.py b/pyrogram/client/methods/messages/send_document.py
index a36a0fbb..da012b2c 100644
--- a/pyrogram/client/methods/messages/send_document.py
+++ b/pyrogram/client/methods/messages/send_document.py
@@ -16,15 +16,13 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-import binascii
 import os
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
 from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
 
 
 class SendDocument(BaseClient):
@@ -46,9 +44,9 @@ class SendDocument(BaseClient):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> Union["pyrogram.Message", None]:
-        """Use this method to send general files.
+        """Send generic files.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -63,16 +61,15 @@ class SendDocument(BaseClient):
             thumb (``str``, *optional*):
                 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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             caption (``str``, *optional*):
                 Document caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             disable_notification (``bool``, *optional*):
                 Sends the message silently.
@@ -95,7 +92,7 @@ class SendDocument(BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -109,11 +106,11 @@ class SendDocument(BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            :obj:`Message` | ``None``: On success, the sent document message is returned, otherwise, in case the upload
+            is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         file = None
         style = self.html if parse_mode.lower() == "html" else self.markdown
@@ -123,7 +120,7 @@ class SendDocument(BaseClient):
                 thumb = None if thumb is None else self.save_file(thumb)
                 file = self.save_file(document, progress=progress, progress_args=progress_args)
                 media = types.InputMediaUploadedDocument(
-                    mime_type="application/zip",
+                    mime_type=self.guess_mime_type(document) or "application/zip",
                     file=file,
                     thumb=thumb,
                     attributes=[
@@ -135,28 +132,7 @@ class SendDocument(BaseClient):
                     url=document
                 )
             else:
-                try:
-                    decoded = utils.decode(document)
-                    fmt = " 24 else " "pyrogram.Message":
-        """Use this method to send points on the map.
+        """Send points on the map.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -64,10 +64,10 @@ class SendLocation(BaseClient):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            :obj:`Message`: On success, the sent location message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         r = self.send(
             functions.messages.SendMedia(
diff --git a/pyrogram/client/methods/messages/send_media_group.py b/pyrogram/client/methods/messages/send_media_group.py
index 4fdc1132..194a2202 100644
--- a/pyrogram/client/methods/messages/send_media_group.py
+++ b/pyrogram/client/methods/messages/send_media_group.py
@@ -16,17 +16,15 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-import binascii
 import logging
 import os
-import struct
 import time
 from typing import Union, List
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FloodWait
 from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FloodWait
 
 log = logging.getLogger(__name__)
 
@@ -40,10 +38,10 @@ class SendMediaGroup(BaseClient):
         media: List[Union["pyrogram.InputMediaPhoto", "pyrogram.InputMediaVideo"]],
         disable_notification: bool = None,
         reply_to_message_id: int = None
-    ):
-        """Use this method to send a group of photos or videos as an album.
+    ) -> List["pyrogram.Message"]:
+        """Send a group of photos or videos as an album.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -60,11 +58,10 @@ class SendMediaGroup(BaseClient):
                 If the message is a reply, ID of the original message.
 
         Returns:
-            On success, a :obj:`Messages ` object is returned containing all the
-            single messages sent.
+            List of :obj:`Message`: On success, a list of the sent messages is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         multi_media = []
 
@@ -97,28 +94,7 @@ class SendMediaGroup(BaseClient):
                         )
                     )
                 else:
-                    try:
-                        decoded = utils.decode(i.media)
-                        fmt = " 24 else " 24 else " "pyrogram.Message":
-        """Use this method to send text messages.
+        """Send text messages.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -51,9 +51,8 @@ class SendMessage(BaseClient):
                 Text of the message to be sent.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
 
             disable_web_page_preview (``bool``, *optional*):
                 Disables link previews for links in this message.
@@ -70,10 +69,10 @@ class SendMessage(BaseClient):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message` is returned.
+            :obj:`Message`: On success, the sent text message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         style = self.html if parse_mode.lower() == "html" else self.markdown
         message, entities = style.parse(text).values()
diff --git a/pyrogram/client/methods/messages/send_photo.py b/pyrogram/client/methods/messages/send_photo.py
index 7e327cbd..c1fd33d8 100644
--- a/pyrogram/client/methods/messages/send_photo.py
+++ b/pyrogram/client/methods/messages/send_photo.py
@@ -16,15 +16,13 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-import binascii
 import os
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
 from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
 
 
 class SendPhoto(BaseClient):
@@ -46,9 +44,9 @@ class SendPhoto(BaseClient):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> Union["pyrogram.Message", None]:
-        """Use this method to send photos.
+        """Send photos.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -64,9 +62,8 @@ class SendPhoto(BaseClient):
                 Photo caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             ttl_seconds (``int``, *optional*):
                 Self-Destruct Timer.
@@ -94,7 +91,7 @@ class SendPhoto(BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -108,11 +105,11 @@ class SendPhoto(BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            :obj:`Message` | ``None``: On success, the sent photo message is returned, otherwise, in case the upload
+            is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         file = None
         style = self.html if parse_mode.lower() == "html" else self.markdown
@@ -130,29 +127,7 @@ class SendPhoto(BaseClient):
                     ttl_seconds=ttl_seconds
                 )
             else:
-                try:
-                    decoded = utils.decode(photo)
-                    fmt = " 24 else " "pyrogram.Message":
-        """Use this method to send a new poll.
+        """Send a new poll.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
                 For a contact that exists in your Telegram address book you can use his phone number (str).
 
             question (``str``):
-                The poll question, as string.
+                Poll question, 1-255 characters.
 
             options (List of ``str``):
-                The poll options, as list of strings (2 to 10 options are allowed).
+                List of answer options, 2-10 strings 1-100 characters each.
 
             disable_notification (``bool``, *optional*):
                 Sends the message silently.
@@ -64,10 +64,10 @@ class SendPoll(BaseClient):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            :obj:`Message`: On success, the sent poll message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         r = self.send(
             functions.messages.SendMedia(
diff --git a/pyrogram/client/methods/messages/send_sticker.py b/pyrogram/client/methods/messages/send_sticker.py
index e556aae3..4f7a99ff 100644
--- a/pyrogram/client/methods/messages/send_sticker.py
+++ b/pyrogram/client/methods/messages/send_sticker.py
@@ -16,15 +16,13 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-import binascii
 import os
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
 from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
 
 
 class SendSticker(BaseClient):
@@ -43,9 +41,9 @@ class SendSticker(BaseClient):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> Union["pyrogram.Message", None]:
-        """Use this method to send .webp stickers.
+        """Send .webp stickers.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -78,7 +76,7 @@ class SendSticker(BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -92,11 +90,10 @@ class SendSticker(BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
-
+            :obj:`Message` | ``None``: On success, the sent sticker message is returned, otherwise, in case the upload
+            is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         file = None
 
@@ -104,7 +101,7 @@ class SendSticker(BaseClient):
             if os.path.exists(sticker):
                 file = self.save_file(sticker, progress=progress, progress_args=progress_args)
                 media = types.InputMediaUploadedDocument(
-                    mime_type="image/webp",
+                    mime_type=self.guess_mime_type(sticker) or "image/webp",
                     file=file,
                     attributes=[
                         types.DocumentAttributeFilename(file_name=os.path.basename(sticker))
@@ -115,28 +112,7 @@ class SendSticker(BaseClient):
                     url=sticker
                 )
             else:
-                try:
-                    decoded = utils.decode(sticker)
-                    fmt = " 24 else " "pyrogram.Message":
-        """Use this method to send information about a venue.
+        """Send information about a venue.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -81,10 +81,10 @@ class SendVenue(BaseClient):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            :obj:`Message`: On success, the sent venue message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         r = self.send(
             functions.messages.SendMedia(
diff --git a/pyrogram/client/methods/messages/send_video.py b/pyrogram/client/methods/messages/send_video.py
index 08d8b7ab..4e1201fc 100644
--- a/pyrogram/client/methods/messages/send_video.py
+++ b/pyrogram/client/methods/messages/send_video.py
@@ -16,15 +16,13 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-import binascii
 import os
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
 from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
 
 
 class SendVideo(BaseClient):
@@ -50,9 +48,9 @@ class SendVideo(BaseClient):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> Union["pyrogram.Message", None]:
-        """Use this method to send video files.
+        """Send video files.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -68,9 +66,8 @@ class SendVideo(BaseClient):
                 Video caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             duration (``int``, *optional*):
                 Duration of sent video in seconds.
@@ -84,7 +81,7 @@ class SendVideo(BaseClient):
             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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             supports_streaming (``bool``, *optional*):
@@ -111,7 +108,7 @@ class SendVideo(BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -125,11 +122,11 @@ class SendVideo(BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            :obj:`Message` | ``None``: On success, the sent video message is returned, otherwise, in case the upload
+            is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         file = None
         style = self.html if parse_mode.lower() == "html" else self.markdown
@@ -139,7 +136,7 @@ class SendVideo(BaseClient):
                 thumb = None if thumb is None else self.save_file(thumb)
                 file = self.save_file(video, progress=progress, progress_args=progress_args)
                 media = types.InputMediaUploadedDocument(
-                    mime_type="video/mp4",
+                    mime_type=self.guess_mime_type(video) or "video/mp4",
                     file=file,
                     thumb=thumb,
                     attributes=[
@@ -157,28 +154,7 @@ class SendVideo(BaseClient):
                     url=video
                 )
             else:
-                try:
-                    decoded = utils.decode(video)
-                    fmt = " 24 else ".
 
-import binascii
 import os
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
 from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
 
 
 class SendVideoNote(BaseClient):
@@ -46,9 +44,9 @@ class SendVideoNote(BaseClient):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> Union["pyrogram.Message", None]:
-        """Use this method to send video messages.
+        """Send video messages.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -69,7 +67,7 @@ class SendVideoNote(BaseClient):
             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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             disable_notification (``bool``, *optional*):
@@ -93,7 +91,7 @@ class SendVideoNote(BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -107,11 +105,11 @@ class SendVideoNote(BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            :obj:`Message` | ``None``: On success, the sent video note message is returned, otherwise, in case the
+            pload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         file = None
 
@@ -120,7 +118,7 @@ class SendVideoNote(BaseClient):
                 thumb = None if thumb is None else self.save_file(thumb)
                 file = self.save_file(video_note, progress=progress, progress_args=progress_args)
                 media = types.InputMediaUploadedDocument(
-                    mime_type="video/mp4",
+                    mime_type=self.guess_mime_type(video_note) or "video/mp4",
                     file=file,
                     thumb=thumb,
                     attributes=[
@@ -133,28 +131,7 @@ class SendVideoNote(BaseClient):
                     ]
                 )
             else:
-                try:
-                    decoded = utils.decode(video_note)
-                    fmt = " 24 else ".
 
-import binascii
 import os
-import struct
 from typing import Union
 
 import pyrogram
 from pyrogram.api import functions, types
-from pyrogram.errors import FileIdInvalid, FilePartMissing
 from pyrogram.client.ext import BaseClient, utils
+from pyrogram.errors import FilePartMissing
 
 
 class SendVoice(BaseClient):
@@ -46,9 +44,9 @@ class SendVoice(BaseClient):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> Union["pyrogram.Message", None]:
-        """Use this method to send audio files.
+        """Send audio files.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -64,9 +62,8 @@ class SendVoice(BaseClient):
                 Voice message caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             duration (``int``, *optional*):
                 Duration of the voice message in seconds.
@@ -92,7 +89,7 @@ class SendVoice(BaseClient):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -106,11 +103,11 @@ class SendVoice(BaseClient):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            :obj:`Message` | ``None``: On success, the sent voice message is returned, otherwise, in case the upload
+            is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         file = None
         style = self.html if parse_mode.lower() == "html" else self.markdown
@@ -119,7 +116,7 @@ class SendVoice(BaseClient):
             if os.path.exists(voice):
                 file = self.save_file(voice, progress=progress, progress_args=progress_args)
                 media = types.InputMediaUploadedDocument(
-                    mime_type="audio/mpeg",
+                    mime_type=self.guess_mime_type(voice) or "audio/mpeg",
                     file=file,
                     attributes=[
                         types.DocumentAttributeAudio(
@@ -133,28 +130,7 @@ class SendVoice(BaseClient):
                     url=voice
                 )
             else:
-                try:
-                    decoded = utils.decode(voice)
-                    fmt = " 24 else " bool:
-        """Use this method to close (stop) a poll.
+        message_id: int,
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
+    ) -> "pyrogram.Poll":
+        """Stop a poll which was sent by you.
 
-        Closed polls can't be reopened and nobody will be able to vote in it anymore.
+        Stopped polls can't be reopened and nobody will be able to vote in it anymore.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
                 For a contact that exists in your Telegram address book you can use his phone number (str).
 
             message_id (``int``):
-                Unique poll message identifier inside this chat.
+                Identifier of the original message with the poll.
+
+            reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
 
         Returns:
-            On success, True is returned.
+            :obj:`Poll`: On success, the stopped poll with the final results is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         poll = self.get_messages(chat_id, message_id).poll
 
-        self.send(
+        r = self.send(
             functions.messages.EditMessage(
                 peer=self.resolve_peer(chat_id),
                 id=message_id,
@@ -60,8 +65,9 @@ class ClosePoll(BaseClient):
                         question="",
                         answers=[]
                     )
-                )
+                ),
+                reply_markup=reply_markup.write() if reply_markup else None
             )
         )
 
-        return True
+        return pyrogram.Poll._parse(self, r.updates[0])
diff --git a/pyrogram/client/methods/messages/vote_poll.py b/pyrogram/client/methods/messages/vote_poll.py
index 2a9de874..a5d77d86 100644
--- a/pyrogram/client/methods/messages/vote_poll.py
+++ b/pyrogram/client/methods/messages/vote_poll.py
@@ -18,6 +18,7 @@
 
 from typing import Union
 
+import pyrogram
 from pyrogram.api import functions
 from pyrogram.client.ext import BaseClient
 
@@ -28,35 +29,36 @@ class VotePoll(BaseClient):
         chat_id: Union[int, str],
         message_id: id,
         option: int
-    ) -> bool:
-        """Use this method to vote a poll.
+    ) -> "pyrogram.Poll":
+        """Vote a poll.
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
                 For a contact that exists in your Telegram address book you can use his phone number (str).
 
             message_id (``int``):
-                Unique poll message identifier inside this chat.
+                Identifier of the original message with the poll.
 
             option (``int``):
                 Index of the poll option you want to vote for (0 to 9).
 
         Returns:
-            On success, True is returned.
+            :obj:`Poll` - On success, the poll with the chosen option is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
+
         poll = self.get_messages(chat_id, message_id).poll
 
-        self.send(
+        r = self.send(
             functions.messages.SendVote(
                 peer=self.resolve_peer(chat_id),
                 msg_id=message_id,
-                options=[poll.options[option].data]
+                options=[poll.options[option]._data]
             )
         )
 
-        return True
+        return pyrogram.Poll._parse(self, r.updates[0])
diff --git a/pyrogram/client/methods/password/change_cloud_password.py b/pyrogram/client/methods/password/change_cloud_password.py
index 2f8cfbd6..a33b83c7 100644
--- a/pyrogram/client/methods/password/change_cloud_password.py
+++ b/pyrogram/client/methods/password/change_cloud_password.py
@@ -30,9 +30,9 @@ class ChangeCloudPassword(BaseClient):
         new_password: str,
         new_hint: str = ""
     ) -> bool:
-        """Use this method to change your Two-Step Verification password (Cloud Password) with a new one.
+        """Change your Two-Step Verification password (Cloud Password) with a new one.
 
-        Args:
+        Parameters:
             current_password (``str``):
                 Your current password.
 
@@ -43,11 +43,11 @@ class ChangeCloudPassword(BaseClient):
                 A new password hint.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` in case there is no cloud password to change.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case there is no cloud password to change.
         """
         r = self.send(functions.account.GetPassword())
 
diff --git a/pyrogram/client/methods/password/enable_cloud_password.py b/pyrogram/client/methods/password/enable_cloud_password.py
index b29dcfd3..23ee1608 100644
--- a/pyrogram/client/methods/password/enable_cloud_password.py
+++ b/pyrogram/client/methods/password/enable_cloud_password.py
@@ -30,11 +30,11 @@ class EnableCloudPassword(BaseClient):
         hint: str = "",
         email: str = None
     ) -> bool:
-        """Use this method to enable the Two-Step Verification security feature (Cloud Password) on your account.
+        """Enable the Two-Step Verification security feature (Cloud Password) on your account.
 
         This password will be asked when you log-in on a new device in addition to the SMS code.
 
-        Args:
+        Parameters:
             password (``str``):
                 Your password.
 
@@ -45,11 +45,11 @@ class EnableCloudPassword(BaseClient):
                 Recovery e-mail.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` in case there is already a cloud password enabled.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case there is already a cloud password enabled.
         """
         r = self.send(functions.account.GetPassword())
 
diff --git a/pyrogram/client/methods/password/remove_cloud_password.py b/pyrogram/client/methods/password/remove_cloud_password.py
index 6e9a0ab4..9dcbb005 100644
--- a/pyrogram/client/methods/password/remove_cloud_password.py
+++ b/pyrogram/client/methods/password/remove_cloud_password.py
@@ -26,18 +26,18 @@ class RemoveCloudPassword(BaseClient):
         self,
         password: str
     ) -> bool:
-        """Use this method to turn off the Two-Step Verification security feature (Cloud Password) on your account.
+        """Turn off the Two-Step Verification security feature (Cloud Password) on your account.
 
-        Args:
+        Parameters:
             password (``str``):
                 Your current password.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` in case there is no cloud password to remove.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case there is no cloud password to remove.
         """
         r = self.send(functions.account.GetPassword())
 
diff --git a/pyrogram/client/methods/users/__init__.py b/pyrogram/client/methods/users/__init__.py
index f8c39650..20b50ce9 100644
--- a/pyrogram/client/methods/users/__init__.py
+++ b/pyrogram/client/methods/users/__init__.py
@@ -16,20 +16,26 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from .delete_user_profile_photos import DeleteUserProfilePhotos
+from .delete_profile_photos import DeleteProfilePhotos
 from .get_me import GetMe
-from .get_user_profile_photos import GetUserProfilePhotos
+from .get_profile_photos import GetProfilePhotos
+from .get_profile_photos_count import GetProfilePhotosCount
+from .get_user_dc import GetUserDC
 from .get_users import GetUsers
-from .set_user_profile_photo import SetUserProfilePhoto
+from .iter_profile_photos import IterProfilePhotos
+from .set_profile_photo import SetProfilePhoto
 from .update_username import UpdateUsername
 
 
 class Users(
-    GetUserProfilePhotos,
-    SetUserProfilePhoto,
-    DeleteUserProfilePhotos,
+    GetProfilePhotos,
+    SetProfilePhoto,
+    DeleteProfilePhotos,
     GetUsers,
     GetMe,
-    UpdateUsername
+    UpdateUsername,
+    GetProfilePhotosCount,
+    GetUserDC,
+    IterProfilePhotos
 ):
     pass
diff --git a/pyrogram/client/methods/users/delete_user_profile_photos.py b/pyrogram/client/methods/users/delete_profile_photos.py
similarity index 81%
rename from pyrogram/client/methods/users/delete_user_profile_photos.py
rename to pyrogram/client/methods/users/delete_profile_photos.py
index bd9fc98e..1b46382c 100644
--- a/pyrogram/client/methods/users/delete_user_profile_photos.py
+++ b/pyrogram/client/methods/users/delete_profile_photos.py
@@ -24,23 +24,23 @@ from pyrogram.api import functions, types
 from ...ext import BaseClient
 
 
-class DeleteUserProfilePhotos(BaseClient):
-    def delete_user_profile_photos(
+class DeleteProfilePhotos(BaseClient):
+    def delete_profile_photos(
         self,
         id: Union[str, List[str]]
     ) -> bool:
-        """Use this method to delete your own profile photos.
+        """Delete your own profile photos.
 
-        Args:
+        Parameters:
             id (``str`` | ``list``):
-                A single :obj:`Photo ` id as string or multiple ids as list of strings for deleting
+                A single :obj:`Photo` id as string or multiple ids as list of strings for deleting
                 more than one photos at once.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         id = id if isinstance(id, list) else [id]
         input_photos = []
diff --git a/pyrogram/client/methods/users/get_me.py b/pyrogram/client/methods/users/get_me.py
index c8b6c1f1..44f16af3 100644
--- a/pyrogram/client/methods/users/get_me.py
+++ b/pyrogram/client/methods/users/get_me.py
@@ -23,13 +23,13 @@ from ...ext import BaseClient
 
 class GetMe(BaseClient):
     def get_me(self) -> "pyrogram.User":
-        """A simple method for testing your authorization. Requires no parameters.
+        """Get your own user identity.
 
         Returns:
-            Basic information about the user or bot in form of a :obj:`User` object
+            :obj:`User`: Basic information about the user or bot.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         return pyrogram.User._parse(
             self,
diff --git a/pyrogram/client/methods/users/get_user_profile_photos.py b/pyrogram/client/methods/users/get_profile_photos.py
similarity index 54%
rename from pyrogram/client/methods/users/get_user_profile_photos.py
rename to pyrogram/client/methods/users/get_profile_photos.py
index ac7a872e..3ffeae39 100644
--- a/pyrogram/client/methods/users/get_user_profile_photos.py
+++ b/pyrogram/client/methods/users/get_profile_photos.py
@@ -16,24 +16,26 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from typing import Union
+from typing import Union, List
 
 import pyrogram
-from pyrogram.api import functions
+from pyrogram.api import functions, types
+from pyrogram.client.ext import utils
+
 from ...ext import BaseClient
 
 
-class GetUserProfilePhotos(BaseClient):
-    def get_user_profile_photos(
+class GetProfilePhotos(BaseClient):
+    def get_profile_photos(
         self,
-        user_id: Union[int, str],
+        chat_id: Union[int, str],
         offset: int = 0,
         limit: int = 100
-    ) -> "pyrogram.UserProfilePhotos":
-        """Use this method to get a list of profile pictures for a user.
+    ) -> List["pyrogram.Photo"]:
+        """Get a list of profile pictures for a user or a chat.
 
-        Args:
-            user_id (``int`` | ``str``):
+        Parameters:
+            chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
                 For a contact that exists in your Telegram address book you can use his phone number (str).
@@ -47,19 +49,42 @@ class GetUserProfilePhotos(BaseClient):
                 Values between 1—100 are accepted. Defaults to 100.
 
         Returns:
-            On success, a :obj:`UserProfilePhotos` object is returned.
+            List of :obj:`Photo`: On success, a list of profile photos is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
-        return pyrogram.UserProfilePhotos._parse(
-            self,
-            self.send(
+        peer_id = self.resolve_peer(chat_id)
+
+        if isinstance(peer_id, types.InputPeerChannel):
+            r = utils.parse_messages(
+                self,
+                self.send(
+                    functions.messages.Search(
+                        peer=peer_id,
+                        q="",
+                        filter=types.InputMessagesFilterChatPhotos(),
+                        min_date=0,
+                        max_date=0,
+                        offset_id=0,
+                        add_offset=offset,
+                        limit=limit,
+                        max_id=0,
+                        min_id=0,
+                        hash=0
+                    )
+                )
+            )
+
+            return pyrogram.List([message.new_chat_photo for message in r][:limit])
+        else:
+            r = self.send(
                 functions.photos.GetUserPhotos(
-                    user_id=self.resolve_peer(user_id),
+                    user_id=peer_id,
                     offset=offset,
                     max_id=0,
                     limit=limit
                 )
             )
-        )
+
+            return pyrogram.List(pyrogram.Photo._parse(self, photo) for photo in r.photos)
diff --git a/pyrogram/client/methods/users/get_profile_photos_count.py b/pyrogram/client/methods/users/get_profile_photos_count.py
new file mode 100644
index 00000000..bf00a10b
--- /dev/null
+++ b/pyrogram/client/methods/users/get_profile_photos_count.py
@@ -0,0 +1,67 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from typing import Union
+
+from pyrogram.api import functions, types
+
+from ...ext import BaseClient
+
+
+class GetProfilePhotosCount(BaseClient):
+    def get_profile_photos_count(self, chat_id: Union[int, str]) -> int:
+        """Get the total count of profile pictures for a user.
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+                For your personal cloud (Saved Messages) you can simply use "me" or "self".
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+        Returns:
+            ``int``: On success, the user profile photos count is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        peer_id = self.resolve_peer(chat_id)
+
+        if isinstance(peer_id, types.InputPeerChannel):
+            r = self.send(
+                functions.messages.GetSearchCounters(
+                    peer=peer_id,
+                    filters=[types.InputMessagesFilterChatPhotos()],
+                )
+            )
+
+            return r[0].count
+        else:
+            r = self.send(
+                functions.photos.GetUserPhotos(
+                    user_id=peer_id,
+                    offset=0,
+                    max_id=0,
+                    limit=1
+                )
+            )
+
+            if isinstance(r, types.photos.Photos):
+                return len(r.photos)
+            else:
+                return r.count
diff --git a/pyrogram/client/methods/users/get_user_dc.py b/pyrogram/client/methods/users/get_user_dc.py
new file mode 100644
index 00000000..75587884
--- /dev/null
+++ b/pyrogram/client/methods/users/get_user_dc.py
@@ -0,0 +1,58 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from typing import Union
+
+from pyrogram.api import functions, types
+from ...ext import BaseClient
+
+
+class GetUserDC(BaseClient):
+    def get_user_dc(self, user_id: Union[int, str]) -> Union[int, None]:
+        """Get the assigned DC (data center) of a user.
+
+        .. note::
+
+            This information is approximate: it is based on where Telegram stores a user profile pictures and does not
+            by any means tell you the user location (i.e. a user might travel far away, but will still connect to its
+            assigned DC). More info at `FAQs <../faq#what-are-the-ip-addresses-of-telegram-data-centers>`_.
+
+        Parameters:
+            user_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+                For your personal cloud (Saved Messages) you can simply use "me" or "self".
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+        Returns:
+            ``int`` | ``None``: The DC identifier as integer, or None in case it wasn't possible to get it (i.e. the
+            user has no profile picture or has the privacy setting enabled).
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        r = self.send(functions.users.GetUsers(id=[self.resolve_peer(user_id)]))
+
+        if r:
+            r = r[0]
+
+            if r.photo:
+                if isinstance(r.photo, types.UserProfilePhoto):
+                    return r.photo.dc_id
+
+        return None
diff --git a/pyrogram/client/methods/users/get_users.py b/pyrogram/client/methods/users/get_users.py
index 7e6ebd6b..f76e6802 100644
--- a/pyrogram/client/methods/users/get_users.py
+++ b/pyrogram/client/methods/users/get_users.py
@@ -24,26 +24,27 @@ from ...ext import BaseClient
 
 
 class GetUsers(BaseClient):
+    # TODO: Add Users type and use that
     def get_users(
         self,
-        user_ids: Iterable[Union[int, str]]
+        user_ids: Union[Iterable[Union[int, str]], int, str]
     ) -> Union["pyrogram.User", List["pyrogram.User"]]:
-        """Use this method to get information about a user.
+        """Get information about a user.
         You can retrieve up to 200 users at once.
 
-        Args:
+        Parameters:
             user_ids (``iterable``):
                 A list of User identifiers (id or username) or a single user id/username.
                 For a contact that exists in your Telegram address book you can use his phone number (str).
                 Iterators and Generators are also accepted.
 
         Returns:
-            On success and in case *user_ids* was an iterable, the returned value will be a list of the requested
-            :obj:`Users ` even if a list contains just one element, otherwise if
-            *user_ids* was an integer or string, the single requested :obj:`User` is returned.
+            :obj:`User` | List of :obj:`User`: In case *user_ids* was an integer or string the single requested user is
+            returned, otherwise, in case *user_ids* was an iterable a list of users is returned, even if the iterable
+            contained one item only.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         is_iterable = not isinstance(user_ids, (int, str))
         user_ids = list(user_ids) if is_iterable else [user_ids]
@@ -55,7 +56,7 @@ class GetUsers(BaseClient):
             )
         )
 
-        users = []
+        users = pyrogram.List()
 
         for i in r:
             users.append(pyrogram.User._parse(self, i))
diff --git a/pyrogram/client/methods/users/iter_profile_photos.py b/pyrogram/client/methods/users/iter_profile_photos.py
new file mode 100644
index 00000000..49317f87
--- /dev/null
+++ b/pyrogram/client/methods/users/iter_profile_photos.py
@@ -0,0 +1,79 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from typing import Union, Generator
+
+import pyrogram
+from ...ext import BaseClient
+
+
+class IterProfilePhotos(BaseClient):
+    def iter_profile_photos(
+        self,
+        chat_id: Union[int, str],
+        offset: int = 0,
+        limit: int = 0,
+    ) -> Generator["pyrogram.Photo", None, None]:
+        """Iterate through a chat or a user profile photos sequentially.
+
+        This convenience method does the same as repeatedly calling :meth:`~Client.get_profile_photos` in a loop, thus
+        saving you from the hassle of setting up boilerplate code. It is useful for getting all the profile photos with
+        a single call.
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+                For your personal cloud (Saved Messages) you can simply use "me" or "self".
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            limit (``int``, *optional*):
+                Limits the number of profile photos to be retrieved.
+                By default, no limit is applied and all profile photos are returned.
+
+            offset (``int``, *optional*):
+                Sequential number of the first profile photo to be returned.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`Photo` objects.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        current = 0
+        total = limit or (1 << 31)
+        limit = min(100, total)
+
+        while True:
+            photos = self.get_profile_photos(
+                chat_id=chat_id,
+                offset=offset,
+                limit=limit
+            )
+
+            if not photos:
+                return
+
+            offset += len(photos)
+
+            for photo in photos:
+                yield photo
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/client/methods/users/set_user_profile_photo.py b/pyrogram/client/methods/users/set_profile_photo.py
similarity index 84%
rename from pyrogram/client/methods/users/set_user_profile_photo.py
rename to pyrogram/client/methods/users/set_profile_photo.py
index af02a12d..a713fd34 100644
--- a/pyrogram/client/methods/users/set_user_profile_photo.py
+++ b/pyrogram/client/methods/users/set_profile_photo.py
@@ -20,26 +20,26 @@ from pyrogram.api import functions
 from ...ext import BaseClient
 
 
-class SetUserProfilePhoto(BaseClient):
-    def set_user_profile_photo(
+class SetProfilePhoto(BaseClient):
+    def set_profile_photo(
         self,
         photo: str
     ) -> bool:
-        """Use this method to set a new profile photo.
+        """Set a new profile photo.
 
         This method only works for Users.
         Bots profile photos must be set using BotFather.
 
-        Args:
+        Parameters:
             photo (``str``):
                 Profile photo to set.
                 Pass a file path as string to upload a new photo that exists on your local machine.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
 
         return bool(
diff --git a/pyrogram/client/methods/users/update_username.py b/pyrogram/client/methods/users/update_username.py
index d0c87eb2..002dbf75 100644
--- a/pyrogram/client/methods/users/update_username.py
+++ b/pyrogram/client/methods/users/update_username.py
@@ -27,21 +27,21 @@ class UpdateUsername(BaseClient):
         self,
         username: Union[str, None]
     ) -> bool:
-        """Use this method to update your own username.
+        """Update your own username.
         
         This method only works for users, not bots. Bot usernames must be changed via Bot Support or by recreating
         them from scratch using BotFather. To update a channel or supergroup username you can use
-        :meth:`update_chat_username`.
+        :meth:`~Client.update_chat_username`.
 
-        Args:
+        Parameters:
             username (``str`` | ``None``):
-                Username to set. "" (empty string) or None to remove the username.
+                Username to set. "" (empty string) or None to remove it.
 
         Returns:
-            True on success.
+            ``bool``: True on success.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
 
         return bool(
diff --git a/pyrogram/client/types/__init__.py b/pyrogram/client/types/__init__.py
index 120c7ff5..8fa55482 100644
--- a/pyrogram/client/types/__init__.py
+++ b/pyrogram/client/types/__init__.py
@@ -16,10 +16,12 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from .bots import *
+from .bots_and_keyboards import *
 from .inline_mode import *
 from .input_media import *
 from .input_message_content import *
+from .list import List
 from .messages_and_media import *
+from .object import Object
 from .update import *
 from .user_and_chats import *
diff --git a/pyrogram/client/types/bots/callback_query.py b/pyrogram/client/types/bots/callback_query.py
deleted file mode 100644
index 4497747e..00000000
--- a/pyrogram/client/types/bots/callback_query.py
+++ /dev/null
@@ -1,165 +0,0 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017-2019 Dan Tès 
-#
-# 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 .
-
-from base64 import b64encode
-from struct import pack
-
-import pyrogram
-from pyrogram.api import types
-from ..pyrogram_type import PyrogramType
-from ..update import Update
-from ..user_and_chats import User
-
-
-class CallbackQuery(PyrogramType, Update):
-    """This object represents an incoming callback query from a callback button in an inline keyboard.
-    If the button that originated the query was attached to a message sent by the bot, the field message
-    will be present. If the button was attached to a message sent via the bot (in inline mode),
-    the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
-
-    Args:
-        id (``str``):
-            Unique identifier for this query.
-
-        from_user (:obj:`User `):
-            Sender.
-
-        chat_instance (``str``, *optional*):
-            Global identifier, uniquely corresponding to the chat to which the message with the callback button was
-            sent. Useful for high scores in games.
-
-        message (:obj:`Message `, *optional*):
-            Message with the callback button that originated the query. Note that message content and message date will
-            not be available if the message is too old.
-
-        inline_message_id (``str``):
-            Identifier of the message sent via the bot in inline mode, that originated the query.
-
-        data (``bytes``, *optional*):
-            Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
-
-        game_short_name (``str``, *optional*):
-            Short name of a Game to be returned, serves as the unique identifier for the game.
-
-    """
-
-    __slots__ = ["id", "from_user", "chat_instance", "message", "inline_message_id", "data", "game_short_name"]
-
-    def __init__(
-        self,
-        *,
-        client: "pyrogram.client.ext.BaseClient",
-        id: str,
-        from_user: User,
-        chat_instance: str,
-        message: "pyrogram.Message" = None,
-        inline_message_id: str = None,
-        data: bytes = None,
-        game_short_name: str = None
-    ):
-        super().__init__(client)
-
-        self.id = id
-        self.from_user = from_user
-        self.chat_instance = chat_instance
-        self.message = message
-        self.inline_message_id = inline_message_id
-        self.data = data
-        self.game_short_name = game_short_name
-
-    @staticmethod
-    def _parse(client, callback_query, users) -> "CallbackQuery":
-        message = None
-        inline_message_id = None
-
-        if isinstance(callback_query, types.UpdateBotCallbackQuery):
-            peer = callback_query.peer
-
-            if isinstance(peer, types.PeerUser):
-                peer_id = peer.user_id
-            elif isinstance(peer, types.PeerChat):
-                peer_id = -peer.chat_id
-            else:
-                peer_id = int("-100" + str(peer.channel_id))
-
-            message = client.get_messages(peer_id, callback_query.msg_id)
-        elif isinstance(callback_query, types.UpdateInlineBotCallbackQuery):
-            inline_message_id = b64encode(
-                pack(
-                    "`.
-
-        Use this method as a shortcut for:
-
-        .. code-block:: python
-
-            client.answer_callback_query(
-                callback_query.id,
-                text="Hello",
-                show_alert=True
-            )
-
-        Example:
-            .. code-block:: python
-
-                callback_query.answer("Hello", show_alert=True)
-
-        Args:
-            text (``str``):
-                Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters.
-
-            show_alert (``bool``):
-                If true, an alert will be shown by the client instead of a notification at the top of the chat screen.
-                Defaults to False.
-
-            url (``str``):
-                URL that will be opened by the user's client.
-                If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your
-                game – note that this will only work if the query comes from a callback_game button.
-                Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
-
-            cache_time (``int``):
-                The maximum amount of time in seconds that the result of the callback query may be cached client-side.
-                Telegram apps will support caching starting in version 3.14. Defaults to 0.
-        """
-        return self._client.answer_callback_query(
-            callback_query_id=self.id,
-            text=text,
-            show_alert=show_alert,
-            url=url,
-            cache_time=cache_time
-        )
diff --git a/pyrogram/client/types/bots/game_high_scores.py b/pyrogram/client/types/bots/game_high_scores.py
deleted file mode 100644
index 3c197969..00000000
--- a/pyrogram/client/types/bots/game_high_scores.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017-2019 Dan Tès 
-#
-# 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 .
-
-from typing import List
-
-import pyrogram
-from pyrogram.api import types
-from pyrogram.client.types.pyrogram_type import PyrogramType
-from .game_high_score import GameHighScore
-
-
-class GameHighScores(PyrogramType):
-    """This object represents the high scores table for a game.
-
-    Args:
-        total_count (``int``):
-            Total number of scores the target game has.
-
-        game_high_scores (List of :obj:`GameHighScore `):
-            Game scores.
-    """
-
-    __slots__ = ["total_count", "game_high_scores"]
-
-    def __init__(
-        self,
-        *,
-        client: "pyrogram.client.ext.BaseClient",
-        total_count: int,
-        game_high_scores: List[GameHighScore]
-    ):
-        super().__init__(client)
-
-        self.total_count = total_count
-        self.game_high_scores = game_high_scores
-
-    @staticmethod
-    def _parse(client, game_high_scores: types.messages.HighScores) -> "GameHighScores":
-        return GameHighScores(
-            total_count=len(game_high_scores.scores),
-            game_high_scores=[
-                GameHighScore._parse(client, score, game_high_scores.users)
-                for score in game_high_scores.scores],
-            client=client
-        )
diff --git a/pyrogram/client/types/bots/__init__.py b/pyrogram/client/types/bots_and_keyboards/__init__.py
similarity index 87%
rename from pyrogram/client/types/bots/__init__.py
rename to pyrogram/client/types/bots_and_keyboards/__init__.py
index dae33e10..90376504 100644
--- a/pyrogram/client/types/bots/__init__.py
+++ b/pyrogram/client/types/bots_and_keyboards/__init__.py
@@ -20,7 +20,6 @@ from .callback_game import CallbackGame
 from .callback_query import CallbackQuery
 from .force_reply import ForceReply
 from .game_high_score import GameHighScore
-from .game_high_scores import GameHighScores
 from .inline_keyboard_button import InlineKeyboardButton
 from .inline_keyboard_markup import InlineKeyboardMarkup
 from .keyboard_button import KeyboardButton
@@ -28,6 +27,6 @@ from .reply_keyboard_markup import ReplyKeyboardMarkup
 from .reply_keyboard_remove import ReplyKeyboardRemove
 
 __all__ = [
-    "CallbackGame", "CallbackQuery", "ForceReply", "GameHighScore", "GameHighScores", "InlineKeyboardButton",
-    "InlineKeyboardMarkup", "KeyboardButton", "ReplyKeyboardMarkup", "ReplyKeyboardRemove"
+    "CallbackGame", "CallbackQuery", "ForceReply", "GameHighScore", "InlineKeyboardButton", "InlineKeyboardMarkup",
+    "KeyboardButton", "ReplyKeyboardMarkup", "ReplyKeyboardRemove"
 ]
diff --git a/pyrogram/client/types/bots/callback_game.py b/pyrogram/client/types/bots_and_keyboards/callback_game.py
similarity index 84%
rename from pyrogram/client/types/bots/callback_game.py
rename to pyrogram/client/types/bots_and_keyboards/callback_game.py
index fc2d9884..acf6df60 100644
--- a/pyrogram/client/types/bots/callback_game.py
+++ b/pyrogram/client/types/bots_and_keyboards/callback_game.py
@@ -16,11 +16,11 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class CallbackGame(PyrogramType):
-    """A placeholder, currently holds no information.
+class CallbackGame(Object):
+    """Placeholder, currently holds no information.
 
     Use BotFather to set up your game.
     """
@@ -28,4 +28,4 @@ class CallbackGame(PyrogramType):
     __slots__ = []
 
     def __init__(self):
-        super().__init__(None)
+        super().__init__()
diff --git a/pyrogram/client/types/bots_and_keyboards/callback_query.py b/pyrogram/client/types/bots_and_keyboards/callback_query.py
new file mode 100644
index 00000000..fcc90e57
--- /dev/null
+++ b/pyrogram/client/types/bots_and_keyboards/callback_query.py
@@ -0,0 +1,322 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from base64 import b64encode
+from struct import pack
+from typing import Union
+
+import pyrogram
+from pyrogram.api import types
+from ..object import Object
+from ..update import Update
+from ..user_and_chats import User
+
+
+class CallbackQuery(Object, Update):
+    """An incoming callback query from a callback button in an inline keyboard.
+
+    If the button that originated the query was attached to a message sent by the bot, the field *message*
+    will be present. If the button was attached to a message sent via the bot (in inline mode), the field
+    *inline_message_id* will be present. Exactly one of the fields *data* or *game_short_name* will be present.
+
+    Parameters:
+        id (``str``):
+            Unique identifier for this query.
+
+        from_user (:obj:`User`):
+            Sender.
+
+        chat_instance (``str``, *optional*):
+            Global identifier, uniquely corresponding to the chat to which the message with the callback button was
+            sent. Useful for high scores in games.
+
+        message (:obj:`Message`, *optional*):
+            Message with the callback button that originated the query. Note that message content and message date will
+            not be available if the message is too old.
+
+        inline_message_id (``str``):
+            Identifier of the message sent via the bot in inline mode, that originated the query.
+
+        data (``str`` | ``bytes``, *optional*):
+            Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
+
+        game_short_name (``str``, *optional*):
+            Short name of a Game to be returned, serves as the unique identifier for the game.
+
+    """
+
+    __slots__ = ["id", "from_user", "chat_instance", "message", "inline_message_id", "data", "game_short_name"]
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.BaseClient" = None,
+        id: str,
+        from_user: User,
+        chat_instance: str,
+        message: "pyrogram.Message" = None,
+        inline_message_id: str = None,
+        data: Union[str, bytes] = None,
+        game_short_name: str = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.from_user = from_user
+        self.chat_instance = chat_instance
+        self.message = message
+        self.inline_message_id = inline_message_id
+        self.data = data
+        self.game_short_name = game_short_name
+
+    @staticmethod
+    def _parse(client, callback_query, users) -> "CallbackQuery":
+        message = None
+        inline_message_id = None
+
+        if isinstance(callback_query, types.UpdateBotCallbackQuery):
+            peer = callback_query.peer
+
+            if isinstance(peer, types.PeerUser):
+                peer_id = peer.user_id
+            elif isinstance(peer, types.PeerChat):
+                peer_id = -peer.chat_id
+            else:
+                peer_id = int("-100" + str(peer.channel_id))
+
+            message = client.get_messages(peer_id, callback_query.msg_id)
+        elif isinstance(callback_query, types.UpdateInlineBotCallbackQuery):
+            inline_message_id = b64encode(
+                pack(
+                    " Union["pyrogram.Message", bool]:
+        """Edit the text of messages attached to this callback query.
+
+        Bound method *edit_message_text* of :obj:`CallbackQuery`.
+
+        Parameters:
+            text (``str``):
+                New text of the message.
+
+            parse_mode (``str``, *optional*):
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
+
+            disable_web_page_preview (``bool``, *optional*):
+                Disables link previews for links in this message.
+
+            reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            :obj:`Message` | ``bool``: On success, if the edited message was sent by the bot, the edited message is
+            returned, otherwise True is returned (message sent via the bot, as inline query result).
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if self.inline_message_id is None:
+            return self._client.edit_message_text(
+                chat_id=self.message.chat.id,
+                message_id=self.message.message_id,
+                text=text,
+                parse_mode=parse_mode,
+                disable_web_page_preview=disable_web_page_preview,
+                reply_markup=reply_markup
+            )
+        else:
+            return self._client.edit_inline_text(
+                inline_message_id=self.inline_message_id,
+                text=text,
+                parse_mode=parse_mode,
+                disable_web_page_preview=disable_web_page_preview,
+                reply_markup=reply_markup
+            )
+
+    def edit_caption(
+        self,
+        caption: str,
+        parse_mode: str = "",
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
+    ) -> Union["pyrogram.Message", bool]:
+        """Edit the caption of media messages attached to this callback query.
+
+        Bound method *edit_message_caption* of :obj:`CallbackQuery`.
+
+        Parameters:
+            caption (``str``):
+                New caption of the message.
+
+            parse_mode (``str``, *optional*):
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
+
+            reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            :obj:`Message` | ``bool``: On success, if the edited message was sent by the bot, the edited message is
+            returned, otherwise True is returned (message sent via the bot, as inline query result).
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return self.edit_text(caption, parse_mode, reply_markup)
+
+    def edit_media(
+        self,
+        media: "pyrogram.InputMedia",
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
+    ) -> Union["pyrogram.Message", bool]:
+        """Edit animation, audio, document, photo or video messages attached to this callback query.
+
+        Bound method *edit_message_media* of :obj:`CallbackQuery`.
+
+        Parameters:
+            media (:obj:`InputMedia`):
+                One of the InputMedia objects describing an animation, audio, document, photo or video.
+
+            reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            :obj:`Message` | ``bool``: On success, if the edited message was sent by the bot, the edited message is
+            returned, otherwise True is returned (message sent via the bot, as inline query result).
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if self.inline_message_id is None:
+            return self._client.edit_message_media(
+                chat_id=self.message.chat.id,
+                message_id=self.message.message_id,
+                media=media,
+                reply_markup=reply_markup
+            )
+        else:
+            return self._client.edit_inline_media(
+                inline_message_id=self.inline_message_id,
+                media=media,
+                reply_markup=reply_markup
+            )
+
+    def edit_reply_markup(
+        self,
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
+    ) -> Union["pyrogram.Message", bool]:
+        """Edit only the reply markup of messages attached to this callback query.
+
+        Bound method *edit_message_reply_markup* of :obj:`CallbackQuery`.
+
+        Parameters:
+            reply_markup (:obj:`InlineKeyboardMarkup`):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            :obj:`Message` | ``bool``: On success, if the edited message was sent by the bot, the edited message is
+            returned, otherwise True is returned (message sent via the bot, as inline query result).
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if self.inline_message_id is None:
+            return self._client.edit_message_reply_markup(
+                chat_id=self.message.chat.id,
+                message_id=self.message.message_id,
+                reply_markup=reply_markup
+            )
+        else:
+            return self._client.edit_inline_reply_markup(
+                inline_message_id=self.inline_message_id,
+                reply_markup=reply_markup
+            )
diff --git a/pyrogram/client/types/bots/force_reply.py b/pyrogram/client/types/bots_and_keyboards/force_reply.py
similarity index 86%
rename from pyrogram/client/types/bots/force_reply.py
rename to pyrogram/client/types/bots_and_keyboards/force_reply.py
index 12969742..6c542aa8 100644
--- a/pyrogram/client/types/bots/force_reply.py
+++ b/pyrogram/client/types/bots_and_keyboards/force_reply.py
@@ -17,17 +17,20 @@
 # along with Pyrogram.  If not, see .
 
 from pyrogram.api.types import ReplyKeyboardForceReply
-from ..pyrogram_type import PyrogramType
+
+from ..object import Object
 
 
-class ForceReply(PyrogramType):
-    """Upon receiving a message with this object, Telegram clients will display a reply interface to the user.
+class ForceReply(Object):
+    """Object used to force clients to show a reply interface.
+
+    Upon receiving a message with this object, Telegram clients will display a reply interface to the user.
 
     This acts as if the user has selected the bot's message and tapped "Reply".
     This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to
     sacrifice privacy mode.
 
-    Args:
+    Parameters:
         selective (``bool``, *optional*):
             Use this parameter if you want to force reply from specific users only. Targets:
             1) users that are @mentioned in the text of the Message object;
@@ -40,7 +43,7 @@ class ForceReply(PyrogramType):
         self,
         selective: bool = None
     ):
-        super().__init__(None)
+        super().__init__()
 
         self.selective = selective
 
diff --git a/pyrogram/client/types/bots/game_high_score.py b/pyrogram/client/types/bots_and_keyboards/game_high_score.py
similarity index 89%
rename from pyrogram/client/types/bots/game_high_score.py
rename to pyrogram/client/types/bots_and_keyboards/game_high_score.py
index da6b2881..5d576ad4 100644
--- a/pyrogram/client/types/bots/game_high_score.py
+++ b/pyrogram/client/types/bots_and_keyboards/game_high_score.py
@@ -19,14 +19,14 @@
 import pyrogram
 
 from pyrogram.api import types
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 from pyrogram.client.types.user_and_chats import User
 
 
-class GameHighScore(PyrogramType):
-    """This object represents one row of the high scores table for a game.
+class GameHighScore(Object):
+    """One row of the high scores table for a game.
 
-    Args:
+    Parameters:
         user (:obj:`User`):
             User.
 
@@ -42,7 +42,7 @@ class GameHighScore(PyrogramType):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         user: User,
         score: int,
         position: int = None
diff --git a/pyrogram/client/types/bots/inline_keyboard_button.py b/pyrogram/client/types/bots_and_keyboards/inline_keyboard_button.py
similarity index 82%
rename from pyrogram/client/types/bots/inline_keyboard_button.py
rename to pyrogram/client/types/bots_and_keyboards/inline_keyboard_button.py
index c0c3eb8c..54aa7802 100644
--- a/pyrogram/client/types/bots/inline_keyboard_button.py
+++ b/pyrogram/client/types/bots_and_keyboards/inline_keyboard_button.py
@@ -16,22 +16,26 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
+from typing import Union
+
 from pyrogram.api.types import (
     KeyboardButtonUrl, KeyboardButtonCallback,
     KeyboardButtonSwitchInline, KeyboardButtonGame
 )
 from .callback_game import CallbackGame
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class InlineKeyboardButton(PyrogramType):
-    """This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
+class InlineKeyboardButton(Object):
+    """One button of an inline keyboard.
 
-    Args:
+    You must use exactly one of the optional fields.
+
+    Parameters:
         text (``str``):
             Label text on the button.
 
-        callback_data (``bytes``, *optional*):
+        callback_data (``str`` | ``bytes``, *optional*):
             Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes.
 
         url (``str``, *optional*):
@@ -61,13 +65,13 @@ class InlineKeyboardButton(PyrogramType):
     def __init__(
         self,
         text: str,
-        callback_data: bytes = None,
+        callback_data: Union[str, bytes] = None,
         url: str = None,
         switch_inline_query: str = None,
         switch_inline_query_current_chat: str = None,
         callback_game: CallbackGame = None
     ):
-        super().__init__(None)
+        super().__init__()
 
         self.text = str(text)
         self.url = url
@@ -86,9 +90,16 @@ class InlineKeyboardButton(PyrogramType):
             )
 
         if isinstance(o, KeyboardButtonCallback):
+            # Try decode data to keep it as string, but if fails, fallback to bytes so we don't lose any information,
+            # instead of decoding by ignoring/replacing errors.
+            try:
+                data = o.data.decode()
+            except UnicodeDecodeError:
+                data = o.data
+
             return InlineKeyboardButton(
                 text=o.text,
-                callback_data=o.data
+                callback_data=data
             )
 
         if isinstance(o, KeyboardButtonSwitchInline):
@@ -111,7 +122,9 @@ class InlineKeyboardButton(PyrogramType):
 
     def write(self):
         if self.callback_data is not None:
-            return KeyboardButtonCallback(text=self.text, data=self.callback_data)
+            # Telegram only wants bytes, but we are allowed to pass strings too, for convenience.
+            data = bytes(self.callback_data, "utf-8") if isinstance(self.callback_data, str) else self.callback_data
+            return KeyboardButtonCallback(text=self.text, data=data)
 
         if self.url is not None:
             return KeyboardButtonUrl(text=self.text, url=self.url)
diff --git a/pyrogram/client/types/bots/inline_keyboard_markup.py b/pyrogram/client/types/bots_and_keyboards/inline_keyboard_markup.py
similarity index 87%
rename from pyrogram/client/types/bots/inline_keyboard_markup.py
rename to pyrogram/client/types/bots_and_keyboards/inline_keyboard_markup.py
index 54476c5e..7b811f88 100644
--- a/pyrogram/client/types/bots/inline_keyboard_markup.py
+++ b/pyrogram/client/types/bots_and_keyboards/inline_keyboard_markup.py
@@ -20,14 +20,14 @@ from typing import List
 
 from pyrogram.api.types import ReplyInlineMarkup, KeyboardButtonRow
 from . import InlineKeyboardButton
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class InlineKeyboardMarkup(PyrogramType):
-    """This object represents an inline keyboard that appears right next to the message it belongs to.
+class InlineKeyboardMarkup(Object):
+    """An inline keyboard that appears right next to the message it belongs to.
 
-    Args:
-        inline_keyboard (List of List of :obj:`InlineKeyboardButton `):
+    Parameters:
+        inline_keyboard (List of List of :obj:`InlineKeyboardButton`):
             List of button rows, each represented by a List of InlineKeyboardButton objects.
     """
 
@@ -37,7 +37,7 @@ class InlineKeyboardMarkup(PyrogramType):
         self,
         inline_keyboard: List[List[InlineKeyboardButton]]
     ):
-        super().__init__(None)
+        super().__init__()
 
         self.inline_keyboard = inline_keyboard
 
diff --git a/pyrogram/client/types/bots/keyboard_button.py b/pyrogram/client/types/bots_and_keyboards/keyboard_button.py
similarity index 93%
rename from pyrogram/client/types/bots/keyboard_button.py
rename to pyrogram/client/types/bots_and_keyboards/keyboard_button.py
index 477442cc..8374db1b 100644
--- a/pyrogram/client/types/bots/keyboard_button.py
+++ b/pyrogram/client/types/bots_and_keyboards/keyboard_button.py
@@ -18,15 +18,16 @@
 
 from pyrogram.api.types import KeyboardButton as RawKeyboardButton
 from pyrogram.api.types import KeyboardButtonRequestPhone, KeyboardButtonRequestGeoLocation
-from ..pyrogram_type import PyrogramType
+
+from ..object import Object
 
 
-class KeyboardButton(PyrogramType):
-    """This object represents one button of the reply keyboard.
+class KeyboardButton(Object):
+    """One button of the reply keyboard.
     For simple text buttons String can be used instead of this object to specify text of the button.
     Optional fields are mutually exclusive.
 
-    Args:
+    Parameters:
         text (``str``):
             Text of the button. If none of the optional fields are used, it will be sent as a message when
             the button is pressed.
@@ -48,7 +49,7 @@ class KeyboardButton(PyrogramType):
         request_contact: bool = None,
         request_location: bool = None
     ):
-        super().__init__(None)
+        super().__init__()
 
         self.text = str(text)
         self.request_contact = request_contact
diff --git a/pyrogram/client/types/bots/reply_keyboard_markup.py b/pyrogram/client/types/bots_and_keyboards/reply_keyboard_markup.py
similarity index 93%
rename from pyrogram/client/types/bots/reply_keyboard_markup.py
rename to pyrogram/client/types/bots_and_keyboards/reply_keyboard_markup.py
index b0216803..4e666d1f 100644
--- a/pyrogram/client/types/bots/reply_keyboard_markup.py
+++ b/pyrogram/client/types/bots_and_keyboards/reply_keyboard_markup.py
@@ -21,14 +21,14 @@ from typing import List, Union
 from pyrogram.api.types import KeyboardButtonRow
 from pyrogram.api.types import ReplyKeyboardMarkup as RawReplyKeyboardMarkup
 from . import KeyboardButton
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class ReplyKeyboardMarkup(PyrogramType):
-    """This object represents a custom keyboard with reply options.
+class ReplyKeyboardMarkup(Object):
+    """A custom keyboard with reply options.
 
-    Args:
-        keyboard (List of List of :obj:`KeyboardButton `):
+    Parameters:
+        keyboard (List of List of :obj:`KeyboardButton`):
             List of button rows, each represented by a List of KeyboardButton objects.
 
         resize_keyboard (``bool``, *optional*):
@@ -58,7 +58,7 @@ class ReplyKeyboardMarkup(PyrogramType):
         one_time_keyboard: bool = None,
         selective: bool = None
     ):
-        super().__init__(None)
+        super().__init__()
 
         self.keyboard = keyboard
         self.resize_keyboard = resize_keyboard
diff --git a/pyrogram/client/types/bots/reply_keyboard_remove.py b/pyrogram/client/types/bots_and_keyboards/reply_keyboard_remove.py
similarity index 76%
rename from pyrogram/client/types/bots/reply_keyboard_remove.py
rename to pyrogram/client/types/bots_and_keyboards/reply_keyboard_remove.py
index 75f2a7b5..d451a8e8 100644
--- a/pyrogram/client/types/bots/reply_keyboard_remove.py
+++ b/pyrogram/client/types/bots_and_keyboards/reply_keyboard_remove.py
@@ -17,15 +17,19 @@
 # along with Pyrogram.  If not, see .
 
 from pyrogram.api.types import ReplyKeyboardHide
-from ..pyrogram_type import PyrogramType
+
+from ..object import Object
 
 
-class ReplyKeyboardRemove(PyrogramType):
-    """Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard.
-    By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time
-    keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
+class ReplyKeyboardRemove(Object):
+    """Object used to tell clients to remove a bot keyboard.
 
-    Args:
+    Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display
+    the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot.
+    An exception is made for one-time keyboards that are hidden immediately after the user presses a button
+    (see ReplyKeyboardMarkup).
+
+    Parameters:
         selective (``bool``, *optional*):
             Use this parameter if you want to remove the keyboard for specific users only. Targets:
             1) users that are @mentioned in the text of the Message object;
@@ -40,7 +44,7 @@ class ReplyKeyboardRemove(PyrogramType):
         self,
         selective: bool = None
     ):
-        super().__init__(None)
+        super().__init__()
 
         self.selective = selective
 
diff --git a/pyrogram/client/types/inline_mode/inline_query.py b/pyrogram/client/types/inline_mode/inline_query.py
index 9c1c02ac..6bfc58c3 100644
--- a/pyrogram/client/types/inline_mode/inline_query.py
+++ b/pyrogram/client/types/inline_mode/inline_query.py
@@ -22,20 +22,21 @@ import pyrogram
 from pyrogram.api import types
 from .inline_query_result import InlineQueryResult
 from ..messages_and_media import Location
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 from ..update import Update
 from ..user_and_chats import User
 
 
-class InlineQuery(PyrogramType, Update):
-    """This object represents an incoming inline query.
+class InlineQuery(Object, Update):
+    """An incoming inline query.
+
     When the user sends an empty query, your bot could return some default or trending results.
 
-    Args:
+    Parameters:
         id (``str``):
             Unique identifier for this query.
 
-        from_user (:obj:`User `):
+        from_user (:obj:`User`):
             Sender.
 
         query (``str``):
@@ -44,7 +45,7 @@ class InlineQuery(PyrogramType, Update):
         offset (``str``):
             Offset of the results to be returned, can be controlled by the bot.
 
-        location (:obj:`Location `. *optional*):
+        location (:obj:`Location`. *optional*):
             Sender location, only for bots that request user location.
     """
     __slots__ = ["id", "from_user", "query", "offset", "location"]
@@ -52,7 +53,7 @@ class InlineQuery(PyrogramType, Update):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         id: str,
         from_user: User,
         query: str,
@@ -61,7 +62,6 @@ class InlineQuery(PyrogramType, Update):
     ):
         super().__init__(client)
 
-        self._client = client
         self.id = id
         self.from_user = from_user
         self.query = query
@@ -92,7 +92,7 @@ class InlineQuery(PyrogramType, Update):
         switch_pm_text: str = "",
         switch_pm_parameter: str = ""
     ):
-        """Bound method *answer* of :obj:`InlineQuery `.
+        """Bound method *answer* of :obj:`InlineQuery`.
 
         Use this method as a shortcut for:
 
@@ -108,8 +108,8 @@ class InlineQuery(PyrogramType, Update):
 
                 inline_query.answer([...])
 
-        Args:
-            results (List of :obj:`InlineQueryResult `):
+        Parameters:
+            results (List of :obj:`InlineQueryResult`):
                 A list of results for the inline query.
 
             cache_time (``int``, *optional*):
diff --git a/pyrogram/client/types/inline_mode/inline_query_result.py b/pyrogram/client/types/inline_mode/inline_query_result.py
index 3e7fcb02..3fc70885 100644
--- a/pyrogram/client/types/inline_mode/inline_query_result.py
+++ b/pyrogram/client/types/inline_mode/inline_query_result.py
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 """- :obj:`InlineQueryResultCachedAudio`
     - :obj:`InlineQueryResultCachedDocument`
@@ -39,10 +39,10 @@ from ..pyrogram_type import PyrogramType
     - :obj:`InlineQueryResultVoice`"""
 
 
-class InlineQueryResult(PyrogramType):
-    """This object represents one result of an inline query.
+class InlineQueryResult(Object):
+    """One result of an inline query.
 
-    Pyrogram currently supports results of the following 20 types:
+    Pyrogram currently supports results of the following types:
 
     - :obj:`InlineQueryResultArticle`
     """
@@ -50,7 +50,7 @@ class InlineQueryResult(PyrogramType):
     __slots__ = ["type", "id"]
 
     def __init__(self, type: str, id: str):
-        super().__init__(None)
+        super().__init__()
 
         self.type = type
         self.id = id
diff --git a/pyrogram/client/types/inline_mode/inline_query_result_article.py b/pyrogram/client/types/inline_mode/inline_query_result_article.py
index 8d0089c3..ad0be9e4 100644
--- a/pyrogram/client/types/inline_mode/inline_query_result_article.py
+++ b/pyrogram/client/types/inline_mode/inline_query_result_article.py
@@ -23,21 +23,21 @@ from .inline_query_result import InlineQueryResult
 
 
 class InlineQueryResultArticle(InlineQueryResult):
-    """Represents a link to an article or web page.
+    """Link to an article or web page.
 
     TODO: Hide url?
 
-    Args:
+    Parameters:
         id (``str``):
             Unique identifier for this result, 1-64 bytes.
 
         title (``str``):
             Title for the result.
 
-        input_message_content (:obj:`InputMessageContent `):
+        input_message_content (:obj:`InputMessageContent`):
             Content of the message to be sent.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, *optional*):
+        reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
             Inline keyboard attached to the message.
 
         url (``str``, *optional*):
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_audio.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_audio.py
index a67163c6..d5fb954a 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_audio.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_audio.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultAudio(PyrogramType):
+class InlineQueryResultAudio(Object):
     """Represents a link to an mp3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
 
     Attributes:
         ID: ``0xb0700004``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be audio.
 
@@ -50,15 +50,16 @@ class InlineQueryResultAudio(PyrogramType):
         audio_duration (``int`` ``32-bit``, optional):
             Audio duration in seconds.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the audio.
 
     """
 
-    def __init__(self, type: str, id: str, audio_url: str, title: str, caption: str = None, parse_mode: str = None, performer: str = None, audio_duration: int = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, audio_url: str, title: str, caption: str = None, parse_mode: str = None,
+                 performer: str = None, audio_duration: int = None, reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.audio_url = audio_url  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_audio.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_audio.py
index f6ed1f15..47b9bbe2 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_audio.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_audio.py
@@ -20,18 +20,18 @@ import binascii
 import struct
 
 from pyrogram.api import types
-from pyrogram.errors import FileIdInvalid
 from pyrogram.client.ext import utils, BaseClient
 from pyrogram.client.style import HTML, Markdown
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
+from pyrogram.errors import FileIdInvalid
 
 
-class InlineQueryResultCachedAudio(PyrogramType):
+class InlineQueryResultCachedAudio(Object):
     """Represents a link to an audio file stored on the Telegram servers.
     By default, this audio file will be sent by the user. Alternatively, you can use *input_message_content* to send a
     message with the specified content instead of the audio.
 
-    Args:
+    Parameters:
         id (``str``):
             Unique identifier for this result, 1-64 bytes.
 
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_document.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_document.py
index ab1637d2..d3b3d0dc 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_document.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_document.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultCachedDocument(PyrogramType):
+class InlineQueryResultCachedDocument(Object):
     """Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
 
     Attributes:
         ID: ``0xb0700015``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be document.
 
@@ -47,16 +47,17 @@ class InlineQueryResultCachedDocument(PyrogramType):
         parse_mode (``str``, optional):
             Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the file.
 
     """
     ID = 0xb0700015
 
-    def __init__(self, type: str, id: str, title: str, document_file_id: str, description: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, title: str, document_file_id: str, description: str = None,
+                 caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.title = title  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_gif.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_gif.py
index 4c457873..28a3595b 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_gif.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_gif.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultCachedGif(PyrogramType):
+class InlineQueryResultCachedGif(Object):
     """Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
 
     Attributes:
         ID: ``0xb0700012``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be gif.
 
@@ -44,16 +44,17 @@ class InlineQueryResultCachedGif(PyrogramType):
         parse_mode (``str``, optional):
             Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the GIF animation.
 
     """
     ID = 0xb0700012
 
-    def __init__(self, type: str, id: str, gif_file_id: str, title: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, gif_file_id: str, title: str = None, caption: str = None,
+                 parse_mode: str = None, reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.gif_file_id = gif_file_id  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_mpeg4_gif.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_mpeg4_gif.py
index 93ec1efb..95ab03a0 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_mpeg4_gif.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_mpeg4_gif.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultCachedMpeg4Gif(PyrogramType):
+class InlineQueryResultCachedMpeg4Gif(Object):
     """Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
 
     Attributes:
         ID: ``0xb0700013``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be mpeg4_gif.
 
@@ -47,13 +47,14 @@ class InlineQueryResultCachedMpeg4Gif(PyrogramType):
         reply_markup (:obj:`InlineKeyboardMarkup `, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the video animation.
 
     """
     ID = 0xb0700013
 
-    def __init__(self, type: str, id: str, mpeg4_file_id: str, title: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, mpeg4_file_id: str, title: str = None, caption: str = None,
+                 parse_mode: str = None, reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.mpeg4_file_id = mpeg4_file_id  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_photo.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_photo.py
index ee6b2654..22793cef 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_photo.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_photo.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultCachedPhoto(PyrogramType):
+class InlineQueryResultCachedPhoto(Object):
     """Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
 
     Attributes:
         ID: ``0xb0700011``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be photo.
 
@@ -56,7 +56,8 @@ class InlineQueryResultCachedPhoto(PyrogramType):
     """
     ID = 0xb0700011
 
-    def __init__(self, type: str, id: str, photo_file_id: str, title: str = None, description: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, photo_file_id: str, title: str = None, description: str = None,
+                 caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.photo_file_id = photo_file_id  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_sticker.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_sticker.py
index 6142b1fa..6b2b37c9 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_sticker.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_sticker.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultCachedSticker(PyrogramType):
+class InlineQueryResultCachedSticker(Object):
     """Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
 
     Attributes:
         ID: ``0xb0700014``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be sticker.
 
@@ -35,10 +35,10 @@ class InlineQueryResultCachedSticker(PyrogramType):
         sticker_file_id (``str``):
             A valid file identifier of the sticker.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the sticker.
 
     """
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_video.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_video.py
index 8c00c61a..77dcd6dd 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_video.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_video.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultCachedVideo(PyrogramType):
+class InlineQueryResultCachedVideo(Object):
     """Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
 
     Attributes:
         ID: ``0xb0700016``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be video.
 
@@ -56,7 +56,8 @@ class InlineQueryResultCachedVideo(PyrogramType):
     """
     ID = 0xb0700016
 
-    def __init__(self, type: str, id: str, video_file_id: str, title: str, description: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, video_file_id: str, title: str, description: str = None, caption: str = None,
+                 parse_mode: str = None, reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.video_file_id = video_file_id  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_voice.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_voice.py
index 741df389..a80d5a20 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_voice.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_voice.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultCachedVoice(PyrogramType):
+class InlineQueryResultCachedVoice(Object):
     """Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
 
     Attributes:
         ID: ``0xb0700017``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be voice.
 
@@ -44,16 +44,17 @@ class InlineQueryResultCachedVoice(PyrogramType):
         parse_mode (``str``, optional):
             Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the voice message.
 
     """
     ID = 0xb0700017
 
-    def __init__(self, type: str, id: str, voice_file_id: str, title: str, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, voice_file_id: str, title: str, caption: str = None, parse_mode: str = None,
+                 reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.voice_file_id = voice_file_id  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_contact.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_contact.py
index e26af4ea..afddb9ec 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_contact.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_contact.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultContact(PyrogramType):
+class InlineQueryResultContact(Object):
     """Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
 
     Attributes:
         ID: ``0xb0700009``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be contact.
 
@@ -62,7 +62,9 @@ class InlineQueryResultContact(PyrogramType):
     """
     ID = 0xb0700009
 
-    def __init__(self, type: str, id: str, phone_number: str, first_name: str, last_name: str = None, vcard: str = None, reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
+    def __init__(self, type: str, id: str, phone_number: str, first_name: str, last_name: str = None, vcard: str = None,
+                 reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None,
+                 thumb_height: int = None):
         self.type = type  # string
         self.id = id  # string
         self.phone_number = phone_number  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_document.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_document.py
index 93b8fcae..370dc3c6 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_document.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_document.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultDocument(PyrogramType):
+class InlineQueryResultDocument(Object):
     """Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
 
     Attributes:
         ID: ``0xb0700006``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be document.
 
@@ -50,10 +50,10 @@ class InlineQueryResultDocument(PyrogramType):
         description (``str``, optional):
             Short description of the result.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the file.
 
         thumb_url (``str``, optional):
@@ -68,7 +68,9 @@ class InlineQueryResultDocument(PyrogramType):
     """
     ID = 0xb0700006
 
-    def __init__(self, type: str, id: str, title: str, document_url: str, mime_type: str, caption: str = None, parse_mode: str = None, description: str = None, reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
+    def __init__(self, type: str, id: str, title: str, document_url: str, mime_type: str, caption: str = None,
+                 parse_mode: str = None, description: str = None, reply_markup=None, input_message_content=None,
+                 thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
         self.type = type  # string
         self.id = id  # string
         self.title = title  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_game.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_game.py
index 3e7cfb73..bd6f25d2 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_game.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_game.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultGame(PyrogramType):
+class InlineQueryResultGame(Object):
     """Represents a Game.
 
     Attributes:
         ID: ``0xb0700010``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be game.
 
@@ -35,7 +35,7 @@ class InlineQueryResultGame(PyrogramType):
         game_short_name (``str``):
             Short name of the game.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
     """
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_gif.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_gif.py
index 13f4fc18..56817d76 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_gif.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_gif.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultGif(PyrogramType):
+class InlineQueryResultGif(Object):
     """Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
 
     Attributes:
         ID: ``0xb0700001``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be gif.
 
@@ -65,7 +65,9 @@ class InlineQueryResultGif(PyrogramType):
     """
     ID = 0xb0700001
 
-    def __init__(self, type: str, id: str, gif_url: str, thumb_url: str, gif_width: int = None, gif_height: int = None, gif_duration: int = None, title: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, gif_url: str, thumb_url: str, gif_width: int = None, gif_height: int = None,
+                 gif_duration: int = None, title: str = None, caption: str = None, parse_mode: str = None,
+                 reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.gif_url = gif_url  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_location.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_location.py
index 176591d2..74c63ede 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_location.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_location.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultLocation(PyrogramType):
+class InlineQueryResultLocation(Object):
     """Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
 
     Attributes:
         ID: ``0xb0700007``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be location.
 
@@ -62,7 +62,9 @@ class InlineQueryResultLocation(PyrogramType):
     """
     ID = 0xb0700007
 
-    def __init__(self, type: str, id: str, latitude: float, longitude: float, title: str, live_period: int = None, reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
+    def __init__(self, type: str, id: str, latitude: float, longitude: float, title: str, live_period: int = None,
+                 reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None,
+                 thumb_height: int = None):
         self.type = type  # string
         self.id = id  # string
         self.latitude = latitude  # double
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_mpeg4_gif.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_mpeg4_gif.py
index 37aa8986..e4da6b89 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_mpeg4_gif.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_mpeg4_gif.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultMpeg4Gif(PyrogramType):
+class InlineQueryResultMpeg4Gif(Object):
     """Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
 
     Attributes:
         ID: ``0xb0700002``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be mpeg4_gif.
 
@@ -65,7 +65,9 @@ class InlineQueryResultMpeg4Gif(PyrogramType):
     """
     ID = 0xb0700002
 
-    def __init__(self, type: str, id: str, mpeg4_url: str, thumb_url: str, mpeg4_width: int = None, mpeg4_height: int = None, mpeg4_duration: int = None, title: str = None, caption: str = None, parse_mode: str = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, mpeg4_url: str, thumb_url: str, mpeg4_width: int = None,
+                 mpeg4_height: int = None, mpeg4_duration: int = None, title: str = None, caption: str = None,
+                 parse_mode: str = None, reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.mpeg4_url = mpeg4_url  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_photo.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_photo.py
index 2ba7c312..570bd55d 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_photo.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_photo.py
@@ -18,14 +18,14 @@
 
 from pyrogram.api import types
 from pyrogram.client.style import HTML, Markdown
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultPhoto(PyrogramType):
+class InlineQueryResultPhoto(Object):
     """Represents a link to a photo. By default, this photo will be sent by the user with optional caption.
     Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
 
-    Args:
+    Parameters:
         id (``str``):
             Unique identifier for this result, 1-64 bytes.
 
@@ -54,27 +54,27 @@ class InlineQueryResultPhoto(PyrogramType):
             Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
             the media caption.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, *optional*):
+        reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, *optional*):
+        input_message_content (:obj:`InputMessageContent`, *optional*):
             Content of the message to be sent instead of the photo.
 
     """
 
     def __init__(
-            self,
-            id: str,
-            photo_url: str,
-            thumb_url: str,
-            photo_width: int = 0,
-            photo_height: int = 0,
-            title: str = None,
-            description: str = None,
-            caption: str = "",
-            parse_mode: str = "",
-            reply_markup=None,
-            input_message_content=None
+        self,
+        id: str,
+        photo_url: str,
+        thumb_url: str,
+        photo_width: int = 0,
+        photo_height: int = 0,
+        title: str = None,
+        description: str = None,
+        caption: str = "",
+        parse_mode: str = "",
+        reply_markup=None,
+        input_message_content=None
     ):
         self.id = id  # string
         self.photo_url = photo_url  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_venue.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_venue.py
index 23ddfc35..29eb86a6 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_venue.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_venue.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultVenue(PyrogramType):
+class InlineQueryResultVenue(Object):
     """Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
 
     Attributes:
         ID: ``0xb0700008``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be venue.
 
@@ -50,10 +50,10 @@ class InlineQueryResultVenue(PyrogramType):
         foursquare_type (``str``, optional):
             Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".).
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the venue.
 
         thumb_url (``str``, optional):
@@ -68,7 +68,9 @@ class InlineQueryResultVenue(PyrogramType):
     """
     ID = 0xb0700008
 
-    def __init__(self, type: str, id: str, latitude: float, longitude: float, title: str, address: str, foursquare_id: str = None, foursquare_type: str = None, reply_markup=None, input_message_content=None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
+    def __init__(self, type: str, id: str, latitude: float, longitude: float, title: str, address: str,
+                 foursquare_id: str = None, foursquare_type: str = None, reply_markup=None, input_message_content=None,
+                 thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
         self.type = type  # string
         self.id = id  # string
         self.latitude = latitude  # double
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_video.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_video.py
index 9b1723e1..61984d48 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_video.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_video.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultVideo(PyrogramType):
+class InlineQueryResultVideo(Object):
     """Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
 
     Attributes:
         ID: ``0xb0700003``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be video.
 
@@ -62,16 +62,18 @@ class InlineQueryResultVideo(PyrogramType):
         description (``str``, optional):
             Short description of the result.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).
 
     """
     ID = 0xb0700003
 
-    def __init__(self, type: str, id: str, video_url: str, mime_type: str, thumb_url: str, title: str, caption: str = None, parse_mode: str = None, video_width: int = None, video_height: int = None, video_duration: int = None, description: str = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, video_url: str, mime_type: str, thumb_url: str, title: str,
+                 caption: str = None, parse_mode: str = None, video_width: int = None, video_height: int = None,
+                 video_duration: int = None, description: str = None, reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.video_url = video_url  # string
diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_voice.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_voice.py
index 188063ec..7a5f3cd1 100644
--- a/pyrogram/client/types/inline_mode/todo/inline_query_result_voice.py
+++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_voice.py
@@ -16,16 +16,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.client.types.pyrogram_type import PyrogramType
+from pyrogram.client.types.object import Object
 
 
-class InlineQueryResultVoice(PyrogramType):
+class InlineQueryResultVoice(Object):
     """Represents a link to a voice recording in an .ogg container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
 
     Attributes:
         ID: ``0xb0700005``
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the result, must be voice.
 
@@ -47,16 +47,17 @@ class InlineQueryResultVoice(PyrogramType):
         voice_duration (``int`` ``32-bit``, optional):
             Recording duration in seconds.
 
-        reply_markup (:obj:`InlineKeyboardMarkup `, optional):
+        reply_markup (:obj:`InlineKeyboardMarkup`, optional):
             Inline keyboard attached to the message.
 
-        input_message_content (:obj:`InputMessageContent `, optional):
+        input_message_content (:obj:`InputMessageContent`, optional):
             Content of the message to be sent instead of the voice recording.
 
     """
     ID = 0xb0700005
 
-    def __init__(self, type: str, id: str, voice_url: str, title: str, caption: str = None, parse_mode: str = None, voice_duration: int = None, reply_markup=None, input_message_content=None):
+    def __init__(self, type: str, id: str, voice_url: str, title: str, caption: str = None, parse_mode: str = None,
+                 voice_duration: int = None, reply_markup=None, input_message_content=None):
         self.type = type  # string
         self.id = id  # string
         self.voice_url = voice_url  # string
diff --git a/pyrogram/client/types/input_media/input_media.py b/pyrogram/client/types/input_media/input_media.py
index 3062f136..2b5d7f0f 100644
--- a/pyrogram/client/types/input_media/input_media.py
+++ b/pyrogram/client/types/input_media/input_media.py
@@ -16,22 +16,24 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class InputMedia(PyrogramType):
-    """This object represents the content of a media message to be sent. It should be one of:
+class InputMedia(Object):
+    """Content of a media message to be sent.
 
-    - :obj:`InputMediaAnimation `
-    - :obj:`InputMediaDocument `
-    - :obj:`InputMediaAudio `
-    - :obj:`InputMediaPhoto `
-    - :obj:`InputMediaVideo `
+    It should be one of:
+
+    - :obj:`InputMediaAnimation`
+    - :obj:`InputMediaDocument`
+    - :obj:`InputMediaAudio`
+    - :obj:`InputMediaPhoto`
+    - :obj:`InputMediaVideo`
     """
     __slots__ = ["media", "caption", "parse_mode"]
 
     def __init__(self, media: str, caption: str, parse_mode: str):
-        super().__init__(None)
+        super().__init__()
 
         self.media = media
         self.caption = caption
diff --git a/pyrogram/client/types/input_media/input_media_animation.py b/pyrogram/client/types/input_media/input_media_animation.py
index e77499b5..23fcb967 100644
--- a/pyrogram/client/types/input_media/input_media_animation.py
+++ b/pyrogram/client/types/input_media/input_media_animation.py
@@ -20,9 +20,9 @@ from . import InputMedia
 
 
 class InputMediaAnimation(InputMedia):
-    """This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
+    """An animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent inside an album.
 
-    Args:
+    Parameters:
         media (``str``):
             Animation to send.
             Pass a file_id as string to send a file that exists on the Telegram servers or
@@ -31,16 +31,15 @@ class InputMediaAnimation(InputMedia):
         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.
+            A thumbnail's width and height should not exceed 320 pixels.
             Thumbnails can't be reused and can be only uploaded as a new file.
 
         caption (``str``, *optional*):
             Caption of the animation to be sent, 0-1024 characters
 
         parse_mode (``str``, *optional*):
-            Use :obj:`MARKDOWN ` or :obj:`HTML `
-            if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-            Defaults to Markdown.
+            Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs
+            in your caption. Defaults to "markdown".
 
         width (``int``, *optional*):
             Animation width.
diff --git a/pyrogram/client/types/input_media/input_media_audio.py b/pyrogram/client/types/input_media/input_media_audio.py
index e8f1c257..3fb45d8f 100644
--- a/pyrogram/client/types/input_media/input_media_audio.py
+++ b/pyrogram/client/types/input_media/input_media_audio.py
@@ -20,10 +20,11 @@ from . import InputMedia
 
 
 class InputMediaAudio(InputMedia):
-    """This object represents an audio to be sent inside an album.
+    """An audio to be sent inside an album.
+
     It is intended to be used with :obj:`send_media_group() `.
 
-    Args:
+    Parameters:
         media (``str``):
             Audio to send.
             Pass a file_id as string to send an audio that exists on the Telegram servers or
@@ -32,16 +33,15 @@ class InputMediaAudio(InputMedia):
         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.
+            A thumbnail's width and height should not exceed 320 pixels.
             Thumbnails can't be reused and can be only uploaded as a new file.
 
         caption (``str``, *optional*):
             Caption of the audio to be sent, 0-1024 characters
 
         parse_mode (``str``, *optional*):
-            Use :obj:`MARKDOWN ` or :obj:`HTML `
-            if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-            Defaults to Markdown.
+            Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs
+            in your caption. Defaults to "markdown".
 
         duration (``int``, *optional*):
             Duration of the audio in seconds
diff --git a/pyrogram/client/types/input_media/input_media_document.py b/pyrogram/client/types/input_media/input_media_document.py
index 9391e7d8..0de8dedf 100644
--- a/pyrogram/client/types/input_media/input_media_document.py
+++ b/pyrogram/client/types/input_media/input_media_document.py
@@ -20,9 +20,9 @@ from . import InputMedia
 
 
 class InputMediaDocument(InputMedia):
-    """This object represents a general file to be sent.
+    """A generic file to be sent inside an album.
 
-    Args:
+    Parameters:
         media (``str``):
             File to send.
             Pass a file_id as string to send a file that exists on the Telegram servers or
@@ -31,16 +31,15 @@ class InputMediaDocument(InputMedia):
         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.
+            A thumbnail's width and height should not exceed 320 pixels.
             Thumbnails can't be reused and can be only uploaded as a new file.
 
         caption (``str``, *optional*):
             Caption of the document to be sent, 0-1024 characters
 
         parse_mode (``str``, *optional*):
-            Use :obj:`MARKDOWN ` or :obj:`HTML `
-            if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-            Defaults to Markdown.
+            Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs
+            in your caption. Defaults to "markdown".
     """
 
     __slots__ = ["thumb"]
diff --git a/pyrogram/client/types/input_media/input_media_photo.py b/pyrogram/client/types/input_media/input_media_photo.py
index e6bba03b..ce134af2 100644
--- a/pyrogram/client/types/input_media/input_media_photo.py
+++ b/pyrogram/client/types/input_media/input_media_photo.py
@@ -20,10 +20,10 @@ from . import InputMedia
 
 
 class InputMediaPhoto(InputMedia):
-    """This object represents a photo to be sent inside an album.
+    """A photo to be sent inside an album.
     It is intended to be used with :obj:`send_media_group() `.
 
-    Args:
+    Parameters:
         media (``str``):
             Photo to send.
             Pass a file_id as string to send a photo that exists on the Telegram servers or
@@ -34,9 +34,8 @@ class InputMediaPhoto(InputMedia):
             Caption of the photo to be sent, 0-1024 characters
 
         parse_mode (``str``, *optional*):
-            Use :obj:`MARKDOWN ` or :obj:`HTML `
-            if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-            Defaults to Markdown.
+            Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs
+            in your caption. Defaults to "markdown".
     """
 
     __slots__ = []
diff --git a/pyrogram/client/types/input_media/input_media_video.py b/pyrogram/client/types/input_media/input_media_video.py
index 5c918f13..9764dd1a 100644
--- a/pyrogram/client/types/input_media/input_media_video.py
+++ b/pyrogram/client/types/input_media/input_media_video.py
@@ -20,10 +20,10 @@ from . import InputMedia
 
 
 class InputMediaVideo(InputMedia):
-    """This object represents a video to be sent inside an album.
+    """A video to be sent inside an album.
     It is intended to be used with :obj:`send_media_group() `.
 
-    Args:
+    Parameters:
         media (``str``):
             Video to send.
             Pass a file_id as string to send a video that exists on the Telegram servers or
@@ -33,16 +33,15 @@ class InputMediaVideo(InputMedia):
         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.
+            A thumbnail's width and height should not exceed 320 pixels.
             Thumbnails can't be reused and can be only uploaded as a new file.
 
         caption (``str``, *optional*):
             Caption of the video to be sent, 0-1024 characters
 
         parse_mode (``str``, *optional*):
-            Use :obj:`MARKDOWN ` or :obj:`HTML `
-            if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-            Defaults to Markdown.
+            Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs
+            in your caption. Defaults to "markdown".
 
         width (``int``, *optional*):
             Video width.
diff --git a/pyrogram/client/types/input_media/input_phone_contact.py b/pyrogram/client/types/input_media/input_phone_contact.py
index d2ac8012..9c03694d 100644
--- a/pyrogram/client/types/input_media/input_phone_contact.py
+++ b/pyrogram/client/types/input_media/input_phone_contact.py
@@ -17,15 +17,16 @@
 # along with Pyrogram.  If not, see .
 
 from pyrogram.api.types import InputPhoneContact as RawInputPhoneContact
+
 from pyrogram.session.internals import MsgId
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class InputPhoneContact(PyrogramType):
-    """This object represents a Phone Contact to be added in your Telegram address book.
-    It is intended to be used with :meth:`add_contacts() `
+class InputPhoneContact(Object):
+    """A Phone Contact to be added in your Telegram address book.
+    It is intended to be used with :meth:`~pyrogram.Client.add_contacts()`
 
-    Args:
+    Parameters:
         phone (``str``):
             Contact's phone number
 
diff --git a/pyrogram/client/types/input_message_content/input_message_content.py b/pyrogram/client/types/input_message_content/input_message_content.py
index f3e238b8..fe11ef7a 100644
--- a/pyrogram/client/types/input_message_content/input_message_content.py
+++ b/pyrogram/client/types/input_message_content/input_message_content.py
@@ -16,17 +16,17 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 """- :obj:`InputLocationMessageContent`
     - :obj:`InputVenueMessageContent`
     - :obj:`InputContactMessageContent`"""
 
 
-class InputMessageContent(PyrogramType):
-    """This object represents the content of a message to be sent as a result of an inline query.
+class InputMessageContent(Object):
+    """Content of a message to be sent as a result of an inline query.
 
-    Pyrogram currently supports the following 4 types:
+    Pyrogram currently supports the following types:
 
     - :obj:`InputTextMessageContent`
     """
@@ -34,4 +34,4 @@ class InputMessageContent(PyrogramType):
     __slots__ = []
 
     def __init__(self):
-        super().__init__(None)
+        super().__init__()
diff --git a/pyrogram/client/types/input_message_content/input_text_message_content.py b/pyrogram/client/types/input_message_content/input_text_message_content.py
index 0e6ffa8b..4b294aab 100644
--- a/pyrogram/client/types/input_message_content/input_text_message_content.py
+++ b/pyrogram/client/types/input_message_content/input_text_message_content.py
@@ -22,16 +22,15 @@ from ...style import HTML, Markdown
 
 
 class InputTextMessageContent(InputMessageContent):
-    """This object represents the content of a text message to be sent as the result of an inline query.
+    """Content of a text message to be sent as the result of an inline query.
 
-    Args:
+    Parameters:
         message_text (``str``):
             Text of the message to be sent, 1-4096 characters.
 
         parse_mode (``str``, *optional*):
-            Use :obj:`MARKDOWN ` or :obj:`HTML `
-            if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message.
-            Defaults to Markdown.
+            Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs
+            in your message. Defaults to "markdown".
 
         disable_web_page_preview (``bool``, *optional*):
             Disables link previews for links in this message.
diff --git a/pyrogram/client/types/list.py b/pyrogram/client/types/list.py
new file mode 100644
index 00000000..cec2d8a2
--- /dev/null
+++ b/pyrogram/client/types/list.py
@@ -0,0 +1,32 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from .object import Object
+
+
+class List(list):
+    __slots__ = []
+
+    def __str__(self):
+        # noinspection PyCallByClass
+        return Object.__str__(self)
+
+    def __repr__(self):
+        return "pyrogram.client.types.pyrogram_list.PyrogramList([{}])".format(
+            ",".join(Object.__repr__(i) for i in self)
+        )
diff --git a/pyrogram/client/types/messages_and_media/__init__.py b/pyrogram/client/types/messages_and_media/__init__.py
index ae4386d0..b9bcb460 100644
--- a/pyrogram/client/types/messages_and_media/__init__.py
+++ b/pyrogram/client/types/messages_and_media/__init__.py
@@ -24,19 +24,18 @@ from .game import Game
 from .location import Location
 from .message import Message
 from .message_entity import MessageEntity
-from .messages import Messages
 from .photo import Photo
-from .photo_size import PhotoSize
 from .poll import Poll
 from .poll_option import PollOption
 from .sticker import Sticker
-from .user_profile_photos import UserProfilePhotos
+from .stripped_thumbnail import StrippedThumbnail
+from .thumbnail import Thumbnail
 from .venue import Venue
 from .video import Video
 from .video_note import VideoNote
 from .voice import Voice
 
 __all__ = [
-    "Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Messages", "Photo",
-    "PhotoSize", "Poll", "PollOption", "Sticker", "UserProfilePhotos", "Venue", "Video", "VideoNote", "Voice"
+    "Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Photo", "Thumbnail",
+    "StrippedThumbnail", "Poll", "PollOption", "Sticker", "Venue", "Video", "VideoNote", "Voice"
 ]
diff --git a/pyrogram/client/types/messages_and_media/animation.py b/pyrogram/client/types/messages_and_media/animation.py
index 21a01e0f..5441a114 100644
--- a/pyrogram/client/types/messages_and_media/animation.py
+++ b/pyrogram/client/types/messages_and_media/animation.py
@@ -17,18 +17,19 @@
 # along with Pyrogram.  If not, see .
 
 from struct import pack
+from typing import List
 
 import pyrogram
 from pyrogram.api import types
-from .photo_size import PhotoSize
-from ..pyrogram_type import PyrogramType
+from .thumbnail import Thumbnail
+from ..object import Object
 from ...ext.utils import encode
 
 
-class Animation(PyrogramType):
-    """This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
+class Animation(Object):
+    """An animation file (GIF or H.264/MPEG-4 AVC video without sound).
 
-    Args:
+    Parameters:
         file_id (``str``):
             Unique identifier for this file.
 
@@ -41,9 +42,6 @@ class Animation(PyrogramType):
         duration (``int``):
             Duration of the animation in seconds as defined by sender.
 
-        thumb (:obj:`PhotoSize `, *optional*):
-            Animation thumbnail.
-
         file_name (``str``, *optional*):
             Animation file name.
 
@@ -55,28 +53,30 @@ class Animation(PyrogramType):
 
         date (``int``, *optional*):
             Date the animation was sent in Unix time.
+
+        thumbs (List of :obj:`Thumbnail`, *optional*):
+            Animation thumbnails.
     """
 
-    __slots__ = ["file_id", "thumb", "file_name", "mime_type", "file_size", "date", "width", "height", "duration"]
+    __slots__ = ["file_id", "file_name", "mime_type", "file_size", "date", "width", "height", "duration", "thumbs"]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         file_id: str,
         width: int,
         height: int,
         duration: int,
-        thumb: PhotoSize = None,
         file_name: str = None,
         mime_type: str = None,
         file_size: int = None,
-        date: int = None
+        date: int = None,
+        thumbs: List[Thumbnail] = None
     ):
         super().__init__(client)
 
         self.file_id = file_id
-        self.thumb = thumb
         self.file_name = file_name
         self.mime_type = mime_type
         self.file_size = file_size
@@ -84,10 +84,15 @@ class Animation(PyrogramType):
         self.width = width
         self.height = height
         self.duration = duration
+        self.thumbs = thumbs
 
     @staticmethod
-    def _parse(client, animation: types.Document, video_attributes: types.DocumentAttributeVideo,
-               file_name: str) -> "Animation":
+    def _parse(
+        client,
+        animation: types.Document,
+        video_attributes: types.DocumentAttributeVideo,
+        file_name: str
+    ) -> "Animation":
         return Animation(
             file_id=encode(
                 pack(
@@ -101,10 +106,10 @@ class Animation(PyrogramType):
             width=getattr(video_attributes, "w", 0),
             height=getattr(video_attributes, "h", 0),
             duration=getattr(video_attributes, "duration", 0),
-            thumb=PhotoSize._parse(client, animation.thumbs),
             mime_type=animation.mime_type,
             file_size=animation.size,
             file_name=file_name,
             date=animation.date,
+            thumbs=Thumbnail._parse(client, animation),
             client=client
         )
diff --git a/pyrogram/client/types/messages_and_media/audio.py b/pyrogram/client/types/messages_and_media/audio.py
index db49f2eb..3d9cf8a6 100644
--- a/pyrogram/client/types/messages_and_media/audio.py
+++ b/pyrogram/client/types/messages_and_media/audio.py
@@ -17,27 +17,25 @@
 # along with Pyrogram.  If not, see .
 
 from struct import pack
+from typing import List
 
 import pyrogram
 from pyrogram.api import types
-from .photo_size import PhotoSize
-from ..pyrogram_type import PyrogramType
+from .thumbnail import Thumbnail
+from ..object import Object
 from ...ext.utils import encode
 
 
-class Audio(PyrogramType):
-    """This object represents an audio file to be treated as music by the Telegram clients.
+class Audio(Object):
+    """An audio file to be treated as music by the Telegram clients.
 
-    Args:
+    Parameters:
         file_id (``str``):
             Unique identifier for this file.
 
         duration (``int``):
             Duration of the audio in seconds as defined by sender.
 
-        thumb (:obj:`PhotoSize `, *optional*):
-            Thumbnail of the music file album cover.
-
         file_name (``str``, *optional*):
             Audio file name.
 
@@ -55,28 +53,32 @@ class Audio(PyrogramType):
 
         title (``str``, *optional*):
             Title of the audio as defined by sender or by audio tags.
+
+        thumbs (List of :obj:`Thumbnail`, *optional*):
+            Thumbnails of the music file album cover.
     """
 
-    __slots__ = ["file_id", "thumb", "file_name", "mime_type", "file_size", "date", "duration", "performer", "title"]
+    __slots__ = [
+        "file_id", "file_name", "mime_type", "file_size", "date", "duration", "performer", "title", "thumbs"
+    ]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         file_id: str,
         duration: int,
-        thumb: PhotoSize = None,
         file_name: str = None,
         mime_type: str = None,
         file_size: int = None,
         date: int = None,
         performer: str = None,
-        title: str = None
+        title: str = None,
+        thumbs: List[Thumbnail] = None
     ):
         super().__init__(client)
 
         self.file_id = file_id
-        self.thumb = thumb
         self.file_name = file_name
         self.mime_type = mime_type
         self.file_size = file_size
@@ -84,10 +86,15 @@ class Audio(PyrogramType):
         self.duration = duration
         self.performer = performer
         self.title = title
+        self.thumbs = thumbs
 
     @staticmethod
-    def _parse(client, audio: types.Document, audio_attributes: types.DocumentAttributeAudio,
-               file_name: str) -> "Audio":
+    def _parse(
+        client,
+        audio: types.Document,
+        audio_attributes: types.DocumentAttributeAudio,
+        file_name: str
+    ) -> "Audio":
         return Audio(
             file_id=encode(
                 pack(
@@ -103,8 +110,8 @@ class Audio(PyrogramType):
             title=audio_attributes.title,
             mime_type=audio.mime_type,
             file_size=audio.size,
-            thumb=PhotoSize._parse(client, audio.thumbs),
             file_name=file_name,
             date=audio.date,
+            thumbs=Thumbnail._parse(client, audio),
             client=client
         )
diff --git a/pyrogram/client/types/messages_and_media/contact.py b/pyrogram/client/types/messages_and_media/contact.py
index 5abe5319..d18f5e18 100644
--- a/pyrogram/client/types/messages_and_media/contact.py
+++ b/pyrogram/client/types/messages_and_media/contact.py
@@ -19,13 +19,13 @@
 import pyrogram
 
 from pyrogram.api import types
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class Contact(PyrogramType):
-    """This object represents a phone contact.
+class Contact(Object):
+    """A phone contact.
 
-    Args:
+    Parameters:
         phone_number (``str``):
             Contact's phone number.
 
@@ -47,7 +47,7 @@ class Contact(PyrogramType):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         phone_number: str,
         first_name: str,
         last_name: str = None,
diff --git a/pyrogram/client/types/messages_and_media/document.py b/pyrogram/client/types/messages_and_media/document.py
index f3ccc4f8..45994e16 100644
--- a/pyrogram/client/types/messages_and_media/document.py
+++ b/pyrogram/client/types/messages_and_media/document.py
@@ -17,24 +17,22 @@
 # along with Pyrogram.  If not, see .
 
 from struct import pack
+from typing import List
 
 import pyrogram
 from pyrogram.api import types
-from .photo_size import PhotoSize
-from ..pyrogram_type import PyrogramType
+from .thumbnail import Thumbnail
+from ..object import Object
 from ...ext.utils import encode
 
 
-class Document(PyrogramType):
-    """This object represents a general file (as opposed to photos, voice messages, audio files, ...).
+class Document(Object):
+    """A generic file (as opposed to photos, voice messages, audio files, ...).
 
-    Args:
+    Parameters:
         file_id (``str``):
             Unique file identifier.
 
-        thumb (:obj:`PhotoSize `, *optional*):
-            Document thumbnail as defined by sender.
-
         file_name (``str``, *optional*):
             Original filename as defined by sender.
 
@@ -46,29 +44,32 @@ class Document(PyrogramType):
 
         date (``int``, *optional*):
             Date the document was sent in Unix time.
+
+        thumbs (List of :obj:`Thumbnail`, *optional*):
+            Document thumbnails as defined by sender.
     """
 
-    __slots__ = ["file_id", "thumb", "file_name", "mime_type", "file_size", "date"]
+    __slots__ = ["file_id", "file_name", "mime_type", "file_size", "date", "thumbs"]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         file_id: str,
-        thumb: PhotoSize = None,
         file_name: str = None,
         mime_type: str = None,
         file_size: int = None,
-        date: int = None
+        date: int = None,
+        thumbs: List[Thumbnail] = None
     ):
         super().__init__(client)
 
         self.file_id = file_id
-        self.thumb = thumb
         self.file_name = file_name
         self.mime_type = mime_type
         self.file_size = file_size
         self.date = date
+        self.thumbs = thumbs
 
     @staticmethod
     def _parse(client, document: types.Document, file_name: str) -> "Document":
@@ -82,10 +83,10 @@ class Document(PyrogramType):
                     document.access_hash
                 )
             ),
-            thumb=PhotoSize._parse(client, document.thumbs),
             file_name=file_name,
             mime_type=document.mime_type,
             file_size=document.size,
             date=document.date,
+            thumbs=Thumbnail._parse(client, document),
             client=client
         )
diff --git a/pyrogram/client/types/messages_and_media/game.py b/pyrogram/client/types/messages_and_media/game.py
index cf0b4fa6..2b400e65 100644
--- a/pyrogram/client/types/messages_and_media/game.py
+++ b/pyrogram/client/types/messages_and_media/game.py
@@ -20,14 +20,14 @@ import pyrogram
 from pyrogram.api import types
 from .animation import Animation
 from .photo import Photo
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class Game(PyrogramType):
-    """This object represents a game.
+class Game(Object):
+    """A game.
     Use BotFather to create and edit games, their short names will act as unique identifiers.
 
-    Args:
+    Parameters:
         id (``int``):
             Unique identifier of the game.
 
@@ -40,10 +40,10 @@ class Game(PyrogramType):
         description (``str``):
             Description of the game.
 
-        photo (:obj:`Photo `):
+        photo (:obj:`Photo`):
             Photo that will be displayed in the game message in chats.
 
-        animation (:obj:`Animation `, *optional*):
+        animation (:obj:`Animation`, *optional*):
             Animation that will be displayed in the game message in chats.
             Upload via BotFather.
     """
@@ -53,7 +53,7 @@ class Game(PyrogramType):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         id: int,
         title: str,
         short_name: str,
diff --git a/pyrogram/client/types/messages_and_media/location.py b/pyrogram/client/types/messages_and_media/location.py
index 3a7f6d38..5af55f0f 100644
--- a/pyrogram/client/types/messages_and_media/location.py
+++ b/pyrogram/client/types/messages_and_media/location.py
@@ -19,13 +19,13 @@
 import pyrogram
 
 from pyrogram.api import types
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class Location(PyrogramType):
-    """This object represents a point on the map.
+class Location(Object):
+    """A point on the map.
 
-    Args:
+    Parameters:
         longitude (``float``):
             Longitude as defined by sender.
 
@@ -38,7 +38,7 @@ class Location(PyrogramType):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         longitude: float,
         latitude: float
     ):
diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py
index fc2cb8fb..cd59b5eb 100644
--- a/pyrogram/client/types/messages_and_media/message.py
+++ b/pyrogram/client/types/messages_and_media/message.py
@@ -21,14 +21,13 @@ from typing import List, Match, Union
 
 import pyrogram
 from pyrogram.api import types
-from pyrogram.errors import MessageIdsEmpty
-from pyrogram.client.ext import ChatAction, ParseMode
 from pyrogram.client.types.input_media import InputMedia
+from pyrogram.errors import MessageIdsEmpty
 from .contact import Contact
 from .location import Location
 from .message_entity import MessageEntity
 from ..messages_and_media.photo import Photo
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 from ..update import Update
 from ..user_and_chats.chat import Chat
 from ..user_and_chats.user import User
@@ -60,29 +59,29 @@ class Str(str):
         return self._client.html.unparse(self, self._entities)
 
 
-class Message(PyrogramType, Update):
-    """This object represents a message.
+class Message(Object, Update):
+    """A message.
 
-    Args:
+    Parameters:
         message_id (``int``):
             Unique message identifier inside this chat.
 
         date (``int``, *optional*):
             Date the message was sent in Unix time.
 
-        chat (:obj:`Chat `, *optional*):
+        chat (:obj:`Chat`, *optional*):
             Conversation the message belongs to.
 
-        from_user (:obj:`User `, *optional*):
+        from_user (:obj:`User`, *optional*):
             Sender, empty for messages sent to channels.
 
-        forward_from (:obj:`User `, *optional*):
+        forward_from (:obj:`User`, *optional*):
             For forwarded messages, sender of the original message.
 
-        forward_from_name (``str``, *optional*):
+        forward_sender_name (``str``, *optional*):
             For messages forwarded from users who have hidden their accounts, name of the user.
 
-        forward_from_chat (:obj:`Chat `, *optional*):
+        forward_from_chat (:obj:`Chat`, *optional*):
             For messages forwarded from channels, information about the original channel.
 
         forward_from_message_id (``int``, *optional*):
@@ -94,7 +93,7 @@ class Message(PyrogramType, Update):
         forward_date (``int``, *optional*):
             For forwarded messages, date the original message was sent in Unix time.
 
-        reply_to_message (:obj:`Message `, *optional*):
+        reply_to_message (:obj:`Message`, *optional*):
             For replies, the original message. Note that the Message object in this field will not contain
             further reply_to_message fields even if it itself is a reply.
 
@@ -111,7 +110,7 @@ class Message(PyrogramType, Update):
             new_chat_photo, delete_chat_photo, group_chat_created, supergroup_chat_created, channel_chat_created,
             migrate_to_chat_id, migrate_from_chat_id, pinned_message.
 
-        media (``bool`` *optional*):
+        media (``bool``, *optional*):
             The message is a media message.
             A media message has one and only one of these fields set: audio, document, photo, sticker, video, animation,
             voice, video_note, contact, location, venue.
@@ -131,38 +130,38 @@ class Message(PyrogramType, Update):
             *text.html* to get the marked up message text. In case there is no entity, the fields
             will contain the same text as *text*.
 
-        entities (List of :obj:`MessageEntity `, *optional*):
+        entities (List of :obj:`MessageEntity`, *optional*):
             For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.
 
-        caption_entities (List of :obj:`MessageEntity `, *optional*):
+        caption_entities (List of :obj:`MessageEntity`, *optional*):
             For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear
             in the caption.
 
-        audio (:obj:`Audio `, *optional*):
+        audio (:obj:`Audio`, *optional*):
             Message is an audio file, information about the file.
 
-        document (:obj:`Document `, *optional*):
+        document (:obj:`Document`, *optional*):
             Message is a general file, information about the file.
 
-        photo (:obj:`Photo `, *optional*):
+        photo (:obj:`Photo`, *optional*):
             Message is a photo, information about the photo.
 
-        sticker (:obj:`Sticker `, *optional*):
+        sticker (:obj:`Sticker`, *optional*):
             Message is a sticker, information about the sticker.
 
-        animation (:obj:`Animation `, *optional*):
+        animation (:obj:`Animation`, *optional*):
             Message is an animation, information about the animation.
 
-        game (:obj:`Game `, *optional*):
+        game (:obj:`Game`, *optional*):
             Message is a game, information about the game.
 
-        video (:obj:`Video `, *optional*):
+        video (:obj:`Video`, *optional*):
             Message is a video, information about the video.
 
-        voice (:obj:`Voice `, *optional*):
+        voice (:obj:`Voice`, *optional*):
             Message is a voice message, information about the file.
 
-        video_note (:obj:`VideoNote `, *optional*):
+        video_note (:obj:`VideoNote`, *optional*):
             Message is a video note, information about the video message.
 
         caption (``str``, *optional*):
@@ -171,13 +170,13 @@ class Message(PyrogramType, Update):
             *caption.html* to get the marked up caption text. In case there is no caption entity, the fields
             will contain the same text as *caption*.
 
-        contact (:obj:`Contact `, *optional*):
+        contact (:obj:`Contact`, *optional*):
             Message is a shared contact, information about the contact.
 
-        location (:obj:`Location `, *optional*):
+        location (:obj:`Location`, *optional*):
             Message is a shared location, information about the location.
 
-        venue (:obj:`Venue `, *optional*):
+        venue (:obj:`Venue`, *optional*):
             Message is a venue, information about the venue.
 
         web_page (``bool``, *optional*):
@@ -186,17 +185,20 @@ class Message(PyrogramType, Update):
             web page preview. In future versions this property could turn into a full web page object that contains
             more details.
 
-        new_chat_members (List of :obj:`User `, *optional*):
+        poll (:obj:`Poll`, *optional*):
+            Message is a native poll, information about the poll.
+
+        new_chat_members (List of :obj:`User`, *optional*):
             New members that were added to the group or supergroup and information about them
             (the bot itself may be one of these members).
 
-        left_chat_member (:obj:`User `, *optional*):
+        left_chat_member (:obj:`User`, *optional*):
             A member was removed from the group, information about them (this member may be the bot itself).
 
         new_chat_title (``str``, *optional*):
             A chat title was changed to this value.
 
-        new_chat_photo (:obj:`Photo `, *optional*):
+        new_chat_photo (:obj:`Photo`, *optional*):
             A chat photo was change to this value.
 
         delete_chat_photo (``bool``, *optional*):
@@ -229,19 +231,19 @@ class Message(PyrogramType, Update):
             in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float
             type are safe for storing this identifier.
 
-        pinned_message (:obj:`Message `, *optional*):
+        pinned_message (:obj:`Message`, *optional*):
             Specified message was pinned.
             Note that the Message object in this field will not contain further reply_to_message fields even if it
             is itself a reply.
 
-        game_high_score (:obj:`GameHighScore `, *optional*):
+        game_high_score (:obj:`GameHighScore`, *optional*):
             The game score for a user.
             The reply_to_message field will contain the game Message.
 
         views (``int``, *optional*):
             Channel post views.
 
-        via_bot (:obj:`User `):
+        via_bot (:obj:`User`):
             The information of the bot that generated the message from an inline query of a user.
 
         outgoing (``bool``, *optional*):
@@ -267,7 +269,7 @@ class Message(PyrogramType, Update):
     # TODO: Add game missing field. Also invoice, successful_payment, connected_website
 
     __slots__ = [
-        "message_id", "date", "chat", "from_user", "forward_from", "forward_from_name", "forward_from_chat",
+        "message_id", "date", "chat", "from_user", "forward_from", "forward_sender_name", "forward_from_chat",
         "forward_from_message_id", "forward_signature", "forward_date", "reply_to_message", "mentioned", "empty",
         "service", "media", "edit_date", "media_group_id", "author_signature", "text", "entities", "caption_entities",
         "audio", "document", "photo", "sticker", "animation", "game", "video", "voice", "video_note", "caption",
@@ -280,13 +282,13 @@ class Message(PyrogramType, Update):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         message_id: int,
         date: int = None,
         chat: Chat = None,
         from_user: User = None,
         forward_from: User = None,
-        forward_from_name: str = None,
+        forward_sender_name: str = None,
         forward_from_chat: Chat = None,
         forward_from_message_id: int = None,
         forward_signature: str = None,
@@ -348,7 +350,7 @@ class Message(PyrogramType, Update):
         self.chat = chat
         self.from_user = from_user
         self.forward_from = forward_from
-        self.forward_from_name = forward_from_name
+        self.forward_sender_name = forward_sender_name
         self.forward_from_chat = forward_from_chat
         self.forward_from_message_id = forward_from_message_id
         self.forward_signature = forward_signature
@@ -487,7 +489,7 @@ class Message(PyrogramType, Update):
             entities = list(filter(lambda x: x is not None, entities))
 
             forward_from = None
-            forward_from_name = None
+            forward_sender_name = None
             forward_from_chat = None
             forward_from_message_id = None
             forward_signature = None
@@ -501,7 +503,7 @@ class Message(PyrogramType, Update):
                 if forward_header.from_id:
                     forward_from = User._parse(client, users[forward_header.from_id])
                 elif forward_header.from_name:
-                    forward_from_name = forward_header.from_name
+                    forward_sender_name = forward_header.from_name
                 else:
                     forward_from_chat = Chat._parse_channel_chat(client, chats[forward_header.channel_id])
                     forward_from_message_id = forward_header.channel_post
@@ -607,7 +609,7 @@ class Message(PyrogramType, Update):
                 caption_entities=entities or None if media is not None else None,
                 author_signature=message.post_author,
                 forward_from=forward_from,
-                forward_from_name=forward_from_name,
+                forward_sender_name=forward_sender_name,
                 forward_from_chat=forward_from_chat,
                 forward_from_message_id=forward_from_message_id,
                 forward_signature=forward_signature,
@@ -649,7 +651,7 @@ class Message(PyrogramType, Update):
 
             return parsed_message
 
-    def reply(
+    def reply_text(
         self,
         text: str,
         quote: bool = None,
@@ -659,7 +661,7 @@ class Message(PyrogramType, Update):
         reply_to_message_id: int = None,
         reply_markup=None
     ) -> "Message":
-        """Bound method *reply* of :obj:`Message `.
+        """Bound method *reply_text* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -674,9 +676,9 @@ class Message(PyrogramType, Update):
         Example:
             .. code-block:: python
 
-                message.reply("hello", quote=True)
+                message.reply_text("hello", quote=True)
 
-        Args:
+        Parameters:
             text (``str``):
                 Text of the message to be sent.
 
@@ -686,9 +688,8 @@ class Message(PyrogramType, Update):
                 Defaults to ``True`` in group chats and ``False`` in private chats.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
 
             disable_web_page_preview (``bool``, *optional*):
                 Disables link previews for links in this message.
@@ -708,7 +709,7 @@ class Message(PyrogramType, Update):
             On success, the sent Message is returned.
 
         Raises:
-            :class:`RPCError `
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -747,7 +748,7 @@ class Message(PyrogramType, Update):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> "Message":
-        """Bound method *reply_animation* of :obj:`Message `.
+        """Bound method *reply_animation* :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -763,7 +764,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_animation(animation)
 
-        Args:
+        Parameters:
             animation (``str``):
                 Animation to send.
                 Pass a file_id as string to send an animation that exists on the Telegram servers,
@@ -779,9 +780,8 @@ class Message(PyrogramType, Update):
                 Animation caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             duration (``int``, *optional*):
                 Duration of sent animation in seconds.
@@ -795,7 +795,7 @@ class Message(PyrogramType, Update):
             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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             disable_notification (``bool``, *optional*):
@@ -819,7 +819,7 @@ class Message(PyrogramType, Update):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -833,11 +833,11 @@ class Message(PyrogramType, Update):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            On success, the sent :obj:`Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned instead.
 
         Raises:
-            :class:`RPCError `
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -882,7 +882,7 @@ class Message(PyrogramType, Update):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> "Message":
-        """Bound method *reply_audio* of :obj:`Message `.
+        """Bound method *reply_audio* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -898,7 +898,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_audio(audio)
 
-        Args:
+        Parameters:
             audio (``str``):
                 Audio file to send.
                 Pass a file_id as string to send an audio file that exists on the Telegram servers,
@@ -914,9 +914,8 @@ class Message(PyrogramType, Update):
                 Audio caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             duration (``int``, *optional*):
                 Duration of the audio in seconds.
@@ -930,7 +929,7 @@ class Message(PyrogramType, Update):
             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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             disable_notification (``bool``, *optional*):
@@ -954,7 +953,7 @@ class Message(PyrogramType, Update):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -968,11 +967,11 @@ class Message(PyrogramType, Update):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            On success, the sent :obj:`Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned instead.
 
         Raises:
-            :class:`RPCError `
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1011,7 +1010,7 @@ class Message(PyrogramType, Update):
             "pyrogram.ForceReply"
         ] = None
     ) -> "Message":
-        """Bound method *reply_cached_media* of :obj:`Message `.
+        """Bound method *reply_cached_media* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1027,7 +1026,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_cached_media(file_id)
 
-        Args:
+        Parameters:
             file_id (``str``):
                 Media to send.
                 Pass a file_id as string to send a media that exists on the Telegram servers.
@@ -1041,9 +1040,8 @@ class Message(PyrogramType, Update):
                 Media caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             disable_notification (``bool``, *optional*):
                 Sends the message silently.
@@ -1057,10 +1055,10 @@ class Message(PyrogramType, Update):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            On success, the sent :obj:`Message` is returned.
 
         Raises:
-            :class:`RPCError `
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1078,12 +1076,8 @@ class Message(PyrogramType, Update):
             reply_markup=reply_markup
         )
 
-    def reply_chat_action(
-        self,
-        action: Union[ChatAction, str],
-        progress: int = 0
-    ) -> "Message":
-        """Bound method *reply_chat_action* of :obj:`Message `.
+    def reply_chat_action(self, action: str) -> bool:
+        """Bound method *reply_chat_action* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1099,28 +1093,25 @@ class Message(PyrogramType, Update):
 
                 message.reply_chat_action("typing")
 
-        Args:
-            action (:obj:`ChatAction ` | ``str``):
-                Type of action to broadcast.
-                Choose one from the :class:`ChatAction ` enumeration,
-                depending on what the user is about to receive.
-                You can also provide a string (e.g. "typing", "upload_photo", "record_audio", ...).
-
-            progress (``int``, *optional*):
-                Progress of the upload process.
-                Currently useless because official clients don't seem to be handling this.
+        Parameters:
+            action (``str``):
+                Type of action to broadcast. Choose one, depending on what the user is about to receive: *"typing"* for
+                text messages, *"upload_photo"* for photos, *"record_video"* or *"upload_video"* for videos,
+                *"record_audio"* or *"upload_audio"* for audio files, *"upload_document"* for general files,
+                *"find_location"* for location data, *"record_video_note"* or *"upload_video_note"* for video notes,
+                *"choose_contact"* for contacts, *"playing"* for games or *"cancel"* to cancel any chat action currently
+                displayed.
 
         Returns:
-            On success, True is returned.
+            ``bool``: On success, True is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
-            ``ValueError`` if the provided string is not a valid ChatAction.
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case the provided string is not a valid chat action.
         """
         return self._client.send_chat_action(
             chat_id=self.chat.id,
-            action=action,
-            progress=progress
+            action=action
         )
 
     def reply_contact(
@@ -1139,7 +1130,7 @@ class Message(PyrogramType, Update):
             "pyrogram.ForceReply"
         ] = None
     ) -> "Message":
-        """Bound method *reply_contact* of :obj:`Message `.
+        """Bound method *reply_contact* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1156,7 +1147,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_contact(phone_number, "Dan")
 
-        Args:
+        Parameters:
             phone_number (``str``):
                 Contact's phone number.
 
@@ -1186,10 +1177,10 @@ class Message(PyrogramType, Update):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            On success, the sent :obj:`Message` is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1226,7 +1217,7 @@ class Message(PyrogramType, Update):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> "Message":
-        """Bound method *reply_document* of :obj:`Message `.
+        """Bound method *reply_document* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1242,7 +1233,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_document(document)
 
-        Args:
+        Parameters:
             document (``str``):
                 File to send.
                 Pass a file_id as string to send a file that exists on the Telegram servers,
@@ -1257,16 +1248,15 @@ class Message(PyrogramType, Update):
             thumb (``str``, *optional*):
                 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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             caption (``str``, *optional*):
                 Document caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             disable_notification (``bool``, *optional*):
                 Sends the message silently.
@@ -1289,7 +1279,7 @@ class Message(PyrogramType, Update):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -1303,11 +1293,11 @@ class Message(PyrogramType, Update):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            On success, the sent :obj:`Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned instead.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1341,7 +1331,7 @@ class Message(PyrogramType, Update):
             "pyrogram.ForceReply"
         ] = None
     ) -> "Message":
-        """Bound method *reply_game* of :obj:`Message `.
+        """Bound method *reply_game* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1357,7 +1347,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_game("lumberjack")
 
-        Args:
+        Parameters:
             game_short_name (``str``):
                 Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
 
@@ -1381,7 +1371,7 @@ class Message(PyrogramType, Update):
             On success, the sent :obj:`Message` is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1406,7 +1396,7 @@ class Message(PyrogramType, Update):
         reply_to_message_id: int = None,
         hide_via: bool = None
     ) -> "Message":
-        """Bound method *reply_inline_bot_result* of :obj:`Message `.
+        """Bound method *reply_inline_bot_result* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1423,7 +1413,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_inline_bot_result(query_id, result_id)
 
-        Args:
+        Parameters:
             query_id (``int``):
                 Unique identifier for the answered query.
 
@@ -1449,7 +1439,7 @@ class Message(PyrogramType, Update):
             On success, the sent Message is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1480,7 +1470,7 @@ class Message(PyrogramType, Update):
             "pyrogram.ForceReply"
         ] = None
     ) -> "Message":
-        """Bound method *reply_location* of :obj:`Message `.
+        """Bound method *reply_location* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1497,7 +1487,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_location(41.890251, 12.492373)
 
-        Args:
+        Parameters:
             latitude (``float``):
                 Latitude of the location.
 
@@ -1521,10 +1511,10 @@ class Message(PyrogramType, Update):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            On success, the sent :obj:`Message` is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1548,7 +1538,7 @@ class Message(PyrogramType, Update):
         disable_notification: bool = None,
         reply_to_message_id: int = None
     ) -> "Message":
-        """Bound method *reply_media_group* of :obj:`Message `.
+        """Bound method *reply_media_group* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1564,7 +1554,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_media_group(list_of_media)
 
-        Args:
+        Parameters:
             media (``list``):
                 A list containing either :obj:`InputMediaPhoto ` or
                 :obj:`InputMediaVideo ` objects
@@ -1583,11 +1573,11 @@ class Message(PyrogramType, Update):
                 If the message is a reply, ID of the original message.
 
         Returns:
-            On success, a :obj:`Messages ` object is returned containing all the
+            On success, a :obj:`Messages` object is returned containing all the
             single messages sent.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1620,7 +1610,7 @@ class Message(PyrogramType, Update):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> "Message":
-        """Bound method *reply_photo* of :obj:`Message `.
+        """Bound method *reply_photo* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1636,7 +1626,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_photo(photo)
 
-        Args:
+        Parameters:
             photo (``str``):
                 Photo to send.
                 Pass a file_id as string to send a photo that exists on the Telegram servers,
@@ -1652,9 +1642,8 @@ class Message(PyrogramType, Update):
                 Photo caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             ttl_seconds (``int``, *optional*):
                 Self-Destruct Timer.
@@ -1682,7 +1671,7 @@ class Message(PyrogramType, Update):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -1696,11 +1685,11 @@ class Message(PyrogramType, Update):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            On success, the sent :obj:`Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned instead.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1735,7 +1724,7 @@ class Message(PyrogramType, Update):
             "pyrogram.ForceReply"
         ] = None
     ) -> "Message":
-        """Bound method *reply_poll* of :obj:`Message `.
+        """Bound method *reply_poll* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1752,7 +1741,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_poll("Is Pyrogram the best?", ["Yes", "Yes"])
 
-        Args:
+        Parameters:
             question (``str``):
                 The poll question, as string.
 
@@ -1776,10 +1765,10 @@ class Message(PyrogramType, Update):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            On success, the sent :obj:`Message` is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1811,7 +1800,7 @@ class Message(PyrogramType, Update):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> "Message":
-        """Bound method *reply_sticker* of :obj:`Message `.
+        """Bound method *reply_sticker* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1827,7 +1816,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_sticker(sticker)
 
-        Args:
+        Parameters:
             sticker (``str``):
                 Sticker to send.
                 Pass a file_id as string to send a sticker that exists on the Telegram servers,
@@ -1860,7 +1849,7 @@ class Message(PyrogramType, Update):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -1874,11 +1863,11 @@ class Message(PyrogramType, Update):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            On success, the sent :obj:`Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned instead.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -1914,7 +1903,7 @@ class Message(PyrogramType, Update):
             "pyrogram.ForceReply"
         ] = None
     ) -> "Message":
-        """Bound method *reply_venue* of :obj:`Message `.
+        """Bound method *reply_venue* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -1933,7 +1922,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_venue(41.890251, 12.492373, "Coliseum", "Piazza del Colosseo, 1, 00184 Roma RM")
 
-        Args:
+        Parameters:
             latitude (``float``):
                 Latitude of the venue.
 
@@ -1970,10 +1959,10 @@ class Message(PyrogramType, Update):
                 instructions to remove reply keyboard or to force a reply from the user.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
+            On success, the sent :obj:`Message` is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -2016,7 +2005,7 @@ class Message(PyrogramType, Update):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> "Message":
-        """Bound method *reply_video* of :obj:`Message `.
+        """Bound method *reply_video* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2032,7 +2021,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_video(video)
 
-        Args:
+        Parameters:
             video (``str``):
                 Video to send.
                 Pass a file_id as string to send a video that exists on the Telegram servers,
@@ -2048,9 +2037,8 @@ class Message(PyrogramType, Update):
                 Video caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             duration (``int``, *optional*):
                 Duration of sent video in seconds.
@@ -2064,7 +2052,7 @@ class Message(PyrogramType, Update):
             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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             supports_streaming (``bool``, *optional*):
@@ -2091,7 +2079,7 @@ class Message(PyrogramType, Update):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -2105,11 +2093,11 @@ class Message(PyrogramType, Update):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            On success, the sent :obj:`Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned instead.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -2152,7 +2140,7 @@ class Message(PyrogramType, Update):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> "Message":
-        """Bound method *reply_video_note* of :obj:`Message `.
+        """Bound method *reply_video_note* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2168,7 +2156,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_video_note(video_note)
 
-        Args:
+        Parameters:
             video_note (``str``):
                 Video note to send.
                 Pass a file_id as string to send a video note that exists on the Telegram servers, or
@@ -2189,7 +2177,7 @@ class Message(PyrogramType, Update):
             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.
+                A thumbnail's width and height should not exceed 320 pixels.
                 Thumbnails can't be reused and can be only uploaded as a new file.
 
             disable_notification (``bool``, *optional*):
@@ -2213,7 +2201,7 @@ class Message(PyrogramType, Update):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -2227,11 +2215,11 @@ class Message(PyrogramType, Update):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            On success, the sent :obj:`Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned instead.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -2270,7 +2258,7 @@ class Message(PyrogramType, Update):
         progress: callable = None,
         progress_args: tuple = ()
     ) -> "Message":
-        """Bound method *reply_voice* of :obj:`Message `.
+        """Bound method *reply_voice* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2286,7 +2274,7 @@ class Message(PyrogramType, Update):
 
                 message.reply_voice(voice)
 
-        Args:
+        Parameters:
             voice (``str``):
                 Audio file to send.
                 Pass a file_id as string to send an audio that exists on the Telegram servers,
@@ -2302,9 +2290,8 @@ class Message(PyrogramType, Update):
                 Voice message caption, 0-1024 characters.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your caption. Defaults to "markdown".
 
             duration (``int``, *optional*):
                 Duration of the voice message in seconds.
@@ -2330,7 +2317,7 @@ class Message(PyrogramType, Update):
                 a chat_id and a message_id in order to edit a message with the updated progress.
 
         Other Parameters:
-            client (:obj:`Client `):
+            client (:obj:`Client`):
                 The Client itself, useful when you want to call other API methods inside the callback function.
 
             current (``int``):
@@ -2344,11 +2331,11 @@ class Message(PyrogramType, Update):
                 You can either keep *\*args* or add every single extra argument in your function signature.
 
         Returns:
-            On success, the sent :obj:`Message ` is returned.
-            In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
+            On success, the sent :obj:`Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~Client.stop_transmission`, None is returned instead.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         if quote is None:
             quote = self.chat.type != "private"
@@ -2369,19 +2356,14 @@ class Message(PyrogramType, Update):
             progress_args=progress_args
         )
 
-    def edit(
+    def edit_text(
         self,
         text: str,
         parse_mode: str = "",
         disable_web_page_preview: bool = None,
-        reply_markup: Union[
-            "pyrogram.InlineKeyboardMarkup",
-            "pyrogram.ReplyKeyboardMarkup",
-            "pyrogram.ReplyKeyboardRemove",
-            "pyrogram.ForceReply"
-        ] = None
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
     ) -> "Message":
-        """Bound method *edit* of :obj:`Message `
+        """Bound method *edit_text* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2396,16 +2378,15 @@ class Message(PyrogramType, Update):
         Example:
             .. code-block:: python
 
-                message.edit("hello")
+                message.edit_text("hello")
 
-        Args:
+        Parameters:
             text (``str``):
                 New text of the message.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
 
             disable_web_page_preview (``bool``, *optional*):
                 Disables link previews for links in this message.
@@ -2414,10 +2395,10 @@ class Message(PyrogramType, Update):
                 An InlineKeyboardMarkup object.
 
         Returns:
-            On success, the edited :obj:`Message ` is returned.
+            On success, the edited :obj:`Message` is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         return self._client.edit_message_text(
             chat_id=self.chat.id,
@@ -2432,14 +2413,9 @@ class Message(PyrogramType, Update):
         self,
         caption: str,
         parse_mode: str = "",
-        reply_markup: Union[
-            "pyrogram.InlineKeyboardMarkup",
-            "pyrogram.ReplyKeyboardMarkup",
-            "pyrogram.ReplyKeyboardRemove",
-            "pyrogram.ForceReply"
-        ] = None
+        reply_markup: "pyrogram.InlineKeyboardMarkup" = None
     ) -> "Message":
-        """Bound method *edit_caption* of :obj:`Message `
+        """Bound method *edit_caption* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2456,23 +2432,22 @@ class Message(PyrogramType, Update):
 
                 message.edit_caption("hello")
 
-        Args:
+        Parameters:
             caption (``str``):
                 New caption of the message.
 
             parse_mode (``str``, *optional*):
-                Use :obj:`MARKDOWN ` or :obj:`HTML `
-                if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message.
-                Defaults to Markdown.
+                Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
+                URLs in your message. Defaults to "markdown".
 
             reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
                 An InlineKeyboardMarkup object.
 
         Returns:
-            On success, the edited :obj:`Message ` is returned.
+            On success, the edited :obj:`Message` is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         return self._client.edit_message_caption(
             chat_id=self.chat.id,
@@ -2483,7 +2458,7 @@ class Message(PyrogramType, Update):
         )
 
     def edit_media(self, media: InputMedia, reply_markup: "pyrogram.InlineKeyboardMarkup" = None) -> "Message":
-        """Bound method *edit_media* of :obj:`Message `
+        """Bound method *edit_media* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2500,18 +2475,18 @@ class Message(PyrogramType, Update):
 
                 message.edit_media(media)
 
-        Args:
-            media (:obj:`InputMediaAnimation` | :obj:`InputMediaAudio` | :obj:`InputMediaDocument` | :obj:`InputMediaPhoto` | :obj:`InputMediaVideo`)
+        Parameters:
+            media (:obj:`InputMedia`):
                 One of the InputMedia objects describing an animation, audio, document, photo or video.
 
             reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
                 An InlineKeyboardMarkup object.
 
         Returns:
-            On success, the edited :obj:`Message ` is returned.
+            On success, the edited :obj:`Message` is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         return self._client.edit_message_media(
             chat_id=self.chat.id,
@@ -2521,7 +2496,7 @@ class Message(PyrogramType, Update):
         )
 
     def edit_reply_markup(self, reply_markup: "pyrogram.InlineKeyboardMarkup" = None) -> "Message":
-        """Bound method *edit_reply_markup* of :obj:`Message `
+        """Bound method *edit_reply_markup* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2538,16 +2513,16 @@ class Message(PyrogramType, Update):
 
                 message.edit_reply_markup(inline_reply_markup)
 
-        Args:
+        Parameters:
             reply_markup (:obj:`InlineKeyboardMarkup`):
                 An InlineKeyboardMarkup object.
 
         Returns:
             On success, if edited message is sent by the bot, the edited
-            :obj:`Message ` is returned, otherwise True is returned.
+            :obj:`Message` is returned, otherwise True is returned.
 
         Raises:
-            :class:`RPCError ` in case of a Telegram RPC error.
+            RPCError: In case of a Telegram RPC error.
         """
         return self._client.edit_message_reply_markup(
             chat_id=self.chat.id,
@@ -2562,7 +2537,7 @@ class Message(PyrogramType, Update):
         as_copy: bool = False,
         remove_caption: bool = False
     ) -> "Message":
-        """Bound method *forward* of :obj:`Message `.
+        """Bound method *forward* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2579,7 +2554,7 @@ class Message(PyrogramType, Update):
 
                 message.forward(chat_id)
 
-        Args:
+        Parameters:
             chat_id (``int`` | ``str``):
                 Unique identifier (int) or username (str) of the target chat.
                 For your personal cloud (Saved Messages) you can simply use "me" or "self".
@@ -2602,7 +2577,7 @@ class Message(PyrogramType, Update):
             On success, the forwarded Message is returned.
 
         Raises:
-            :class:`RPCError `
+            RPCError: In case of a Telegram RPC error.
         """
         if as_copy:
             if self.service:
@@ -2632,7 +2607,7 @@ class Message(PyrogramType, Update):
                 )
 
                 if self.photo:
-                    file_id = self.photo.sizes[-1].file_id
+                    file_id = self.photo.file_id
                 elif self.audio:
                     file_id = self.audio.file_id
                 elif self.document:
@@ -2693,7 +2668,7 @@ class Message(PyrogramType, Update):
                 if self.sticker or self.video_note:  # Sticker and VideoNote should have no caption
                     return send_media(file_id=file_id)
                 else:
-                    return send_media(file_id=file_id, caption=caption, parse_mode=ParseMode.HTML)
+                    return send_media(file_id=file_id, caption=caption, parse_mode="html")
             else:
                 raise ValueError("Can't copy this message")
         else:
@@ -2705,7 +2680,7 @@ class Message(PyrogramType, Update):
             )
 
     def delete(self, revoke: bool = True):
-        """Bound method *delete* of :obj:`Message `.
+        """Bound method *delete* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2721,7 +2696,7 @@ class Message(PyrogramType, Update):
 
                 message.delete()
 
-        Args:
+        Parameters:
             revoke (``bool``, *optional*):
                 Deletes messages on both parts.
                 This is only for private cloud chats and normal groups, messages on
@@ -2729,23 +2704,21 @@ class Message(PyrogramType, Update):
                 Defaults to True.
 
         Returns:
-            True on success.
+            True on success, False otherwise.
 
         Raises:
-            :class:`RPCError `
+            RPCError: In case of a Telegram RPC error.
         """
-        self._client.delete_messages(
+        return self._client.delete_messages(
             chat_id=self.chat.id,
             message_ids=self.message_id,
             revoke=revoke
         )
 
-        return True
+    def click(self, x: int or str, y: int = 0, quote: bool = None, timeout: int = 10):
+        """Bound method *click* of :obj:`Message`.
 
-    def click(self, x: int or str, y: int = None, quote: bool = None):
-        """Bound method *click* of :obj:`Message `.
-
-        Use as a shortcut for clicking a button attached to the message instead of.
+        Use as a shortcut for clicking a button attached to the message instead of:
 
         - Clicking inline buttons:
 
@@ -2778,9 +2751,10 @@ class Message(PyrogramType, Update):
             3.  Pass one string argument only (e.g.: ``.click("Settings")``, to click a button by using its label).
                 Only the first matching button will be pressed.
 
-        Args:
+        Parameters:
             x (``int`` | ``str``):
                 Used as integer index, integer abscissa (in pair with y) or as string label.
+                Defaults to 0 (first button).
 
             y (``int``, *optional*):
                 Used as ordinate only (in pair with x).
@@ -2790,58 +2764,66 @@ class Message(PyrogramType, Update):
                 If ``True``, the message will be sent as a reply to this message.
                 Defaults to ``True`` in group chats and ``False`` in private chats.
 
+            timeout (``int``, *optional*):
+                Timeout in seconds.
+
         Returns:
-            -   The result of *request_callback_answer()* in case of inline callback button clicks.
-            -   The result of *reply()* in case of normal button clicks.
-            -   A string in case the inline button is an URL, switch_inline_query or switch_inline_query_current_chat
-                button.
+            -   The result of :meth:`~Client.request_callback_answer` in case of inline callback button clicks.
+            -   The result of :meth:`~Message.reply()` in case of normal button clicks.
+            -   A string in case the inline button is a URL, a *switch_inline_query* or a
+                *switch_inline_query_current_chat* button.
 
         Raises:
-            :class:`RPCError `
-            ``ValueError``: If the provided index or position is out of range or the button label was not found
-            ``TimeoutError``: If, after clicking an inline button, the bot fails to answer within 10 seconds
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case the provided index or position is out of range or the button label was not found.
+            TimeoutError: In case, after clicking an inline button, the bot fails to answer within the timeout.
         """
+
         if isinstance(self.reply_markup, pyrogram.ReplyKeyboardMarkup):
-            return self.reply(x, quote=quote)
+            keyboard = self.reply_markup.keyboard
+            is_inline = False
         elif isinstance(self.reply_markup, pyrogram.InlineKeyboardMarkup):
-            if isinstance(x, int) and y is None:
-                try:
-                    button = [
-                        button
-                        for row in self.reply_markup.inline_keyboard
-                        for button in row
-                    ][x]
-                except IndexError:
-                    raise ValueError("The button at index {} doesn't exist".format(x)) from None
-            elif isinstance(x, int) and isinstance(y, int):
-                try:
-                    button = self.reply_markup.inline_keyboard[y][x]
-                except IndexError:
-                    raise ValueError("The button at position ({}, {}) doesn't exist".format(x, y)) from None
-            elif isinstance(x, str):
-                x = x.encode("utf-16", "surrogatepass").decode("utf-16")
+            keyboard = self.reply_markup.inline_keyboard
+            is_inline = True
+        else:
+            raise ValueError("The message doesn't contain any keyboard")
 
-                try:
-                    button = [
-                        button
-                        for row in self.reply_markup.inline_keyboard
-                        for button in row
-                        if x == button.text
-                    ][0]
-                except IndexError:
-                    raise ValueError(
-                        "The button with label '{}' doesn't exists".format(
-                            x.encode("unicode_escape").decode()
-                        )
-                    ) from None
-            else:
-                raise ValueError("Invalid arguments")
+        if isinstance(x, int) and y is None:
+            try:
+                button = [
+                    button
+                    for row in keyboard
+                    for button in row
+                ][x]
+            except IndexError:
+                raise ValueError("The button at index {} doesn't exist".format(x))
+        elif isinstance(x, int) and isinstance(y, int):
+            try:
+                button = keyboard[y][x]
+            except IndexError:
+                raise ValueError("The button at position ({}, {}) doesn't exist".format(x, y))
+        elif isinstance(x, str) and y is None:
+            label = x.encode("utf-16", "surrogatepass").decode("utf-16")
 
+            try:
+                button = [
+                    button
+                    for row in keyboard
+                    for button in row
+                    if label == button.text
+                ][0]
+            except IndexError:
+                raise ValueError("The button with label '{}' doesn't exists".format(x))
+        else:
+            raise ValueError("Invalid arguments")
+
+        if is_inline:
             if button.callback_data:
                 return self._client.request_callback_answer(
                     chat_id=self.chat.id,
                     message_id=self.message_id,
-                    callback_data=button.callback_data
+                    callback_data=button.callback_data,
+                    timeout=timeout
                 )
             elif button.url:
                 return button.url
@@ -2852,7 +2834,7 @@ class Message(PyrogramType, Update):
             else:
                 raise ValueError("This button is not supported yet")
         else:
-            raise ValueError("The message doesn't contain any keyboard")
+            self.reply(button, quote=quote)
 
     def download(
         self,
@@ -2860,8 +2842,8 @@ class Message(PyrogramType, Update):
         block: bool = True,
         progress: callable = None,
         progress_args: tuple = ()
-    ) -> "Message":
-        """Bound method *download* of :obj:`Message `.
+    ) -> str:
+        """Bound method *download* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2874,7 +2856,7 @@ class Message(PyrogramType, Update):
 
                 message.download()
 
-        Args:
+        Parameters:
             file_name (``str``, *optional*):
                 A custom *file_name* to be used instead of the one provided by Telegram.
                 By default, all files are downloaded in the *downloads* folder in your working directory.
@@ -2898,7 +2880,7 @@ class Message(PyrogramType, Update):
             On success, the absolute path of the downloaded file as string is returned, None otherwise.
 
         Raises:
-            :class:`RPCError `
+            RPCError: In case of a Telegram RPC error.
             ``ValueError``: If the message doesn't contain any downloadable media
         """
         return self._client.download_media(
@@ -2910,7 +2892,7 @@ class Message(PyrogramType, Update):
         )
 
     def pin(self, disable_notification: bool = None) -> "Message":
-        """Bound method *pin* of :obj:`Message `.
+        """Bound method *pin* of :obj:`Message`.
 
         Use as a shortcut for:
 
@@ -2926,7 +2908,7 @@ class Message(PyrogramType, Update):
 
                 message.pin()
 
-        Args:
+        Parameters:
             disable_notification (``bool``):
                 Pass True, if it is not necessary to send a notification to all chat members about the new pinned
                 message. Notifications are always disabled in channels.
@@ -2935,7 +2917,7 @@ class Message(PyrogramType, Update):
             True on success.
 
         Raises:
-            :class:`RPCError `
+            RPCError: In case of a Telegram RPC error.
         """
         return self._client.pin_chat_message(
             chat_id=self.chat.id,
diff --git a/pyrogram/client/types/messages_and_media/message_entity.py b/pyrogram/client/types/messages_and_media/message_entity.py
index 160d0d1e..420bd914 100644
--- a/pyrogram/client/types/messages_and_media/message_entity.py
+++ b/pyrogram/client/types/messages_and_media/message_entity.py
@@ -19,20 +19,20 @@
 import pyrogram
 
 from pyrogram.api import types
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 from ..user_and_chats.user import User
 
 
-class MessageEntity(PyrogramType):
-    """This object represents one special entity in a text message.
+class MessageEntity(Object):
+    """One special entity in a text message.
     For example, hashtags, usernames, URLs, etc.
 
-    Args:
+    Parameters:
         type (``str``):
             Type of the entity.
             Can be "mention" (@username), "hashtag", "cashtag", "bot_command", "url", "email", "phone_number", "bold"
-            (bold text), italic (italic text), "code" (monowidth string), "pre" (monowidth block), "text_link"
-            (for clickable text URLs), "text_mention" (for users without usernames).
+            (bold text), "italic" (italic text), "code" (monowidth string), "pre" (monowidth block), "text_link"
+            (for clickable text URLs), "text_mention" (for custom text mentions based on users' identifiers).
 
         offset (``int``):
             Offset in UTF-16 code units to the start of the entity.
@@ -43,7 +43,7 @@ class MessageEntity(PyrogramType):
         url (``str``, *optional*):
             For "text_link" only, url that will be opened after user taps on the text.
 
-        user (:obj:`User `, *optional*):
+        user (:obj:`User`, *optional*):
             For "text_mention" only, the mentioned user.
     """
 
@@ -68,7 +68,7 @@ class MessageEntity(PyrogramType):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         type: str,
         offset: int,
         length: int,
diff --git a/pyrogram/client/types/messages_and_media/messages.py b/pyrogram/client/types/messages_and_media/messages.py
deleted file mode 100644
index da1a2676..00000000
--- a/pyrogram/client/types/messages_and_media/messages.py
+++ /dev/null
@@ -1,170 +0,0 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017-2019 Dan Tès 
-#
-# 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 .
-
-from typing import List, Union
-
-import pyrogram
-from pyrogram.api import types
-from .message import Message
-from ..pyrogram_type import PyrogramType
-from ..update import Update
-from ..user_and_chats import Chat
-
-
-class Messages(PyrogramType, Update):
-    """This object represents a chat's messages.
-
-    Args:
-        total_count (``int``):
-            Total number of messages the target chat has.
-
-        messages (List of :obj:`Message `):
-            Requested messages.
-    """
-
-    __slots__ = ["total_count", "messages"]
-
-    def __init__(
-        self,
-        *,
-        client: "pyrogram.client.ext.BaseClient",
-        total_count: int,
-        messages: List[Message]
-    ):
-        super().__init__(client)
-
-        self.total_count = total_count
-        self.messages = messages
-
-    @staticmethod
-    def _parse(client, messages: types.messages.Messages, replies: int = 1) -> "Messages":
-        users = {i.id: i for i in messages.users}
-        chats = {i.id: i for i in messages.chats}
-
-        total_count = getattr(messages, "count", len(messages.messages))
-
-        if not messages.messages:
-            return Messages(
-                total_count=total_count,
-                messages=[],
-                client=client
-            )
-
-        parsed_messages = [Message._parse(client, message, users, chats, replies=0) for message in messages.messages]
-
-        if replies:
-            messages_with_replies = {i.id: getattr(i, "reply_to_msg_id", None) for i in messages.messages}
-            reply_message_ids = [i[0] for i in filter(lambda x: x[1] is not None, messages_with_replies.items())]
-
-            if reply_message_ids:
-                reply_messages = client.get_messages(
-                    parsed_messages[0].chat.id,
-                    reply_to_message_ids=reply_message_ids,
-                    replies=0
-                ).messages
-
-                for message in parsed_messages:
-                    reply_id = messages_with_replies[message.message_id]
-
-                    for reply in reply_messages:
-                        if reply.message_id == reply_id:
-                            message.reply_to_message = reply
-
-        return Messages(
-            total_count=total_count,
-            messages=parsed_messages,
-            client=client
-        )
-
-    @staticmethod
-    def _parse_deleted(client, update) -> "Messages":
-        messages = update.messages
-        channel_id = getattr(update, "channel_id", None)
-
-        parsed_messages = []
-
-        for message in messages:
-            parsed_messages.append(
-                Message(
-                    message_id=message,
-                    chat=Chat(
-                        id=int("-100" + str(channel_id)),
-                        type="channel",
-                        client=client
-                    ) if channel_id is not None else None,
-                    client=client
-                )
-            )
-
-        return Messages(
-            total_count=len(parsed_messages),
-            messages=parsed_messages,
-            client=client
-        )
-
-    def forward(
-        self,
-        chat_id: Union[int, str],
-        disable_notification: bool = None,
-        as_copy: bool = False,
-        remove_caption: bool = False
-    ):
-        """Bound method *forward* of :obj:`Message `.
-
-        Args:
-            chat_id (``int`` | ``str``):
-                Unique identifier (int) or username (str) of the target chat.
-                For your personal cloud (Saved Messages) you can simply use "me" or "self".
-                For a contact that exists in your Telegram address book you can use his phone number (str).
-
-            disable_notification (``bool``, *optional*):
-                Sends messages silently.
-                Users will receive a notification with no sound.
-
-            as_copy (``bool``, *optional*):
-                Pass True to forward messages without the forward header (i.e.: send a copy of the message content).
-                Defaults to False.
-
-            remove_caption (``bool``, *optional*):
-                If set to True and *as_copy* is enabled as well, media captions are not preserved when copying the
-                message. Has no effect if *as_copy* is not enabled.
-                Defaults to False.
-
-        Returns:
-            On success, a :class:`Messages ` containing forwarded messages is returned.
-
-        Raises:
-            :class:`RPCError `
-        """
-        forwarded_messages = []
-
-        for message in self.messages:
-            forwarded_messages.append(
-                message.forward(
-                    chat_id=chat_id,
-                    as_copy=as_copy,
-                    disable_notification=disable_notification,
-                    remove_caption=remove_caption
-                )
-            )
-
-        return Messages(
-            total_count=len(forwarded_messages),
-            messages=forwarded_messages,
-            client=self._client
-        )
diff --git a/pyrogram/client/types/messages_and_media/photo.py b/pyrogram/client/types/messages_and_media/photo.py
index 6f1852fb..653fe4c0 100644
--- a/pyrogram/client/types/messages_and_media/photo.py
+++ b/pyrogram/client/types/messages_and_media/photo.py
@@ -16,89 +16,79 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from base64 import b64encode
 from struct import pack
 from typing import List
 
 import pyrogram
 from pyrogram.api import types
-from .photo_size import PhotoSize
-from ..pyrogram_type import PyrogramType
+from .thumbnail import Thumbnail
+from ..object import Object
 from ...ext.utils import encode
 
 
-class Photo(PyrogramType):
-    """This object represents a Photo.
+class Photo(Object):
+    """A Photo.
 
-    Args:
-        id (``str``):
+    Parameters:
+        file_id (``str``):
             Unique identifier for this photo.
 
+        width (``int``):
+            Photo width.
+
+        height (``int``):
+            Photo height.
+
+        file_size (``int``):
+            File size.
+
         date (``int``):
             Date the photo was sent in Unix time.
 
-        sizes (List of :obj:`PhotoSize `):
-            Available sizes of this photo.
+        thumbs (List of :obj:`Thumbnail`, *optional*):
+            Available thumbnails of this photo.
     """
 
-    __slots__ = ["id", "date", "sizes"]
+    __slots__ = ["file_id", "width", "height", "file_size", "date", "thumbs"]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
-        id: str,
+        client: "pyrogram.BaseClient" = None,
+        file_id: str,
+        width: int,
+        height: int,
+        file_size: int,
         date: int,
-        sizes: List[PhotoSize]
+        thumbs: List[Thumbnail]
     ):
         super().__init__(client)
 
-        self.id = id
+        self.file_id = file_id
+        self.width = width
+        self.height = height
+        self.file_size = file_size
         self.date = date
-        self.sizes = sizes
+        self.thumbs = thumbs
 
     @staticmethod
-    def _parse(client, photo: types.Photo):
+    def _parse(client, photo: types.Photo) -> "Photo":
         if isinstance(photo, types.Photo):
-            raw_sizes = photo.sizes
-            sizes = []
-
-            for raw_size in raw_sizes:
-                if isinstance(raw_size, (types.PhotoSize, types.PhotoCachedSize)):
-                    if isinstance(raw_size, types.PhotoSize):
-                        file_size = raw_size.size
-                    elif isinstance(raw_size, types.PhotoCachedSize):
-                        file_size = len(raw_size.bytes)
-                    else:
-                        file_size = 0
-
-                    loc = raw_size.location
-
-                    if isinstance(loc, types.FileLocation):
-                        size = PhotoSize(
-                            file_id=encode(
-                                pack(
-                                    "
-#
-# 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 .
-
-from struct import pack
-from typing import List, Union
-
-import pyrogram
-from pyrogram.api import types
-from pyrogram.client.ext.utils import encode
-from ..pyrogram_type import PyrogramType
-
-
-class PhotoSize(PyrogramType):
-    """This object represents one size of a photo or a file/sticker thumbnail.
-
-    Args:
-        file_id (``str``):
-            Unique identifier for this file.
-
-        width (``int``):
-            Photo width.
-
-        height (``int``):
-            Photo height.
-
-        file_size (``int``):
-            File size.
-    """
-
-    __slots__ = ["file_id", "width", "height", "file_size"]
-
-    def __init__(
-        self,
-        *,
-        client: "pyrogram.client.ext.BaseClient",
-        file_id: str,
-        width: int,
-        height: int,
-        file_size: int
-    ):
-        super().__init__(client)
-
-        self.file_id = file_id
-        self.width = width
-        self.height = height
-        self.file_size = file_size
-
-    @staticmethod
-    def _parse(client, thumbs: List) -> Union["PhotoSize", None]:
-        if not thumbs:
-            return None
-
-        photo_size = thumbs[-1]
-
-        if not isinstance(photo_size, (types.PhotoSize, types.PhotoCachedSize, types.PhotoStrippedSize)):
-            return None
-
-        loc = photo_size.location
-
-        if not isinstance(loc, types.FileLocation):
-            return None
-
-        return PhotoSize(
-            file_id=encode(
-                pack(
-                    ".
 
-from typing import List
+from typing import List, Union
 
 import pyrogram
 from pyrogram.api import types
 from .poll_option import PollOption
-from ..pyrogram_type import PyrogramType
+from ..object import Object
+from ..update import Update
 
 
-class Poll(PyrogramType):
-    """This object represents a Poll.
+class Poll(Object, Update):
+    """A Poll.
 
-    Args:
-        id (``int``):
-            The poll id in this chat.
-
-        closed (``bool``):
-            Whether the poll is closed or not.
+    Parameters:
+        id (``str``):
+            Unique poll identifier.
 
         question (``str``):
-            Poll question.
+            Poll question, 1-255 characters.
 
         options (List of :obj:`PollOption`):
-            The available poll options.
+            List of poll options.
+
+        is_closed (``bool``):
+            True, if the poll is closed.
 
         total_voters (``int``):
-            Total amount of voters for this poll.
+            Total count of voters for this poll.
 
-        option_chosen (``int``, *optional*):
-            The index of your chosen option (in case you voted already), None otherwise.
+        chosen_option (``int``, *optional*):
+            Index of your chosen option (0-9), None in case you haven't voted yet.
     """
 
-    __slots__ = ["id", "closed", "question", "options", "total_voters", "option_chosen"]
+    __slots__ = ["id", "question", "options", "is_closed", "total_voters", "chosen_option"]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
-        id: int,
-        closed: bool,
+        client: "pyrogram.BaseClient" = None,
+        id: str,
         question: str,
         options: List[PollOption],
+        is_closed: bool,
         total_voters: int,
-        option_chosen: int = None
+        chosen_option: int = None
     ):
         super().__init__(client)
 
         self.id = id
-        self.closed = closed
         self.question = question
         self.options = options
+        self.is_closed = is_closed
         self.total_voters = total_voters
-        self.option_chosen = option_chosen
+        self.chosen_option = chosen_option
 
     @staticmethod
-    def _parse(client, media_poll: types.MessageMediaPoll) -> "Poll":
+    def _parse(client, media_poll: Union[types.MessageMediaPoll, types.UpdateMessagePoll]) -> "Poll":
         poll = media_poll.poll
         results = media_poll.results.results
         total_voters = media_poll.results.total_voters
-        option_chosen = None
-
+        chosen_option = None
         options = []
 
         for i, answer in enumerate(poll.answers):
-            voters = 0
+            voter_count = 0
 
             if results:
                 result = results[i]
-                voters = result.voters
+                voter_count = result.voters
 
                 if result.chosen:
-                    option_chosen = i
+                    chosen_option = i
 
-            options.append(PollOption(
-                text=answer.text,
-                voters=voters,
-                data=answer.option,
-                client=client
-            ))
+            options.append(
+                PollOption(
+                    text=answer.text,
+                    voter_count=voter_count,
+                    data=answer.option,
+                    client=client
+                )
+            )
 
         return Poll(
-            id=poll.id,
-            closed=poll.closed,
+            id=str(poll.id),
             question=poll.question,
             options=options,
+            is_closed=poll.closed,
             total_voters=total_voters,
-            option_chosen=option_chosen,
+            chosen_option=chosen_option,
+            client=client
+        )
+
+    @staticmethod
+    def _parse_update(client, update: types.UpdateMessagePoll):
+        if update.poll is not None:
+            return Poll._parse(client, update)
+
+        results = update.results.results
+        chosen_option = None
+        options = []
+
+        for i, result in enumerate(results):
+            if result.chosen:
+                chosen_option = i
+
+            options.append(
+                PollOption(
+                    text="",
+                    voter_count=result.voters,
+                    data=result.option,
+                    client=client
+                )
+            )
+
+        return Poll(
+            id=str(update.poll_id),
+            question="",
+            options=options,
+            is_closed=False,
+            total_voters=update.results.total_voters,
+            chosen_option=chosen_option,
             client=client
         )
diff --git a/pyrogram/client/types/messages_and_media/poll_option.py b/pyrogram/client/types/messages_and_media/poll_option.py
index c45c1db2..35f6b071 100644
--- a/pyrogram/client/types/messages_and_media/poll_option.py
+++ b/pyrogram/client/types/messages_and_media/poll_option.py
@@ -17,36 +17,36 @@
 # along with Pyrogram.  If not, see .
 
 import pyrogram
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class PollOption(PyrogramType):
-    """This object represents a Poll Option.
+class PollOption(Object):
+    """Contains information about one answer option in a poll.
 
-    Args:
+    Parameters:
         text (``str``):
-            Text of the poll option.
+            Option text, 1-100 characters.
 
-        voters (``int``):
-            The number of users who voted this option.
-            It will be 0 until you vote for the poll.
+        voter_count (``int``):
+            Number of users that voted for this option.
+            Equals to 0 until you vote.
 
         data (``bytes``):
-            Unique data that identifies this option among all the other options in a poll.
+            The data this poll option is holding.
     """
 
-    __slots__ = ["text", "voters", "data"]
+    __slots__ = ["text", "voter_count", "data"]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         text: str,
-        voters: int,
+        voter_count: int,
         data: bytes
     ):
         super().__init__(client)
 
         self.text = text
-        self.voters = voters
+        self.voter_count = voter_count
         self.data = data
diff --git a/pyrogram/client/types/messages_and_media/sticker.py b/pyrogram/client/types/messages_and_media/sticker.py
index 1ae2c23e..78fdda38 100644
--- a/pyrogram/client/types/messages_and_media/sticker.py
+++ b/pyrogram/client/types/messages_and_media/sticker.py
@@ -18,19 +18,20 @@
 
 from functools import lru_cache
 from struct import pack
+from typing import List
 
 import pyrogram
 from pyrogram.api import types, functions
 from pyrogram.errors import StickersetInvalid
-from .photo_size import PhotoSize
-from ..pyrogram_type import PyrogramType
+from .thumbnail import Thumbnail
+from ..object import Object
 from ...ext.utils import encode
 
 
-class Sticker(PyrogramType):
-    """This object represents a sticker.
+class Sticker(Object):
+    """A sticker.
 
-    Args:
+    Parameters:
         file_id (``str``):
             Unique identifier for this file.
 
@@ -40,9 +41,6 @@ class Sticker(PyrogramType):
         height (``int``):
             Sticker height.
 
-        thumb (:obj:`PhotoSize `, *optional*):
-            Sticker thumbnail in the .webp or .jpg format.
-
         file_name (``str``, *optional*):
             Sticker file name.
 
@@ -60,33 +58,35 @@ class Sticker(PyrogramType):
 
         set_name (``str``, *optional*):
             Name of the sticker set to which the sticker belongs.
+
+        thumbs (List of :obj:`Thumbnail`, *optional*):
+            Sticker thumbnails in the .webp or .jpg format.
     """
 
     # TODO: Add mask position
 
     __slots__ = [
-        "file_id", "thumb", "file_name", "mime_type", "file_size", "date", "width", "height", "emoji", "set_name"
+        "file_id", "file_name", "mime_type", "file_size", "date", "width", "height", "emoji", "set_name", "thumbs"
     ]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         file_id: str,
         width: int,
         height: int,
-        thumb: PhotoSize = None,
         file_name: str = None,
         mime_type: str = None,
         file_size: int = None,
         date: int = None,
         emoji: str = None,
-        set_name: str = None
+        set_name: str = None,
+        thumbs: List[Thumbnail] = None
     ):
         super().__init__(client)
 
         self.file_id = file_id
-        self.thumb = thumb
         self.file_name = file_name
         self.mime_type = mime_type
         self.file_size = file_size
@@ -95,6 +95,7 @@ class Sticker(PyrogramType):
         self.height = height
         self.emoji = emoji
         self.set_name = set_name
+        self.thumbs = thumbs
         # self.mask_position = mask_position
 
     @staticmethod
@@ -135,7 +136,6 @@ class Sticker(PyrogramType):
             ),
             width=image_size_attributes.w if image_size_attributes else 0,
             height=image_size_attributes.h if image_size_attributes else 0,
-            thumb=PhotoSize._parse(client, sticker.thumbs),
             # TODO: mask_position
             set_name=set_name,
             emoji=sticker_attributes.alt or None,
@@ -143,5 +143,6 @@ class Sticker(PyrogramType):
             mime_type=sticker.mime_type,
             file_name=file_name,
             date=sticker.date,
+            thumbs=Thumbnail._parse(client, sticker),
             client=client
         )
diff --git a/pyrogram/client/types/messages_and_media/user_profile_photos.py b/pyrogram/client/types/messages_and_media/stripped_thumbnail.py
similarity index 53%
rename from pyrogram/client/types/messages_and_media/user_profile_photos.py
rename to pyrogram/client/types/messages_and_media/stripped_thumbnail.py
index f162b077..1c967042 100644
--- a/pyrogram/client/types/messages_and_media/user_profile_photos.py
+++ b/pyrogram/client/types/messages_and_media/stripped_thumbnail.py
@@ -16,42 +16,34 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from typing import List
-
 import pyrogram
-from .photo import Photo
-from ..pyrogram_type import PyrogramType
+from pyrogram.api import types
+from ..object import Object
 
 
-class UserProfilePhotos(PyrogramType):
-    """This object represents a user's profile pictures.
+class StrippedThumbnail(Object):
+    """A stripped thumbnail
 
-    Args:
-        total_count (``int``):
-            Total number of profile pictures the target user has.
-
-        photos (List of :obj:`Photo `):
-            Requested profile pictures.
+    Parameters:
+        data (``bytes``):
+            Thumbnail data
     """
 
-    __slots__ = ["total_count", "photos"]
+    __slots__ = ["data"]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
-        total_count: int,
-        photos: List[Photo]
+        client: "pyrogram.BaseClient" = None,
+        data: bytes
     ):
         super().__init__(client)
 
-        self.total_count = total_count
-        self.photos = photos
+        self.data = data
 
     @staticmethod
-    def _parse(client, photos) -> "UserProfilePhotos":
-        return UserProfilePhotos(
-            total_count=getattr(photos, "count", len(photos.photos)),
-            photos=[Photo._parse(client, photo) for photo in photos.photos],
+    def _parse(client, stripped_thumbnail: types.PhotoStrippedSize) -> "StrippedThumbnail":
+        return StrippedThumbnail(
+            data=stripped_thumbnail.bytes,
             client=client
         )
diff --git a/pyrogram/client/types/messages_and_media/thumbnail.py b/pyrogram/client/types/messages_and_media/thumbnail.py
new file mode 100644
index 00000000..ee173b1c
--- /dev/null
+++ b/pyrogram/client/types/messages_and_media/thumbnail.py
@@ -0,0 +1,105 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from struct import pack
+from typing import Union, List
+
+import pyrogram
+from pyrogram.api import types
+from pyrogram.client.ext.utils import encode
+from .stripped_thumbnail import StrippedThumbnail
+from ..object import Object
+
+
+class Thumbnail(Object):
+    """One size of a photo or a file/sticker thumbnail.
+
+    Parameters:
+        file_id (``str``):
+            Unique identifier for this file.
+
+        width (``int``):
+            Photo width.
+
+        height (``int``):
+            Photo height.
+
+        file_size (``int``):
+            File size.
+    """
+
+    __slots__ = ["file_id", "width", "height", "file_size"]
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.BaseClient" = None,
+        file_id: str,
+        width: int,
+        height: int,
+        file_size: int
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.width = width
+        self.height = height
+        self.file_size = file_size
+
+    @staticmethod
+    def _parse(
+        client,
+        media: Union[types.Photo, types.Document]
+    ) -> Union[List[Union[StrippedThumbnail, "Thumbnail"]], None]:
+        if isinstance(media, types.Photo):
+            raw_thumbnails = media.sizes[:-1]
+            media_type = 0
+        elif isinstance(media, types.Document):
+            raw_thumbnails = media.thumbs
+            media_type = 14
+
+            if not raw_thumbnails:
+                return None
+        else:
+            return None
+
+        thumbnails = []
+
+        for thumbnail in raw_thumbnails:
+            # TODO: Enable this
+            # if isinstance(thumbnail, types.PhotoStrippedSize):
+            #     thumbnails.append(StrippedThumbnail._parse(client, thumbnail))
+            if isinstance(thumbnail, types.PhotoSize):
+                thumbnails.append(
+                    Thumbnail(
+                        file_id=encode(
+                            pack(
+                                "`):
+    Parameters:
+        location (:obj:`Location`):
             Venue location.
 
         title (``str``):
@@ -49,7 +49,7 @@ class Venue(PyrogramType):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         location: Location,
         title: str,
         address: str,
diff --git a/pyrogram/client/types/messages_and_media/video.py b/pyrogram/client/types/messages_and_media/video.py
index caf34ce9..0a7f47cd 100644
--- a/pyrogram/client/types/messages_and_media/video.py
+++ b/pyrogram/client/types/messages_and_media/video.py
@@ -17,18 +17,19 @@
 # along with Pyrogram.  If not, see .
 
 from struct import pack
+from typing import List
 
 import pyrogram
 from pyrogram.api import types
-from .photo_size import PhotoSize
-from ..pyrogram_type import PyrogramType
+from .thumbnail import Thumbnail
+from ..object import Object
 from ...ext.utils import encode
 
 
-class Video(PyrogramType):
-    """This object represents a video file.
+class Video(Object):
+    """A video file.
 
-    Args:
+    Parameters:
         file_id (``str``):
             Unique identifier for this file.
 
@@ -41,53 +42,65 @@ class Video(PyrogramType):
         duration (``int``):
             Duration of the video in seconds as defined by sender.
 
-        thumb (:obj:`PhotoSize `, *optional*):
-            Video thumbnail.
-
         file_name (``str``, *optional*):
             Video file name.
 
         mime_type (``str``, *optional*):
             Mime type of a file as defined by sender.
 
+        supports_streaming (``bool``, *optional*):
+            True, if the video was uploaded with streaming support.
+
         file_size (``int``, *optional*):
             File size.
 
         date (``int``, *optional*):
             Date the video was sent in Unix time.
+
+        thumbs (List of :obj:`Thumbnail`, *optional*):
+            Video thumbnails.
     """
 
-    __slots__ = ["file_id", "thumb", "file_name", "mime_type", "file_size", "date", "width", "height", "duration"]
+    __slots__ = [
+        "file_id", "width", "height", "duration", "file_name", "mime_type", "supports_streaming", "file_size", "date",
+        "thumbs"
+    ]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         file_id: str,
         width: int,
         height: int,
         duration: int,
-        thumb: PhotoSize = None,
         file_name: str = None,
         mime_type: str = None,
+        supports_streaming: bool = None,
         file_size: int = None,
-        date: int = None
+        date: int = None,
+        thumbs: List[Thumbnail] = None
     ):
         super().__init__(client)
 
         self.file_id = file_id
-        self.thumb = thumb
-        self.file_name = file_name
-        self.mime_type = mime_type
-        self.file_size = file_size
-        self.date = date
         self.width = width
         self.height = height
         self.duration = duration
+        self.file_name = file_name
+        self.mime_type = mime_type
+        self.supports_streaming = supports_streaming
+        self.file_size = file_size
+        self.date = date
+        self.thumbs = thumbs
 
     @staticmethod
-    def _parse(client, video: types.Document, video_attributes: types.DocumentAttributeVideo,
-               file_name: str) -> "Video":
+    def _parse(
+        client,
+        video: types.Document,
+        video_attributes: types.DocumentAttributeVideo,
+        file_name: str
+    ) -> "Video":
         return Video(
             file_id=encode(
                 pack(
@@ -101,10 +114,11 @@ class Video(PyrogramType):
             width=video_attributes.w,
             height=video_attributes.h,
             duration=video_attributes.duration,
-            thumb=PhotoSize._parse(client, video.thumbs),
-            mime_type=video.mime_type,
-            file_size=video.size,
             file_name=file_name,
+            mime_type=video.mime_type,
+            supports_streaming=video_attributes.supports_streaming,
+            file_size=video.size,
             date=video.date,
+            thumbs=Thumbnail._parse(client, video),
             client=client
         )
diff --git a/pyrogram/client/types/messages_and_media/video_note.py b/pyrogram/client/types/messages_and_media/video_note.py
index e6c2ab31..54c9ec8d 100644
--- a/pyrogram/client/types/messages_and_media/video_note.py
+++ b/pyrogram/client/types/messages_and_media/video_note.py
@@ -17,18 +17,19 @@
 # along with Pyrogram.  If not, see .
 
 from struct import pack
+from typing import List
 
 import pyrogram
 from pyrogram.api import types
-from .photo_size import PhotoSize
-from ..pyrogram_type import PyrogramType
+from .thumbnail import Thumbnail
+from ..object import Object
 from ...ext.utils import encode
 
 
-class VideoNote(PyrogramType):
-    """This object represents a video note.
+class VideoNote(Object):
+    """A video note.
 
-    Args:
+    Parameters:
         file_id (``str``):
             Unique identifier for this file.
 
@@ -38,9 +39,6 @@ class VideoNote(PyrogramType):
         duration (``int``):
             Duration of the video in seconds as defined by sender.
 
-        thumb (:obj:`PhotoSize `, *optional*):
-            Video thumbnail.
-
         mime_type (``str``, *optional*):
             MIME type of the file as defined by sender.
 
@@ -49,18 +47,21 @@ class VideoNote(PyrogramType):
 
         date (``int``, *optional*):
             Date the video note was sent in Unix time.
+
+        thumbs (List of :obj:`Thumbnail`, *optional*):
+            Video thumbnails.
     """
 
-    __slots__ = ["file_id", "thumb", "mime_type", "file_size", "date", "length", "duration"]
+    __slots__ = ["file_id", "mime_type", "file_size", "date", "length", "duration", "thumbs"]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         file_id: str,
         length: int,
         duration: int,
-        thumb: PhotoSize = None,
+        thumbs: List[Thumbnail] = None,
         mime_type: str = None,
         file_size: int = None,
         date: int = None
@@ -68,12 +69,12 @@ class VideoNote(PyrogramType):
         super().__init__(client)
 
         self.file_id = file_id
-        self.thumb = thumb
         self.mime_type = mime_type
         self.file_size = file_size
         self.date = date
         self.length = length
         self.duration = duration
+        self.thumbs = thumbs
 
     @staticmethod
     def _parse(client, video_note: types.Document, video_attributes: types.DocumentAttributeVideo) -> "VideoNote":
@@ -89,9 +90,9 @@ class VideoNote(PyrogramType):
             ),
             length=video_attributes.w,
             duration=video_attributes.duration,
-            thumb=PhotoSize._parse(client, video_note.thumbs),
             file_size=video_note.size,
             mime_type=video_note.mime_type,
             date=video_note.date,
+            thumbs=Thumbnail._parse(client, video_note),
             client=client
         )
diff --git a/pyrogram/client/types/messages_and_media/voice.py b/pyrogram/client/types/messages_and_media/voice.py
index b4063088..e4256197 100644
--- a/pyrogram/client/types/messages_and_media/voice.py
+++ b/pyrogram/client/types/messages_and_media/voice.py
@@ -20,14 +20,14 @@ from struct import pack
 
 import pyrogram
 from pyrogram.api import types
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 from ...ext.utils import encode
 
 
-class Voice(PyrogramType):
-    """This object represents a voice note.
+class Voice(Object):
+    """A voice note.
 
-    Args:
+    Parameters:
         file_id (``str``):
             Unique identifier for this file.
 
@@ -52,7 +52,7 @@ class Voice(PyrogramType):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         file_id: str,
         duration: int,
         waveform: bytes = None,
diff --git a/pyrogram/client/types/object.py b/pyrogram/client/types/object.py
new file mode 100644
index 00000000..4d482e63
--- /dev/null
+++ b/pyrogram/client/types/object.py
@@ -0,0 +1,85 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2019 Dan Tès 
+#
+# 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 .
+
+from collections import OrderedDict
+from datetime import datetime
+from json import dumps
+
+import pyrogram
+
+
+class Meta(type, metaclass=type("", (type,), {"__str__": lambda _: "~hi"})):
+    def __str__(self):
+        return "".format(self.__name__)
+
+
+class Object(metaclass=Meta):
+    __slots__ = ["_client"]
+
+    def __init__(self, client: "pyrogram.BaseClient" = None):
+        self._client = client
+
+        if self._client is None:
+            del self._client
+
+    @staticmethod
+    def default(obj: "Object"):
+        if isinstance(obj, bytes):
+            return repr(obj)
+
+        return OrderedDict(
+            [("_", "pyrogram." + obj.__class__.__name__)]
+            + [
+                (attr, "*" * len(getattr(obj, attr)))
+                if attr == "phone_number"
+                else (attr, str(datetime.fromtimestamp(getattr(obj, attr))))
+                if attr.endswith("date")
+                else (attr, getattr(obj, attr))
+                for attr in obj.__slots__
+                if getattr(obj, attr) is not None
+            ]
+        )
+
+    def __str__(self) -> str:
+        return dumps(self, indent=4, default=Object.default, ensure_ascii=False)
+
+    def __repr__(self) -> str:
+        return "pyrogram.{}({})".format(
+            self.__class__.__name__,
+            ", ".join(
+                "{}={}".format(attr, repr(getattr(self, attr)))
+                for attr in self.__slots__
+                if getattr(self, attr) is not None
+            )
+        )
+
+    def __eq__(self, other: "Object") -> bool:
+        for attr in self.__slots__:
+            try:
+                if getattr(self, attr) != getattr(other, attr):
+                    return False
+            except AttributeError:
+                return False
+
+        return True
+
+    def __getitem__(self, item):
+        return getattr(self, item)
+
+    def __setitem__(self, key, value):
+        setattr(self, key, value)
diff --git a/pyrogram/client/types/pyrogram_type.py b/pyrogram/client/types/pyrogram_type.py
deleted file mode 100644
index af828926..00000000
--- a/pyrogram/client/types/pyrogram_type.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017-2019 Dan Tès 
-#
-# 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 .
-
-from collections import OrderedDict
-from json import dumps
-
-import pyrogram
-
-
-class PyrogramType:
-    __slots__ = ["_client"]
-
-    def __init__(self, client: "pyrogram.client.ext.BaseClient"):
-        self._client = client
-
-    def __str__(self):
-        return dumps(self, indent=4, default=default, ensure_ascii=False)
-
-    def __getitem__(self, item):
-        return getattr(self, item)
-
-
-def remove_none(obj):
-    if isinstance(obj, (list, tuple, set)):
-        return type(obj)(remove_none(x) for x in obj if x is not None)
-    elif isinstance(obj, dict):
-        return type(obj)((remove_none(k), remove_none(v)) for k, v in obj.items() if k is not None and v is not None)
-    else:
-        return obj
-
-
-def default(o: PyrogramType):
-    try:
-        content = {i: getattr(o, i) for i in o.__slots__}
-
-        return remove_none(
-            OrderedDict(
-                [("_", "pyrogram." + o.__class__.__name__)]
-                + [i for i in content.items()]
-            )
-        )
-    except AttributeError:
-        return repr(o)
diff --git a/pyrogram/client/types/user_and_chats/__init__.py b/pyrogram/client/types/user_and_chats/__init__.py
index 2059589a..922ac86a 100644
--- a/pyrogram/client/types/user_and_chats/__init__.py
+++ b/pyrogram/client/types/user_and_chats/__init__.py
@@ -18,16 +18,13 @@
 
 from .chat import Chat
 from .chat_member import ChatMember
-from .chat_members import ChatMembers
 from .chat_permissions import ChatPermissions
 from .chat_photo import ChatPhoto
 from .chat_preview import ChatPreview
 from .dialog import Dialog
-from .dialogs import Dialogs
 from .user import User
 from .user_status import UserStatus
 
 __all__ = [
-    "Chat", "ChatMember", "ChatMembers", "ChatPermissions", "ChatPhoto", "ChatPreview", "Dialog", "Dialogs", "User",
-    "UserStatus"
+    "Chat", "ChatMember", "ChatPermissions", "ChatPhoto", "ChatPreview", "Dialog", "User", "UserStatus"
 ]
diff --git a/pyrogram/client/types/user_and_chats/chat.py b/pyrogram/client/types/user_and_chats/chat.py
index a13f8a2b..2d88d3ed 100644
--- a/pyrogram/client/types/user_and_chats/chat.py
+++ b/pyrogram/client/types/user_and_chats/chat.py
@@ -22,76 +22,94 @@ import pyrogram
 from pyrogram.api import types
 from .chat_permissions import ChatPermissions
 from .chat_photo import ChatPhoto
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class Chat(PyrogramType):
-    """This object represents a chat.
+class Chat(Object):
+    """A chat.
 
-    Args:
+    Parameters:
         id (``int``):
             Unique identifier for this chat.
 
         type (``str``):
-            Type of chat, can be either "private", "group", "supergroup" or "channel".
+            Type of chat, can be either "private", "bot", "group", "supergroup" or "channel".
+
+        is_verified (``bool``, *optional*):
+            True, if this chat has been verified by Telegram. Supergroups, channels and bots only.
+
+        is_restricted (``bool``, *optional*):
+            True, if this chat has been restricted. Supergroups, channels and bots only.
+            See *restriction_reason* for details.
+
+        is_scam (``bool``, *optional*):
+            True, if this chat has been flagged for scam. Supergroups, channels and bots only.
+
+        is_support (``bool``):
+            True, if this chat is part of the Telegram support team. Users and bots only.
 
         title (``str``, *optional*):
             Title, for supergroups, channels and basic group chats.
 
         username (``str``, *optional*):
-            Username, for private chats, supergroups and channels if available.
+            Username, for private chats, bots, supergroups and channels if available.
 
         first_name (``str``, *optional*):
-            First name of the other party in a private chat.
+            First name of the other party in a private chat, for private chats and bots.
 
         last_name (``str``, *optional*):
-            Last name of the other party in a private chat.
+            Last name of the other party in a private chat, for private chats.
 
-        photo (:obj:`ChatPhoto `, *optional*):
+        photo (:obj:`ChatPhoto`, *optional*):
             Chat photo. Suitable for downloads only.
 
         description (``str``, *optional*):
-            Description, for supergroups and channel chats.
-            Returned only in :meth:`get_chat() `.
+            Bio, for private chats and bots or description for groups, supergroups and channels.
+            Returned only in :meth:`~Client.get_chat`.
 
         invite_link (``str``, *optional*):
-            Chat invite link, for supergroups and channel chats.
-            Returned only in :meth:`get_chat() `.
+            Chat invite link, for groups, supergroups and channels.
+            Returned only in :meth:`~Client.get_chat`.
 
-        pinned_message (:obj:`Message `, *optional*):
-            Pinned message, for supergroups and channel chats.
-            Returned only in :meth:`get_chat() `.
+        pinned_message (:obj:`Message`, *optional*):
+            Pinned message, for groups, supergroups channels and own chat.
+            Returned only in :meth:`~Client.get_chat`.
 
         sticker_set_name (``str``, *optional*):
             For supergroups, name of group sticker set.
-            Returned only in :meth:`get_chat() `.
+            Returned only in :meth:`~Client.get_chat`.
 
         can_set_sticker_set (``bool``, *optional*):
             True, if the group sticker set can be changed by you.
-            Returned only in :meth:`get_chat() `.
+            Returned only in :meth:`~Client.get_chat`.
 
         members_count (``int``, *optional*):
-            Chat members count, for groups and channels only.
+            Chat members count, for groups, supergroups and channels only.
 
         restriction_reason (``str``, *optional*):
             The reason why this chat might be unavailable to some users.
+            This field is available only in case *is_restricted* is True.
 
-        permissions (:obj:`ChatPermissions ` *optional*):
-            Information about the chat default permissions.
+        permissions (:obj:`ChatPermissions` *optional*):
+            Information about the chat default permissions, for groups and supergroups.
     """
 
     __slots__ = [
-        "id", "type", "title", "username", "first_name", "last_name", "photo", "description", "invite_link",
-        "pinned_message", "sticker_set_name", "can_set_sticker_set", "members_count", "restriction_reason",
-        "permissions"
+        "id", "type", "is_verified", "is_restricted", "is_scam", "is_support", "title", "username", "first_name",
+        "last_name", "photo", "description", "invite_link", "pinned_message", "sticker_set_name", "can_set_sticker_set",
+        "members_count", "restriction_reason", "permissions"
     ]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         id: int,
         type: str,
+        is_verified: bool = None,
+        is_restricted: bool = None,
+        is_scam: bool = None,
+        is_support: bool = None,
         title: str = None,
         username: str = None,
         first_name: str = None,
@@ -110,6 +128,10 @@ class Chat(PyrogramType):
 
         self.id = id
         self.type = type
+        self.is_verified = is_verified
+        self.is_restricted = is_restricted
+        self.is_scam = is_scam
+        self.is_support = is_support
         self.title = title
         self.username = username
         self.first_name = first_name
@@ -126,36 +148,49 @@ class Chat(PyrogramType):
 
     @staticmethod
     def _parse_user_chat(client, user: types.User) -> "Chat":
+        peer_id = user.id
+
         return Chat(
-            id=user.id,
-            type="private",
+            id=peer_id,
+            type="bot" if user.bot else "private",
+            is_verified=getattr(user, "verified", None),
+            is_restricted=getattr(user, "restricted", None),
+            is_scam=getattr(user, "scam", None),
+            is_support=getattr(user, "support", None),
             username=user.username,
             first_name=user.first_name,
             last_name=user.last_name,
-            photo=ChatPhoto._parse(client, user.photo),
+            photo=ChatPhoto._parse(client, user.photo, peer_id),
             restriction_reason=user.restriction_reason,
             client=client
         )
 
     @staticmethod
     def _parse_chat_chat(client, chat: types.Chat) -> "Chat":
+        peer_id = -chat.id
+
         return Chat(
-            id=-chat.id,
+            id=peer_id,
             type="group",
             title=chat.title,
-            photo=ChatPhoto._parse(client, getattr(chat, "photo", None)),
+            photo=ChatPhoto._parse(client, getattr(chat, "photo", None), peer_id),
             permissions=ChatPermissions._parse(getattr(chat, "default_banned_rights", None)),
             client=client
         )
 
     @staticmethod
     def _parse_channel_chat(client, channel: types.Channel) -> "Chat":
+        peer_id = int("-100" + str(channel.id))
+
         return Chat(
-            id=int("-100" + str(channel.id)),
+            id=peer_id,
             type="supergroup" if channel.megagroup else "channel",
+            is_verified=getattr(channel, "verified", None),
+            is_restricted=getattr(channel, "restricted", None),
+            is_scam=getattr(channel, "scam", None),
             title=channel.title,
             username=getattr(channel, "username", None),
-            photo=ChatPhoto._parse(client, getattr(channel, "photo", None)),
+            photo=ChatPhoto._parse(client, getattr(channel, "photo", None), peer_id),
             restriction_reason=getattr(channel, "restriction_reason", None),
             permissions=ChatPermissions._parse(getattr(channel, "default_banned_rights", None)),
             client=client
@@ -185,6 +220,12 @@ class Chat(PyrogramType):
         if isinstance(chat_full, types.UserFull):
             parsed_chat = Chat._parse_user_chat(client, chat_full.user)
             parsed_chat.description = chat_full.about
+
+            if chat_full.pinned_msg_id:
+                parsed_chat.pinned_message = client.get_messages(
+                    parsed_chat.id,
+                    message_ids=chat_full.pinned_msg_id
+                )
         else:
             full_chat = chat_full.full_chat
             chat = None
@@ -225,3 +266,49 @@ class Chat(PyrogramType):
             return Chat._parse_user_chat(client, chat)
         else:
             return Chat._parse_channel_chat(client, chat)
+
+    def archive(self):
+        """Bound method *archive* of :obj:`Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.archive_chats(-100123456789)
+
+        Example:
+            .. code-block:: python
+
+                chat.archive()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return self._client.archive_chats(self.id)
+
+    def unarchive(self):
+        """Bound method *unarchive* of :obj:`Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.unarchive_chats(-100123456789)
+
+        Example:
+            .. code-block:: python
+
+                chat.unarchive()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return self._client.unarchive_chats(self.id)
diff --git a/pyrogram/client/types/user_and_chats/chat_member.py b/pyrogram/client/types/user_and_chats/chat_member.py
index 35911210..7451012c 100644
--- a/pyrogram/client/types/user_and_chats/chat_member.py
+++ b/pyrogram/client/types/user_and_chats/chat_member.py
@@ -19,14 +19,14 @@
 import pyrogram
 
 from pyrogram.api import types
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class ChatMember(PyrogramType):
-    """This object contains information about one member of a chat.
+class ChatMember(Object):
+    """Contains information about one member of a chat.
 
-    Args:
-        user (:obj:`User `):
+    Parameters:
+        user (:obj:`User`):
             Information about the user.
 
         status (``str``):
@@ -36,30 +36,34 @@ class ChatMember(PyrogramType):
         date (``int``, *optional*):
             Date when the user joined, unix time. Not available for creator.
 
-        invited_by (:obj:`User `, *optional*):
+        is_member (``bool``, *optional*):
+            Restricted only. True, if the user is a member of the chat at the moment of the request.
+
+        invited_by (:obj:`User`, *optional*):
             Administrators and self member only. Information about the user who invited this member.
             In case the user joined by himself this will be the same as "user".
 
-        promoted_by (:obj:`User `, *optional*):
+        promoted_by (:obj:`User`, *optional*):
             Administrators only. Information about the user who promoted this member as administrator.
 
-        restricted_by (:obj:`User `, *optional*):
+        restricted_by (:obj:`User`, *optional*):
             Restricted and kicked only. Information about the user who restricted or kicked this member.
 
-        permissions (:obj:`ChatPermissions ` *optional*):
+        permissions (:obj:`ChatPermissions` *optional*):
             Administrators, restricted and kicked members only.
             Information about the member permissions.
     """
 
-    __slots__ = ["user", "status", "date", "invited_by", "promoted_by", "restricted_by", "permissions"]
+    __slots__ = ["user", "status", "date", "is_member", "invited_by", "promoted_by", "restricted_by", "permissions"]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         user: "pyrogram.User",
         status: str,
         date: int = None,
+        is_member: bool = None,
         invited_by: "pyrogram.User" = None,
         promoted_by: "pyrogram.User" = None,
         restricted_by: "pyrogram.User" = None,
@@ -70,6 +74,7 @@ class ChatMember(PyrogramType):
         self.user = user
         self.status = status
         self.date = date
+        self.is_member = is_member
         self.invited_by = invited_by
         self.promoted_by = promoted_by
         self.restricted_by = restricted_by
@@ -123,12 +128,9 @@ class ChatMember(PyrogramType):
         if isinstance(member, types.ChannelParticipantBanned):
             return ChatMember(
                 user=user,
-                status=(
-                    "kicked" if member.banned_rights.view_messages
-                    else "left" if member.left
-                    else "restricted"
-                ),
+                status="kicked" if member.banned_rights.view_messages else "restricted",
                 date=member.date,
+                is_member=not member.left,
                 restricted_by=pyrogram.User._parse(client, users[member.kicked_by]),
                 permissions=pyrogram.ChatPermissions._parse(member),
                 client=client
diff --git a/pyrogram/client/types/user_and_chats/chat_members.py b/pyrogram/client/types/user_and_chats/chat_members.py
deleted file mode 100644
index 3c89b124..00000000
--- a/pyrogram/client/types/user_and_chats/chat_members.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017-2019 Dan Tès 
-#
-# 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 .
-
-from typing import List
-
-import pyrogram
-from pyrogram.api import types
-from .chat_member import ChatMember
-from ..pyrogram_type import PyrogramType
-
-
-class ChatMembers(PyrogramType):
-    """This object contains information about the members list of a chat.
-
-    Args:
-        total_count (``int``):
-            Total number of members the chat has.
-
-        chat_members (List of :obj:`ChatMember `):
-            Requested chat members.
-    """
-
-    __slots__ = ["total_count", "chat_members"]
-
-    def __init__(
-        self,
-        *,
-        client: "pyrogram.client.ext.BaseClient",
-        total_count: int,
-        chat_members: List[ChatMember]
-    ):
-        super().__init__(client)
-
-        self.total_count = total_count
-        self.chat_members = chat_members
-
-    @staticmethod
-    def _parse(client, members):
-        users = {i.id: i for i in members.users}
-        chat_members = []
-
-        if isinstance(members, types.channels.ChannelParticipants):
-            total_count = members.count
-            members = members.participants
-        else:
-            members = members.full_chat.participants.participants
-            total_count = len(members)
-
-        for member in members:
-            chat_members.append(ChatMember._parse(client, member, users))
-
-        return ChatMembers(
-            total_count=total_count,
-            chat_members=chat_members,
-            client=client
-        )
diff --git a/pyrogram/client/types/user_and_chats/chat_permissions.py b/pyrogram/client/types/user_and_chats/chat_permissions.py
index 7b35b1d0..84099955 100644
--- a/pyrogram/client/types/user_and_chats/chat_permissions.py
+++ b/pyrogram/client/types/user_and_chats/chat_permissions.py
@@ -19,16 +19,16 @@
 from typing import Union
 
 from pyrogram.api import types
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class ChatPermissions(PyrogramType):
-    """This object represents both a chat default permissions and a single member permissions within a chat.
+class ChatPermissions(Object):
+    """A chat default permissions and a single member permissions within a chat.
 
     Some permissions make sense depending on the context: default chat permissions, restricted/kicked member or
     administrators in groups or channels.
 
-    Args:
+    Parameters:
         until_date (``int``, *optional*):
             Applicable to restricted and kicked members only.
             Date when user restrictions will be lifted, unix time.
diff --git a/pyrogram/client/types/user_and_chats/chat_photo.py b/pyrogram/client/types/user_and_chats/chat_photo.py
index 6fbc779d..1584a286 100644
--- a/pyrogram/client/types/user_and_chats/chat_photo.py
+++ b/pyrogram/client/types/user_and_chats/chat_photo.py
@@ -20,14 +20,14 @@ from struct import pack
 
 import pyrogram
 from pyrogram.api import types
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 from ...ext.utils import encode
 
 
-class ChatPhoto(PyrogramType):
-    """This object represents a chat photo.
+class ChatPhoto(Object):
+    """A chat photo.
 
-    Args:
+    Parameters:
         small_file_id (``str``):
             Unique file identifier of small (160x160) chat photo. This file_id can be used only for photo download.
 
@@ -40,7 +40,7 @@ class ChatPhoto(PyrogramType):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         small_file_id: str,
         big_file_id: str
     ):
@@ -50,31 +50,24 @@ class ChatPhoto(PyrogramType):
         self.big_file_id = big_file_id
 
     @staticmethod
-    def _parse(client, chat_photo: types.UserProfilePhoto or types.ChatPhoto):
+    def _parse(client, chat_photo: types.UserProfilePhoto or types.ChatPhoto, peer_id: int):
         if not isinstance(chat_photo, (types.UserProfilePhoto, types.ChatPhoto)):
             return None
 
-        if not isinstance(chat_photo.photo_small, types.FileLocation):
-            return None
-
-        if not isinstance(chat_photo.photo_big, types.FileLocation):
-            return None
-
-        photo_id = getattr(chat_photo, "photo_id", 0)
         loc_small = chat_photo.photo_small
         loc_big = chat_photo.photo_big
 
         return ChatPhoto(
             small_file_id=encode(
                 pack(
-                    "`):
             Conversation the dialog belongs to.
 
-        top_message (:obj:`Message `):
+        top_message (:obj:`Message`):
             The last message sent in the dialog at this time.
 
         unread_messages_count (``int``):
-            Amount of unread messages in this dialogs.
+            Amount of unread messages in this dialog.
 
         unread_mentions_count (``int``):
             Amount of unread messages containing a mention in this dialog.
@@ -51,7 +51,7 @@ class Dialog(PyrogramType):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         chat: Chat,
         top_message: "pyrogram.Message",
         unread_messages_count: int,
@@ -69,7 +69,7 @@ class Dialog(PyrogramType):
         self.is_pinned = is_pinned
 
     @staticmethod
-    def _parse(client, dialog, messages, users, chats) -> "Dialog":
+    def _parse(client, dialog: types.Dialog, messages, users, chats) -> "Dialog":
         chat_id = dialog.peer
 
         if isinstance(chat_id, types.PeerUser):
diff --git a/pyrogram/client/types/user_and_chats/dialogs.py b/pyrogram/client/types/user_and_chats/dialogs.py
deleted file mode 100644
index 431cca8d..00000000
--- a/pyrogram/client/types/user_and_chats/dialogs.py
+++ /dev/null
@@ -1,79 +0,0 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017-2019 Dan Tès 
-#
-# 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 .
-
-from typing import List
-
-import pyrogram
-from pyrogram.api import types
-from .dialog import Dialog
-from ..messages_and_media import Message
-from ..pyrogram_type import PyrogramType
-
-
-class Dialogs(PyrogramType):
-    """This object represents a user's dialogs chunk.
-
-    Args:
-        total_count (``int``):
-            Total number of dialogs the user has.
-
-        dialogs (List of :obj:`Dialog `):
-            Requested dialogs.
-    """
-
-    __slots__ = ["total_count", "dialogs"]
-
-    def __init__(
-        self,
-        *,
-        client: "pyrogram.client.ext.BaseClient",
-        total_count: int,
-        dialogs: List[Dialog]
-    ):
-        super().__init__(client)
-
-        self.total_count = total_count
-        self.dialogs = dialogs
-
-    @staticmethod
-    def _parse(client, dialogs) -> "Dialogs":
-        users = {i.id: i for i in dialogs.users}
-        chats = {i.id: i for i in dialogs.chats}
-
-        messages = {}
-
-        for message in dialogs.messages:
-            to_id = message.to_id
-
-            if isinstance(to_id, types.PeerUser):
-                if message.out:
-                    chat_id = to_id.user_id
-                else:
-                    chat_id = message.from_id
-            elif isinstance(to_id, types.PeerChat):
-                chat_id = -to_id.chat_id
-            else:
-                chat_id = int("-100" + str(to_id.channel_id))
-
-            messages[chat_id] = Message._parse(client, message, users, chats)
-
-        return Dialogs(
-            total_count=getattr(dialogs, "count", len(dialogs.dialogs)),
-            dialogs=[Dialog._parse(client, dialog, messages, users, chats) for dialog in dialogs.dialogs],
-            client=client
-        )
diff --git a/pyrogram/client/types/user_and_chats/user.py b/pyrogram/client/types/user_and_chats/user.py
index 5718b917..f47e8c42 100644
--- a/pyrogram/client/types/user_and_chats/user.py
+++ b/pyrogram/client/types/user_and_chats/user.py
@@ -20,13 +20,13 @@ import pyrogram
 from pyrogram.api import types
 from .chat_photo import ChatPhoto
 from .user_status import UserStatus
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 
 
-class User(PyrogramType):
-    """This object represents a Telegram user or bot.
+class User(Object):
+    """A Telegram user or bot.
 
-    Args:
+    Parameters:
         id (``int``):
             Unique identifier for this user or bot.
 
@@ -45,6 +45,19 @@ class User(PyrogramType):
         is_bot (``bool``):
             True, if this user is a bot.
 
+        is_verified (``bool``):
+            True, if this user has been verified by Telegram.
+
+        is_restricted (``bool``):
+            True, if this user has been restricted. Bots only.
+            See *restriction_reason* for details.
+
+        is_scam (``bool``):
+            True, if this user has been flagged for scam.
+
+        is_support (``bool``):
+            True, if this user is part of the Telegram support team.
+
         first_name (``str``):
             User's or bot's first name.
 
@@ -68,23 +81,29 @@ class User(PyrogramType):
 
         restriction_reason (``str``, *optional*):
             The reason why this bot might be unavailable to some users.
+            This field is available only in case *is_restricted* is True.
     """
 
     __slots__ = [
-        "id", "is_self", "is_contact", "is_mutual_contact", "is_deleted", "is_bot", "first_name", "last_name", "status",
-        "username", "language_code", "phone_number", "photo", "restriction_reason"
+        "id", "is_self", "is_contact", "is_mutual_contact", "is_deleted", "is_bot", "is_verified", "is_restricted",
+        "is_scam", "is_support", "first_name", "last_name", "status", "username", "language_code", "phone_number",
+        "photo", "restriction_reason"
     ]
 
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         id: int,
         is_self: bool,
         is_contact: bool,
         is_mutual_contact: bool,
         is_deleted: bool,
         is_bot: bool,
+        is_verified: bool,
+        is_restricted: bool,
+        is_scam: bool,
+        is_support: bool,
         first_name: str,
         last_name: str = None,
         status: UserStatus = None,
@@ -102,6 +121,10 @@ class User(PyrogramType):
         self.is_mutual_contact = is_mutual_contact
         self.is_deleted = is_deleted
         self.is_bot = is_bot
+        self.is_verified = is_verified
+        self.is_restricted = is_restricted
+        self.is_scam = is_scam
+        self.is_support = is_support
         self.first_name = first_name
         self.last_name = last_name
         self.status = status
@@ -123,13 +146,63 @@ class User(PyrogramType):
             is_mutual_contact=user.mutual_contact,
             is_deleted=user.deleted,
             is_bot=user.bot,
+            is_verified=user.verified,
+            is_restricted=user.restricted,
+            is_scam=user.scam,
+            is_support=user.support,
             first_name=user.first_name,
             last_name=user.last_name,
             status=UserStatus._parse(client, user.status, user.id, user.bot),
             username=user.username,
             language_code=user.lang_code,
             phone_number=user.phone,
-            photo=ChatPhoto._parse(client, user.photo),
+            photo=ChatPhoto._parse(client, user.photo, user.id),
             restriction_reason=user.restriction_reason,
             client=client
         )
+
+    def archive(self):
+        """Bound method *archive* of :obj:`User`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.archive_chats(123456789)
+
+        Example:
+            .. code-block:: python
+
+                user.archive()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return self._client.archive_chats(self.id)
+
+    def unarchive(self):
+        """Bound method *unarchive* of :obj:`User`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.unarchive_chats(123456789)
+
+        Example:
+            .. code-block:: python
+
+                user.unarchive()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return self._client.unarchive_chats(self.id)
diff --git a/pyrogram/client/types/user_and_chats/user_status.py b/pyrogram/client/types/user_and_chats/user_status.py
index 170ce373..4d12afc1 100644
--- a/pyrogram/client/types/user_and_chats/user_status.py
+++ b/pyrogram/client/types/user_and_chats/user_status.py
@@ -19,19 +19,19 @@
 import pyrogram
 
 from pyrogram.api import types
-from ..pyrogram_type import PyrogramType
+from ..object import Object
 from ..update import Update
 
 
-class UserStatus(PyrogramType, Update):
-    """This object represents a User status (Last Seen privacy).
+class UserStatus(Object, Update):
+    """A User status (Last Seen privacy).
 
     .. note::
 
         You won't see exact last seen timestamps for people with whom you don't share your own. Instead, you get
         "recently", "within_week", "within_month" or "long_time_ago" fields set.
 
-    Args:
+    Parameters:
         user_id (``int``):
             User's id.
 
@@ -70,7 +70,7 @@ class UserStatus(PyrogramType, Update):
     def __init__(
         self,
         *,
-        client: "pyrogram.client.ext.BaseClient",
+        client: "pyrogram.BaseClient" = None,
         user_id: int,
         online: bool = None,
         offline: bool = None,
diff --git a/pyrogram/crypto/aes.py b/pyrogram/crypto/aes.py
index de275bd0..d603caa0 100644
--- a/pyrogram/crypto/aes.py
+++ b/pyrogram/crypto/aes.py
@@ -56,7 +56,7 @@ except ImportError:
     log.warning(
         "TgCrypto is missing! "
         "Pyrogram will work the same, but at a much slower speed. "
-        "More info: https://docs.pyrogram.ml/resources/TgCrypto"
+        "More info: https://docs.pyrogram.org/topics/tgcrypto"
     )
 
 
diff --git a/pyrogram/session/auth.py b/pyrogram/session/auth.py
index 89e5b61f..fb6e7ca3 100644
--- a/pyrogram/session/auth.py
+++ b/pyrogram/session/auth.py
@@ -23,7 +23,7 @@ from io import BytesIO
 from os import urandom
 
 from pyrogram.api import functions, types
-from pyrogram.api.core import Object, Long, Int
+from pyrogram.api.core import TLObject, Long, Int
 from pyrogram.connection import Connection
 from pyrogram.crypto import AES, RSA, Prime
 from .internals import MsgId
@@ -43,7 +43,7 @@ class Auth:
         self.connection = None
 
     @staticmethod
-    def pack(data: Object) -> bytes:
+    def pack(data: TLObject) -> bytes:
         return (
             bytes(8)
             + Long(MsgId())
@@ -54,9 +54,9 @@ class Auth:
     @staticmethod
     def unpack(b: BytesIO):
         b.seek(20)  # Skip auth_key_id (8), message_id (8) and message_length (4)
-        return Object.read(b)
+        return TLObject.read(b)
 
-    def send(self, data: Object):
+    def send(self, data: TLObject):
         data = self.pack(data)
         self.connection.send(data)
         response = BytesIO(self.connection.recv())
@@ -158,7 +158,7 @@ class Auth:
                 answer_with_hash = AES.ige256_decrypt(encrypted_answer, tmp_aes_key, tmp_aes_iv)
                 answer = answer_with_hash[20:]
 
-                server_dh_inner_data = Object.read(BytesIO(answer))
+                server_dh_inner_data = TLObject.read(BytesIO(answer))
 
                 log.debug("Done decrypting answer")
 
diff --git a/pyrogram/session/internals/msg_factory.py b/pyrogram/session/internals/msg_factory.py
index 7d922ec3..2b833ce8 100644
--- a/pyrogram/session/internals/msg_factory.py
+++ b/pyrogram/session/internals/msg_factory.py
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with Pyrogram.  If not, see .
 
-from pyrogram.api.core import Message, MsgContainer, Object
+from pyrogram.api.core import Message, MsgContainer, TLObject
 from pyrogram.api.functions import Ping
 from pyrogram.api.types import MsgsAck, HttpWait
 from .msg_id import MsgId
@@ -29,7 +29,7 @@ class MsgFactory:
     def __init__(self):
         self.seq_no = SeqNo()
 
-    def __call__(self, body: Object) -> Message:
+    def __call__(self, body: TLObject) -> Message:
         return Message(
             body,
             MsgId(),
diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py
index 8afaf7b6..bd7f0f26 100644
--- a/pyrogram/session/session.py
+++ b/pyrogram/session/session.py
@@ -30,7 +30,7 @@ import pyrogram
 from pyrogram import __copyright__, __license__, __version__
 from pyrogram.api import functions, types, core
 from pyrogram.api.all import layer
-from pyrogram.api.core import Message, Object, MsgContainer, Long, FutureSalt, Int
+from pyrogram.api.core import Message, TLObject, MsgContainer, Long, FutureSalt, Int
 from pyrogram.connection import Connection
 from pyrogram.crypto import AES, KDF
 from pyrogram.errors import RPCError, InternalServerError, AuthKeyDuplicated
@@ -351,7 +351,8 @@ class Session:
 
             # Seconds to wait until middle-overlap, which is
             # 15 minutes before/after the current/next salt end/start time
-            dt = (self.current_salt.valid_until - now).total_seconds() - 900
+            valid_until = datetime.fromtimestamp(self.current_salt.valid_until)
+            dt = (valid_until - now).total_seconds() - 900
 
             log.debug("Current salt: {} | Next salt in {:.0f}m {:.0f}s ({})".format(
                 self.current_salt.salt,
@@ -391,7 +392,7 @@ class Session:
 
         log.debug("RecvThread stopped")
 
-    def _send(self, data: Object, wait_response: bool = True, timeout: float = WAIT_TIMEOUT):
+    def _send(self, data: TLObject, wait_response: bool = True, timeout: float = WAIT_TIMEOUT):
         message = self.msg_factory(data)
         msg_id = message.msg_id
 
@@ -422,7 +423,7 @@ class Session:
             else:
                 return result
 
-    def send(self, data: Object, retries: int = MAX_RETRIES, timeout: float = WAIT_TIMEOUT):
+    def send(self, data: TLObject, retries: int = MAX_RETRIES, timeout: float = WAIT_TIMEOUT):
         self.is_connected.wait(self.WAIT_TIMEOUT)
 
         try:
diff --git a/requirements.txt b/requirements.txt
index 227aacf6..45525022 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
 pyaes==1.6.1
-pysocks==1.6.8
+pysocks==1.7.0
 typing==3.6.6; python_version<"3.5"
\ No newline at end of file
diff --git a/setup.py b/setup.py
index cba41b78..146dae9e 100644
--- a/setup.py
+++ b/setup.py
@@ -27,28 +27,20 @@ from compiler.api import compiler as api_compiler
 from compiler.docs import compiler as docs_compiler
 from compiler.error import compiler as error_compiler
 
+with open("requirements.txt", encoding="utf-8") as r:
+    requires = [i.strip() for i in r]
 
-def read(file: str) -> list:
-    with open(file, encoding="utf-8") as r:
-        return [i.strip() for i in r]
+with open("pyrogram/__init__.py", encoding="utf-8") as f:
+    version = re.findall(r"__version__ = \"(.+)\"", f.read())[0]
 
-
-def get_version():
-    with open("pyrogram/__init__.py", encoding="utf-8") as f:
-        return re.findall(r"__version__ = \"(.+)\"", f.read())[0]
-
-
-def get_readme():
-    # PyPI doesn't like raw html
-    with open("README.rst", encoding="utf-8") as f:
-        readme = re.sub(r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n", "", f.read())
-        return re.sub(r"\|header\|", "|logo|\n\n|description|\n\n|schema| |tgcrypto|", readme)
+with open("README.md", encoding="utf-8") as f:
+    readme = f.read()
 
 
 class Clean(Command):
     DIST = ["./build", "./dist", "./Pyrogram.egg-info"]
     API = ["pyrogram/api/errors/exceptions", "pyrogram/api/functions", "pyrogram/api/types", "pyrogram/api/all.py"]
-    DOCS = ["docs/source/functions", "docs/source/types", "docs/build"]
+    DOCS = ["docs/source/telegram", "docs/build"]
     ALL = DIST + API + DOCS
 
     description = "Clean generated files"
@@ -128,23 +120,25 @@ class Generate(Command):
 
 
 if len(argv) > 1 and argv[1] in ["bdist_wheel", "install", "develop"]:
-    error_compiler.start()
     api_compiler.start()
+    error_compiler.start()
     docs_compiler.start()
 
 setup(
     name="Pyrogram",
-    version=get_version(),
-    description="Telegram MTProto API Client Library for Python",
-    long_description=get_readme(),
+    version=version,
+    description="Telegram MTProto API Client Library and Framework for Python",
+    long_description=readme,
+    long_description_content_type="text/markdown",
     url="https://github.com/pyrogram",
     download_url="https://github.com/pyrogram/pyrogram/releases/latest",
-    author="Dan Tès",
-    author_email="admin@pyrogram.ml",
+    author="Dan",
+    author_email="dan@pyrogram.org",
     license="LGPLv3+",
     classifiers=[
-        "Development Status :: 3 - Alpha",
+        "Development Status :: 4 - Beta",
         "Intended Audience :: Developers",
+        "Natural Language :: English",
         "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
         "Operating System :: OS Independent",
         "Programming Language :: Python",
@@ -152,6 +146,8 @@ setup(
         "Programming Language :: Python :: 3.4",
         "Programming Language :: Python :: 3.5",
         "Programming Language :: Python :: 3.6",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: Implementation",
         "Programming Language :: Python :: Implementation :: CPython",
         "Programming Language :: Python :: Implementation :: PyPy",
@@ -165,17 +161,19 @@ setup(
     keywords="telegram chat messenger mtproto api client library python",
     project_urls={
         "Tracker": "https://github.com/pyrogram/pyrogram/issues",
-        "Community": "https://t.me/PyrogramChat",
+        "Community": "https://t.me/Pyrogram",
         "Source": "https://github.com/pyrogram/pyrogram",
-        "Documentation": "https://docs.pyrogram.ml",
+        "Documentation": "https://docs.pyrogram.org",
     },
     python_requires="~=3.4",
     packages=find_packages(exclude=["compiler*"]),
+    package_data={
+        "pyrogram.client.ext": ["mime.types"]
+    },
     zip_safe=False,
-    install_requires=read("requirements.txt"),
+    install_requires=requires,
     extras_require={
-        "tgcrypto": ["tgcrypto==1.1.1"],  # TODO: Remove soon
-        "fast": ["tgcrypto==1.1.1"],
+        "fast": ["tgcrypto==1.1.1"]
     },
     cmdclass={
         "clean": Clean,