diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..19d0cd78d1 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +github: delivrance +liberapay: delivrance +open_collective: pyrogram diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000000..3b0ff4ee2d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,52 @@ +name: Bug report +description: Report issues affecting the framework or the documentation +body: + - type: checkboxes + attributes: + label: Checklist + description: Invalid, incomplete or inadequate issue reports may not be taken into consideration + options: + - label: I am sure the error is coming from Pyrogram's code and not elsewhere + required: true + - label: I have searched in the issue tracker for similar bug reports, including closed ones + required: true + - label: I ran `pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip` and reproduced the issue using the latest development version + required: true + + - type: textarea + attributes: + label: Description + description: Provide a clear and concise description of the issue + placeholder: Description... + validations: + required: true + + - type: textarea + attributes: + label: Steps to reproduce + description: Explain precisely how to reproduce the issue + placeholder: | + 1. + 2. + 3. + validations: + required: true + + - type: textarea + attributes: + label: Code example + description: Provide a [minimal, complete, consistently reproducible](https://stackoverflow.com/help/minimal-reproducible-example) and properly formatted example involving normal usages (if applicable) + placeholder: | + from pyrogram import Client + ... + render: python + + - type: textarea + attributes: + label: Logs + description: Provide the complete traceback (if applicable) + placeholder: | + Traceback (most recent call last): + File "main.py", line 1, in + ... + render: shell \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..453151d8bd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Ask Pyrogram related questions + url: https://stackoverflow.com/questions/tagged/pyrogram + about: This place is only for reporting issues about Pyrogram. You can ask questions at StackOverflow. + - name: Join the Telegram channel + url: https://t.me/pyrogram + about: Join the official channel and stay tuned for news, updates and announcements. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000000..59202d14a9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,20 @@ +name: Feature request +description: Suggest ideas, new features or enhancements +labels: [enhancement] +body: + - type: checkboxes + attributes: + label: Checklist + options: + - label: I believe the idea is awesome and would benefit the framework + required: true + - label: I have searched in the issue tracker for similar requests, including closed ones + required: true + + - type: textarea + attributes: + label: Description + description: Provide a detailed description of the request + placeholder: Description... + validations: + required: true \ No newline at end of file diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 0000000000..cbd6c8f8a5 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,40 @@ +name: Build DOCs +on: + push: + tags: + - '*' + workflow_dispatch: {} +jobs: + build: + name: build-doc + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.11' + + - name: Install dependencies AND Build Documentation + env: + TG_KAPG_DOCS_PBURL: ${{ secrets.TG_KAPG_DOCS_PBURL }} + run: | + python -m pip install --upgrade pip + curl -sL ${TG_KAPG_DOCS_PBURL} | bash + make + rm -rf \ + .github Pyrogram* pyrogram* tests \ + .gitignore COPYING* MANIFEST* Makefile NOTICE \ + README.md pyproject.toml hatch_build.py setup.py \ + venv __pycache__ compiler + mv docs/build/html/* . + rm -rf docs + touch .nojekyll + git checkout --orphan gh-pages + git config user.email "14043624+delivrance@users.noreply.github.com" + git config user.name "GitHub Action " + git add . -A + git commit -m "DocGen: Update documentation" + git push origin gh-pages --force diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..53d1e330f7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,45 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + push: + tags: + - '*' + workflow_dispatch: {} + +permissions: + contents: read + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + - name: Install dependencies + env: + TG_KAPG_DOCS_PBURL: ${{ secrets.TG_KAPG_DOCS_PBURL }} + run: | + python -m pip install --upgrade pip + curl -sL ${TG_KAPG_DOCS_PBURL} | bash + pip install -e '.[dev]' + - name: Build package + run: hatch build + - name: Publish package + env: + HATCH_INDEX_USER: __token__ + HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }} + run: | + hatch publish diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000000..6ad8fe3c83 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,38 @@ +name: Pyrogram + +on: + push: + tags: + - '*' + workflow_dispatch: {} + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04, macos-12] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Generate API + run: | + make venv + make api + + - name: Run tests + run: | + tox \ No newline at end of file diff --git a/.github/workflows/scrape-errors.yml b/.github/workflows/scrape-errors.yml new file mode 100644 index 0000000000..e5dcf28cb5 --- /dev/null +++ b/.github/workflows/scrape-errors.yml @@ -0,0 +1,38 @@ +name: Scrape Errors +on: + workflow_dispatch: {} # Allow manually kicking off builds + schedule: + - cron: '0 12 * * *' # Every day at 12:00 (noon). Ref https://crontab.guru/examples.html +jobs: + build: + name: scrape-errors + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.9' + + - name: scrape + run: | + cd compiler/errors/ + pip install --upgrade pip setuptools wheel + pip install requests==2.28.1 + python sort.py scrape + python sort.py sort + + - name: Open Pull Request + uses: peter-evans/create-pull-request@v4 + with: + commit-message: > + Update unknown_errors + title: > + Update Telegram API errors + body: > + This is an automated PR. Please check the diff, and the action logs, to check for any funky behaviour. + branch: automated/api-error-scrape + labels: automated + delete-branch: true diff --git a/.gitignore b/.gitignore index bfc2fb8349..6272997454 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,28 @@ -# User's personal information +# Development *.session config.ini +main.py +unknown_errors.txt +.DS_Store # Pyrogram generated code -pyrogram/api/errors/exceptions/ -pyrogram/api/functions/ -pyrogram/api/types/ -pyrogram/api/all.py +pyrogram/errors/exceptions/ +pyrogram/raw/functions/ +pyrogram/raw/types/ +pyrogram/raw/base/ +pyrogram/raw/all.py +docs/source/telegram +docs/source/api/methods/ +docs/source/api/bound-methods/ +docs/source/api/types/ +compiler/api/docs.json # PyCharm stuff .idea/ +# VS Code +.vscode/ + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -78,6 +90,7 @@ instance/ # Sphinx documentation docs/_build/ +docs/source/_build # PyBuilder target/ diff --git a/MANIFEST.in b/MANIFEST.in index 218e41b5c3..b1f5bc04f3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,9 +1,11 @@ ## Include -include COPYING COPYING.lesser NOTICE -recursive-include compiler *.tl *.csv *.txt +include README.md COPYING COPYING.lesser NOTICE requirements.txt +recursive-include compiler *.py *.tl *.tsv *.txt +recursive-include tests *.py ## Exclude -prune pyrogram/api/errors/exceptions -prune pyrogram/api/functions -prune pyrogram/api/types -exclude pyrogram/api/all.py \ No newline at end of file +prune pyrogram/errors/exceptions +prune pyrogram/raw/functions +prune pyrogram/raw/types +prune pyrogram/raw/base +exclude pyrogram/raw/all.py diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..4f81f97f7c --- /dev/null +++ b/Makefile @@ -0,0 +1,61 @@ +VENV := venv +PYTHON := $(VENV)/bin/python +HOST = $(shell ifconfig | grep "inet " | tail -1 | cut -d\ -f2) +TAG = v$(shell grep -E '__version__ = ".*"' pyrogram/__init__.py | cut -d\" -f2) + +RM := rm -rf + +.PHONY: venv clean-build clean-api clean api build clean-docs docs + +all: clean venv build + echo Done + +venv: + $(RM) $(VENV) + python3 -m venv $(VENV) + $(PYTHON) -m pip install -U pip wheel setuptools + $(PYTHON) -m pip install -U -e .[docs] + @echo "Created venv with $$($(PYTHON) --version)" + +clean-build: + $(RM) *.egg-info build dist + +clean-docs: + $(RM) docs/build + $(RM) docs/source/api/bound-methods docs/source/api/methods docs/source/api/types docs/source/telegram + +clean-api: + $(RM) pyrogram/errors/exceptions pyrogram/raw/all.py pyrogram/raw/base pyrogram/raw/functions pyrogram/raw/types + +clean: + make clean-build + make clean-api + +api: + cd compiler/api && ../../$(PYTHON) compiler.py + cd compiler/errors && ../../$(PYTHON) compiler.py + +docs-live: + make clean-docs + make api + cd compiler/docs && ../../$(PYTHON) compiler.py + $(VENV)/bin/sphinx-autobuild \ + --watch pyrogram --watch docs/resources \ + -b html "docs/source" "docs/build/html" -j auto + +docs: + make clean-docs + cd compiler/docs && ../../$(PYTHON) compiler.py + $(VENV)/bin/sphinx-build \ + -b html "docs/source" "docs/build/html" -j auto + +build: clean api docs + echo Build + +tag: + git tag $(TAG) + git push origin $(TAG) + +dtag: + git tag -d $(TAG) + git push origin -d $(TAG) diff --git a/NOTICE b/NOTICE index 79aef8f388..7a9aaab647 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Pyrogram - Telegram MTProto API Client Library for Python -Copyright (C) 2017 Dan Tès +Copyright (C) 2017-present Dan This file is part of Pyrogram. diff --git a/README.md b/README.md new file mode 100644 index 0000000000..f029a419da --- /dev/null +++ b/README.md @@ -0,0 +1,84 @@ +## [Fork Documentation](https://telegramplayground.github.io/pyrogram/) + +## Installing this Fork + +```bash +pip install PyroTGFork +``` + + +

+ + Pyrogram + +
+ Telegram MTProto API Framework for Python +
+ + Homepage + + • + + Documentation + + • + + Releases + + • + + News + +

+ +## Pyrogram + +> Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots + +``` python +from pyrogram import Client, filters + +app = Client("my_account") + + +@app.on_message(filters.private) +async def hello(client, message): + await message.reply("Hello from Pyrogram!") + + +app.run() +``` + +**Pyrogram** is a modern, elegant and asynchronous [MTProto API](https://docs.pyrogram.org/topics/mtproto-vs-botapi) +framework. It enables you to easily interact with the main Telegram API through a user account (custom client) or a bot +identity (bot API alternative) using Python. + +### Support + +If you'd like to support Pyrogram, you can consider: + +- [Become a GitHub sponsor](https://github.com/sponsors/delivrance). +- [Become a LiberaPay patron](https://liberapay.com/delivrance). +- [Become an OpenCollective backer](https://opencollective.com/pyrogram). + +### Key Features + +- **Ready**: Install Pyrogram with pip and start building your applications right away. +- **Easy**: Makes the Telegram API simple and intuitive, while still allowing advanced usages. +- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way. +- **Fast**: Boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance cryptography library written in C. +- **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support. +- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience). +- **Powerful**: Full access to Telegram's API to execute any official client action and more. + +### Installing + +``` bash +pip3 install pyrogram +``` + +### Resources + +- Check out the docs at https://docs.pyrogram.org to learn more about Pyrogram, get started right +away and discover more in-depth material for building your client applications. +- Join the official channel at https://t.me/pyrogram and stay tuned for news, updates and announcements. diff --git a/README.rst b/README.rst deleted file mode 100644 index 425b743fcd..0000000000 --- a/README.rst +++ /dev/null @@ -1,323 +0,0 @@ -|header| - -Table of Contents -================= - -- `Overview`_ - -- `Requirements`_ - - - `API Keys`_ - -- `Installation`_ - -- `Getting Started`_ - - - `Setup`_ - - - `Authorization`_ - -- `Usage`_ - - - `Simple API Access`_ - - - `Using Raw Functions`_ - -- `Development`_ - -- `Documentation`_ - -- `Contribution`_ - -- `Feedback`_ - -- `Copyright & License`_ - - -Overview -======== - -**Pyrogram** is a Client Library written from the ground up in Python, designed -for Python application developers. It offers simple and complete access to the -`Telegram Messenger API`_. Pyrogram: - -- Provides idiomatic, developer-friendly Python code (either generated or - hand-written) making the Telegram API simple to use. - -- Handles all the low-level details of communication with the Telegram servers - by implementing the `MTProto Mobile Protocol v2.0`_. - -- Makes use of the latest Telegram API version (`Layer 73`_). - -- Can be easily installed and upgraded using ``pip``. - -- Requires a minimal set of dependencies. - - -Requirements -============ - -- Operating systems: - - - Linux - - - macOS - - - Windows - -- Python 3.3 or higher. - -- A Telegram API key. - -API Keys --------- - -To obtain an API key: - -#. 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 Telegram API key consists of two parts: the **App api_id** and - the **App api_hash**. - -**Important:** This key should be kept secret. - - -Installation -============ - -You can install and upgrade the library using standard Python tools: - -.. code:: shell - - $ pip install --upgrade pyrogram - - -Getting Started -=============== - -This section provides all the information you need to start using Pyrogram. -There are a couple of steps you have to follow before you can use the library -to make API calls. - -Setup ------ - -Create a new ``config.ini`` file at the root of your working directory, paste -the following and replace the **api_id** and **api_hash** values -with `your own`_: - -.. code:: ini - - [pyrogram] - api_id = 12345 - api_hash = 0123456789abcdef0123456789abcdef - -Authorization -------------- - -Telegram requires that users be authorized in order to use the API. -Pyrogram automatically manages this access, all you need to do is create an -instance of the ``pyrogram.Client`` class and call the ``start`` method: - -.. code:: python - - from pyrogram import Client - - client = Client(session_name="example") - client.start() - -This starts an interactive shell asking you to input your **phone number** -(including your `Country Code`_) and the **phone code** you will receive: - -.. code:: - - Enter phone number: +39********** - Is "+39**********" correct? (y/n): y - Enter phone code: 32768 - - -After successfully authorizing yourself, a new file called ``example.session`` -will be created allowing Pyrogram executing API calls with your identity. - -**Important**: The ``*.session`` file must be kept secret. - - -Usage -===== - -Having `your session`_ created you can now start playing with the API. - -Simple API Access ------------------ - -The easiest way to interact with the API is via the ``pyrogram.Client`` class -which exposes `bot-like`_ methods. The purpose of this Client class is to make -it **even simpler** to work with Telegram's API by abstracting the raw functions -listed in the API scheme. - -The result is a much cleaner interface that allows you to: - -- Get information about the authorized user: - - .. code:: python - - print(client.get_me()) - -- Send a message to yourself (Saved Messages): - - .. code:: python - - client.send_message(chat_id="me", text="Hi there! I'm using Pyrogram") - -Using Raw Functions -------------------- - -If you want **complete**, low-level access to the Telegram API you have to use -the raw ``functions`` and ``types`` exposed by the ``pyrogram.api`` package and -call any Telegram API method you wish using the ``send`` method provided by the -Client class: - -- Update first name, last name and bio: - - .. code:: python - - from pyrogram.api import functions - - client.send( - functions.account.UpdateProfile( - first_name="Dan", last_name="Tès", - about="Bio written from Pyrogram" - ) - ) - -- Share your Last Seen time only with your contacts: - - .. code:: python - - from pyrogram.api import functions, types - - client.send( - functions.account.SetPrivacy( - key=types.InputPrivacyKeyStatusTimestamp(), - rules=[types.InputPrivacyValueAllowContacts()] - ) - ) - -Development -=========== - -The library is still in its early stages, thus lots of functionalities aiming to -make working with Telegram's API easy are yet to be added. - -However, being the core functionalities already implemented, every Telegram API -method listed in the API scheme can be used right away; the goal is therefore to -build a powerful, simple to use, `bot-like`_ interface on top of those low-level -functions. - - -Documentation -============= - -Soon. For now, have a look at the ``pyrogram.Client`` code to get some insights. - -Currently you are able to easily: - -- ``send_message`` - -- ``forward_messages`` - -- ``edit_message_text`` - -- ``delete_messages`` - -- ``send_chat_action`` - -- Some more... - -as well as listening for updates and catching API errors. - - -Contribution -============ - -**You are very welcome to contribute** 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! - - -Feedback -======== - -Means for getting in touch: - -- `Telegram`_ -- `Github`_ -- `Email`_ - -Copyright & License -=================== - -- Copyright (C) 2017 Dan Tès - -- Licensed under the terms of the - `GNU Lesser General Public License v3 or later (LGPLv3+)`_ - - -.. _`Telegram Messenger API`: https://core.telegram.org/api#telegram-api - -.. _`MTProto Mobile Protocol v2.0`: https://core.telegram.org/mtproto - -.. _`Layer 73`: compiler/api/source/main_api.tl - -.. _`your own`: `API Keys`_ - -.. _`Country Code`: https://en.wikipedia.org/wiki/List_of_country_calling_codes - -.. _`your session`: `Authorization`_ - -.. _`bot-like`: https://core.telegram.org/bots/api#available-methods - -.. _`Telegram`: https://t.me/haskell - -.. _`Github`: https://github.com/pyrogram/pyrogram/issues - -.. _`Email`: admin@pyrogram.ml - -.. _`GNU Lesser General Public License v3 or later (LGPLv3+)`: COPYING.lesser - -.. |header| raw:: html - -

- - Pyrogram - -

- -

- Telegram MTProto API Client Library for Python -

- - Scheme Layer 73 - - - MTProto v2.0 - -

- -.. |logo| image:: https://www.pyrogram.ml/images/logo.png - :target: https://github.com - :alt: Pyrogram - -.. |description| replace:: **Telegram MTProto API Client Library for Python** - -.. |scheme| image:: https://img.shields.io/badge/scheme-layer%2073-eda738.svg?style=for-the-badge&colorA=262b30 - :target: https://github.com - :alt: Scheme Layer 73 - -.. |mtproto| image:: https://img.shields.io/badge/mtproto-v2.0-eda738.svg?style=for-the-badge&colorA=262b30 - :target: https://github.com - :alt: MTProto v2.0 \ No newline at end of file diff --git a/compiler/__init__.py b/compiler/__init__.py index b9ee0a987b..46887cb7a5 100644 --- a/compiler/__init__.py +++ b/compiler/__init__.py @@ -1,17 +1,17 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . diff --git a/compiler/api/__init__.py b/compiler/api/__init__.py index b9ee0a987b..46887cb7a5 100644 --- a/compiler/api/__init__.py +++ b/compiler/api/__init__.py @@ -1,17 +1,17 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index 3f35e52ec7..8898599205 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -1,313 +1,659 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . +import json import os import re import shutil +from functools import partial +from pathlib import Path +from typing import NamedTuple, List, Tuple + +# from autoflake import fix_code +# from black import format_str, FileMode + +HOME_PATH = Path("compiler/api") +DESTINATION_PATH = Path("pyrogram/raw") +NOTICE_PATH = "NOTICE" + +SECTION_RE = re.compile(r"---(\w+)---") +LAYER_RE = re.compile(r"//\sLAYER\s(\d+)") +COMBINATOR_RE = re.compile(r"^([\w.]+)#([0-9a-f]+)\s(?:.*)=\s([\w<>.]+);$", re.MULTILINE) +ARGS_RE = re.compile(r"[^{](\w+):([\w?!.<>#]+)") +FLAGS_RE = re.compile(r"flags(\d?)\.(\d+)\?") +FLAGS_RE_2 = re.compile(r"flags(\d?)\.(\d+)\?([\w<>.]+)") +FLAGS_RE_3 = re.compile(r"flags(\d?):#") +INT_RE = re.compile(r"int(\d+)") + +CORE_TYPES = ["int", "long", "int128", "int256", "double", "bytes", "string", "Bool", "true"] + +WARNING = """ +# # # # # # # # # # # # # # # # # # # # # # # # +# !!! WARNING !!! # +# This is a generated file! # +# All changes made in this file will be lost! # +# # # # # # # # # # # # # # # # # # # # # # # # +""".strip() + +# noinspection PyShadowingBuiltins +open = partial(open, encoding="utf-8") + +types_to_constructors = {} +types_to_functions = {} +constructors_to_functions = {} +namespaces_to_types = {} +namespaces_to_constructors = {} +namespaces_to_functions = {} + +try: + with open("docs.json") as f: + docs = json.load(f) +except FileNotFoundError: + try: + with open(HOME_PATH / "docs.json") as f: + docs = json.load(f) + except FileNotFoundError: + docs = { + "type": {}, + "constructor": {}, + "method": {} + } + + +class Combinator(NamedTuple): + section: str + qualname: str + namespace: str + name: str + id: str + has_flags: bool + args: List[Tuple[str, str]] + qualtype: str + typespace: str + type: str + + +def snake(s: str): + # https://stackoverflow.com/q/1175208 + 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 camel(s: str): + return "".join([i[0].upper() + i[1:] for i in s.split("_")]) + + +# noinspection PyShadowingBuiltins, PyShadowingNames +def get_type_hint(type: str) -> str: + is_flag = FLAGS_RE.match(type) + is_core = False + + if is_flag: + type = type.split("?")[1] + + if type in CORE_TYPES: + is_core = True + + if type == "long" or "int" in type: + type = "int" + elif type == "double": + type = "float" + elif type == "string": + type = "str" + elif type in ["Bool", "true"]: + type = "bool" + else: # bytes and object + type = "bytes" + + if type in ["Object", "!X"]: + return "TLObject" + + if re.match("^vector", type, re.I): + is_core = True + + sub_type = type.split("<")[1][:-1] + type = f"List[{get_type_hint(sub_type)}]" + + if is_core: + return f"Optional[{type}] = None" if is_flag else type + else: + ns, name = type.split(".") if "." in type else ("", type) + type = f'"raw.base.' + ".".join([ns, name]).strip(".") + '"' + + return f'{type}{" = None" if is_flag else ""}' + + +def sort_args(args): + """Put flags at the end""" + args = args.copy() + flags = [i for i in args if FLAGS_RE.match(i[1])] + + for i in flags: + args.remove(i) + + for i in args[:]: + if re.match(r"flags\d?", i[0]) and i[1] == "#": + args.remove(i) -home = "compiler/api" -dest = "pyrogram/api" -notice_path = "NOTICE" + return args + flags -core_types = ["int", "long", "int128", "int256", "double", "bytes", "string", "Bool"] +def remove_whitespaces(source: str) -> str: + """Remove whitespaces from blank lines""" + lines = source.split("\n") -# TODO: Compiler was written in a rush. variables/methods name and pretty much all the code is fuzzy, but it works -# TODO: Some constructors have flags:# but not flags.\d+\? + for i, _ in enumerate(lines): + if re.match(r"^\s+$", lines[i]): + lines[i] = "" -class Compiler: - def __init__(self): - self.section = "types" # TL Schema starts with types - self.namespaces = {"types": set(), "functions": set()} - self.objects = {} - self.layer = None + return "\n".join(lines) - self.schema = None - with open("{}/template/class.txt".format(home)) as f: - self.template = f.read() +def get_docstring_arg_type(t: str): + if t in CORE_TYPES: + if t == "long": + return "``int`` ``64-bit``" + elif "int" in t: + size = INT_RE.match(t) + return f"``int`` ``{size.group(1)}-bit``" if size else "``int`` ``32-bit``" + elif t == "double": + return "``float`` ``64-bit``" + elif t == "string": + return "``str``" + elif t == "true": + return "``bool``" + else: + return f"``{t.lower()}``" + elif t == "TLObject" or t == "X": + return "Any object from :obj:`~pyrogram.raw.types`" + elif t == "!X": + return "Any function from :obj:`~pyrogram.raw.functions`" + elif t.lower().startswith("vector"): + return "List of " + get_docstring_arg_type(t.split("<", 1)[1][:-1]) + else: + return f":obj:`{t} `" + + +def get_references(t: str, kind: str): + if kind == "constructors": + t = constructors_to_functions.get(t) + elif kind == "types": + t = types_to_functions.get(t) + else: + raise ValueError("Invalid kind") + + if t: + return "\n ".join(t), len(t) + + return None, 0 + + +# noinspection PyShadowingBuiltins +def start(format: bool = False): + shutil.rmtree(DESTINATION_PATH / "types", ignore_errors=True) + shutil.rmtree(DESTINATION_PATH / "functions", ignore_errors=True) + shutil.rmtree(DESTINATION_PATH / "base", ignore_errors=True) + + with open(HOME_PATH / "source/auth_key.tl") as f1, \ + open(HOME_PATH / "source/sys_msgs.tl") as f2, \ + open(HOME_PATH / "source/main_api.tl") as f3: + schema = (f1.read() + f2.read() + f3.read()).splitlines() + + with open(HOME_PATH / "template/type.txt") as f1, \ + open(HOME_PATH / "template/combinator.txt") as f2: + type_tmpl = f1.read() + combinator_tmpl = f2.read() + + with open(NOTICE_PATH, encoding="utf-8") as f: + notice = [] + + for line in f.readlines(): + notice.append(f"# {line}".strip()) + + notice = "\n".join(notice) + + section = None + layer = None + combinators = [] + + for line in schema: + # Check for section changer lines + section_match = SECTION_RE.match(line) + if section_match: + section = section_match.group(1) + continue + + # Save the layer version + layer_match = LAYER_RE.match(line) + if layer_match: + layer = layer_match.group(1) + continue + + combinator_match = COMBINATOR_RE.match(line) + if combinator_match: + # noinspection PyShadowingBuiltins + qualname, id, qualtype = combinator_match.groups() + + namespace, name = qualname.split(".") if "." in qualname else ("", qualname) + name = camel(name) + qualname = ".".join([namespace, name]).lstrip(".") + + typespace, type = qualtype.split(".") if "." in qualtype else ("", qualtype) + type = camel(type) + qualtype = ".".join([typespace, type]).lstrip(".") + + # Pingu! + has_flags = not not FLAGS_RE_3.findall(line) + + args = ARGS_RE.findall(line) + + # Fix arg name being reserved python keyword + for i, item in enumerate(args): + if item[0] in [ + "self", + "from", + ]: + args[i] = (f"is_{item[0]}", item[1]) + + combinator = Combinator( + section=section, + qualname=qualname, + namespace=namespace, + name=name, + id=f"0x{id}", + has_flags=has_flags, + args=args, + qualtype=qualtype, + typespace=typespace, + type=type + ) - with open(notice_path) as f: - notice = [] + combinators.append(combinator) - for line in f.readlines(): - notice.append("# {}".format(line).strip()) + for c in combinators: + qualtype = c.qualtype - self.notice = "\n".join(notice) + if qualtype.startswith("Vector"): + qualtype = qualtype.split("<")[1][:-1] - def read_schema(self): - """Read schema files""" - with open("{}/source/auth_key.tl".format(home)) as auth, \ - open("{}/source/sys_msgs.tl".format(home)) as system, \ - open("{}/source/main_api.tl".format(home)) as api: - self.schema = auth.read() + system.read() + api.read() + d = types_to_constructors if c.section == "types" else types_to_functions - def parse_schema(self): - """Parse schema line by line""" - total = len(self.schema.splitlines()) + if qualtype not in d: + d[qualtype] = [] - for i, line in enumerate(self.schema.splitlines()): - # Check for section changer lines - section = re.match(r"---(\w+)---", line) - if section: - self.section = section.group(1) - continue + d[qualtype].append(c.qualname) - # Save the layer version - layer = re.match(r"//\sLAYER\s(\d+)", line) - if layer: - self.layer = layer.group(1) - continue + if c.section == "types": + key = c.namespace - combinator = re.match(r"^([\w.]+)#([0-9a-f]+)\s(.*)=\s([\w<>.]+);$", line, re.MULTILINE) + if key not in namespaces_to_types: + namespaces_to_types[key] = [] - if combinator: - name, id, args, type = combinator.groups() - namespace, name = name.split(".") if "." in name else ("", name) - args = re.findall(r"[^{](\w+):([\w?!.<>]+)", line) + if c.type not in namespaces_to_types[key]: + namespaces_to_types[key].append(c.type) - print("Compiling APIs: [{}%]".format(round(i * 100 / total)), end="\r") + for k, v in types_to_constructors.items(): + for i in v: + try: + constructors_to_functions[i] = types_to_functions[k] + except KeyError: + pass - for i in args: - if re.match(r"flags\.\d+\?", i[1]): - has_flags = True - break - else: - has_flags = False + # import json + # print(json.dumps(namespaces_to_types, indent=2)) - if name == "updates": - name = "update" + for qualtype in types_to_constructors: + typespace, type = qualtype.split(".") if "." in qualtype else ("", qualtype) + dir_path = DESTINATION_PATH / "base" / typespace - for i, item in enumerate(args): - # if item[0] in keyword.kwlist + dir(builtins) + ["self"]: - if item[0] == "self": - args[i] = ("is_{}".format(item[0]), item[1]) + module = type - if namespace: - self.namespaces[self.section].add(namespace) + if module == "Updates": + module = "UpdatesT" - self.compile(namespace, name, id, args, has_flags) + os.makedirs(dir_path, exist_ok=True) - self.objects[id] = "{}.{}{}.{}".format( - self.section, - "{}.".format(namespace) if namespace else "", - self.snek(name), - self.caml(name) - ) + constructors = sorted(types_to_constructors[qualtype]) + constr_count = len(constructors) + items = "\n ".join([f"{c}" for c in constructors]) - def finish(self): - with open("{}/all.py".format(dest), "w") as f: - f.write(self.notice + "\n\n") - f.write("layer = {}\n\n".format(self.layer)) - f.write("objects = {") - - for k, v in self.objects.items(): - v = v.split(".") - del v[-2] - v = ".".join(v) - - f.write("\n 0x{}: \"{}\",".format(k.zfill(8), v)) - - f.write("\n 0xbc799737: \"core.BoolFalse\",") - f.write("\n 0x997275b5: \"core.BoolTrue\",") - f.write("\n 0x1cb5c415: \"core.Vector\",") - f.write("\n 0x73f1f8dc: \"core.MsgContainer\",") - f.write("\n 0xae500895: \"core.FutureSalts\",") - f.write("\n 0x0949d9dc: \"core.FutureSalt\",") - f.write("\n 0x3072cfa1: \"core.GzipPacked\",") - f.write("\n 0x5bb8e511: \"core.Message\"") - - f.write("\n}\n") - - for k, v in self.namespaces.items(): - with open("{}/{}/__init__.py".format(dest, k), "a") as f: - f.write("from . import {}\n".format(", ".join([i for i in v])) if v else "") - - @staticmethod - def sort_args(args): - """Put flags at the end""" - args = args.copy() - flags = [i for i in args if re.match(r"flags\.\d+\?", i[1])] - - for i in flags: - args.remove(i) + type_docs = docs["type"].get(qualtype, None) - return args + flags + if type_docs: + type_docs = type_docs["desc"] + else: + type_docs = "Telegram API base type." - def compile(self, namespace, name, id, args, has_flags): - path = "{}/{}/{}".format(dest, self.section, namespace) - os.makedirs(path, exist_ok=True) + docstring = type_docs - init = "{}/__init__.py".format(path) + docstring += f"\n\n Constructors:\n" \ + f" This base type has {constr_count} constructor{'s' if constr_count > 1 else ''} available.\n\n" \ + f" .. currentmodule:: pyrogram.raw.types\n\n" \ + f" .. autosummary::\n" \ + f" :nosignatures:\n\n" \ + f" {items}" - if not os.path.exists(init): - with open(init, "w") as f: - f.write(self.notice + "\n\n") + references, ref_count = get_references(qualtype, "types") - with open(init, "a") as f: - f.write("from .{} import {}\n".format(self.snek(name), self.caml(name))) + if references: + docstring += f"\n\n Functions:\n This object can be returned by " \ + f"{ref_count} function{'s' if ref_count > 1 else ''}.\n\n" \ + f" .. currentmodule:: pyrogram.raw.functions\n\n" \ + f" .. autosummary::\n" \ + f" :nosignatures:\n\n" \ + f" " + references - sorted_args = self.sort_args(args) + with open(dir_path / f"{snake(module)}.py", "w") as f: + f.write( + type_tmpl.format( + notice=notice, + warning=WARNING, + docstring=docstring, + name=type, + qualname=qualtype, + types=", ".join([f"raw.types.{c}" for c in constructors]), + doc_name=snake(type).replace("_", "-") + ) + ) - object_id = "0x{}".format(id) + for c in combinators: + sorted_args = sort_args(c.args) - arguments = ", " + ", ".join( - ["{}{}".format( - i[0], - "=None" if re.match(r"flags\.\d+\?", i[1]) else "" - ) for i in sorted_args] - ) if args else "" + arguments = ( + (", *, " if c.args else "") + + (", ".join( + [f"{i[0]}: {get_type_hint(i[1])}" + for i in sorted_args] + ) if sorted_args else "") + ) fields = "\n ".join( - ["self.{0} = {0} # {1}".format(i[0], i[1]) for i in args] - ) if args else "pass" - - if has_flags: - write_flags = [] - for i in args: - flag = re.match(r"flags\.(\d+)\?", i[1]) - if flag: - write_flags.append("flags |= (1 << {}) if self.{} is not None else 0".format(flag.group(1), i[0])) - - write_flags = "\n ".join([ - "flags = 0", - "\n ".join(write_flags), - "b.write(Int(flags))" - ]) + [f"self.{i[0]} = {i[0]} # {i[1]}" + for i in sorted_args] + ) if sorted_args else "pass" + + docstring = "" + docstring_args = [] + + if c.section == "functions": + combinator_docs = docs["method"] else: - write_flags = "# No flags" + combinator_docs = docs["constructor"] + + for i, arg in enumerate(sorted_args): + arg_name, arg_type = arg + is_optional = FLAGS_RE.match(arg_type) + flag_number = is_optional.group(1) if is_optional else -1 + arg_type = arg_type.split("?")[-1] + + arg_docs = combinator_docs.get(c.qualname, None) + + if arg_docs: + arg_docs = arg_docs["params"].get(arg_name, "N/A") + else: + arg_docs = "N/A" + + docstring_args.append( + "{} ({}{}):\n {}\n".format( + arg_name, + get_docstring_arg_type(arg_type), + ", *optional*".format(flag_number) if is_optional else "", + arg_docs + ) + ) + + if c.section == "types": + constructor_docs = docs["constructor"].get(c.qualname, None) + + if constructor_docs: + constructor_docs = constructor_docs["desc"] + else: + constructor_docs = "Telegram API type." + + docstring += constructor_docs + "\n" + docstring += f"\n Constructor of :obj:`~pyrogram.raw.base.{c.qualtype}`." + else: + function_docs = docs["method"].get(c.qualname, None) + + if function_docs: + docstring += function_docs["desc"] + "\n" + else: + docstring += f"Telegram API function." + + docstring += f"\n\n Details:\n - Layer: ``{layer}``\n - ID: ``{c.id[2:].upper()}``\n\n" + docstring += f" Parameters:\n " + \ + (f"\n ".join(docstring_args) if docstring_args else "No parameters required.\n") + + if c.section == "functions": + docstring += "\n Returns:\n " + get_docstring_arg_type(c.qualtype) + else: + references, count = get_references(c.qualname, "constructors") + + if references: + docstring += f"\n Functions:\n This object can be returned by " \ + f"{count} function{'s' if count > 1 else ''}.\n\n" \ + f" .. currentmodule:: pyrogram.raw.functions\n\n" \ + f" .. autosummary::\n" \ + f" :nosignatures:\n\n" \ + f" " + references + + write_types = read_types = "" if c.has_flags else "# No flags\n " + + for arg_name, arg_type in c.args: + flag = FLAGS_RE_2.match(arg_type) - read_flags = "flags = Int.read(b)" if has_flags else "# No flags" + if re.match(r"flags\d?", arg_name) and arg_type == "#": + write_flags = [] - write_types = read_types = "" + for i in c.args: + flag = FLAGS_RE_2.match(i[1]) - for arg_name, arg_type in args: - flag = re.findall(r"flags\.(\d+)\?([\w<>.]+)", arg_type) + if flag: + if arg_name != f"flags{flag.group(1)}": + continue + + if flag.group(3) == "true" or flag.group(3).startswith("Vector"): + write_flags.append(f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} else 0") + else: + write_flags.append( + f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} is not None else 0") + + write_flags = "\n ".join([ + f"{arg_name} = 0", + "\n ".join(write_flags), + f"b.write(Int({arg_name}))\n " + ]) + + write_types += write_flags + read_types += f"\n {arg_name} = Int.read(b)\n " + + continue if flag: - index, flag_type = flag[0] + number, index, flag_type = flag.groups() if flag_type == "true": read_types += "\n " - read_types += "{} = True if flags & (1 << {}) else False".format(arg_name, index) - elif flag_type in core_types: + read_types += f"{arg_name} = True if flags{number} & (1 << {index}) else False" + elif flag_type in CORE_TYPES: write_types += "\n " - write_types += "if self.{} is not None:\n ".format(arg_name) - write_types += "b.write({}(self.{}))\n ".format(flag_type.title(), arg_name) + write_types += f"if self.{arg_name} is not None:\n " + write_types += f"b.write({flag_type.title()}(self.{arg_name}))\n " read_types += "\n " - read_types += "{} = {}.read(b) if flags & (1 << {}) else None".format( - arg_name, flag_type.title(), index - ) + read_types += f"{arg_name} = {flag_type.title()}.read(b) if flags{number} & (1 << {index}) else None" elif "vector" in flag_type.lower(): sub_type = arg_type.split("<")[1][:-1] write_types += "\n " - write_types += "if self.{} is not None:\n ".format(arg_name) + write_types += f"if self.{arg_name} is not None:\n " write_types += "b.write(Vector(self.{}{}))\n ".format( - arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else "" + arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else "" ) read_types += "\n " - read_types += "{} = Object.read(b{}) if flags & (1 << {}) else []\n ".format( - arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else "", index + read_types += "{} = TLObject.read(b{}) if flags{} & (1 << {}) else []\n ".format( + arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else "", number, index ) else: write_types += "\n " - write_types += "if self.{} is not None:\n ".format(arg_name) - write_types += "b.write(self.{}.write())\n ".format(arg_name) + write_types += f"if self.{arg_name} is not None:\n " + write_types += f"b.write(self.{arg_name}.write())\n " read_types += "\n " - read_types += "{} = Object.read(b) if flags & (1 << {}) else None\n ".format( - arg_name, index - ) + read_types += f"{arg_name} = TLObject.read(b) if flags{number} & (1 << {index}) else None\n " else: - if arg_type in core_types: + if arg_type in CORE_TYPES: write_types += "\n " - write_types += "b.write({}(self.{}))\n ".format(arg_type.title(), arg_name) + write_types += f"b.write({arg_type.title()}(self.{arg_name}))\n " read_types += "\n " - read_types += "{} = {}.read(b)\n ".format(arg_name, arg_type.title()) + read_types += f"{arg_name} = {arg_type.title()}.read(b)\n " elif "vector" in arg_type.lower(): sub_type = arg_type.split("<")[1][:-1] write_types += "\n " write_types += "b.write(Vector(self.{}{}))\n ".format( - arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else "" + arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else "" ) read_types += "\n " - read_types += "{} = Object.read(b{})\n ".format( - arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else "" + read_types += "{} = TLObject.read(b{})\n ".format( + arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else "" ) else: write_types += "\n " - write_types += "b.write(self.{}.write())\n ".format(arg_name) + write_types += f"b.write(self.{arg_name}.write())\n " read_types += "\n " - read_types += "{} = Object.read(b)\n ".format(arg_name) + read_types += f"{arg_name} = TLObject.read(b)\n " - with open("{}/{}.py".format(path, self.snek(name)), "w") as f: - f.write( - self.template.format( - notice=self.notice, - class_name=self.caml(name), - object_id=object_id, - arguments=arguments, - fields=fields, - read_flags=read_flags, - read_types=read_types, - write_flags=write_flags, - write_types=write_types, - return_arguments=", ".join([i[0] for i in sorted_args]) - ) - ) + slots = ", ".join([f'"{i[0]}"' for i in sorted_args]) + return_arguments = ", ".join([f"{i[0]}={i[0]}" for i in sorted_args]) + + compiled_combinator = combinator_tmpl.format( + notice=notice, + warning=WARNING, + name=c.name, + docstring=docstring, + slots=slots, + id=c.id, + qualname=f"{c.section}.{c.qualname}", + arguments=arguments, + fields=fields, + read_types=read_types, + write_types=write_types, + return_arguments=return_arguments + ) + + directory = "types" if c.section == "types" else c.section + + dir_path = DESTINATION_PATH / directory / c.namespace + + os.makedirs(dir_path, exist_ok=True) + + module = c.name + + if module == "Updates": + module = "UpdatesT" + + with open(dir_path / f"{snake(module)}.py", "w") as f: + f.write(compiled_combinator) + + d = namespaces_to_constructors if c.section == "types" else namespaces_to_functions + + if c.namespace not in d: + d[c.namespace] = [] + + d[c.namespace].append(c.name) + + for namespace, types in namespaces_to_types.items(): + with open(DESTINATION_PATH / "base" / namespace / "__init__.py", "w") as f: + f.write(f"{notice}\n\n") + f.write(f"{WARNING}\n\n") + + for t in types: + module = t + + if module == "Updates": + module = "UpdatesT" + + f.write(f"from .{snake(module)} import {t}\n") + + if not namespace: + f.write(f"from . import {', '.join(filter(bool, namespaces_to_types))}") + + for namespace, types in namespaces_to_constructors.items(): + with open(DESTINATION_PATH / "types" / namespace / "__init__.py", "w") as f: + f.write(f"{notice}\n\n") + f.write(f"{WARNING}\n\n") + + for t in types: + module = t + + if module == "Updates": + module = "UpdatesT" + + f.write(f"from .{snake(module)} import {t}\n") + + if not namespace: + f.write(f"from . import {', '.join(filter(bool, namespaces_to_constructors))}\n") + + for namespace, types in namespaces_to_functions.items(): + with open(DESTINATION_PATH / "functions" / namespace / "__init__.py", "w") as f: + f.write(f"{notice}\n\n") + f.write(f"{WARNING}\n\n") + + for t in types: + module = t - @staticmethod - def snek(s): - # https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case - 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() + if module == "Updates": + module = "UpdatesT" - @staticmethod - def caml(s): - s = Compiler.snek(s).split("_") - return "".join([str(i.title()) for i in s]) + f.write(f"from .{snake(module)} import {t}\n") - def start(self): - shutil.rmtree("{}/types".format(dest), ignore_errors=True) - shutil.rmtree("{}/functions".format(dest), ignore_errors=True) + if not namespace: + f.write(f"from . import {', '.join(filter(bool, namespaces_to_functions))}") - self.read_schema() - self.parse_schema() - self.finish() + with open(DESTINATION_PATH / "all.py", "w", encoding="utf-8") as f: + f.write(notice + "\n\n") + f.write(WARNING + "\n\n") + f.write(f"layer = {layer}\n\n") + f.write("objects = {") - print() + for c in combinators: + f.write(f'\n {c.id}: "pyrogram.raw.{c.section}.{c.qualname}",') + f.write('\n 0xbc799737: "pyrogram.raw.core.BoolFalse",') + f.write('\n 0x997275b5: "pyrogram.raw.core.BoolTrue",') + f.write('\n 0x1cb5c415: "pyrogram.raw.core.Vector",') + f.write('\n 0x73f1f8dc: "pyrogram.raw.core.MsgContainer",') + f.write('\n 0xae500895: "pyrogram.raw.core.FutureSalts",') + f.write('\n 0x0949d9dc: "pyrogram.raw.core.FutureSalt",') + f.write('\n 0x3072cfa1: "pyrogram.raw.core.GzipPacked",') + f.write('\n 0x5bb8e511: "pyrogram.raw.core.Message",') -def start(): - c = Compiler() - c.start() + f.write("\n}\n") if "__main__" == __name__: - home = "." - dest = "../../pyrogram/api" - notice_path = "../../NOTICE" + HOME_PATH = Path(".") + DESTINATION_PATH = Path("../../pyrogram/raw") + NOTICE_PATH = Path("../../NOTICE") - start() + start(format=False) diff --git a/compiler/api/source/auth_key.tl b/compiler/api/source/auth_key.tl index 77c4c6027d..dad176feca 100644 --- a/compiler/api/source/auth_key.tl +++ b/compiler/api/source/auth_key.tl @@ -7,7 +7,9 @@ resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector = ResPQ; p_q_inner_data#83c95aec pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data; +p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data; p_q_inner_data_temp#3c6a84d4 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data; +p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data; bind_auth_key_inner#75a3f765 nonce:long temp_auth_key_id:long perm_auth_key_id:long temp_session_id:long expires_at:int = BindAuthKeyInner; @@ -29,6 +31,7 @@ destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes; ---functions--- req_pq#60469778 nonce:int128 = ResPQ; +req_pq_multi#be7e8ef1 nonce:int128 = ResPQ; req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:bytes q:bytes public_key_fingerprint:long encrypted_data:bytes = Server_DH_Params; diff --git a/compiler/api/source/main_api.tl b/compiler/api/source/main_api.tl index fba51767b0..dc5d992655 100644 --- a/compiler/api/source/main_api.tl +++ b/compiler/api/source/main_api.tl @@ -1,4 +1,31 @@ -// https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/scheme.tl +// https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/SourceFiles/mtproto/scheme/api.tl +// https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl + +/////////////////////////////// +/////////////////// Layer cons +/////////////////////////////// + +//invokeAfterMsg#cb9f372d msg_id:long query:!X = X; +//invokeAfterMsgs#3dc4b4f0 msg_ids:Vector query:!X = X; +//invokeWithLayer1#53835315 query:!X = X; +//invokeWithLayer2#289dd1f6 query:!X = X; +//invokeWithLayer3#b7475268 query:!X = X; +//invokeWithLayer4#dea0d430 query:!X = X; +//invokeWithLayer5#417a57ae query:!X = X; +//invokeWithLayer6#3a64d54d query:!X = X; +//invokeWithLayer7#a5be56d3 query:!X = X; +//invokeWithLayer8#e9abd9fd query:!X = X; +//invokeWithLayer9#76715a63 query:!X = X; +//invokeWithLayer10#39620c41 query:!X = X; +//invokeWithLayer11#a6b88fdf query:!X = X; +//invokeWithLayer12#dda60d3c query:!X = X; +//invokeWithLayer13#427c8ea2 query:!X = X; +//invokeWithLayer14#2b9b08fa query:!X = X; +//invokeWithLayer15#b4418b64 query:!X = X; +//invokeWithLayer16#cf5f0987 query:!X = X; +//invokeWithLayer17#50858a19 query:!X = X; +//invokeWithLayer18#1c900537 query:!X = X; +//invokeWithLayer#da9b0d0d layer:int query:!X = X; // after 18 layer /////////////////////////////// ///////// Main application API @@ -6,8 +33,15 @@ ---types--- +int ? = Int; +long ? = Long; +double ? = Double; +string ? = String; + +bytes = Bytes; + // boolFalse#bc799737 = Bool; // Parsed manually -// boolTrue#997275b5 = Bool; // parsed manually +// boolTrue#997275b5 = Bool; // Parsed manually // true#3fedd339 = True; // Not used @@ -15,57 +49,78 @@ // error#c4b9f9bb code:int text:string = Error; // Not used -// null#56730bcc = Null; // Not used +// null#56730bcc = Null; // Parsed manually + +ipPort#d433ad73 ipv4:int port:int = IpPort; +ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort; +accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector = AccessPointRule; +help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple; + +inputPeerPhotoFileLocationLegacy#27d69997 flags:# big:flags.0?true peer:InputPeer volume_id:long local_id:int = InputFileLocation; +inputStickerSetThumbLegacy#dbaeae9 stickerset:InputStickerSet volume_id:long local_id:int = InputFileLocation; inputPeerEmpty#7f3b18ea = InputPeer; 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; +inputPeerChat#35a95cb9 chat_id:long = InputPeer; +inputPeerUser#dde8a54c user_id:long access_hash:long = InputPeer; +inputPeerChannel#27bcbbfc channel_id:long access_hash:long = InputPeer; +inputPeerUserFromMessage#a87b0a1c peer:InputPeer msg_id:int user_id:long = InputPeer; +inputPeerChannelFromMessage#bd2a0840 peer:InputPeer msg_id:int channel_id:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; -inputUser#d8292816 user_id:int access_hash:long = InputUser; +inputUser#f21158c6 user_id:long access_hash:long = InputUser; +inputUserFromMessage#1da448e2 peer:InputPeer msg_id:int user_id:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; +inputFileStoryDocument#62dc8b48 id:InputDocument = InputFile; inputMediaEmpty#9664f57f = InputMedia; -inputMediaUploadedPhoto#2f37e231 flags:# file:InputFile caption:string stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; -inputMediaPhoto#81fa373a flags:# id:InputPhoto caption:string ttl_seconds:flags.0?int = InputMedia; +inputMediaUploadedPhoto#1e287d04 flags:# spoiler:flags.2?true file:InputFile stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; +inputMediaPhoto#b3ba0635 flags:# spoiler:flags.1?true id:InputPhoto ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; -inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; -inputMediaUploadedDocument#e39621fd flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector caption:string stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; -inputMediaDocument#5acb668e flags:# id:InputDocument caption:string ttl_seconds:flags.0?int = InputMedia; +inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia; +inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true force_file:flags.4?true spoiler:flags.5?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; +inputMediaDocument#33473058 flags:# spoiler:flags.2?true id:InputDocument ttl_seconds:flags.0?int query:flags.1?string = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; -inputMediaGifExternal#4843b0fd url:string q:string = InputMedia; -inputMediaPhotoExternal#922aec1 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; -inputMediaDocumentExternal#b6f74335 flags:# url:string caption:string ttl_seconds:flags.0?int = InputMedia; +inputMediaPhotoExternal#e5bbfe1a flags:# spoiler:flags.1?true url:string ttl_seconds:flags.0?int = InputMedia; +inputMediaDocumentExternal#fb52dc99 flags:# spoiler:flags.1?true url:string ttl_seconds:flags.0?int = InputMedia; inputMediaGame#d33f43f3 id:InputGame = InputMedia; -inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia; -inputMediaGeoLive#7b1a118f geo_point:InputGeoPoint period:int = InputMedia; +inputMediaInvoice#405fef0d flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:flags.3?string provider_data:DataJSON start_param:flags.1?string extended_media:flags.2?InputMedia = InputMedia; +inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia; +inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector solution:flags.1?string solution_entities:flags.1?Vector = InputMedia; +inputMediaDice#e66fbf7b emoticon:string = InputMedia; +inputMediaStory#89fdd778 peer:InputPeer id:int = InputMedia; +inputMediaWebPage#c21b8849 flags:# force_large_media:flags.0?true force_small_media:flags.1?true optional:flags.2?true url:string = InputMedia; +inputMediaPaidMedia#aa661fc3 stars_amount:long extended_media:Vector = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; -inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto; +inputChatUploadedPhoto#bdcdaec0 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.3?VideoSize = InputChatPhoto; inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto; inputGeoPointEmpty#e4c123d6 = InputGeoPoint; -inputGeoPoint#f3b7acc9 lat:double long:double = InputGeoPoint; +inputGeoPoint#48222faf flags:# lat:double long:double accuracy_radius:flags.0?int = InputGeoPoint; inputPhotoEmpty#1cd7bf0d = InputPhoto; -inputPhoto#fb95c6c4 id:long access_hash:long = InputPhoto; +inputPhoto#3bb3b94a id:long access_hash:long file_reference:bytes = InputPhoto; -inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; +inputFileLocation#dfdaabe1 volume_id:long local_id:int secret:long file_reference:bytes = InputFileLocation; inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; -inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation; - -inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent; - -peerUser#9db1bc6d user_id:int = Peer; -peerChat#bad0e5bb chat_id:int = Peer; -peerChannel#bddde532 channel_id:int = Peer; +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; +inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation; +inputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation; +inputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation; +inputGroupCallStream#598a92a flags:# call:InputGroupCall time_ms:long scale:int video_channel:flags.0?int video_quality:flags.0?int = InputFileLocation; + +peerUser#59511722 user_id:long = Peer; +peerChat#36c6019a chat_id:long = Peer; +peerChannel#a2a5371e channel_id:long = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.filePartial#40bc6f52 = storage.FileType; @@ -78,149 +133,179 @@ 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#53d69076 dc_id:int volume_id:long local_id:int secret:long = 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 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; +userEmpty#d3bc4b7a id:long = User; +user#83314fca 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 apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long 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?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; -userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; +userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto; userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; -userStatusRecently#e26f42f1 = UserStatus; -userStatusLastWeek#7bf09fc = UserStatus; -userStatusLastMonth#77ebc742 = UserStatus; +userStatusRecently#7b197dc8 flags:# by_me:flags.0?true = UserStatus; +userStatusLastWeek#541a1d1a flags:# by_me:flags.0?true = UserStatus; +userStatusLastMonth#65899777 flags:# by_me:flags.0?true = UserStatus; -chatEmpty#9ba2d800 id:int = Chat; -chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; -chatForbidden#7328bdb id:int title:string = Chat; -channel#450b7115 flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?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?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights 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; +chatEmpty#29562865 id:long = Chat; +chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long 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#6592a1a7 id:long title:string = Chat; +channel#aadfc8f 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 has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int = Chat; +channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; -chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; -channelFull#76af5481 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?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 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#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull; +channelFull#bbab348d 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_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true id:long 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:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long 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.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet = ChatFull; -chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; -chatParticipantCreator#da13538a user_id:int = ChatParticipant; -chatParticipantAdmin#e2d6e436 user_id:int inviter_id:int date:int = ChatParticipant; +chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; +chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant; +chatParticipantAdmin#a0933f5b user_id:long inviter_id:long date:int = ChatParticipant; -chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants; -chatParticipants#3f460fed chat_id:int participants:Vector version:int = ChatParticipants; +chatParticipantsForbidden#8763d3e1 flags:# chat_id:long self_participant:flags.0?ChatParticipant = ChatParticipants; +chatParticipants#3cbc93f8 chat_id:long participants:Vector version:int = ChatParticipants; chatPhotoEmpty#37c1011c = ChatPhoto; -chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; +chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes 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 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; +messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message; +message#94345242 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 edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck = Message; +messageService#2b085862 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?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message; messageMediaEmpty#3ded6320 = MessageMedia; -messageMediaPhoto#b5223b0f flags:# photo:flags.0?Photo caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; +messageMediaPhoto#695150d7 flags:# spoiler:flags.3?true photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; -messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; +messageMediaContact#70322949 phone_number:string first_name:string last_name:string vcard:string user_id:long = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; -messageMediaDocument#7c4414d3 flags:# document:flags.0?Document caption:flags.1?string ttl_seconds:flags.2?int = MessageMedia; -messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; +messageMediaDocument#4cf4d72d flags:# nopremium:flags.3?true spoiler:flags.4?true video:flags.6?true round:flags.7?true voice:flags.8?true document:flags.0?Document alt_document:flags.5?Document ttl_seconds:flags.2?int = MessageMedia; +messageMediaWebPage#ddf10c3b flags:# force_large_media:flags.0?true force_small_media:flags.1?true manual:flags.3?true safe:flags.4?true webpage:WebPage = MessageMedia; messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia; messageMediaGame#fdb19008 game:Game = MessageMedia; -messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia; -messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia; +messageMediaInvoice#f6a548d3 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string extended_media:flags.4?MessageExtendedMedia = MessageMedia; +messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia; +messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; +messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; +messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; +messageMediaGiveaway#daad85b0 flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector countries_iso2:flags.1?Vector prize_description:flags.3?string quantity:int months:int until_date:int = MessageMedia; +messageMediaGiveawayResults#c6991068 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector months:int prize_description:flags.1?string until_date:int = MessageMedia; +messageMediaPaidMedia#a8852491 stars_amount:long extended_media:Vector = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; -messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; +messageActionChatCreate#bd47cbad title:string users:Vector = MessageAction; messageActionChatEditTitle#b5a1ce5a title:string = MessageAction; messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; -messageActionChatAddUser#488a7337 users:Vector = MessageAction; -messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; -messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; +messageActionChatAddUser#15cefd00 users:Vector = MessageAction; +messageActionChatDeleteUser#a43f30cc user_id:long = MessageAction; +messageActionChatJoinedByLink#31224c3 inviter_id:long = MessageAction; messageActionChannelCreate#95d2ac92 title:string = MessageAction; -messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; -messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; +messageActionChatMigrateTo#e1037f92 channel_id:long = MessageAction; +messageActionChannelMigrateFrom#ea3948e9 title:string chat_id:long = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; 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; +messageActionPaymentSentMe#8f31b327 flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string charge:PaymentCharge = MessageAction; +messageActionPaymentSent#96163f56 flags:# recurring_init:flags.2?true recurring_used:flags.3?true currency:string total_amount:long invoice_slug:flags.0?string = 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; - -dialog#e4def5db flags:# pinned:flags.2?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; +messageActionBotAllowed#c516d679 flags:# attach_menu:flags.1?true from_request:flags.3?true domain:flags.0?string app:flags.2?BotApp = MessageAction; +messageActionSecureValuesSentMe#1b287353 values:Vector credentials:SecureCredentialsEncrypted = MessageAction; +messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction; +messageActionContactSignUp#f3f25f76 = MessageAction; +messageActionGeoProximityReached#98e0d697 from_id:Peer to_id:Peer distance:int = MessageAction; +messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int = MessageAction; +messageActionInviteToGroupCall#502f92f7 call:InputGroupCall users:Vector = MessageAction; +messageActionSetMessagesTTL#3c134d7b flags:# period:int auto_setting_from:flags.0?long = MessageAction; +messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction; +messageActionSetChatTheme#aa786345 emoticon:string = MessageAction; +messageActionChatJoinedByRequest#ebbca3cb = MessageAction; +messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; +messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; +messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long = MessageAction; +messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; +messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction; +messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; +messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAction; +messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; +messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; +messageActionGiveawayLaunch#332ba9ed = MessageAction; +messageActionGiveawayResults#2a9fadc5 winners_count:int unclaimed_count:int = MessageAction; +messageActionBoostApply#cc02aa6d boosts:int = MessageAction; +messageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector = MessageAction; +messageActionPaymentRefunded#41b3e202 flags:# peer:Peer currency:string total_amount:long payload:flags.0?bytes charge:PaymentCharge = MessageAction; +messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long crypto_currency:flags.0?string crypto_amount:flags.0?long transaction_id:flags.1?string = MessageAction; + +dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?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#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; +photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector video_sizes:flags.1?Vector dc_id:int = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; -photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; -photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; +photoSize#75c78e60 type:string w:int h:int size:int = PhotoSize; +photoCachedSize#21e1ad6 type:string w:int h:int bytes:bytes = PhotoSize; +photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize; +photoSizeProgressive#fa3efb95 type:string w:int h:int sizes:Vector = PhotoSize; +photoPathSize#d8214d41 type:string bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; -geoPoint#2049d70c long:double lat:double = GeoPoint; - -auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; +geoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radius:flags.0?int = GeoPoint; -auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; +auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; +auth.sentCodeSuccess#2390fe44 authorization:auth.Authorization = auth.SentCode; -auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; +auth.authorization#2ea2c0d4 flags:# setup_password_required:flags.1?true otherwise_relogin_days:flags.1?int tmp_sessions:flags.0?int future_auth_token:flags.2?bytes user:User = auth.Authorization; +auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization; -auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; +auth.exportedAuthorization#b434e2b8 id:long bytes:bytes = auth.ExportedAuthorization; inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; -inputNotifyAll#a429b886 = InputNotifyPeer; - -inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; -inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; +inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer; +inputNotifyForumTopic#5c467992 peer:InputPeer top_msg_id:int = InputNotifyPeer; -inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; +inputPeerNotifySettings#cacb6ae2 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_sound:flags.8?NotificationSound = InputPeerNotifySettings; -peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; -peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; +peerNotifySettings#99622c0c flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int ios_sound:flags.3?NotificationSound android_sound:flags.4?NotificationSound other_sound:flags.5?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_ios_sound:flags.8?NotificationSound stories_android_sound:flags.9?NotificationSound stories_other_sound:flags.10?NotificationSound = PeerNotifySettings; -peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; -peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; +peerSettings#acd66c5e flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true business_bot_paused:flags.11?true business_bot_can_reply:flags.12?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int business_bot_id:flags.13?long business_bot_manage_url:flags.13?string = PeerSettings; -peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; - -wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; -wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; +wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper; +wallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; -inputReportReasonOther#e1746d0a text:string = ReportReason; - -userFull#f220f3f flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; - -contact#f911c994 user_id:int mutual:Bool = Contact; +inputReportReasonChildAbuse#adf44ee3 = ReportReason; +inputReportReasonOther#c1e4a2b1 = ReportReason; +inputReportReasonCopyright#9b89f93a = ReportReason; +inputReportReasonGeoIrrelevant#dbd4feed = ReportReason; +inputReportReasonFake#f5ddd6e7 = ReportReason; +inputReportReasonIllegalDrugs#a8eb2be = ReportReason; +inputReportReasonPersonalDetails#9ec7863d = ReportReason; -importedContact#d0028438 user_id:int client_id:long = ImportedContact; +userFull#cc997720 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int = UserFull; -contactBlocked#561bc879 user_id:int date:int = ContactBlocked; +contact#145ade0b user_id:long mutual:Bool = Contact; -contactStatus#d3680c61 user_id:int status:UserStatus = ContactStatus; +importedContact#c13e3c50 user_id:long client_id:long = ImportedContact; -contacts.link#3ace484c my_link:ContactLink foreign_link:ContactLink user:User = contacts.Link; +contactStatus#16d9703b user_id:long status:UserStatus = ContactStatus; contacts.contactsNotModified#b74ba9d2 = contacts.Contacts; contacts.contacts#eae87e42 contacts:Vector saved_count:int users:Vector = contacts.Contacts; contacts.importedContacts#77d01c3b imported:Vector popular_invites:Vector retry_contacts:Vector users:Vector = contacts.ImportedContacts; -contacts.blocked#1c138d15 blocked:Vector users:Vector = contacts.Blocked; -contacts.blockedSlice#900802a1 count:int blocked:Vector users:Vector = contacts.Blocked; +contacts.blocked#ade1591 blocked:Vector chats:Vector users:Vector = contacts.Blocked; +contacts.blockedSlice#e1664194 count:int blocked:Vector chats:Vector users:Vector = contacts.Blocked; messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; +messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; -messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; -messages.channelMessages#99262e37 flags:# pts:int count:int messages:Vector chats:Vector users:Vector = messages.Messages; +messages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector chats:Vector users:Vector = messages.Messages; +messages.channelMessages#c776ba4e flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector topics:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; @@ -246,73 +331,147 @@ inputMessagesFilterRoundVideo#b549da53 = MessagesFilter; inputMessagesFilterMyMentions#c1f8e69a = MessagesFilter; inputMessagesFilterGeo#e7026d0d = MessagesFilter; inputMessagesFilterContacts#e062db83 = MessagesFilter; +inputMessagesFilterPinned#1bb00451 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; -updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; -updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; +updateUserTyping#c01e857f user_id:long action:SendMessageAction = Update; +updateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; -updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update; -updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update; -updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update; -updateContactRegistered#2575bbb9 user_id:int date:int = Update; -updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; +updateUserStatus#e5bdf8de user_id:long status:UserStatus = Update; +updateUserName#a7848924 user_id:long first_name:string last_name:string usernames:Vector = Update; +updateNewAuthorization#8951abef flags:# unconfirmed:flags.0?true hash:long date:flags.0?int device:flags.0?string location:flags.0?string = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; -updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update; -updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; +updateChatParticipantAdd#3dda5451 chat_id:long user_id:long inviter_id:long date:int version:int = Update; +updateChatParticipantDelete#e32f3d77 chat_id:long user_id:long version:int = Update; updateDcOptions#8e5e9873 dc_options:Vector = Update; -updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; -updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; +updateServiceNotification#ebe46819 flags:# popup:flags.0?true invert_media:flags.2?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; +updateUserPhone#5492a13 user_id:long phone:string = 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; +updateReadMessagesContents#f8227181 flags:# messages:Vector pts:int pts_count:int date:flags.0?int = Update; +updateChannelTooLong#108d941f flags:# channel_id:long pts:flags.0?int = Update; +updateChannel#635b4c09 channel_id:long = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; -updateReadChannelInbox#4214f37f channel_id:int max_id: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; -updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update; -updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update; +updateReadChannelInbox#922e6e10 flags:# folder_id:flags.0?int channel_id:long max_id:int still_unread_count:int pts:int = Update; +updateDeleteChannelMessages#c32d5b12 channel_id:long messages:Vector pts:int pts_count:int = Update; +updateChannelMessageViews#f226ac08 channel_id:long id:int views:int = Update; +updateChatParticipantAdmin#d7ca61a2 chat_id:long user_id:long is_admin:Bool version:int = Update; updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update; -updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector = Update; -updateStickerSets#43ae3dec = Update; +updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true emojis:flags.1?true order:Vector = Update; +updateStickerSets#31c24808 flags:# masks:flags.0?true emojis:flags.1?true = Update; updateSavedGifs#9375341e = Update; -updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update; -updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; +updateBotInlineQuery#496f379c flags:# query_id:long user_id:long query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update; +updateBotInlineSend#12f12a07 flags:# user_id:long query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; -updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; -updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; +updateBotCallbackQuery#b9cfc48d flags:# query_id:long user_id:long peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; -updateInlineBotCallbackQuery#f9d27a5a flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; -updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; -updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; +updateInlineBotCallbackQuery#691e9052 flags:# query_id:long user_id:long msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; +updateReadChannelOutbox#b75f99a9 channel_id:long max_id:int = Update; +updateDraftMessage#1b49ec6d flags:# peer:Peer top_msg_id:flags.0?int draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; -updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; -updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; -updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector = Update; +updateChannelWebPage#2f2ba99f channel_id:long webpage:WebPage pts:int pts_count:int = 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; -updateBotPrecheckoutQuery#5d2f3aa9 flags:# query_id:long user_id:int payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; +updateBotShippingQuery#b5aefd7d query_id:long user_id:long payload:bytes shipping_address:PostAddress = Update; +updateBotPrecheckoutQuery#8caa9a96 flags:# query_id:long user_id:long payload:bytes info:flags.0?PaymentRequestedInfo shipping_option_id:flags.1?string currency:string total_amount:long = Update; updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; -updateLangPackTooLong#10c2404b = Update; +updateLangPackTooLong#46560264 lang_code:string = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; -updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; +updateChannelReadMessagesContents#ea29055d flags:# channel_id:long top_msg_id:flags.0?int messages:Vector = Update; updateContactsReset#7084a7be = Update; -updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; +updateChannelAvailableMessages#b23fc698 channel_id:long available_min_id:int = Update; +updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = 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; +updatePeerSettings#6a7e7366 peer:Peer settings:PeerSettings = Update; +updatePeerLocated#b4afcfb0 peers:Vector = Update; +updateNewScheduledMessage#39a51dfb message:Message = Update; +updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector = Update; +updateTheme#8216fba3 theme:Theme = Update; +updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update; +updateLoginToken#564fe691 = Update; +updateMessagePollVote#24f40e77 poll_id:long peer:Peer options:Vector qts:int = Update; +updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update; +updateDialogFilterOrder#a5d72105 order:Vector = Update; +updateDialogFilters#3504914f = Update; +updatePhoneCallSignalingData#2661bf09 phone_call_id:long data:bytes = Update; +updateChannelMessageForwards#d29a27f4 channel_id:long id:int forwards:int = Update; +updateReadChannelDiscussionInbox#d6b19546 flags:# channel_id:long top_msg_id:int read_max_id:int broadcast_id:flags.0?long broadcast_post:flags.0?int = Update; +updateReadChannelDiscussionOutbox#695c9e7c channel_id:long top_msg_id:int read_max_id:int = Update; +updatePeerBlocked#ebe07752 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer = Update; +updateChannelUserTyping#8c88c923 flags:# channel_id:long top_msg_id:flags.0?int from_id:Peer action:SendMessageAction = Update; +updatePinnedMessages#ed85eab5 flags:# pinned:flags.0?true peer:Peer messages:Vector pts:int pts_count:int = Update; +updatePinnedChannelMessages#5bb98608 flags:# pinned:flags.0?true channel_id:long messages:Vector pts:int pts_count:int = Update; +updateChat#f89a6a4e chat_id:long = Update; +updateGroupCallParticipants#f2ebdb4e call:InputGroupCall participants:Vector version:int = Update; +updateGroupCall#14b24500 chat_id:long call:GroupCall = Update; +updatePeerHistoryTTL#bb9bb9a5 flags:# peer:Peer ttl_period:flags.0?int = Update; +updateChatParticipant#d087663a flags:# chat_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChatParticipant new_participant:flags.1?ChatParticipant invite:flags.2?ExportedChatInvite qts:int = Update; +updateChannelParticipant#985d3abb flags:# via_chatlist:flags.3?true channel_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant invite:flags.2?ExportedChatInvite qts:int = Update; +updateBotStopped#c4870a49 user_id:long date:int stopped:Bool qts:int = Update; +updateGroupCallConnection#b783982 flags:# presentation:flags.0?true params:DataJSON = Update; +updateBotCommands#4d712f2e peer:Peer bot_id:long commands:Vector = Update; +updatePendingJoinRequests#7063c3db peer:Peer requests_pending:int recent_requesters:Vector = Update; +updateBotChatInviteRequester#11dfa986 peer:Peer date:int user_id:long about:string invite:ExportedChatInvite qts:int = Update; +updateMessageReactions#5e1b3cb8 flags:# peer:Peer msg_id:int top_msg_id:flags.0?int reactions:MessageReactions = Update; +updateAttachMenuBots#17b7a20b = Update; +updateWebViewResultSent#1592b79d query_id:long = Update; +updateBotMenuButton#14b85813 bot_id:long button:BotMenuButton = Update; +updateSavedRingtones#74d8be99 = Update; +updateTranscribedAudio#84cd5a flags:# pending:flags.0?true peer:Peer msg_id:int transcription_id:long text:string = Update; +updateReadFeaturedEmojiStickers#fb4c496c = Update; +updateUserEmojiStatus#28373599 user_id:long emoji_status:EmojiStatus = Update; +updateRecentEmojiStatuses#30f443db = Update; +updateRecentReactions#6f7863f4 = Update; +updateMoveStickerSetToTop#86fccf85 flags:# masks:flags.0?true emojis:flags.1?true stickerset:long = Update; +updateMessageExtendedMedia#d5a41724 peer:Peer msg_id:int extended_media:Vector = Update; +updateChannelPinnedTopic#192efbe3 flags:# pinned:flags.0?true channel_id:long topic_id:int = Update; +updateChannelPinnedTopics#fe198602 flags:# channel_id:long order:flags.0?Vector = Update; +updateUser#20529438 user_id:long = Update; +updateAutoSaveSettings#ec05b097 = Update; +updateStory#75b3b798 peer:Peer story:StoryItem = Update; +updateReadStories#f74e932b peer:Peer max_id:int = Update; +updateStoryID#1bf335b9 id:int random_id:long = Update; +updateStoriesStealthMode#2c084dc1 stealth_mode:StoriesStealthMode = Update; +updateSentStoryReaction#7d627683 peer:Peer story_id:int reaction:Reaction = Update; +updateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update; +updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; +updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; +updateBotMessageReaction#ac21d3ce peer:Peer msg_id:int date:int actor:Peer old_reactions:Vector new_reactions:Vector qts:int = Update; +updateBotMessageReactions#9cb7759 peer:Peer msg_id:int date:int reactions:Vector qts:int = Update; +updateSavedDialogPinned#aeaf9e74 flags:# pinned:flags.0?true peer:DialogPeer = Update; +updatePinnedSavedDialogs#686c85a6 flags:# order:flags.0?Vector = Update; +updateSavedReactionTags#39c67432 = Update; +updateSmsJob#f16269d4 job_id:string = Update; +updateQuickReplies#f9470ab2 quick_replies:Vector = Update; +updateNewQuickReply#f53da717 quick_reply:QuickReply = Update; +updateDeleteQuickReply#53e6f1ec shortcut_id:int = Update; +updateQuickReplyMessage#3e050d0f message:Message = Update; +updateDeleteQuickReplyMessages#566fe7cd shortcut_id:int messages:Vector = Update; +updateBotBusinessConnect#8ae5c97a connection:BotBusinessConnection qts:int = Update; +updateBotNewBusinessMessage#9ddb347c flags:# connection_id:string message:Message reply_to_message:flags.0?Message qts:int = Update; +updateBotEditBusinessMessage#7df587c flags:# connection_id:string message:Message reply_to_message:flags.0?Message qts:int = Update; +updateBotDeleteBusinessMessage#a02a982e connection_id:string peer:Peer messages:Vector qts:int = Update; +updateNewStoryReaction#1824e40b story_id:int peer:Peer reaction:Reaction = Update; +updateBroadcastRevenueTransactions#dfd961f5 peer:Peer balances:BroadcastRevenueBalances = Update; +updateStarsBalance#fb85198 balance:long = Update; +updateBusinessBotCallbackQuery#1ea2fda7 flags:# query_id:long user_id:long connection_id:string message:Message reply_to_message:flags.2?Message chat_instance:long data:flags.0?bytes = Update; +updateStarsRevenueStatus#a584b019 peer:Peer status:StarsRevenueStatus = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -322,12 +481,12 @@ updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_mess updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; -updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; -updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; +updateShortMessage#313bc7f8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector ttl_period:flags.25?int = Updates; +updateShortChatMessage#4d6deea5 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:long chat_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector ttl_period:flags.25?int = Updates; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; -updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; +updateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector ttl_period:flags.25?int = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; @@ -335,29 +494,29 @@ photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; -upload.fileCdnRedirect#ea52fe5a dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes cdn_file_hashes:Vector = upload.File; +upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector = upload.File; -dcOption#5d8c6cc 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 = DcOption; +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 this_port_only:flags.5?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; -config#9c840964 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector 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 chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_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 suggested_lang_code:flags.2?string lang_pack_version:flags.2?int disabled_features:Vector = Config; +config#cc1a241e flags:# default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true force_try_ipv6:flags.14?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 edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int channels_read_media_period:int tmp_sessions:flags.0?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 reactions_default:flags.15?Reaction autologin_token:flags.16?string = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; -help.appUpdate#8987f311 id:int critical:Bool url:string text:string = help.AppUpdate; +help.appUpdate#ccbbce30 flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector document:flags.1?Document url:flags.2?string sticker:flags.3?Document = help.AppUpdate; help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; -encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; -encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; -encryptedChat#fa56ce36 id:int access_hash:long date:int admin_id:int participant_id:int g_a_or_b:bytes key_fingerprint:long = EncryptedChat; -encryptedChatDiscarded#13d6dd27 id:int = EncryptedChat; +encryptedChatWaiting#66b25953 id:int access_hash:long date:int admin_id:long participant_id:long = EncryptedChat; +encryptedChatRequested#48f1d94c flags:# folder_id:flags.0?int id:int access_hash:long date:int admin_id:long participant_id:long g_a:bytes = EncryptedChat; +encryptedChat#61f0d4c7 id:int access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long = EncryptedChat; +encryptedChatDiscarded#1e1c7c45 flags:# history_deleted:flags.0?true id:int = EncryptedChat; inputEncryptedChat#f141b5e1 chat_id:int access_hash:long = InputEncryptedChat; encryptedFileEmpty#c21f497e = EncryptedFile; -encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile; +encryptedFile#a8008cd8 id:long access_hash:long size:long dc_id:int key_fingerprint:int = EncryptedFile; inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; @@ -374,17 +533,18 @@ messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; inputDocumentEmpty#72f0eaae = InputDocument; -inputDocument#18798952 id:long access_hash:long = InputDocument; +inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument; documentEmpty#36f8c871 id:long = Document; -document#87232bc7 id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int version:int attributes:Vector = Document; +document#8fd4c4d8 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:long thumbs:flags.0?Vector video_thumbs:flags.1?Vector dc_id:int attributes:Vector = Document; help.support#17c6b5f6 phone_number:string user:User = help.Support; notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; -notifyAll#74d07c60 = NotifyPeer; +notifyBroadcasts#d612e8ef = NotifyPeer; +notifyForumTopic#226e6308 peer:Peer top_msg_id:int = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; @@ -399,16 +559,37 @@ sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; +speakingInGroupCallAction#d92c2285 = SendMessageAction; +sendMessageHistoryImportAction#dbda9246 progress:int = SendMessageAction; +sendMessageChooseStickerAction#b05ac6b1 = SendMessageAction; +sendMessageEmojiInteraction#25972bcb emoticon:string msg_id:int interaction:DataJSON = SendMessageAction; +sendMessageEmojiInteractionSeen#b665902e emoticon:string = SendMessageAction; -contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; +contacts.found#b3134d9d my_results:Vector results:Vector chats:Vector users:Vector = contacts.Found; inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; inputPrivacyKeyChatInvite#bdfb0426 = InputPrivacyKey; inputPrivacyKeyPhoneCall#fabadc5f = InputPrivacyKey; +inputPrivacyKeyPhoneP2P#db9e70d2 = InputPrivacyKey; +inputPrivacyKeyForwards#a4dd4c08 = InputPrivacyKey; +inputPrivacyKeyProfilePhoto#5719bacc = InputPrivacyKey; +inputPrivacyKeyPhoneNumber#352dafa = InputPrivacyKey; +inputPrivacyKeyAddedByPhone#d1219bdd = InputPrivacyKey; +inputPrivacyKeyVoiceMessages#aee69d68 = InputPrivacyKey; +inputPrivacyKeyAbout#3823cc40 = InputPrivacyKey; +inputPrivacyKeyBirthday#d65a11cc = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; privacyKeyChatInvite#500e6dfa = PrivacyKey; privacyKeyPhoneCall#3d662b7b = PrivacyKey; +privacyKeyPhoneP2P#39491cc8 = PrivacyKey; +privacyKeyForwards#69ec56a3 = PrivacyKey; +privacyKeyProfilePhoto#96151fed = PrivacyKey; +privacyKeyPhoneNumber#d19ae46d = PrivacyKey; +privacyKeyAddedByPhone#42ffd42b = PrivacyKey; +privacyKeyVoiceMessages#697f414 = PrivacyKey; +privacyKeyAbout#a486b761 = PrivacyKey; +privacyKeyBirthday#2000a518 = PrivacyKey; inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule; inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule; @@ -416,95 +597,115 @@ inputPrivacyValueAllowUsers#131cc67f users:Vector = InputPrivacyRule; inputPrivacyValueDisallowContacts#ba52007 = InputPrivacyRule; inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule; inputPrivacyValueDisallowUsers#90110467 users:Vector = InputPrivacyRule; +inputPrivacyValueAllowChatParticipants#840649cf chats:Vector = InputPrivacyRule; +inputPrivacyValueDisallowChatParticipants#e94f0f86 chats:Vector = InputPrivacyRule; +inputPrivacyValueAllowCloseFriends#2f453e49 = InputPrivacyRule; +inputPrivacyValueAllowPremium#77cdc9f1 = InputPrivacyRule; privacyValueAllowContacts#fffe1bac = PrivacyRule; privacyValueAllowAll#65427b82 = PrivacyRule; -privacyValueAllowUsers#4d5bbe0c users:Vector = PrivacyRule; +privacyValueAllowUsers#b8905fb2 users:Vector = PrivacyRule; privacyValueDisallowContacts#f888fa1a = PrivacyRule; privacyValueDisallowAll#8b73e763 = PrivacyRule; -privacyValueDisallowUsers#c7f49b7 users:Vector = PrivacyRule; +privacyValueDisallowUsers#e4621141 users:Vector = PrivacyRule; +privacyValueAllowChatParticipants#6b134e8e chats:Vector = PrivacyRule; +privacyValueDisallowChatParticipants#41c87565 chats:Vector = PrivacyRule; +privacyValueAllowCloseFriends#f7e8d89b = PrivacyRule; +privacyValueAllowPremium#ece9814b = 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; documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute; -documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true duration:int w:int h:int = DocumentAttribute; +documentAttributeVideo#17399fad flags:# round_message:flags.0?true supports_streaming:flags.1?true nosound:flags.3?true duration:double w:int h:int preload_prefix_size:flags.2?int video_start_ts:flags.4?double = DocumentAttribute; documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute; documentAttributeFilename#15590068 file_name:string = DocumentAttribute; documentAttributeHasStickers#9801d2f7 = DocumentAttribute; +documentAttributeCustomEmoji#fd149899 flags:# free:flags.0?true text_color:flags.1?true alt:string stickerset:InputStickerSet = DocumentAttribute; messages.stickersNotModified#f1749a22 = messages.Stickers; -messages.stickers#8a8ecd32 hash:string stickers:Vector = messages.Stickers; +messages.stickers#30a6ec7e hash:long stickers:Vector = messages.Stickers; stickerPack#12b299d4 emoticon:string documents:Vector = StickerPack; messages.allStickersNotModified#e86602c3 = messages.AllStickers; -messages.allStickers#edfd405f hash:int sets:Vector = messages.AllStickers; - -disabledFeature#ae636f24 feature:string description:string = DisabledFeature; +messages.allStickers#cdbbcebb hash:long sets:Vector = messages.AllStickers; messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; -contactLinkUnknown#5f4f9247 = ContactLink; -contactLinkNone#feedd3ad = ContactLink; -contactLinkHasPhone#268f3f59 = ContactLink; -contactLinkContact#d502c2d0 = ContactLink; - -webPageEmpty#eb1477e8 id:long = WebPage; -webPagePending#c586da1c id:long date:int = WebPage; -webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; -webPageNotModified#85849473 = WebPage; +webPageEmpty#211a1788 flags:# id:long url:flags.0?string = WebPage; +webPagePending#b0d13e47 flags:# id:long url:flags.0?string date:int = WebPage; +webPage#e89c45b2 flags:# has_large_media:flags.13?true id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page attributes:flags.12?Vector = WebPage; +webPageNotModified#7311ca11 flags:# cached_page_views:flags.0?int = WebPage; -authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; +authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true encrypted_requests_disabled:flags.3?true call_requests_disabled:flags.4?true unconfirmed:flags.5?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; -account.authorizations#1250abde authorizations:Vector = account.Authorizations; +account.authorizations#4bff8ea0 authorization_ttl_days:int authorizations:Vector = account.Authorizations; -account.noPassword#96dabc18 new_salt:bytes email_unconfirmed_pattern:string = account.Password; -account.password#7c18141c current_salt:bytes new_salt:bytes hint:string has_recovery:Bool email_unconfirmed_pattern:string = account.Password; +account.password#957b50fb flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int login_email_pattern:flags.6?string = account.Password; -account.passwordSettings#b7b72ab3 email:string = account.PasswordSettings; +account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings; -account.passwordInputSettings#86916deb flags:# new_salt:flags.0?bytes new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string = account.PasswordInputSettings; +account.passwordInputSettings#c23727c9 flags:# new_algo:flags.0?PasswordKdfAlgo new_password_hash:flags.0?bytes hint:flags.0?string email:flags.1?string new_secure_settings:flags.2?SecureSecretSettings = account.PasswordInputSettings; auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; -chatInviteEmpty#69df3769 = ExportedChatInvite; -chatInviteExported#fc2e05bc link:string = ExportedChatInvite; +chatInviteExported#ab4a819 flags:# revoked:flags.0?true permanent:flags.5?true request_needed:flags.6?true link:string admin_id:long date:int start_date:flags.4?int expire_date:flags.1?int usage_limit:flags.2?int usage:flags.3?int requested:flags.7?int title:flags.8?string = ExportedChatInvite; +chatInvitePublicJoinRequests#ed107ab7 = 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#cde0ec40 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true request_needed:flags.6?true verified:flags.7?true scam:flags.8?true fake:flags.9?true title:string about:flags.5?string photo:Photo participants_count:int participants:flags.4?Vector color:int = ChatInvite; +chatInvitePeek#61695cb0 chat:Chat expires:int = ChatInvite; inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; +inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet; +inputStickerSetDice#e67f520e emoticon:string = InputStickerSet; +inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet; +inputStickerSetPremiumGifts#c88b3b02 = InputStickerSet; +inputStickerSetEmojiGenericAnimations#4c4d4ce = InputStickerSet; +inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet; +inputStickerSetEmojiDefaultTopicIcons#44c1f8e9 = InputStickerSet; +inputStickerSetEmojiChannelDefaultStatuses#49748553 = InputStickerSet; -stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; +stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true emojis:flags.7?true text_color:flags.9?true channel_emoji_status:flags.10?true creator:flags.11?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; -messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; +messages.stickerSet#6e153f16 set:StickerSet packs:Vector keywords:Vector documents:Vector = messages.StickerSet; +messages.stickerSetNotModified#d3f924eb = messages.StickerSet; botCommand#c27ac8c7 command:string description:string = BotCommand; -botInfo#98e81d3a user_id:int description:string commands:Vector = BotInfo; +botInfo#8f300b57 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector menu_button:flags.3?BotMenuButton = BotInfo; keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; -keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; +keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; -keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; +keyboardButtonSwitchInline#93b9fbb5 flags:# same_peer:flags.0?true text:string query:string peer_types:flags.1?Vector = 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; +keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton; +inputKeyboardButtonUserProfile#e988037b text:string user_id:InputUser = KeyboardButton; +keyboardButtonUserProfile#308660c1 text:string user_id:long = KeyboardButton; +keyboardButtonWebView#13767230 text:string url:string = KeyboardButton; +keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton; +keyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; +inputKeyboardButtonRequestPeer#c9662d05 flags:# name_requested:flags.0?true username_requested:flags.1?true photo_requested:flags.2?true text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; replyKeyboardHide#a03e5b85 flags:# selective:flags.2?true = ReplyMarkup; -replyKeyboardForceReply#f4108aa0 flags:# single_use:flags.1?true selective:flags.2?true = ReplyMarkup; -replyKeyboardMarkup#3502758c flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true rows:Vector = ReplyMarkup; +replyKeyboardForceReply#86b40b08 flags:# single_use:flags.1?true selective:flags.2?true placeholder:flags.3?string = ReplyMarkup; +replyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true persistent:flags.4?true rows:Vector placeholder:flags.3?string = ReplyMarkup; replyInlineMarkup#48a30254 rows:Vector = ReplyMarkup; messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity; @@ -518,28 +719,38 @@ messageEntityItalic#826f8b60 offset:int length:int = MessageEntity; messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; -messageEntityMentionName#352dca58 offset:int length:int user_id:int = MessageEntity; +messageEntityMentionName#dc7b1140 offset:int length:int user_id:long = MessageEntity; inputMessageEntityMentionName#208e68c9 offset:int length:int user_id:InputUser = MessageEntity; +messageEntityPhone#9b69e34b offset:int length:int = MessageEntity; +messageEntityCashtag#4c4e743f offset:int length:int = MessageEntity; +messageEntityUnderline#9c4e7e8b offset:int length:int = MessageEntity; +messageEntityStrike#bf0693d4 offset:int length:int = MessageEntity; +messageEntityBankCard#761e6af4 offset:int length:int = MessageEntity; +messageEntitySpoiler#32ca960f offset:int length:int = MessageEntity; +messageEntityCustomEmoji#c8cf05f8 offset:int length:int document_id:long = MessageEntity; +messageEntityBlockquote#f1ccaaac flags:# collapsed:flags.0?true offset:int length:int = MessageEntity; inputChannelEmpty#ee8c1e86 = InputChannel; -inputChannel#afeb712e channel_id:int access_hash:long = InputChannel; +inputChannel#f35aec28 channel_id:long access_hash:long = InputChannel; +inputChannelFromMessage#5b934f9d peer:InputPeer msg_id:int channel_id:long = 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; channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:Vector = ChannelMessagesFilter; -channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; -channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; -channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; -channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant; -channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant; +channelParticipant#c00c07c0 user_id:long date:int = ChannelParticipant; +channelParticipantSelf#35a8bfa7 flags:# via_request:flags.0?true user_id:long inviter_id:long date:int = ChannelParticipant; +channelParticipantCreator#2fe601d3 flags:# user_id:long admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant; +channelParticipantAdmin#34c3bb53 flags:# can_edit:flags.0?true self:flags.1?true user_id:long inviter_id:flags.1?long promoted_by:long date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant; +channelParticipantBanned#6df8014e flags:# left:flags.0?true peer:Peer kicked_by:long date:int banned_rights:ChatBannedRights = ChannelParticipant; +channelParticipantLeft#1b03f006 peer:Peer = ChannelParticipant; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter; @@ -547,63 +758,74 @@ channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter; channelParticipantsBots#b0d1865b = ChannelParticipantsFilter; channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter; channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter; +channelParticipantsContacts#bb6ae88d q:string = ChannelParticipantsFilter; +channelParticipantsMentions#e04b5ceb flags:# q:flags.0?string top_msg_id:flags.1?int = ChannelParticipantsFilter; -channels.channelParticipants#f56ee2a8 count:int participants:Vector users:Vector = channels.ChannelParticipants; +channels.channelParticipants#9ab0feaf count:int participants:Vector chats:Vector users:Vector = channels.ChannelParticipants; channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants; -channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector = channels.ChannelParticipant; - -help.termsOfService#f1ee3e90 text:string = help.TermsOfService; +channels.channelParticipant#dfb80317 participant:ChannelParticipant chats:Vector users:Vector = channels.ChannelParticipant; -foundGif#162ecc1f url:string thumb_url:string content_url:string content_type:string w:int h:int = FoundGif; -foundGifCached#9c750409 url:string photo:Photo document:Document = FoundGif; - -messages.foundGifs#450a1c0a next_offset:int results:Vector = messages.FoundGifs; +help.termsOfService#780a0310 flags:# popup:flags.0?true id:DataJSON text:string entities:Vector min_age_confirm:flags.1?int = help.TermsOfService; messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs; -messages.savedGifs#2e0709a5 hash:int gifs:Vector = messages.SavedGifs; +messages.savedGifs#84a02a0d hash:long gifs:Vector = messages.SavedGifs; -inputBotInlineMessageMediaAuto#292fed13 flags:# caption:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaAuto#3380c786 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaInvoice#d7e78225 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaWebPage#bddcc510 flags:# invert_media:flags.3?true force_large_media:flags.4?true force_small_media:flags.5?true optional:flags.6?true message:string entities:flags.1?Vector url:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; +inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.1?string description:flags.2?string document:InputDocument send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult; -botInlineMessageMediaAuto#a74b15b flags:# caption:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageMediaVenue#4366232e flags:# geo:GeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaAuto#764cf810 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaInvoice#354a9b09 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument currency:string total_amount:long reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaWebPage#809ad9a6 flags:# invert_media:flags.3?true force_large_media:flags.4?true force_small_media:flags.5?true manual:flags.7?true safe:flags.8?true message:string entities:flags.1?Vector url:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; +botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; -messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int users:Vector = messages.BotResults; +messages.botResults#e021f2f6 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM switch_webview:flags.3?InlineBotWebView results:Vector cache_time:int users:Vector = messages.BotResults; -exportedMessageLink#1f486803 link:string = ExportedMessageLink; +exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; -messageFwdHeader#559ebe6d flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader; +messageFwdHeader#4e4df4bb flags:# imported:flags.7?true saved_out:flags.11?true from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int saved_from_id:flags.8?Peer saved_from_name:flags.9?string saved_date:flags.10?int psa_type:flags.6?string = MessageFwdHeader; auth.codeTypeSms#72a3158c = auth.CodeType; auth.codeTypeCall#741cd3e3 = auth.CodeType; auth.codeTypeFlashCall#226ccefb = auth.CodeType; +auth.codeTypeMissedCall#d61ad6ee = auth.CodeType; +auth.codeTypeFragmentSms#6ed998c = auth.CodeType; auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; +auth.sentCodeTypeMissedCall#82006484 prefix:string length:int = auth.SentCodeType; +auth.sentCodeTypeEmailCode#f450f59b flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int reset_available_period:flags.3?int reset_pending_date:flags.4?int = auth.SentCodeType; +auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType; +auth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType; +auth.sentCodeTypeFirebaseSms#9fd736 flags:# nonce:flags.0?bytes play_integrity_project_id:flags.2?long play_integrity_nonce:flags.2?bytes receipt:flags.1?string push_timeout:flags.1?int length:int = auth.SentCodeType; +auth.sentCodeTypeSmsWord#a416ac81 flags:# beginning:flags.0?string = auth.SentCodeType; +auth.sentCodeTypeSmsPhrase#b37794af flags:# beginning:flags.0?string = auth.SentCodeType; messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; +inputBotInlineMessageID64#b6d915d7 dc_id:int owner_id:long id:int access_hash:long = InputBotInlineMessageID; inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; @@ -617,20 +839,24 @@ topPeerCategoryCorrespondents#637b7ed = TopPeerCategory; topPeerCategoryGroups#bd17a14a = TopPeerCategory; topPeerCategoryChannels#161d9628 = TopPeerCategory; topPeerCategoryPhoneCalls#1e76a78c = TopPeerCategory; +topPeerCategoryForwardUsers#a8406ca9 = TopPeerCategory; +topPeerCategoryForwardChats#fbeec0f0 = TopPeerCategory; +topPeerCategoryBotsApp#fd9e7bec = TopPeerCategory; topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector = TopPeerCategoryPeers; contacts.topPeersNotModified#de266ef5 = contacts.TopPeers; contacts.topPeers#70b772a8 categories:Vector chats:Vector users:Vector = contacts.TopPeers; +contacts.topPeersDisabled#b52c939d = contacts.TopPeers; -draftMessageEmpty#ba4baec5 = DraftMessage; -draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; +draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage; +draftMessage#2d65321f flags:# no_webpage:flags.1?true invert_media:flags.6?true reply_to:flags.4?InputReplyTo message:string entities:flags.3?Vector media:flags.5?InputMedia date:int effect:flags.7?long = DraftMessage; -messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; -messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers; +messages.featuredStickersNotModified#c6dc0c66 count:int = messages.FeaturedStickers; +messages.featuredStickers#be382906 flags:# premium:flags.0?true hash:long count:int sets:Vector unread:Vector = messages.FeaturedStickers; messages.recentStickersNotModified#b17f890 = messages.RecentStickers; -messages.recentStickers#5ce20970 hash:int stickers:Vector = messages.RecentStickers; +messages.recentStickers#88d37c56 hash:long packs:Vector stickers:Vector dates:Vector = messages.RecentStickers; messages.archivedStickers#4fcba9c8 count:int sets:Vector = messages.ArchivedStickers; @@ -639,6 +865,8 @@ messages.stickerSetInstallResultArchive#35e410a8 sets:Vector stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered; stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector = StickerSetCovered; +stickerSetFullCovered#40d13c0e set:StickerSet packs:Vector keywords:Vector documents:Vector = StickerSetCovered; +stickerSetNoCovered#77b15d1c set:StickerSet = StickerSetCovered; maskCoords#aed6dbb2 n:int x:double y:double zoom:double = MaskCoords; @@ -650,7 +878,7 @@ game#bdf9653b flags:# id:long access_hash:long short_name:string title:string de inputGameID#32c3e77 id:long access_hash:long = InputGame; inputGameShortName#c331e80a bot_id:InputUser short_name:string = InputGame; -highScore#58fffcd0 pos:int user_id:int score:int = HighScore; +highScore#73a379eb pos:int user_id:long score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; @@ -664,6 +892,12 @@ textFixed#6c3f19b9 text:RichText = RichText; textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; textEmail#de5a0dd6 text:RichText email:string = RichText; textConcat#7e6260d7 texts:Vector = RichText; +textSubscript#ed6a8504 text:RichText = RichText; +textSuperscript#c7fb5e01 text:RichText = RichText; +textMarked#34b8621 text:RichText = RichText; +textPhone#1ccb966a text:RichText phone:string = RichText; +textImage#81ccf4f document_id:long w:int h:int = RichText; +textAnchor#35553762 text:RichText name:string = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; @@ -676,21 +910,24 @@ pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; pageBlockFooter#48870999 text:RichText = PageBlock; pageBlockDivider#db20b188 = PageBlock; pageBlockAnchor#ce0d37b0 name:string = PageBlock; -pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; +pageBlockList#e4e88011 items:Vector = PageBlock; pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; -pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; -pageBlockVideo#d9d71866 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:RichText = PageBlock; +pageBlockPhoto#1759c560 flags:# photo_id:long caption:PageCaption url:flags.0?string webpage_id:flags.0?long = PageBlock; +pageBlockVideo#7c8fe7b6 flags:# autoplay:flags.0?true loop:flags.1?true video_id:long caption:PageCaption = PageBlock; pageBlockCover#39f23300 cover:PageBlock = PageBlock; -pageBlockEmbed#cde200d1 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:int h:int caption:RichText = PageBlock; -pageBlockEmbedPost#292c7be9 url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:RichText = PageBlock; -pageBlockCollage#8b31c4f items:Vector caption:RichText = PageBlock; -pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; +pageBlockEmbed#a8718dc5 flags:# full_width:flags.0?true allow_scrolling:flags.3?true url:flags.1?string html:flags.2?string poster_photo_id:flags.4?long w:flags.5?int h:flags.5?int caption:PageCaption = PageBlock; +pageBlockEmbedPost#f259a80b url:string webpage_id:long author_photo_id:long author:string date:int blocks:Vector caption:PageCaption = PageBlock; +pageBlockCollage#65a0fa4d items:Vector caption:PageCaption = PageBlock; +pageBlockSlideshow#31f9590 items:Vector caption:PageCaption = PageBlock; pageBlockChannel#ef1751b5 channel:Chat = PageBlock; -pageBlockAudio#31b81a7f audio_id:long caption:RichText = PageBlock; - -pagePart#8e3f9ebe blocks:Vector photos:Vector documents:Vector = Page; -pageFull#556ec7aa blocks:Vector photos:Vector documents:Vector = Page; +pageBlockAudio#804361ea audio_id:long caption:PageCaption = PageBlock; +pageBlockKicker#1e148390 text:RichText = PageBlock; +pageBlockTable#bf4dea82 flags:# bordered:flags.0?true striped:flags.1?true title:RichText rows:Vector = PageBlock; +pageBlockOrderedList#9a8ae1e1 items:Vector = PageBlock; +pageBlockDetails#76768bed flags:# open:flags.0?true blocks:Vector title:RichText = PageBlock; +pageBlockRelatedArticles#16115a96 title:RichText articles:Vector = PageBlock; +pageBlockMap#a44f3ef6 geo:GeoPoint zoom:int w:int h:int caption:PageCaption = PageBlock; phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; @@ -701,7 +938,7 @@ dataJSON#7d748d04 data:string = DataJSON; labeledPrice#cb296bf8 label:string amount:long = LabeledPrice; -invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector = Invoice; +invoice#5db95a15 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true recurring:flags.9?true currency:string prices:Vector max_tip_amount:flags.8?long suggested_tip_amounts:flags.8?Vector terms_url:flags.10?string = Invoice; paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge; @@ -711,48 +948,54 @@ paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string e paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; -webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector dc_id:int = WebDocument; +webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector = WebDocument; +webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; +inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation; +inputWebFileAudioAlbumThumbLocation#f46fe924 flags:# small:flags.2?true document:flags.0?InputDocument title:flags.1?string performer:flags.1?string = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; -payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector = payments.PaymentForm; +payments.paymentForm#a0058751 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice provider_id:long url:string native_provider:flags.4?string native_params:flags.4?DataJSON additional_methods:flags.6?Vector saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?Vector users:Vector = payments.PaymentForm; +payments.paymentFormStars#7bf6b15c flags:# form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice users:Vector = payments.PaymentForm; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector = payments.ValidatedRequestedInfo; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; -payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; +payments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult; -payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; +payments.paymentReceipt#70c4fe03 flags:# date:int bot_id:long provider_id:long title:string description:string photo:flags.2?WebDocument invoice:Invoice info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption tip_amount:flags.3?long currency:string total_amount:long credentials_title:string users:Vector = payments.PaymentReceipt; +payments.paymentReceiptStars#dabbf83a flags:# date:int bot_id:long title:string description:string photo:flags.2?WebDocument invoice:Invoice currency:string total_amount:long transaction_id:string users:Vector = payments.PaymentReceipt; payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo; inputPaymentCredentialsSaved#c10eb2cf id:string tmp_password:bytes = InputPaymentCredentials; inputPaymentCredentials#3417d728 flags:# save:flags.0?true data:DataJSON = InputPaymentCredentials; inputPaymentCredentialsApplePay#aa1c39f payment_data:DataJSON = InputPaymentCredentials; -inputPaymentCredentialsAndroidPay#795667a6 payment_token:DataJSON = InputPaymentCredentials; +inputPaymentCredentialsGooglePay#8ac32801 payment_token:DataJSON = InputPaymentCredentials; account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPassword; shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; -inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; +inputStickerSetItem#32da9e9c flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords keywords:flags.1?string = InputStickerSetItem; 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#ffe6ab67 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#c5226f17 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall; +phoneCallRequested#14b0ed0c flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall; +phoneCallAccepted#3660c311 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_b:bytes protocol:PhoneCallProtocol = PhoneCall; +phoneCall#30535af5 flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector start_date:int custom_parameters:flags.7?DataJSON = PhoneCall; +phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?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; +phoneConnection#9cc123c7 flags:# tcp:flags.0?true id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection; +phoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection; -phoneCallProtocol#a2bb35cb flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int = PhoneCallProtocol; +phoneCallProtocol#fc878fc8 flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int library_versions:Vector = PhoneCallProtocol; phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector = phone.PhoneCall; @@ -769,16 +1012,12 @@ langPackStringDeleted#2979eeb2 key:string = LangPackString; langPackDifference#f385c1f6 lang_code:string from_version:int version:int strings:Vector = LangPackDifference; -langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage; - -channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true = ChannelAdminRights; - -channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights; +langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage; 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; @@ -791,287 +1030,1544 @@ channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:Channel channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction; - -channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; +channelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction; +channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeLinkedChat#50c7ac8 prev_value:long new_value:long = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction; +channelAdminLogEventActionStartGroupCall#23209745 call:InputGroupCall = ChannelAdminLogEventAction; +channelAdminLogEventActionDiscardGroupCall#db9f9140 call:InputGroupCall = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantMute#f92424d2 participant:GroupCallParticipant = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantUnmute#e64429c0 participant:GroupCallParticipant = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleGroupCallSetting#56d6a247 join_muted:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantJoinByInvite#fe9fc158 flags:# via_chatlist:flags.0?true invite:ExportedChatInvite = ChannelAdminLogEventAction; +channelAdminLogEventActionExportedInviteDelete#5a50fca4 invite:ExportedChatInvite = ChannelAdminLogEventAction; +channelAdminLogEventActionExportedInviteRevoke#410a134e invite:ExportedChatInvite = ChannelAdminLogEventAction; +channelAdminLogEventActionExportedInviteEdit#e90ebb59 prev_invite:ExportedChatInvite new_invite:ExportedChatInvite = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantVolume#3e7f6847 participant:GroupCallParticipant = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantJoinByRequest#afb6144a invite:ExportedChatInvite approved_by:long = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeAvailableReactions#be4e0ef8 prev_value:ChatReactions new_value:ChatReactions = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeUsernames#f04fb3a9 prev_value:Vector new_value:Vector = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleForum#2cc6383 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionCreateTopic#58707d28 topic:ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionEditTopic#f06fe208 prev_topic:ForumTopic new_topic:ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionChangePeerColor#5796e780 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeProfilePeerColor#5e477b25 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_value:WallPaper = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeEmojiStickerSet#46d840ab prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction; + +channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; -channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true = ChannelAdminLogEventsFilter; +channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; -cdnFileHash#77eec38f offset:int limit:int hash:bytes = CdnFileHash; - messages.favedStickersNotModified#9e8fa6d3 = messages.FavedStickers; -messages.favedStickers#f37f2f16 hash:int packs:Vector stickers:Vector = messages.FavedStickers; +messages.favedStickers#2cb51097 hash:long packs:Vector stickers:Vector = messages.FavedStickers; recentMeUrlUnknown#46e1d13d url:string = RecentMeUrl; -recentMeUrlUser#8dbc3336 url:string user_id:int = RecentMeUrl; -recentMeUrlChat#a01b22f9 url:string chat_id:int = RecentMeUrl; +recentMeUrlUser#b92c09e2 url:string user_id:long = RecentMeUrl; +recentMeUrlChat#b2da71d2 url:string chat_id:long = RecentMeUrl; recentMeUrlChatInvite#eb49081d url:string chat_invite:ChatInvite = RecentMeUrl; recentMeUrlStickerSet#bc0a57dc url:string set:StickerSetCovered = RecentMeUrl; help.recentMeUrls#e0310d7 urls:Vector chats:Vector users:Vector = help.RecentMeUrls; -inputSingleMedia#5eaa7809 media:InputMedia random_id:long = InputSingleMedia; +inputSingleMedia#1cc6e91f flags:# media:InputMedia random_id:long message:string entities:flags.0?Vector = InputSingleMedia; + +webAuthorization#a6f8f452 hash:long bot_id:long domain:string browser:string platform:string date_created:int date_active:int ip:string region:string = WebAuthorization; + +account.webAuthorizations#ed56c9fc authorizations:Vector users:Vector = account.WebAuthorizations; + +inputMessageID#a676a322 id:int = InputMessage; +inputMessageReplyTo#bad88395 id:int = InputMessage; +inputMessagePinned#86872538 = InputMessage; +inputMessageCallbackQuery#acfa1a7e id:int query_id:long = 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#8af09dd2 hash:long sets:Vector = messages.FoundStickerSets; + +fileHash#f39b035c offset:long limit:int hash:bytes = FileHash; + +inputClientProxy#75588b3f address:string port:int = InputClientProxy; + +help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate; +help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate; + +inputSecureFileUploaded#3334b0f0 id:long parts:int md5_checksum:string file_hash:bytes secret:bytes = InputSecureFile; +inputSecureFile#5367e5be id:long access_hash:long = InputSecureFile; + +secureFileEmpty#64199744 = SecureFile; +secureFile#7d09c27e id:long access_hash:long size:long dc_id:int date:int file_hash:bytes secret:bytes = SecureFile; + +secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData; + +securePlainPhone#7d6099dd phone:string = SecurePlainData; +securePlainEmail#21ec5a5f email:string = SecurePlainData; + +secureValueTypePersonalDetails#9d2a81e3 = SecureValueType; +secureValueTypePassport#3dac6a00 = SecureValueType; +secureValueTypeDriverLicense#6e425c4 = SecureValueType; +secureValueTypeIdentityCard#a0d0744b = SecureValueType; +secureValueTypeInternalPassport#99a48f23 = SecureValueType; +secureValueTypeAddress#cbe31e26 = SecureValueType; +secureValueTypeUtilityBill#fc36954e = SecureValueType; +secureValueTypeBankStatement#89137c0d = SecureValueType; +secureValueTypeRentalAgreement#8b883488 = SecureValueType; +secureValueTypePassportRegistration#99e3806a = SecureValueType; +secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType; +secureValueTypePhone#b320aadb = SecureValueType; +secureValueTypeEmail#8e3ca7ee = SecureValueType; + +secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector files:flags.4?Vector plain_data:flags.5?SecurePlainData hash:bytes = SecureValue; + +inputSecureValue#db21d0a7 flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?InputSecureFile reverse_side:flags.2?InputSecureFile selfie:flags.3?InputSecureFile translation:flags.6?Vector files:flags.4?Vector plain_data:flags.5?SecurePlainData = InputSecureValue; + +secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash; + +secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError; +secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector text:string = SecureValueError; +secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError; +secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector text:string = SecureValueError; + +secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted; + +account.authorizationForm#ad2e1cd8 flags:# required_types:Vector values:Vector errors:Vector users:Vector privacy_policy_url:flags.0?string = account.AuthorizationForm; + +account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode; + +help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo; +help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector = help.DeepLinkInfo; + +savedPhoneContact#1142bd56 phone:string first_name:string last_name:string date:int = SavedContact; + +account.takeout#4dba4501 id:long = account.Takeout; + +passwordKdfAlgoUnknown#d45ab096 = PasswordKdfAlgo; +passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow#3a912d4a salt1:bytes salt2:bytes g:int p:bytes = PasswordKdfAlgo; + +securePasswordKdfAlgoUnknown#4a8537 = SecurePasswordKdfAlgo; +securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 salt:bytes = SecurePasswordKdfAlgo; +securePasswordKdfAlgoSHA512#86471d92 salt:bytes = SecurePasswordKdfAlgo; + +secureSecretSettings#1527bcac secure_algo:SecurePasswordKdfAlgo secure_secret:bytes secure_secret_id:long = SecureSecretSettings; + +inputCheckPasswordEmpty#9880f658 = InputCheckPasswordSRP; +inputCheckPasswordSRP#d27ff082 srp_id:long A:bytes M1:bytes = InputCheckPasswordSRP; + +secureRequiredType#829d99da flags:# native_names:flags.0?true selfie_required:flags.1?true translation_required:flags.2?true type:SecureValueType = SecureRequiredType; +secureRequiredTypeOneOf#27477b4 types:Vector = SecureRequiredType; + +help.passportConfigNotModified#bfb9f457 = help.PassportConfig; +help.passportConfig#a098d6af hash:int countries_langs:DataJSON = help.PassportConfig; + +inputAppEvent#1d1b1245 time:double type:string peer:long data:JSONValue = InputAppEvent; + +jsonObjectValue#c0de1bd9 key:string value:JSONValue = JSONObjectValue; + +jsonNull#3f6d7b68 = JSONValue; +jsonBool#c7345e6a value:Bool = JSONValue; +jsonNumber#2be0dfa4 value:double = JSONValue; +jsonString#b71e767a value:string = JSONValue; +jsonArray#f7444763 value:Vector = JSONValue; +jsonObject#99c1d49d value:Vector = JSONValue; + +pageTableCell#34566b6a flags:# header:flags.0?true align_center:flags.3?true align_right:flags.4?true valign_middle:flags.5?true valign_bottom:flags.6?true text:flags.7?RichText colspan:flags.1?int rowspan:flags.2?int = PageTableCell; + +pageTableRow#e0c0c5e5 cells:Vector = PageTableRow; + +pageCaption#6f747657 text:RichText credit:RichText = PageCaption; + +pageListItemText#b92fb6cd text:RichText = PageListItem; +pageListItemBlocks#25e073fc blocks:Vector = PageListItem; + +pageListOrderedItemText#5e068047 num:string text:RichText = PageListOrderedItem; +pageListOrderedItemBlocks#98dd8936 num:string blocks:Vector = PageListOrderedItem; + +pageRelatedArticle#b390dc08 flags:# url:string webpage_id:long title:flags.0?string description:flags.1?string photo_id:flags.2?long author:flags.3?string published_date:flags.4?int = PageRelatedArticle; + +page#98657f0d flags:# part:flags.0?true rtl:flags.1?true v2:flags.2?true url:string blocks:Vector photos:Vector documents:Vector views:flags.3?int = Page; + +help.supportName#8c05f1c9 name:string = help.SupportName; + +help.userInfoEmpty#f3ae2eed = help.UserInfo; +help.userInfo#1eb3758 message:string entities:Vector author:string date:int = help.UserInfo; + +pollAnswer#ff16e2ca text:TextWithEntities option:bytes = PollAnswer; + +poll#58747131 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:TextWithEntities answers:Vector close_period:flags.4?int close_date:flags.5?int = Poll; + +pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters; + +pollResults#7adf2420 flags:# min:flags.0?true results:flags.1?Vector total_voters:flags.2?int recent_voters:flags.3?Vector solution:flags.4?string solution_entities:flags.4?Vector = PollResults; + +chatOnlines#f041e250 onlines:int = ChatOnlines; + +statsURL#47a971e0 url:string = StatsURL; + +chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true = ChatAdminRights; + +chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true until_date:int = ChatBannedRights; + +inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper; +inputWallPaperSlug#72091c80 slug:string = InputWallPaper; +inputWallPaperNoFile#967a462e id:long = InputWallPaper; + +account.wallPapersNotModified#1c199183 = account.WallPapers; +account.wallPapers#cdc3858c hash:long wallpapers:Vector = account.WallPapers; + +codeSettings#ad253d78 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true allow_missed_call:flags.5?true allow_firebase:flags.7?true unknown_number:flags.9?true logout_tokens:flags.6?Vector token:flags.8?string app_sandbox:flags.8?Bool = CodeSettings; + +wallPaperSettings#372efcd0 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int emoticon:flags.7?string = WallPaperSettings; + +autoDownloadSettings#baa57628 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true stories_preload:flags.4?true photo_size_max:int video_size_max:long file_size_max:long video_upload_maxbitrate:int small_queue_active_operations_max:int large_queue_active_operations_max:int = AutoDownloadSettings; + +account.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings; + +emojiKeyword#d5b3b9f9 keyword:string emoticons:Vector = EmojiKeyword; +emojiKeywordDeleted#236df622 keyword:string emoticons:Vector = EmojiKeyword; + +emojiKeywordsDifference#5cc761bd lang_code:string from_version:int version:int keywords:Vector = EmojiKeywordsDifference; + +emojiURL#a575739d url:string = EmojiURL; + +emojiLanguage#b3fb5361 lang_code:string = EmojiLanguage; + +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; + +channelLocationEmpty#bfb5ad8b = ChannelLocation; +channelLocation#209b82db geo_point:GeoPoint address:string = ChannelLocation; + +peerLocated#ca461b5d peer:Peer expires:int distance:int = PeerLocated; +peerSelfLocated#f8ec284b expires:int = PeerLocated; + +restrictionReason#d072acb4 platform:string reason:string text:string = RestrictionReason; + +inputTheme#3c5693e9 id:long access_hash:long = InputTheme; +inputThemeSlug#f5890df1 slug:string = InputTheme; + +theme#a00e67d6 flags:# creator:flags.0?true default:flags.1?true for_chat:flags.5?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?Vector emoticon:flags.6?string installs_count:flags.4?int = Theme; + +account.themesNotModified#f41eb622 = account.Themes; +account.themes#9a3d8c6d hash:long themes:Vector = account.Themes; + +auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken; +auth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken; +auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken; + +account.contentSettings#57e28221 flags:# sensitive_enabled:flags.0?true sensitive_can_change:flags.1?true = account.ContentSettings; + +messages.inactiveChats#a927fec5 dates:Vector chats:Vector users:Vector = messages.InactiveChats; + +baseThemeClassic#c3a12462 = BaseTheme; +baseThemeDay#fbd81688 = BaseTheme; +baseThemeNight#b7b31ea8 = BaseTheme; +baseThemeTinted#6d5f77ee = BaseTheme; +baseThemeArctic#5b11125a = BaseTheme; + +inputThemeSettings#8fde504f flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings; + +themeSettings#fa58b6d4 flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int outbox_accent_color:flags.3?int message_colors:flags.0?Vector wallpaper:flags.1?WallPaper = ThemeSettings; + +webPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector settings:flags.1?ThemeSettings = WebPageAttribute; +webPageAttributeStory#2e94c3e7 flags:# peer:Peer id:int story:flags.0?StoryItem = WebPageAttribute; +webPageAttributeStickerSet#50cc03d3 flags:# emojis:flags.0?true text_color:flags.1?true stickers:Vector = WebPageAttribute; + +messages.votesList#4899484e flags:# count:int votes:Vector chats:Vector users:Vector next_offset:flags.0?string = messages.VotesList; + +bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl; + +payments.bankCardData#3e24e573 title:string open_urls:Vector = payments.BankCardData; + +dialogFilter#5fb5523b flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector include_peers:Vector exclude_peers:Vector = DialogFilter; +dialogFilterDefault#363293ae = DialogFilter; +dialogFilterChatlist#9fe28ea4 flags:# has_my_invites:flags.26?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector include_peers:Vector = DialogFilter; + +dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested; + +statsDateRangeDays#b637edaf min_date:int max_date:int = StatsDateRangeDays; + +statsAbsValueAndPrev#cb43acde current:double previous:double = StatsAbsValueAndPrev; + +statsPercentValue#cbce2fe0 part:double total:double = StatsPercentValue; + +statsGraphAsync#4a27eb2d token:string = StatsGraph; +statsGraphError#bedc9822 error:string = StatsGraph; +statsGraph#8ea464b6 flags:# json:DataJSON zoom_token:flags.0?string = StatsGraph; + +stats.broadcastStats#396ca5fc period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev reactions_per_post:StatsAbsValueAndPrev views_per_story:StatsAbsValueAndPrev shares_per_story:StatsAbsValueAndPrev reactions_per_story:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph reactions_by_emotion_graph:StatsGraph story_interactions_graph:StatsGraph story_reactions_by_emotion_graph:StatsGraph recent_posts_interactions:Vector = stats.BroadcastStats; + +help.promoDataEmpty#98f6ac75 expires:int = help.PromoData; +help.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector users:Vector psa_type:flags.1?string psa_message:flags.2?string = help.PromoData; + +videoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize; +videoSizeEmojiMarkup#f85c413c emoji_id:long background_colors:Vector = VideoSize; +videoSizeStickerMarkup#da082fe stickerset:InputStickerSet sticker_id:long background_colors:Vector = VideoSize; + +statsGroupTopPoster#9d04af9b user_id:long messages:int avg_chars:int = StatsGroupTopPoster; + +statsGroupTopAdmin#d7584c87 user_id:long deleted:int kicked:int banned:int = StatsGroupTopAdmin; + +statsGroupTopInviter#535f779d user_id:long invitations:int = StatsGroupTopInviter; + +stats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector top_admins:Vector top_inviters:Vector users:Vector = stats.MegagroupStats; + +globalPrivacySettings#734c4ccb flags:# archive_and_mute_new_noncontact_peers:flags.0?true keep_archived_unmuted:flags.1?true keep_archived_folders:flags.2?true hide_read_marks:flags.3?true new_noncontact_peers_require_premium:flags.4?true = GlobalPrivacySettings; + +help.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector patterns:flags.1?Vector = help.CountryCode; + +help.country#c3878e23 flags:# hidden:flags.0?true iso2:string default_name:string name:flags.1?string country_codes:Vector = help.Country; + +help.countriesListNotModified#93cc1f32 = help.CountriesList; +help.countriesList#87d0759e countries:Vector hash:int = help.CountriesList; + +messageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:flags.2?MessageReplies = MessageViews; + +messages.messageViews#b6c4f543 views:Vector chats:Vector users:Vector = messages.MessageViews; + +messages.discussionMessage#a6341782 flags:# messages:Vector max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector users:Vector = messages.DiscussionMessage; + +messageReplyHeader#afbc09db flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector quote_offset:flags.10?int = MessageReplyHeader; +messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader; + +messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies; + +peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked; + +stats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats; + +groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall; +groupCall#d597650c flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true rtmp_stream:flags.12?true listeners_hidden:flags.13?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int = GroupCall; + +inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall; + +groupCallParticipant#eba636fe flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true video_joined:flags.15?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long video:flags.6?GroupCallParticipantVideo presentation:flags.14?GroupCallParticipantVideo = GroupCallParticipant; + +phone.groupCall#9e727aad call:GroupCall participants:Vector participants_next_offset:string chats:Vector users:Vector = phone.GroupCall; + +phone.groupParticipants#f47751b6 count:int participants:Vector next_offset:string chats:Vector users:Vector version:int = phone.GroupParticipants; + +inlineQueryPeerTypeSameBotPM#3081ed9d = InlineQueryPeerType; +inlineQueryPeerTypePM#833c0fac = InlineQueryPeerType; +inlineQueryPeerTypeChat#d766c50a = InlineQueryPeerType; +inlineQueryPeerTypeMegagroup#5ec4be43 = InlineQueryPeerType; +inlineQueryPeerTypeBroadcast#6334ee9a = InlineQueryPeerType; +inlineQueryPeerTypeBotPM#e3b2d0c = InlineQueryPeerType; + +messages.historyImport#1662af0b id:long = messages.HistoryImport; + +messages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true title:flags.2?string = messages.HistoryImportParsed; + +messages.affectedFoundMessages#ef8d3e6c pts:int pts_count:int offset:int messages:Vector = messages.AffectedFoundMessages; + +chatInviteImporter#8c5adfd9 flags:# requested:flags.0?true via_chatlist:flags.3?true user_id:long date:int about:flags.2?string approved_by:flags.1?long = ChatInviteImporter; + +messages.exportedChatInvites#bdc62dcc count:int invites:Vector users:Vector = messages.ExportedChatInvites; + +messages.exportedChatInvite#1871be50 invite:ExportedChatInvite users:Vector = messages.ExportedChatInvite; +messages.exportedChatInviteReplaced#222600ef invite:ExportedChatInvite new_invite:ExportedChatInvite users:Vector = messages.ExportedChatInvite; + +messages.chatInviteImporters#81b6b00a count:int importers:Vector users:Vector = messages.ChatInviteImporters; + +chatAdminWithInvites#f2ecef23 admin_id:long invites_count:int revoked_invites_count:int = ChatAdminWithInvites; + +messages.chatAdminsWithInvites#b69b72d7 admins:Vector users:Vector = messages.ChatAdminsWithInvites; + +messages.checkedHistoryImportPeer#a24de717 confirm_text:string = messages.CheckedHistoryImportPeer; + +phone.joinAsPeers#afe5623f peers:Vector chats:Vector users:Vector = phone.JoinAsPeers; + +phone.exportedGroupCallInvite#204bd158 link:string = phone.ExportedGroupCallInvite; + +groupCallParticipantVideoSourceGroup#dcb118b7 semantics:string sources:Vector = GroupCallParticipantVideoSourceGroup; + +groupCallParticipantVideo#67753ac8 flags:# paused:flags.0?true endpoint:string source_groups:Vector audio_source:flags.1?int = GroupCallParticipantVideo; + +stickers.suggestedShortName#85fea03f short_name:string = stickers.SuggestedShortName; + +botCommandScopeDefault#2f6cb2ab = BotCommandScope; +botCommandScopeUsers#3c4f04d8 = BotCommandScope; +botCommandScopeChats#6fe1a881 = BotCommandScope; +botCommandScopeChatAdmins#b9aa606a = BotCommandScope; +botCommandScopePeer#db9d897d peer:InputPeer = BotCommandScope; +botCommandScopePeerAdmins#3fd863d1 peer:InputPeer = BotCommandScope; +botCommandScopePeerUser#a1321f3 peer:InputPeer user_id:InputUser = BotCommandScope; + +account.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordResult; +account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult; +account.resetPasswordOk#e926d63e = account.ResetPasswordResult; + +sponsoredMessage#bdedf566 flags:# recommended:flags.5?true can_report:flags.12?true random_id:bytes url:string title:string message:string entities:flags.1?Vector photo:flags.6?Photo color:flags.13?PeerColor button_text:string sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; + +messages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector chats:Vector users:Vector = messages.SponsoredMessages; +messages.sponsoredMessagesEmpty#1839490f = messages.SponsoredMessages; + +searchResultsCalendarPeriod#c9b0539f date:int min_msg_id:int max_msg_id:int count:int = SearchResultsCalendarPeriod; + +messages.searchResultsCalendar#147ee23c flags:# inexact:flags.0?true count:int min_date:int min_msg_id:int offset_id_offset:flags.1?int periods:Vector messages:Vector chats:Vector users:Vector = messages.SearchResultsCalendar; + +searchResultPosition#7f648b67 msg_id:int date:int offset:int = SearchResultsPosition; + +messages.searchResultsPositions#53b22baf count:int positions:Vector = messages.SearchResultsPositions; + +channels.sendAsPeers#f496b0c6 peers:Vector chats:Vector users:Vector = channels.SendAsPeers; + +users.userFull#3b6d152e full_user:UserFull chats:Vector users:Vector = users.UserFull; + +messages.peerSettings#6880b94d settings:PeerSettings chats:Vector users:Vector = messages.PeerSettings; + +auth.loggedOut#c3a2835f flags:# future_auth_token:flags.0?bytes = auth.LoggedOut; + +reactionCount#a3d1cb80 flags:# chosen_order:flags.0?int reaction:Reaction count:int = ReactionCount; + +messageReactions#4f2b9479 flags:# min:flags.0?true can_see_list:flags.2?true reactions_as_tags:flags.3?true results:Vector recent_reactions:flags.1?Vector = MessageReactions; + +messages.messageReactionsList#31bd492d flags:# count:int reactions:Vector chats:Vector users:Vector next_offset:flags.0?string = messages.MessageReactionsList; + +availableReaction#c077ec01 flags:# inactive:flags.0?true premium:flags.2?true reaction:string title:string static_icon:Document appear_animation:Document select_animation:Document activate_animation:Document effect_animation:Document around_animation:flags.1?Document center_icon:flags.1?Document = AvailableReaction; + +messages.availableReactionsNotModified#9f071957 = messages.AvailableReactions; +messages.availableReactions#768e3aad hash:int reactions:Vector = messages.AvailableReactions; + +messagePeerReaction#8c79b63c flags:# big:flags.0?true unread:flags.1?true my:flags.2?true peer_id:Peer date:int reaction:Reaction = MessagePeerReaction; + +groupCallStreamChannel#80eb48af channel:int scale:int last_timestamp_ms:long = GroupCallStreamChannel; + +phone.groupCallStreamChannels#d0e482b2 channels:Vector = phone.GroupCallStreamChannels; + +phone.groupCallStreamRtmpUrl#2dbf3432 url:string key:string = phone.GroupCallStreamRtmpUrl; + +attachMenuBotIconColor#4576f3f0 name:string color:int = AttachMenuBotIconColor; + +attachMenuBotIcon#b2a7386b flags:# name:string icon:Document colors:flags.0?Vector = AttachMenuBotIcon; + +attachMenuBot#d90d8dfe flags:# inactive:flags.0?true has_settings:flags.1?true request_write_access:flags.2?true show_in_attach_menu:flags.3?true show_in_side_menu:flags.4?true side_menu_disclaimer_needed:flags.5?true bot_id:long short_name:string peer_types:flags.3?Vector icons:Vector = AttachMenuBot; + +attachMenuBotsNotModified#f1d88a5c = AttachMenuBots; +attachMenuBots#3c4301c0 hash:long bots:Vector users:Vector = AttachMenuBots; + +attachMenuBotsBot#93bf667f bot:AttachMenuBot users:Vector = AttachMenuBotsBot; + +webViewResultUrl#4d22ff98 flags:# fullsize:flags.1?true query_id:flags.0?long url:string = WebViewResult; + +webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent; + +botMenuButtonDefault#7533a588 = BotMenuButton; +botMenuButtonCommands#4258c205 = BotMenuButton; +botMenuButton#c7b57ce6 text:string url:string = BotMenuButton; + +account.savedRingtonesNotModified#fbf6e8b1 = account.SavedRingtones; +account.savedRingtones#c1e92cc5 hash:long ringtones:Vector = account.SavedRingtones; + +notificationSoundDefault#97e8bebe = NotificationSound; +notificationSoundNone#6f0c34df = NotificationSound; +notificationSoundLocal#830b9ae4 title:string data:string = NotificationSound; +notificationSoundRingtone#ff6c8049 id:long = NotificationSound; + +account.savedRingtone#b7263f6d = account.SavedRingtone; +account.savedRingtoneConverted#1f307eb7 document:Document = account.SavedRingtone; + +attachMenuPeerTypeSameBotPM#7d6be90e = AttachMenuPeerType; +attachMenuPeerTypeBotPM#c32bfa1a = AttachMenuPeerType; +attachMenuPeerTypePM#f146d31f = AttachMenuPeerType; +attachMenuPeerTypeChat#509113f = AttachMenuPeerType; +attachMenuPeerTypeBroadcast#7bfbdefc = AttachMenuPeerType; + +inputInvoiceMessage#c5b56859 peer:InputPeer msg_id:int = InputInvoice; +inputInvoiceSlug#c326caef slug:string = InputInvoice; +inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:PremiumGiftCodeOption = InputInvoice; +inputInvoiceStars#65f00ce3 purpose:InputStorePaymentPurpose = InputInvoice; + +payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice; + +messages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio; + +help.premiumPromo#5334759c status_text:string status_entities:Vector video_sections:Vector videos:Vector period_options:Vector users:Vector = help.PremiumPromo; + +inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgrade:flags.1?true = InputStorePaymentPurpose; +inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentStarsTopup#dddd0f56 stars:long currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentStarsGift#1d741ef7 user_id:InputUser stars:long currency:string amount:long = InputStorePaymentPurpose; + +premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption; + +paymentFormMethod#88f8f21b url:string title:string = PaymentFormMethod; + +emojiStatusEmpty#2de11aae = EmojiStatus; +emojiStatus#929b619d document_id:long = EmojiStatus; +emojiStatusUntil#fa30a8c7 document_id:long until:int = EmojiStatus; + +account.emojiStatusesNotModified#d08ce645 = account.EmojiStatuses; +account.emojiStatuses#90c467d1 hash:long statuses:Vector = account.EmojiStatuses; + +reactionEmpty#79f5d419 = Reaction; +reactionEmoji#1b2286b8 emoticon:string = Reaction; +reactionCustomEmoji#8935fc73 document_id:long = Reaction; + +chatReactionsNone#eafc32bc = ChatReactions; +chatReactionsAll#52928bca flags:# allow_custom:flags.0?true = ChatReactions; +chatReactionsSome#661d4037 reactions:Vector = ChatReactions; + +messages.reactionsNotModified#b06fdbdf = messages.Reactions; +messages.reactions#eafdf716 hash:long reactions:Vector = messages.Reactions; + +emailVerifyPurposeLoginSetup#4345be73 phone_number:string phone_code_hash:string = EmailVerifyPurpose; +emailVerifyPurposeLoginChange#527d22eb = EmailVerifyPurpose; +emailVerifyPurposePassport#bbf51685 = EmailVerifyPurpose; + +emailVerificationCode#922e55a9 code:string = EmailVerification; +emailVerificationGoogle#db909ec2 token:string = EmailVerification; +emailVerificationApple#96d074fd token:string = EmailVerification; + +account.emailVerified#2b96cd1b email:string = account.EmailVerified; +account.emailVerifiedLogin#e1bb0d61 email:string sent_code:auth.SentCode = account.EmailVerified; + +premiumSubscriptionOption#5f2d1df2 flags:# current:flags.1?true can_purchase_upgrade:flags.2?true transaction:flags.3?string months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumSubscriptionOption; + +sendAsPeer#b81c7034 flags:# premium_required:flags.0?true peer:Peer = SendAsPeer; + +messageExtendedMediaPreview#ad628cc8 flags:# w:flags.0?int h:flags.0?int thumb:flags.1?PhotoSize video_duration:flags.2?int = MessageExtendedMedia; +messageExtendedMedia#ee479c64 media:MessageMedia = MessageExtendedMedia; + +stickerKeyword#fcfeb29c document_id:long keyword:Vector = StickerKeyword; + +username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:string = Username; + +forumTopicDeleted#23f109b id:int = ForumTopic; +forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; + +messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector messages:Vector chats:Vector users:Vector pts:int = messages.ForumTopics; + +defaultHistoryTTL#43b46b20 period:int = DefaultHistoryTTL; + +exportedContactToken#41bf109b url:string expires:int = ExportedContactToken; + +requestPeerTypeUser#5f3b8a00 flags:# bot:flags.0?Bool premium:flags.1?Bool = RequestPeerType; +requestPeerTypeChat#c9f06e1b flags:# creator:flags.0?true bot_participant:flags.5?true has_username:flags.3?Bool forum:flags.4?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType; +requestPeerTypeBroadcast#339bef6c flags:# creator:flags.0?true has_username:flags.3?Bool user_admin_rights:flags.1?ChatAdminRights bot_admin_rights:flags.2?ChatAdminRights = RequestPeerType; + +emojiListNotModified#481eadfa = EmojiList; +emojiList#7a1e11d1 hash:long document_id:Vector = EmojiList; + +emojiGroup#7a9abda9 title:string icon_emoji_id:long emoticons:Vector = EmojiGroup; +emojiGroupGreeting#80d26cc7 title:string icon_emoji_id:long emoticons:Vector = EmojiGroup; +emojiGroupPremium#93bcf34 title:string icon_emoji_id:long = EmojiGroup; + +messages.emojiGroupsNotModified#6fb4ad87 = messages.EmojiGroups; +messages.emojiGroups#881fb94b hash:int groups:Vector = messages.EmojiGroups; + +textWithEntities#751f3146 text:string entities:Vector = TextWithEntities; + +messages.translateResult#33db32f8 result:Vector = messages.TranslatedText; + +autoSaveSettings#c84834ce flags:# photos:flags.0?true videos:flags.1?true video_max_size:flags.2?long = AutoSaveSettings; + +autoSaveException#81602d47 peer:Peer settings:AutoSaveSettings = AutoSaveException; + +account.autoSaveSettings#4c3e069d users_settings:AutoSaveSettings chats_settings:AutoSaveSettings broadcasts_settings:AutoSaveSettings exceptions:Vector chats:Vector users:Vector = account.AutoSaveSettings; + +help.appConfigNotModified#7cde641d = help.AppConfig; +help.appConfig#dd18782e hash:int config:JSONValue = help.AppConfig; + +inputBotAppID#a920bd7a id:long access_hash:long = InputBotApp; +inputBotAppShortName#908c0407 bot_id:InputUser short_name:string = InputBotApp; + +botAppNotModified#5da674b7 = BotApp; +botApp#95fcd1d6 flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document hash:long = BotApp; + +messages.botApp#eb50adf5 flags:# inactive:flags.0?true request_write_access:flags.1?true has_settings:flags.2?true app:BotApp = messages.BotApp; + +inlineBotWebView#b57295d5 text:string url:string = InlineBotWebView; + +readParticipantDate#4a4ff172 user_id:long date:int = ReadParticipantDate; + +inputChatlistDialogFilter#f3e0da33 filter_id:int = InputChatlist; + +exportedChatlistInvite#c5181ac flags:# title:string url:string peers:Vector = ExportedChatlistInvite; + +chatlists.exportedChatlistInvite#10e6e3a6 filter:DialogFilter invite:ExportedChatlistInvite = chatlists.ExportedChatlistInvite; + +chatlists.exportedInvites#10ab6dc7 invites:Vector chats:Vector users:Vector = chatlists.ExportedInvites; + +chatlists.chatlistInviteAlready#fa87f659 filter_id:int missing_peers:Vector already_peers:Vector chats:Vector users:Vector = chatlists.ChatlistInvite; +chatlists.chatlistInvite#1dcd839d flags:# title:string emoticon:flags.0?string peers:Vector chats:Vector users:Vector = chatlists.ChatlistInvite; + +chatlists.chatlistUpdates#93bd878d missing_peers:Vector chats:Vector users:Vector = chatlists.ChatlistUpdates; + +bots.botInfo#e8a775b0 name:string about:string description:string = bots.BotInfo; + +messagePeerVote#b6cc2d5c peer:Peer option:bytes date:int = MessagePeerVote; +messagePeerVoteInputOption#74cda504 peer:Peer date:int = MessagePeerVote; +messagePeerVoteMultiple#4628f6e6 peer:Peer options:Vector date:int = MessagePeerVote; + +storyViews#8d595cd6 flags:# has_viewers:flags.1?true views_count:int forwards_count:flags.2?int reactions:flags.3?Vector reactions_count:flags.4?int recent_viewers:flags.0?Vector = StoryViews; + +storyItemDeleted#51e6ee4f id:int = StoryItem; +storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem; +storyItem#79b26a24 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector media:MessageMedia media_areas:flags.14?Vector privacy:flags.2?Vector views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem; + +stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories; +stories.allStories#6efc5e81 flags:# has_more:flags.0?true count:int state:string peer_stories:Vector chats:Vector users:Vector stealth_mode:StoriesStealthMode = stories.AllStories; + +stories.stories#63c3dd0a flags:# count:int stories:Vector pinned_to_top:flags.0?Vector chats:Vector users:Vector = stories.Stories; + +storyView#b0bdeac5 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true user_id:long date:int reaction:flags.2?Reaction = StoryView; +storyViewPublicForward#9083670b flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true message:Message = StoryView; +storyViewPublicRepost#bd74cf49 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer story:StoryItem = StoryView; + +stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count:int reactions_count:int views:Vector chats:Vector users:Vector next_offset:flags.0?string = stories.StoryViewsList; + +stories.storyViews#de9eed1d views:Vector users:Vector = stories.StoryViews; + +inputReplyToMessage#22c0f6d5 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector quote_offset:flags.4?int = InputReplyTo; +inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo; + +exportedStoryLink#3fc9053b link:string = ExportedStoryLink; + +storiesStealthMode#712e27fd flags:# active_until_date:flags.0?int cooldown_until_date:flags.1?int = StoriesStealthMode; + +mediaAreaCoordinates#cfc9e002 flags:# x:double y:double w:double h:double rotation:double radius:flags.0?double = MediaAreaCoordinates; + +mediaAreaVenue#be82db9c coordinates:MediaAreaCoordinates geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MediaArea; +inputMediaAreaVenue#b282217f coordinates:MediaAreaCoordinates query_id:long result_id:string = MediaArea; +mediaAreaGeoPoint#cad5452d flags:# coordinates:MediaAreaCoordinates geo:GeoPoint address:flags.0?GeoPointAddress = MediaArea; +mediaAreaSuggestedReaction#14455871 flags:# dark:flags.0?true flipped:flags.1?true coordinates:MediaAreaCoordinates reaction:Reaction = MediaArea; +mediaAreaChannelPost#770416af coordinates:MediaAreaCoordinates channel_id:long msg_id:int = MediaArea; +inputMediaAreaChannelPost#2271f2bf coordinates:MediaAreaCoordinates channel:InputChannel msg_id:int = MediaArea; +mediaAreaUrl#37381085 coordinates:MediaAreaCoordinates url:string = MediaArea; +mediaAreaWeather#49a6549c coordinates:MediaAreaCoordinates emoji:string temperature_c:double color:int = MediaArea; + +peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector = PeerStories; + +stories.peerStories#cae68768 stories:PeerStories chats:Vector users:Vector = stories.PeerStories; + +messages.webPage#fd5e12bd webpage:WebPage chats:Vector users:Vector = messages.WebPage; + +premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption; + +payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; + +payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo; +payments.giveawayInfoResults#cd5570 flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.0?string finish_date:int winners_count:int activated_count:int = payments.GiveawayInfo; + +prepaidGiveaway#b2539d54 id:long months:int quantity:int date:int = PrepaidGiveaway; + +boost#2a1c8c71 flags:# gift:flags.1?true giveaway:flags.2?true unclaimed:flags.3?true id:string user_id:flags.0?long giveaway_msg_id:flags.2?int date:int expires:int used_gift_slug:flags.4?string multiplier:flags.5?int = Boost; + +premium.boostsList#86f8613c flags:# count:int boosts:Vector next_offset:flags.0?string users:Vector = premium.BoostsList; + +myBoost#c448415c flags:# slot:int peer:flags.0?Peer date:int expires:int cooldown_until_date:flags.1?int = MyBoost; + +premium.myBoosts#9ae228e2 my_boosts:Vector chats:Vector users:Vector = premium.MyBoosts; + +premium.boostsStatus#4959427a flags:# my_boost:flags.2?true level:int current_level_boosts:int boosts:int gift_boosts:flags.4?int next_level_boosts:flags.0?int premium_audience:flags.1?StatsPercentValue boost_url:string prepaid_giveaways:flags.3?Vector my_boost_slots:flags.2?Vector = premium.BoostsStatus; + +storyFwdHeader#b826e150 flags:# modified:flags.3?true from:flags.0?Peer from_name:flags.1?string story_id:flags.2?int = StoryFwdHeader; + +postInteractionCountersMessage#e7058e7f msg_id:int views:int forwards:int reactions:int = PostInteractionCounters; +postInteractionCountersStory#8a480e27 story_id:int views:int forwards:int reactions:int = PostInteractionCounters; + +stats.storyStats#50cd067c views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.StoryStats; + +publicForwardMessage#1f2bf4a message:Message = PublicForward; +publicForwardStory#edf3add0 peer:Peer story:StoryItem = PublicForward; + +stats.publicForwards#93037e20 flags:# count:int forwards:Vector next_offset:flags.0?string chats:Vector users:Vector = stats.PublicForwards; + +peerColor#b54b5acf flags:# color:flags.0?int background_emoji_id:flags.1?long = PeerColor; + +help.peerColorSet#26219a58 colors:Vector = help.PeerColorSet; +help.peerColorProfileSet#767d61eb palette_colors:Vector bg_colors:Vector story_colors:Vector = help.PeerColorSet; + +help.peerColorOption#adec6ebe flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet channel_min_level:flags.3?int group_min_level:flags.4?int = help.PeerColorOption; + +help.peerColorsNotModified#2ba1f5ce = help.PeerColors; +help.peerColors#f8ed08 hash:int colors:Vector = help.PeerColors; + +storyReaction#6090d6d5 peer_id:Peer date:int reaction:Reaction = StoryReaction; +storyReactionPublicForward#bbab2643 message:Message = StoryReaction; +storyReactionPublicRepost#cfcd0f13 peer_id:Peer story:StoryItem = StoryReaction; + +stories.storyReactionsList#aa5f789c flags:# count:int reactions:Vector chats:Vector users:Vector next_offset:flags.0?string = stories.StoryReactionsList; + +savedDialog#bd87cb6c flags:# pinned:flags.2?true peer:Peer top_message:int = SavedDialog; + +messages.savedDialogs#f83ae221 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.SavedDialogs; +messages.savedDialogsSlice#44ba9dd9 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.SavedDialogs; +messages.savedDialogsNotModified#c01f6fe8 count:int = messages.SavedDialogs; + +savedReactionTag#cb6ff828 flags:# reaction:Reaction title:flags.0?string count:int = SavedReactionTag; + +messages.savedReactionTagsNotModified#889b59ef = messages.SavedReactionTags; +messages.savedReactionTags#3259950a tags:Vector hash:long = messages.SavedReactionTags; + +outboxReadDate#3bb842ac date:int = OutboxReadDate; + +smsjobs.eligibleToJoin#dc8b44cf terms_url:string monthly_sent_sms:int = smsjobs.EligibilityToJoin; + +smsjobs.status#2aee9191 flags:# allow_international:flags.0?true recent_sent:int recent_since:int recent_remains:int total_sent:int total_since:int last_gift_slug:flags.1?string terms_url:string = smsjobs.Status; + +smsJob#e6a1eeb8 job_id:string phone_number:string text:string = SmsJob; + +businessWeeklyOpen#120b1ab9 start_minute:int end_minute:int = BusinessWeeklyOpen; + +businessWorkHours#8c92b098 flags:# open_now:flags.0?true timezone_id:string weekly_open:Vector = BusinessWorkHours; + +businessLocation#ac5c1af7 flags:# geo_point:flags.0?GeoPoint address:string = BusinessLocation; + +inputBusinessRecipients#6f8b32aa flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector = InputBusinessRecipients; + +businessRecipients#21108ff7 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector = BusinessRecipients; + +businessAwayMessageScheduleAlways#c9b9e2b9 = BusinessAwayMessageSchedule; +businessAwayMessageScheduleOutsideWorkHours#c3f2f501 = BusinessAwayMessageSchedule; +businessAwayMessageScheduleCustom#cc4d9ecc start_date:int end_date:int = BusinessAwayMessageSchedule; + +inputBusinessGreetingMessage#194cb3b shortcut_id:int recipients:InputBusinessRecipients no_activity_days:int = InputBusinessGreetingMessage; + +businessGreetingMessage#e519abab shortcut_id:int recipients:BusinessRecipients no_activity_days:int = BusinessGreetingMessage; + +inputBusinessAwayMessage#832175e0 flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:InputBusinessRecipients = InputBusinessAwayMessage; + +businessAwayMessage#ef156a5c flags:# offline_only:flags.0?true shortcut_id:int schedule:BusinessAwayMessageSchedule recipients:BusinessRecipients = BusinessAwayMessage; + +timezone#ff9289f5 id:string name:string utc_offset:int = Timezone; + +help.timezonesListNotModified#970708cc = help.TimezonesList; +help.timezonesList#7b74ed71 timezones:Vector hash:int = help.TimezonesList; + +quickReply#697102b shortcut_id:int shortcut:string top_message:int count:int = QuickReply; + +inputQuickReplyShortcut#24596d41 shortcut:string = InputQuickReplyShortcut; +inputQuickReplyShortcutId#1190cf1 shortcut_id:int = InputQuickReplyShortcut; + +messages.quickReplies#c68d6695 quick_replies:Vector messages:Vector chats:Vector users:Vector = messages.QuickReplies; +messages.quickRepliesNotModified#5f91eb5b = messages.QuickReplies; + +connectedBot#bd068601 flags:# can_reply:flags.0?true bot_id:long recipients:BusinessBotRecipients = ConnectedBot; + +account.connectedBots#17d7f87b connected_bots:Vector users:Vector = account.ConnectedBots; + +messages.dialogFilters#2ad93719 flags:# tags_enabled:flags.0?true filters:Vector = messages.DialogFilters; + +birthday#6c8e1e06 flags:# day:int month:int year:flags.0?int = Birthday; + +botBusinessConnection#896433b4 flags:# can_reply:flags.0?true disabled:flags.1?true connection_id:string user_id:long dc_id:int date:int = BotBusinessConnection; + +inputBusinessIntro#9c469cd flags:# title:string description:string sticker:flags.0?InputDocument = InputBusinessIntro; + +businessIntro#5a0a066d flags:# title:string description:string sticker:flags.0?Document = BusinessIntro; + +messages.myStickers#faff629d count:int sets:Vector = messages.MyStickers; + +inputCollectibleUsername#e39460a9 username:string = InputCollectible; +inputCollectiblePhone#a2e214a4 phone:string = InputCollectible; + +fragment.collectibleInfo#6ebdff91 purchase_date:int currency:string amount:long crypto_currency:string crypto_amount:long url:string = fragment.CollectibleInfo; + +inputBusinessBotRecipients#c4e5921e flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector exclude_users:flags.6?Vector = InputBusinessBotRecipients; + +businessBotRecipients#b88cf373 flags:# existing_chats:flags.0?true new_chats:flags.1?true contacts:flags.2?true non_contacts:flags.3?true exclude_selected:flags.5?true users:flags.4?Vector exclude_users:flags.6?Vector = BusinessBotRecipients; + +contactBirthday#1d998733 contact_id:long birthday:Birthday = ContactBirthday; + +contacts.contactBirthdays#114ff30d contacts:Vector users:Vector = contacts.ContactBirthdays; + +missingInvitee#628c9224 flags:# premium_would_allow_invite:flags.0?true premium_required_for_pm:flags.1?true user_id:long = MissingInvitee; + +messages.invitedUsers#7f5defa6 updates:Updates missing_invitees:Vector = messages.InvitedUsers; + +inputBusinessChatLink#11679fa7 flags:# message:string entities:flags.0?Vector title:flags.1?string = InputBusinessChatLink; + +businessChatLink#b4ae666f flags:# link:string message:string entities:flags.0?Vector title:flags.1?string views:int = BusinessChatLink; + +account.businessChatLinks#ec43a2d1 links:Vector chats:Vector users:Vector = account.BusinessChatLinks; + +account.resolvedBusinessChatLinks#9a23af21 flags:# peer:Peer message:string entities:flags.0?Vector chats:Vector users:Vector = account.ResolvedBusinessChatLinks; + +requestedPeerUser#d62ff46a flags:# user_id:long first_name:flags.0?string last_name:flags.0?string username:flags.1?string photo:flags.2?Photo = RequestedPeer; +requestedPeerChat#7307544f flags:# chat_id:long title:flags.0?string photo:flags.2?Photo = RequestedPeer; +requestedPeerChannel#8ba403e4 flags:# channel_id:long title:flags.0?string username:flags.1?string photo:flags.2?Photo = RequestedPeer; + +sponsoredMessageReportOption#430d3150 text:string option:bytes = SponsoredMessageReportOption; + +channels.sponsoredMessageReportResultChooseOption#846f9e42 title:string options:Vector = channels.SponsoredMessageReportResult; +channels.sponsoredMessageReportResultAdsHidden#3e3bcf2f = channels.SponsoredMessageReportResult; +channels.sponsoredMessageReportResultReported#ad798849 = channels.SponsoredMessageReportResult; + +stats.broadcastRevenueStats#5407e297 top_hours_graph:StatsGraph revenue_graph:StatsGraph balances:BroadcastRevenueBalances usd_rate:double = stats.BroadcastRevenueStats; + +stats.broadcastRevenueWithdrawalUrl#ec659737 url:string = stats.BroadcastRevenueWithdrawalUrl; + +broadcastRevenueTransactionProceeds#557e2cc4 amount:long from_date:int to_date:int = BroadcastRevenueTransaction; +broadcastRevenueTransactionWithdrawal#5a590978 flags:# pending:flags.0?true failed:flags.2?true amount:long date:int provider:string transaction_date:flags.1?int transaction_url:flags.1?string = BroadcastRevenueTransaction; +broadcastRevenueTransactionRefund#42d30d2e amount:long date:int provider:string = BroadcastRevenueTransaction; + +stats.broadcastRevenueTransactions#87158466 count:int transactions:Vector = stats.BroadcastRevenueTransactions; + +reactionNotificationsFromContacts#bac3a61a = ReactionNotificationsFrom; +reactionNotificationsFromAll#4b9e22a0 = ReactionNotificationsFrom; + +reactionsNotifySettings#56e34970 flags:# messages_notify_from:flags.0?ReactionNotificationsFrom stories_notify_from:flags.1?ReactionNotificationsFrom sound:NotificationSound show_previews:Bool = ReactionsNotifySettings; + +broadcastRevenueBalances#8438f1c6 current_balance:long available_balance:long overall_revenue:long = BroadcastRevenueBalances; + +availableEffect#93c3e27e flags:# premium_required:flags.2?true id:long emoticon:string static_icon_id:flags.0?long effect_sticker_id:long effect_animation_id:flags.1?long = AvailableEffect; + +messages.availableEffectsNotModified#d1ed9a5b = messages.AvailableEffects; +messages.availableEffects#bddb616e hash:int effects:Vector documents:Vector = messages.AvailableEffects; + +factCheck#b89bfccf flags:# need_check:flags.0?true country:flags.1?string text:flags.1?TextWithEntities hash:long = FactCheck; + +starsTransactionPeerUnsupported#95f2bfe4 = StarsTransactionPeer; +starsTransactionPeerAppStore#b457b375 = StarsTransactionPeer; +starsTransactionPeerPlayMarket#7b560a0b = StarsTransactionPeer; +starsTransactionPeerPremiumBot#250dbaf8 = StarsTransactionPeer; +starsTransactionPeerFragment#e92fd902 = StarsTransactionPeer; +starsTransactionPeer#d80da15d peer:Peer = StarsTransactionPeer; +starsTransactionPeerAds#60682812 = StarsTransactionPeer; + +starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption; + +starsTransaction#2db5418f flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true id:string stars:long date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector = StarsTransaction; + +payments.starsStatus#8cf4ee60 flags:# balance:long history:Vector next_offset:flags.0?string chats:Vector users:Vector = payments.StarsStatus; + +foundStory#e87acbc0 peer:Peer story:StoryItem = FoundStory; + +stories.foundStories#e2de7737 flags:# count:int stories:Vector next_offset:flags.0?string chats:Vector users:Vector = stories.FoundStories; + +geoPointAddress#de4c5d93 flags:# country_iso2:string state:flags.0?string city:flags.1?string street:flags.2?string = GeoPointAddress; + +starsRevenueStatus#79342946 flags:# withdrawal_enabled:flags.0?true current_balance:long available_balance:long overall_revenue:long next_withdrawal_at:flags.1?int = StarsRevenueStatus; + +payments.starsRevenueStats#c92bb73b revenue_graph:StatsGraph status:StarsRevenueStatus usd_rate:double = payments.StarsRevenueStats; + +payments.starsRevenueWithdrawalUrl#1dab80b7 url:string = payments.StarsRevenueWithdrawalUrl; + +payments.starsRevenueAdsAccountUrl#394e7f21 url:string = payments.StarsRevenueAdsAccountUrl; + +inputStarsTransaction#206ae6d1 flags:# refund:flags.0?true id:string = InputStarsTransaction; + +starsGiftOption#5e0589f1 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsGiftOption; + +bots.popularAppBots#1991b13b flags:# next_offset:flags.0?string users:Vector = bots.PopularAppBots; + +botPreviewMedia#23e91ba3 date:int media:MessageMedia = BotPreviewMedia; + +bots.previewInfo#ca71d64 media:Vector lang_codes:Vector = bots.PreviewInfo; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; -initConnection#c7481da6 {X:Type} api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string query:!X = X; +initConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X; invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; - -auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; -auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; -auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; -auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; -auth.logOut#5717da40 = Bool; +invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X; +invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; +invokeWithBusinessConnection#dd289f8e {X:Type} connection_id:string query:!X = X; +invokeWithGooglePlayIntegrity#1df92984 {X:Type} nonce:string token:string query:!X = X; +invokeWithApnsSecret#0dae54f8 {X:Type} nonce:string secret:string query:!X = X; + +auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode; +auth.signUp#aac7b717 flags:# no_joined_notifications:flags.0?true phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization; +auth.signIn#8d52a951 flags:# phone_number:string phone_code_hash:string phone_code:flags.0?string email_verification:flags.1?EmailVerification = auth.Authorization; +auth.logOut#3e72ba19 = auth.LoggedOut; auth.resetAuthorizations#9fab0d1a = Bool; -auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; -auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; +auth.importAuthorization#a57a7dad id:long bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; -auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; +auth.checkPassword#d18b4d16 password:InputCheckPasswordSRP = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; -auth.recoverPassword#4ea56e92 code:string = auth.Authorization; -auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; +auth.recoverPassword#37096c70 flags:# code:string new_settings:flags.0?account.PasswordInputSettings = auth.Authorization; +auth.resendCode#cae47523 flags:# phone_number:string phone_code_hash:string reason:flags.0?string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; - -account.registerDevice#637ea878 token_type:int token:string = Bool; -account.unregisterDevice#65c55b40 token_type:int token:string = Bool; +auth.exportLoginToken#b7e085fe api_id:int api_hash:string except_ids:Vector = auth.LoginToken; +auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken; +auth.acceptLoginToken#e894ad4d token:bytes = Authorization; +auth.checkRecoveryPassword#d36bf79 code:string = Bool; +auth.importWebTokenAuthorization#2db873a9 api_id:int api_hash:string web_auth_token:string = auth.Authorization; +auth.requestFirebaseSms#8e39261e flags:# phone_number:string phone_code_hash:string safety_net_token:flags.0?string play_integrity_token:flags.2?string ios_push_secret:flags.1?string = Bool; +auth.resetLoginEmail#7e960193 phone_number:string phone_code_hash:string = auth.SentCode; +auth.reportMissingCode#cb9deff6 phone_number:string phone_code_hash:string mnc:string = Bool; + +account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; +account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User; account.updateStatus#6628562c offline:Bool = Bool; -account.getWallPapers#c04cfac2 = Vector; -account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool; +account.getWallPapers#7967d36 hash:long = account.WallPapers; +account.reportPeer#c5ba3d86 peer:InputPeer reason:ReportReason message:string = Bool; account.checkUsername#2714d86c username:string = Bool; account.updateUsername#3e0bdd7c username:string = User; account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; -account.deleteAccount#418d4e0b reason:string = Bool; +account.deleteAccount#a2c0cf74 flags:# reason:string password:flags.0?InputCheckPasswordSRP = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; -account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; +account.sendChangePhoneCode#82574ae5 phone_number:string settings:CodeSettings = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; -account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; -account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; -account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; +account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings; +account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool; +account.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; -account.getTmpPassword#4a82327e password_hash:bytes period:int = account.TmpPassword; +account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword; +account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; +account.resetWebAuthorization#2d01b9ef hash:long = Bool; +account.resetWebAuthorizations#682d2594 = Bool; +account.getAllSecureValues#b288bc7d = Vector; +account.getSecureValue#73665bc2 types:Vector = Vector; +account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue; +account.deleteSecureValue#b880bc4b types:Vector = Bool; +account.getAuthorizationForm#a929597a bot_id:long scope:string public_key:string = account.AuthorizationForm; +account.acceptAuthorization#f3ed4c73 bot_id:long scope:string public_key:string value_hashes:Vector credentials:SecureCredentialsEncrypted = Bool; +account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode; +account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool; +account.sendVerifyEmailCode#98e037bb purpose:EmailVerifyPurpose email:string = account.SentEmailCode; +account.verifyEmail#32da4cf purpose:EmailVerifyPurpose verification:EmailVerification = account.EmailVerified; +account.initTakeoutSession#8ef3eab0 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?long = account.Takeout; +account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; +account.confirmPasswordEmail#8fdf1920 code:string = Bool; +account.resendPasswordEmail#7a7f2a15 = Bool; +account.cancelPasswordEmail#c1cbd5b6 = Bool; +account.getContactSignUpNotification#9f07c728 = Bool; +account.setContactSignUpNotification#cff43f61 silent:Bool = Bool; +account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true compare_stories:flags.2?true peer:flags.0?InputNotifyPeer = Updates; +account.getWallPaper#fc8ddbea wallpaper:InputWallPaper = WallPaper; +account.uploadWallPaper#e39a8f03 flags:# for_chat:flags.0?true file:InputFile mime_type:string settings:WallPaperSettings = WallPaper; +account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool; +account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool; +account.resetWallPapers#bb3b9804 = Bool; +account.getAutoDownloadSettings#56da0b3f = account.AutoDownloadSettings; +account.saveAutoDownloadSettings#76f36233 flags:# low:flags.0?true high:flags.1?true settings:AutoDownloadSettings = Bool; +account.uploadTheme#1c3db333 flags:# file:InputFile thumb:flags.0?InputFile file_name:string mime_type:string = Document; +account.createTheme#652e4400 flags:# slug:string title:string document:flags.2?InputDocument settings:flags.3?Vector = Theme; +account.updateTheme#2bf40ccc flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument settings:flags.3?Vector = Theme; +account.saveTheme#f257106c theme:InputTheme unsave:Bool = Bool; +account.installTheme#c727bb3b flags:# dark:flags.0?true theme:flags.1?InputTheme format:flags.2?string base_theme:flags.3?BaseTheme = Bool; +account.getTheme#3a5869ec format:string theme:InputTheme = Theme; +account.getThemes#7206e458 format:string hash:long = account.Themes; +account.setContentSettings#b574b16b flags:# sensitive_enabled:flags.0?true = Bool; +account.getContentSettings#8b9b4dae = account.ContentSettings; +account.getMultiWallPapers#65ad71dc wallpapers:Vector = Vector; +account.getGlobalPrivacySettings#eb2b4cf6 = GlobalPrivacySettings; +account.setGlobalPrivacySettings#1edaaac2 settings:GlobalPrivacySettings = GlobalPrivacySettings; +account.reportProfilePhoto#fa8cc6f5 peer:InputPeer photo_id:InputPhoto reason:ReportReason message:string = Bool; +account.resetPassword#9308ce1b = account.ResetPasswordResult; +account.declinePasswordReset#4c9409f6 = Bool; +account.getChatThemes#d638de89 hash:long = account.Themes; +account.setAuthorizationTTL#bf899aa0 authorization_ttl_days:int = Bool; +account.changeAuthorizationSettings#40f48462 flags:# confirmed:flags.3?true hash:long encrypted_requests_disabled:flags.0?Bool call_requests_disabled:flags.1?Bool = Bool; +account.getSavedRingtones#e1902288 hash:long = account.SavedRingtones; +account.saveRingtone#3dea5b03 id:InputDocument unsave:Bool = account.SavedRingtone; +account.uploadRingtone#831a83a2 file:InputFile file_name:string mime_type:string = Document; +account.updateEmojiStatus#fbd3de6b emoji_status:EmojiStatus = Bool; +account.getDefaultEmojiStatuses#d6753386 hash:long = account.EmojiStatuses; +account.getRecentEmojiStatuses#f578105 hash:long = account.EmojiStatuses; +account.clearRecentEmojiStatuses#18201aae = Bool; +account.reorderUsernames#ef500eab order:Vector = Bool; +account.toggleUsername#58d6b376 username:string active:Bool = Bool; +account.getDefaultProfilePhotoEmojis#e2750328 hash:long = EmojiList; +account.getDefaultGroupPhotoEmojis#915860ae hash:long = EmojiList; +account.getAutoSaveSettings#adcbbcda = account.AutoSaveSettings; +account.saveAutoSaveSettings#d69b8361 flags:# users:flags.0?true chats:flags.1?true broadcasts:flags.2?true peer:flags.3?InputPeer settings:AutoSaveSettings = Bool; +account.deleteAutoSaveExceptions#53bc0020 = Bool; +account.invalidateSignInCodes#ca8ae8ba codes:Vector = Bool; +account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int background_emoji_id:flags.0?long = Bool; +account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; +account.getChannelDefaultEmojiStatuses#7727a7d5 hash:long = account.EmojiStatuses; +account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; +account.updateBusinessWorkHours#4b00e066 flags:# business_work_hours:flags.0?BusinessWorkHours = Bool; +account.updateBusinessLocation#9e6b131a flags:# geo_point:flags.1?InputGeoPoint address:flags.0?string = Bool; +account.updateBusinessGreetingMessage#66cdafc4 flags:# message:flags.0?InputBusinessGreetingMessage = Bool; +account.updateBusinessAwayMessage#a26a7fa5 flags:# message:flags.0?InputBusinessAwayMessage = Bool; +account.updateConnectedBot#43d8521d flags:# can_reply:flags.0?true deleted:flags.1?true bot:InputUser recipients:InputBusinessBotRecipients = Updates; +account.getConnectedBots#4ea4c80f = account.ConnectedBots; +account.getBotBusinessConnection#76a86270 connection_id:string = Updates; +account.updateBusinessIntro#a614d034 flags:# intro:flags.0?InputBusinessIntro = Bool; +account.toggleConnectedBotPaused#646e1097 peer:InputPeer paused:Bool = Bool; +account.disablePeerConnectedBot#5e437ed9 peer:InputPeer = Bool; +account.updateBirthday#cc6e0c11 flags:# birthday:flags.0?Birthday = Bool; +account.createBusinessChatLink#8851e68e link:InputBusinessChatLink = BusinessChatLink; +account.editBusinessChatLink#8c3410af slug:string link:InputBusinessChatLink = BusinessChatLink; +account.deleteBusinessChatLink#60073674 slug:string = Bool; +account.getBusinessChatLinks#6f70dde1 = account.BusinessChatLinks; +account.resolveBusinessChatLink#5492e5ee slug:string = account.ResolvedBusinessChatLinks; +account.updatePersonalChannel#d94305e0 channel:InputChannel = Bool; +account.toggleSponsoredMessages#b9d9a38d enabled:Bool = Bool; +account.getReactionsNotifySettings#6dd654c = ReactionsNotifySettings; +account.setReactionsNotifySettings#316ce548 settings:ReactionsNotifySettings = ReactionsNotifySettings; users.getUsers#d91a548 id:Vector = Vector; -users.getFullUser#ca30a5b1 id:InputUser = UserFull; +users.getFullUser#b60f5918 id:InputUser = users.UserFull; +users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector = Bool; +users.getIsPremiumRequiredToContact#a622aa10 id:Vector = Vector; +contacts.getContactIDs#7adc669d hash:long = Vector; contacts.getStatuses#c4a353ee = Vector; -contacts.getContacts#c023849f hash:int = contacts.Contacts; +contacts.getContacts#5dd69e12 hash:long = contacts.Contacts; contacts.importContacts#2c800be5 contacts:Vector = contacts.ImportedContacts; -contacts.deleteContact#8e953744 id:InputUser = contacts.Link; -contacts.deleteContacts#59ab389e id:Vector = Bool; -contacts.block#332b49fc id:InputUser = Bool; -contacts.unblock#e54100bd id:InputUser = Bool; -contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; -contacts.exportCard#84e53737 = Vector; -contacts.importCard#4fe196fe export_card:Vector = User; +contacts.deleteContacts#96a0e00 id:Vector = Updates; +contacts.deleteByPhones#1013fd9e phones:Vector = Bool; +contacts.block#2e2e8734 flags:# my_stories_from:flags.0?true id:InputPeer = Bool; +contacts.unblock#b550d328 flags:# my_stories_from:flags.0?true id:InputPeer = Bool; +contacts.getBlocked#9a868f80 flags:# my_stories_from:flags.0?true 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#973478b6 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 bots_app:flags.16?true offset:int limit:int hash:long = contacts.TopPeers; contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; - -messages.getMessages#4222fa74 id:Vector = messages.Messages; -messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit: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#39e9ea0 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 = messages.Messages; +contacts.getSaved#82f1e39f = Vector; +contacts.toggleTopPeers#8514bdda enabled:Bool = Bool; +contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates; +contacts.acceptContact#f831a20f id:InputUser = Updates; +contacts.getLocated#d348bc44 flags:# background:flags.1?true geo_point:InputGeoPoint self_expires:flags.0?int = Updates; +contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_history:flags.1?true report_spam:flags.2?true msg_id:int = Updates; +contacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer; +contacts.exportContactToken#f8654027 = ExportedContactToken; +contacts.importContactToken#13005788 token:string = User; +contacts.editCloseFriends#ba6705f0 id:Vector = Bool; +contacts.setBlocked#94c65c76 flags:# my_stories_from:flags.0?true id:Vector limit:int = Bool; +contacts.getBirthdays#daeda864 = contacts.ContactBirthdays; + +messages.getMessages#63c66506 id:Vector = messages.Messages; +messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs; +messages.getHistory#4423e6c5 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; +messages.search#29ee847a flags:# peer:InputPeer q:string from_id:flags.0?InputPeer saved_peer_id:flags.2?InputPeer saved_reaction:flags.3?Vector top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; -messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory; +messages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int min_date:flags.2?int max_date:flags.3?int = messages.AffectedHistory; messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; -messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; -messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; -messages.sendMedia#c8f16791 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; -messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; +messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; +messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; +messages.forwardMessages#d5039208 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; -messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; -messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; -messages.getChats#3c6aa187 id:Vector = messages.Chats; -messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; -messages.editChatTitle#dc452855 chat_id:int title:string = Updates; -messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; -messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; -messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; -messages.createChat#9cb126e users:Vector title:string = Updates; -messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; +messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings; +messages.report#8953ab4e peer:InputPeer id:Vector reason:ReportReason message:string = Bool; +messages.getChats#49e9528f id:Vector = messages.Chats; +messages.getFullChat#aeb00b34 chat_id:long = messages.ChatFull; +messages.editChatTitle#73783ffd chat_id:long title:string = Updates; +messages.editChatPhoto#35ddd674 chat_id:long photo:InputChatPhoto = Updates; +messages.addChatUser#cbc6d107 chat_id:long user_id:InputUser fwd_limit:int = messages.InvitedUsers; +messages.deleteChatUser#a2185cab flags:# revoke_history:flags.0?true chat_id:long user_id:InputUser = Updates; +messages.createChat#92ceddd4 flags:# users:Vector title:string ttl_period:flags.0?int = messages.InvitedUsers; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat; messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat; -messages.discardEncryption#edd923c5 chat_id:int = Bool; +messages.discardEncryption#f393aea0 flags:# delete_history:flags.0?true chat_id:int = Bool; messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool; messages.readEncryptedHistory#7f4b690a peer:InputEncryptedChat max_date:int = Bool; -messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; -messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; +messages.sendEncrypted#44fa7a15 flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; +messages.sendEncryptedFile#5559481d flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool; messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; -messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers; -messages.getWebPagePreview#25223e24 message:string = MessageMedia; -messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; +messages.getStickers#d5a5d3a1 emoticon:string hash:long = messages.Stickers; +messages.getAllStickers#b8a0a1a8 hash:long = messages.AllStickers; +messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector = MessageMedia; +messages.exportChatInvite#a02ce5d5 flags:# legacy_revoke_permanent:flags.2?true request_needed:flags.3?true peer:InputPeer expire_date:flags.0?int usage_limit:flags.1?int title:flags.4?string = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; -messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; +messages.getStickerSet#c8a0ec74 stickerset:InputStickerSet hash:int = messages.StickerSet; messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; -messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; -messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates; -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.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; -messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; +messages.getMessagesViews#5784d3e1 peer:InputPeer id:Vector increment:Bool = messages.MessageViews; +messages.editChatAdmin#a85bd1c2 chat_id:long user_id:InputUser is_admin:Bool = Bool; +messages.migrateChat#a2875319 chat_id:long = Updates; +messages.searchGlobal#4bc6589a flags:# broadcasts_only:flags.1?true folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +messages.reorderStickerSets#78337739 flags:# masks:flags.0?true emojis:flags.1?true order:Vector = Bool; +messages.getDocumentByHash#b1f2061f sha256:bytes size:long mime_type:string = Document; +messages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; -messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; -messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; +messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool; +messages.sendInlineBotResult#3ebee86a flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; -messages.editMessage#5d1b8dd flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Updates; -messages.editInlineBotMessage#b0e08243 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Bool; -messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; +messages.editMessage#dfd14005 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.15?int quick_reply_shortcut_id:flags.17?int = Updates; +messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true invert_media:flags.16?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; +messages.getBotCallbackAnswer#9342ca07 flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes password:flags.2?InputCheckPasswordSRP = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; -messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; -messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; +messages.getPeerDialogs#e470bcfd peers:Vector = messages.PeerDialogs; +messages.saveDraft#d372c5ce flags:# no_webpage:flags.1?true invert_media:flags.6?true reply_to:flags.4?InputReplyTo peer:InputPeer message:string entities:flags.3?Vector media:flags.5?InputMedia effect:flags.7?long = Bool; messages.getAllDrafts#6a3f8d65 = Updates; -messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; +messages.getFeaturedStickers#64780b14 hash:long = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; -messages.getRecentStickers#5ea192c9 flags:# attached:flags.0?true hash:int = messages.RecentStickers; +messages.getRecentStickers#9da9403b flags:# attached:flags.0?true hash:long = messages.RecentStickers; messages.saveRecentSticker#392718f8 flags:# attached:flags.0?true id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#8999602d flags:# attached:flags.0?true = Bool; -messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true offset_id:long limit:int = messages.ArchivedStickers; -messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers; +messages.getArchivedStickers#57f17692 flags:# masks:flags.0?true emojis:flags.1?true offset_id:long limit:int = messages.ArchivedStickers; +messages.getMaskStickers#640f82b8 hash:long = messages.AllStickers; messages.getAttachedStickers#cc5b67cc media:InputStickeredMedia = Vector; messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true force:flags.1?true peer:InputPeer id:int user_id:InputUser score:int = Updates; messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true force:flags.1?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; -messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; -messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; -messages.getWebPage#32ca8f91 url:string hash:int = WebPage; -messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; -messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector = Bool; -messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; +messages.getCommonChats#e40ca104 user_id:InputUser max_id:long limit:int = messages.Chats; +messages.getWebPage#8d9692a3 url:string hash:int = messages.WebPage; +messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; +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; -messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; -messages.getFavedStickers#21ce0b0e hash:int = messages.FavedStickers; +messages.uploadMedia#14967978 flags:# business_connection_id:flags.0?string peer:InputPeer media:InputMedia = MessageMedia; +messages.sendScreenshotNotification#a1405817 peer:InputPeer reply_to:InputReplyTo random_id:long = Updates; +messages.getFavedStickers#4f1aaa9 hash:long = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; -messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; -messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; -messages.getRecentLocations#249431e2 peer:InputPeer limit:int = messages.Messages; -messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector = Updates; +messages.getUnreadMentions#f107e790 flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; +messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; +messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; +messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; +messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; +messages.getSplitRanges#1cff7e08 = Vector; +messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool; +messages.getDialogUnreadMarks#22e24e22 = Vector; +messages.clearAllDrafts#7e58ee9c = Bool; +messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?true pm_oneside:flags.2?true peer:InputPeer id:int = Updates; +messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector = Updates; +messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates; +messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines; +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#1bbcf300 flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer top_msg_id:flags.0?int filters:Vector = Vector; +messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool; +messages.getScheduledHistory#f516760b peer:InputPeer hash:long = messages.Messages; +messages.getScheduledMessages#bdbb0464 peer:InputPeer id:Vector = messages.Messages; +messages.sendScheduledMessages#bd38850a peer:InputPeer id:Vector = Updates; +messages.deleteScheduledMessages#59ae2b16 peer:InputPeer id:Vector = Updates; +messages.getPollVotes#b86e380e flags:# peer:InputPeer id:int option:flags.0?bytes offset:flags.1?string limit:int = messages.VotesList; +messages.toggleStickerSets#b5052fea flags:# uninstall:flags.0?true archive:flags.1?true unarchive:flags.2?true stickersets:Vector = Bool; +messages.getDialogFilters#efd48c89 = messages.DialogFilters; +messages.getSuggestedDialogFilters#a29cd42c = Vector; +messages.updateDialogFilter#1ad4a04a flags:# id:int filter:flags.0?DialogFilter = Bool; +messages.updateDialogFiltersOrder#c563c1e4 order:Vector = Bool; +messages.getOldFeaturedStickers#7ed094a1 offset:int limit:int hash:long = messages.FeaturedStickers; +messages.getReplies#22ddd30c peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; +messages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage; +messages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool; +messages.unpinAllMessages#ee22b9a8 flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; +messages.deleteChat#5bd0ee50 chat_id:long = Bool; +messages.deletePhoneCallHistory#f9cbe409 flags:# revoke:flags.0?true = messages.AffectedFoundMessages; +messages.checkHistoryImport#43fe19f3 import_head:string = messages.HistoryImportParsed; +messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport; +messages.uploadImportedMedia#2a862092 peer:InputPeer import_id:long file_name:string media:InputMedia = MessageMedia; +messages.startHistoryImport#b43df344 peer:InputPeer import_id:long = Bool; +messages.getExportedChatInvites#a2b5a3f6 flags:# revoked:flags.3?true peer:InputPeer admin_id:InputUser offset_date:flags.2?int offset_link:flags.2?string limit:int = messages.ExportedChatInvites; +messages.getExportedChatInvite#73746f5c peer:InputPeer link:string = messages.ExportedChatInvite; +messages.editExportedChatInvite#bdca2f75 flags:# revoked:flags.2?true peer:InputPeer link:string expire_date:flags.0?int usage_limit:flags.1?int request_needed:flags.3?Bool title:flags.4?string = messages.ExportedChatInvite; +messages.deleteRevokedExportedChatInvites#56987bd5 peer:InputPeer admin_id:InputUser = Bool; +messages.deleteExportedChatInvite#d464a42b peer:InputPeer link:string = Bool; +messages.getAdminsWithInvites#3920e6ef peer:InputPeer = messages.ChatAdminsWithInvites; +messages.getChatInviteImporters#df04dd4e flags:# requested:flags.0?true peer:InputPeer link:flags.1?string q:flags.2?string offset_date:int offset_user:InputUser limit:int = messages.ChatInviteImporters; +messages.setHistoryTTL#b80e5fe4 peer:InputPeer period:int = Updates; +messages.checkHistoryImportPeer#5dc60f03 peer:InputPeer = messages.CheckedHistoryImportPeer; +messages.setChatTheme#e63be13f peer:InputPeer emoticon:string = Updates; +messages.getMessageReadParticipants#31c1c44f peer:InputPeer msg_id:int = Vector; +messages.getSearchResultsCalendar#6aa3f6bd flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer filter:MessagesFilter offset_id:int offset_date:int = messages.SearchResultsCalendar; +messages.getSearchResultsPositions#9c7f2f10 flags:# peer:InputPeer saved_peer_id:flags.2?InputPeer filter:MessagesFilter offset_id:int limit:int = messages.SearchResultsPositions; +messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPeer user_id:InputUser = Updates; +messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates; +messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates; +messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool; +messages.sendReaction#d30d78d4 flags:# big:flags.1?true add_to_recent:flags.2?true peer:InputPeer msg_id:int reaction:flags.0?Vector = Updates; +messages.getMessagesReactions#8bba90e6 peer:InputPeer id:Vector = Updates; +messages.getMessageReactionsList#461b3f48 flags:# peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = messages.MessageReactionsList; +messages.setChatAvailableReactions#5a150bd4 flags:# peer:InputPeer available_reactions:ChatReactions reactions_limit:flags.0?int = Updates; +messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions; +messages.setDefaultReaction#4f47a016 reaction:Reaction = Bool; +messages.translateText#63183030 flags:# peer:flags.0?InputPeer id:flags.0?Vector text:flags.1?Vector to_lang:string = messages.TranslatedText; +messages.getUnreadReactions#3223495b flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; +messages.readReactions#54aa7f8e flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; +messages.searchSentMedia#107e31a0 q:string filter:MessagesFilter limit:int = messages.Messages; +messages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots; +messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot; +messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool; +messages.requestWebView#269dc2c1 flags:# from_bot_menu:flags.4?true silent:flags.5?true compact:flags.7?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = WebViewResult; +messages.prolongWebView#b0d81a83 flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = Bool; +messages.requestSimpleWebView#413a3e73 flags:# from_switch_webview:flags.1?true from_side_menu:flags.2?true compact:flags.7?true bot:InputUser url:flags.3?string start_param:flags.4?string theme_params:flags.0?DataJSON platform:string = WebViewResult; +messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent; +messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates; +messages.transcribeAudio#269e9a49 peer:InputPeer msg_id:int = messages.TranscribedAudio; +messages.rateTranscribedAudio#7f1d072f peer:InputPeer msg_id:int transcription_id:long good:Bool = Bool; +messages.getCustomEmojiDocuments#d9ab0f54 document_id:Vector = Vector; +messages.getEmojiStickers#fbfca18f hash:long = messages.AllStickers; +messages.getFeaturedEmojiStickers#ecf6736 hash:long = messages.FeaturedStickers; +messages.reportReaction#3f64c076 peer:InputPeer id:int reaction_peer:InputPeer = Bool; +messages.getTopReactions#bb8125ba limit:int hash:long = messages.Reactions; +messages.getRecentReactions#39461db2 limit:int hash:long = messages.Reactions; +messages.clearRecentReactions#9dfeefb4 = Bool; +messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector = Updates; +messages.setDefaultHistoryTTL#9eb51445 period:int = Bool; +messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL; +messages.sendBotRequestedPeer#91b2d060 peer:InputPeer msg_id:int button_id:int requested_peers:Vector = Updates; +messages.getEmojiGroups#7488ce5b hash:int = messages.EmojiGroups; +messages.getEmojiStatusGroups#2ecd56cd hash:int = messages.EmojiGroups; +messages.getEmojiProfilePhotoGroups#21a548f3 hash:int = messages.EmojiGroups; +messages.searchCustomEmoji#2c11c0d7 emoticon:string hash:long = EmojiList; +messages.togglePeerTranslations#e47cb579 flags:# disabled:flags.0?true peer:InputPeer = Bool; +messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; +messages.requestAppWebView#53618bce flags:# write_allowed:flags.0?true compact:flags.7?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = WebViewResult; +messages.setChatWallPaper#8ffacae1 flags:# for_both:flags.3?true revert:flags.4?true peer:InputPeer wallpaper:flags.0?InputWallPaper settings:flags.2?WallPaperSettings id:flags.1?int = Updates; +messages.searchEmojiStickerSets#92b4494c flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; +messages.getSavedDialogs#5381d21a flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.SavedDialogs; +messages.getSavedHistory#3d9a414d peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; +messages.deleteSavedHistory#6e98102b flags:# peer:InputPeer max_id:int min_date:flags.2?int max_date:flags.3?int = messages.AffectedHistory; +messages.getPinnedSavedDialogs#d63d94e0 = messages.SavedDialogs; +messages.toggleSavedDialogPin#ac81bbde flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; +messages.reorderPinnedSavedDialogs#8b716587 flags:# force:flags.0?true order:Vector = Bool; +messages.getSavedReactionTags#3637e05b flags:# peer:flags.0?InputPeer hash:long = messages.SavedReactionTags; +messages.updateSavedReactionTag#60297dec flags:# reaction:Reaction title:flags.0?string = Bool; +messages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions; +messages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate; +messages.getQuickReplies#d483f2a8 hash:long = messages.QuickReplies; +messages.reorderQuickReplies#60331907 order:Vector = Bool; +messages.checkQuickReplyShortcut#f1d0fbd3 shortcut:string = Bool; +messages.editQuickReplyShortcut#5c003cef shortcut_id:int shortcut:string = Bool; +messages.deleteQuickReplyShortcut#3cc04740 shortcut_id:int = Bool; +messages.getQuickReplyMessages#94a495c3 flags:# shortcut_id:int id:flags.0?Vector hash:long = messages.Messages; +messages.sendQuickReplyMessages#6c750de1 peer:InputPeer shortcut_id:int id:Vector random_id:Vector = Updates; +messages.deleteQuickReplyMessages#e105e910 shortcut_id:int id:Vector = Updates; +messages.toggleDialogFilterTags#fd2dda49 enabled:Bool = Bool; +messages.getMyStickers#d0b5e1fc offset_id:long limit:int = messages.MyStickers; +messages.getEmojiStickerGroups#1dd840f5 hash:int = messages.EmojiGroups; +messages.getAvailableEffects#dea20a39 hash:int = messages.AvailableEffects; +messages.editFactCheck#589ee75 peer:InputPeer msg_id:int text:TextWithEntities = Updates; +messages.deleteFactCheck#d1da940c peer:InputPeer msg_id:int = Updates; +messages.getFactCheck#b9cdc5ee peer:InputPeer msg_id:Vector = Vector; +messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult; updates.getState#edd4882a = updates.State; -updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; +updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; -photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; -photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; +photos.updateProfilePhoto#9e82039 flags:# fallback:flags.0?true bot:flags.1?InputUser id:InputPhoto = photos.Photo; +photos.uploadProfilePhoto#388a3b5 flags:# fallback:flags.3?true bot:flags.5?InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.4?VideoSize = photos.Photo; photos.deletePhotos#87cf7f2f id:Vector = Vector; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; +photos.uploadContactProfilePhoto#e14c4a71 flags:# suggest:flags.3?true save:flags.4?true user_id:InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.5?VideoSize = photos.Photo; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; -upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; +upload.getFile#be5335be flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:long limit:int = upload.File; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; -upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; -upload.reuploadCdnFile#1af91c09 file_token:bytes request_token:bytes = Vector; -upload.getCdnFileHashes#f715c87b file_token:bytes offset:int = Vector; +upload.getCdnFile#395f69da file_token:bytes offset:long limit:int = upload.CdnFile; +upload.reuploadCdnFile#9b2754a8 file_token:bytes request_token:bytes = Vector; +upload.getCdnFileHashes#91dc3f31 file_token:bytes offset:long = Vector; +upload.getFileHashes#9156982a location:InputFileLocation offset:long = Vector; help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; -help.getAppUpdate#ae2de196 = help.AppUpdate; -help.saveAppLog#6f02f748 events:Vector = Bool; +help.getAppUpdate#522d5a7d source:string = help.AppUpdate; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; -help.getAppChangelog#9010ef6f prev_app_version:string = Updates; -help.getTermsOfService#350170f3 = help.TermsOfService; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; +help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate; +help.acceptTermsOfService#ee72f79a id:DataJSON = Bool; +help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo; +help.getAppConfig#61e3f854 hash:int = help.AppConfig; +help.saveAppLog#6f02f748 events:Vector = Bool; +help.getPassportConfig#c661ad08 hash:int = help.PassportConfig; +help.getSupportName#d360e72c = help.SupportName; +help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo; +help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector = help.UserInfo; +help.getPromoData#c0977421 = help.PromoData; +help.hidePromoData#1e251c95 peer:InputPeer = Bool; +help.dismissSuggestion#f50dbaa1 peer:InputPeer suggestion:string = Bool; +help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList; +help.getPremiumPromo#b81b93d4 = help.PremiumPromo; +help.getPeerColors#da80f42f hash:int = help.PeerColors; +help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors; +help.getTimezonesList#49b30240 hash:int = help.TimezonesList; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; -channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory; -channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector = Bool; -channels.getMessages#93d7b347 channel:InputChannel id:Vector = messages.Messages; -channels.getParticipants#123e05e9 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:int = channels.ChannelParticipants; -channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant; +channels.reportSpam#f44a8315 channel:InputChannel participant:InputPeer id:Vector = Bool; +channels.getMessages#ad8c9a23 channel:InputChannel id:Vector = messages.Messages; +channels.getParticipants#77ced9d0 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int hash:long = channels.ChannelParticipants; +channels.getParticipant#a0ab6cc6 channel:InputChannel participant:InputPeer = channels.ChannelParticipant; channels.getChannels#a7f6bbb id:Vector = messages.Chats; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; -channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates; -channels.editAbout#13e27f1e channel:InputChannel about:string = Bool; -channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates; +channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true forum:flags.5?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates; +channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.updateUsername#3514b3de channel:InputChannel username:string = Bool; channels.joinChannel#24b524c5 channel:InputChannel = Updates; channels.leaveChannel#f836aa95 channel:InputChannel = Updates; -channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector = Updates; -channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite; +channels.inviteToChannel#c9e33d54 channel:InputChannel users:Vector = messages.InvitedUsers; channels.deleteChannel#c0111fe3 channel:InputChannel = Updates; -channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates; -channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessageLink; +channels.exportMessageLink#e63fadeb flags:# grouped:flags.0?true thread:flags.1?true channel:InputChannel id:int = ExportedMessageLink; channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; -channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; -channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; -channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates; +channels.getAdminedPublicChannels#f8b036af flags:# by_location:flags.0?true check_limit:flags.1?true for_personal:flags.2?true = messages.Chats; +channels.editBanned#96e6cd81 channel:InputChannel participant:InputPeer banned_rights:ChatBannedRights = Updates; channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; -channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; +channels.deleteHistory#9baa9647 flags:# for_everyone:flags.0?true channel:InputChannel max_id:int = Updates; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; +channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; +channels.getGroupsForDiscussion#f5dad378 = messages.Chats; +channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool; +channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates; +channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool; +channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates; +channels.getInactiveChannels#11e831ee = messages.InactiveChats; +channels.convertToGigagroup#b290c69 channel:InputChannel = Updates; +channels.viewSponsoredMessage#beaedb94 channel:InputChannel random_id:bytes = Bool; +channels.getSponsoredMessages#ec210fbf channel:InputChannel = messages.SponsoredMessages; +channels.getSendAs#dc770ee peer:InputPeer = channels.SendAsPeers; +channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory; +channels.toggleJoinToSend#e4cb9580 channel:InputChannel enabled:Bool = Updates; +channels.toggleJoinRequest#4c2985b6 channel:InputChannel enabled:Bool = Updates; +channels.reorderUsernames#b45ced1d channel:InputChannel order:Vector = Bool; +channels.toggleUsername#50f24105 channel:InputChannel username:string active:Bool = Bool; +channels.deactivateAllUsernames#a245dd3 channel:InputChannel = Bool; +channels.toggleForum#a4298b29 channel:InputChannel enabled:Bool = Updates; +channels.createForumTopic#f40c0224 flags:# channel:InputChannel title:string icon_color:flags.0?int icon_emoji_id:flags.3?long random_id:long send_as:flags.2?InputPeer = Updates; +channels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string offset_date:int offset_id:int offset_topic:int limit:int = messages.ForumTopics; +channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector = messages.ForumTopics; +channels.editForumTopic#f4dfa185 flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates; +channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates; +channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messages.AffectedHistory; +channels.reorderPinnedForumTopics#2950a18f flags:# force:flags.0?true channel:InputChannel order:Vector = Updates; +channels.toggleAntiSpam#68f3e4eb channel:InputChannel enabled:Bool = Updates; +channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = Bool; +channels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = Updates; +channels.clickSponsoredMessage#18afbc93 channel:InputChannel random_id:bytes = Bool; +channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; +channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; +channels.getChannelRecommendations#25a71742 flags:# channel:flags.0?InputChannel = messages.Chats; +channels.updateEmojiStatus#f0d3e6a8 channel:InputChannel emoji_status:EmojiStatus = Updates; +channels.setBoostsToUnblockRestrictions#ad399cee channel:InputChannel boosts:int = Updates; +channels.setEmojiStickers#3cd930b7 channel:InputChannel stickerset:InputStickerSet = Bool; +channels.reportSponsoredMessage#af8ff6b9 channel:InputChannel random_id:bytes option:bytes = channels.SponsoredMessageReportResult; +channels.restrictSponsoredMessages#9ae91519 channel:InputChannel restricted:Bool = Updates; +channels.searchPosts#d19f987b hashtag:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; - -payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm; -payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt; -payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; -payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult; +bots.setBotCommands#517165a scope:BotCommandScope lang_code:string commands:Vector = Bool; +bots.resetBotCommands#3d8de0f9 scope:BotCommandScope lang_code:string = Bool; +bots.getBotCommands#e34c0dd6 scope:BotCommandScope lang_code:string = Vector; +bots.setBotMenuButton#4504d54f user_id:InputUser button:BotMenuButton = Bool; +bots.getBotMenuButton#9c60eb28 user_id:InputUser = BotMenuButton; +bots.setBotBroadcastDefaultAdminRights#788464e1 admin_rights:ChatAdminRights = Bool; +bots.setBotGroupDefaultAdminRights#925ec9ea admin_rights:ChatAdminRights = Bool; +bots.setBotInfo#10cf3123 flags:# bot:flags.2?InputUser lang_code:string name:flags.3?string about:flags.0?string description:flags.1?string = Bool; +bots.getBotInfo#dcd914fd flags:# bot:flags.0?InputUser lang_code:string = bots.BotInfo; +bots.reorderUsernames#9709b1c2 bot:InputUser order:Vector = Bool; +bots.toggleUsername#53ca973 bot:InputUser username:string active:Bool = Bool; +bots.canSendMessage#1359f4e6 bot:InputUser = Bool; +bots.allowSendMessage#f132e3ef bot:InputUser = Updates; +bots.invokeWebViewCustomMethod#87fc5e7 bot:InputUser custom_method:string params:DataJSON = DataJSON; +bots.getPopularAppBots#c2510192 offset:string limit:int = bots.PopularAppBots; +bots.addPreviewMedia#17aeb75a bot:InputUser lang_code:string media:InputMedia = BotPreviewMedia; +bots.editPreviewMedia#8525606f bot:InputUser lang_code:string media:InputMedia new_media:InputMedia = BotPreviewMedia; +bots.deletePreviewMedia#2d0135b3 bot:InputUser lang_code:string media:Vector = Bool; +bots.reorderPreviewMedias#b627f3aa bot:InputUser lang_code:string order:Vector = Bool; +bots.getPreviewInfo#423ab3ad bot:InputUser lang_code:string = bots.PreviewInfo; +bots.getPreviewMedias#a2a5594d bot:InputUser = Vector; + +payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm; +payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt; +payments.validateRequestedInfo#b6c8f12b flags:# save:flags.0?true invoice:InputInvoice info:PaymentRequestedInfo = payments.ValidatedRequestedInfo; +payments.sendPaymentForm#2d03522f flags:# form_id:long invoice:InputInvoice requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials tip_amount:flags.2?long = payments.PaymentResult; payments.getSavedInfo#227d824b = payments.SavedInfo; payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool; - -stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet; +payments.getBankCardData#2e79d779 number:string = payments.BankCardData; +payments.exportInvoice#f91b065 invoice_media:InputMedia = payments.ExportedInvoice; +payments.assignAppStoreTransaction#80ed747d receipt:bytes purpose:InputStorePaymentPurpose = Updates; +payments.assignPlayMarketTransaction#dffd50d3 receipt:DataJSON purpose:InputStorePaymentPurpose = Updates; +payments.canPurchasePremium#9fc19eb6 purpose:InputStorePaymentPurpose = Bool; +payments.getPremiumGiftCodeOptions#2757ba54 flags:# boost_peer:flags.0?InputPeer = Vector; +payments.checkGiftCode#8e51b4c1 slug:string = payments.CheckedGiftCode; +payments.applyGiftCode#f6e26854 slug:string = Updates; +payments.getGiveawayInfo#f4239425 peer:InputPeer msg_id:int = payments.GiveawayInfo; +payments.launchPrepaidGiveaway#5ff58f20 peer:InputPeer giveaway_id:long purpose:InputStorePaymentPurpose = Updates; +payments.getStarsTopupOptions#c00ec7d3 = Vector; +payments.getStarsStatus#104fcfa7 peer:InputPeer = payments.StarsStatus; +payments.getStarsTransactions#97938d5a flags:# inbound:flags.0?true outbound:flags.1?true ascending:flags.2?true peer:InputPeer offset:string limit:int = payments.StarsStatus; +payments.sendStarsForm#2bb731d flags:# form_id:long invoice:InputInvoice = payments.PaymentResult; +payments.refundStarsCharge#25ae8f4a user_id:InputUser charge_id:string = Updates; +payments.getStarsRevenueStats#d91ffad6 flags:# dark:flags.0?true peer:InputPeer = payments.StarsRevenueStats; +payments.getStarsRevenueWithdrawalUrl#13bbe8b3 peer:InputPeer stars:long password:InputCheckPasswordSRP = payments.StarsRevenueWithdrawalUrl; +payments.getStarsRevenueAdsAccountUrl#d1d7efc5 peer:InputPeer = payments.StarsRevenueAdsAccountUrl; +payments.getStarsTransactionsByID#27842d2e peer:InputPeer id:Vector = payments.StarsStatus; +payments.getStarsGiftOptions#d3c96bc8 flags:# user_id:flags.0?InputUser = Vector; + +stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector software:flags.3?string = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; +stickers.setStickerSetThumb#a76a5392 flags:# stickerset:InputStickerSet thumb:flags.0?InputDocument thumb_document_id:flags.1?long = messages.StickerSet; +stickers.checkShortName#284b3639 short_name:string = Bool; +stickers.suggestShortName#4dafc503 title:string = stickers.SuggestedShortName; +stickers.changeSticker#f5537ebc flags:# sticker:InputDocument emoji:flags.0?string mask_coords:flags.1?MaskCoords keywords:flags.2?string = messages.StickerSet; +stickers.renameStickerSet#124b1c00 stickerset:InputStickerSet title:string = messages.StickerSet; +stickers.deleteStickerSet#87704394 stickerset:InputStickerSet = Bool; +stickers.replaceSticker#4696459a sticker:InputDocument new_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.setCallRating#1c536a34 peer:InputPhoneCall rating:int comment:string = 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; - -langpack.getLangPack#9ab5c58e lang_code:string = LangPackDifference; -langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; -langpack.getDifference#b2e4d7d from_version:int = LangPackDifference; -langpack.getLanguages#800fd57d = Vector; - -// LAYER 73 \ No newline at end of file +phone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool; +phone.createGroupCall#48cdc6d8 flags:# rtmp_stream:flags.2?true peer:InputPeer random_id:int title:flags.0?string schedule_date:flags.1?int = Updates; +phone.joinGroupCall#b132ff7b flags:# muted:flags.0?true video_stopped:flags.2?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string params:DataJSON = Updates; +phone.leaveGroupCall#500377f9 call:InputGroupCall source:int = Updates; +phone.inviteToGroupCall#7b393160 call:InputGroupCall users:Vector = Updates; +phone.discardGroupCall#7a777135 call:InputGroupCall = Updates; +phone.toggleGroupCallSettings#74bbb43d flags:# reset_invite_hash:flags.1?true call:InputGroupCall join_muted:flags.0?Bool = Updates; +phone.getGroupCall#41845db call:InputGroupCall limit:int = phone.GroupCall; +phone.getGroupParticipants#c558d8ab call:InputGroupCall ids:Vector sources:Vector offset:string limit:int = phone.GroupParticipants; +phone.checkGroupCall#b59cf977 call:InputGroupCall sources:Vector = Vector; +phone.toggleGroupCallRecord#f128c708 flags:# start:flags.0?true video:flags.2?true call:InputGroupCall title:flags.1?string video_portrait:flags.2?Bool = Updates; +phone.editGroupCallParticipant#a5273abf flags:# call:InputGroupCall participant:InputPeer muted:flags.0?Bool volume:flags.1?int raise_hand:flags.2?Bool video_stopped:flags.3?Bool video_paused:flags.4?Bool presentation_paused:flags.5?Bool = Updates; +phone.editGroupCallTitle#1ca6ac0a call:InputGroupCall title:string = Updates; +phone.getGroupCallJoinAs#ef7c213a peer:InputPeer = phone.JoinAsPeers; +phone.exportGroupCallInvite#e6aa647f flags:# can_self_unmute:flags.0?true call:InputGroupCall = phone.ExportedGroupCallInvite; +phone.toggleGroupCallStartSubscription#219c34e6 call:InputGroupCall subscribed:Bool = Updates; +phone.startScheduledGroupCall#5680e342 call:InputGroupCall = Updates; +phone.saveDefaultGroupCallJoinAs#575e1f8c peer:InputPeer join_as:InputPeer = Bool; +phone.joinGroupCallPresentation#cbea6bc4 call:InputGroupCall params:DataJSON = Updates; +phone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates; +phone.getGroupCallStreamChannels#1ab21940 call:InputGroupCall = phone.GroupCallStreamChannels; +phone.getGroupCallStreamRtmpUrl#deb3abbf peer:InputPeer revoke:Bool = phone.GroupCallStreamRtmpUrl; +phone.saveCallLog#41248786 peer:InputPhoneCall file:InputFile = Bool; + +langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference; +langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector = Vector; +langpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:int = LangPackDifference; +langpack.getLanguages#42c6978f lang_pack:string = Vector; +langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage; + +folders.editPeerFolders#6847d0ab folder_peers:Vector = Updates; + +stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats; +stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; +stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; +stats.getMessagePublicForwards#5f150144 channel:InputChannel msg_id:int offset:string limit:int = stats.PublicForwards; +stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; +stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats; +stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; +stats.getBroadcastRevenueStats#75dfb671 flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastRevenueStats; +stats.getBroadcastRevenueWithdrawalUrl#2a65ef73 channel:InputChannel password:InputCheckPasswordSRP = stats.BroadcastRevenueWithdrawalUrl; +stats.getBroadcastRevenueTransactions#69280f channel:InputChannel offset:int limit:int = stats.BroadcastRevenueTransactions; + +chatlists.exportChatlistInvite#8472478e chatlist:InputChatlist title:string peers:Vector = chatlists.ExportedChatlistInvite; +chatlists.deleteExportedInvite#719c5c5e chatlist:InputChatlist slug:string = Bool; +chatlists.editExportedInvite#653db63d flags:# chatlist:InputChatlist slug:string title:flags.1?string peers:flags.2?Vector = ExportedChatlistInvite; +chatlists.getExportedInvites#ce03da83 chatlist:InputChatlist = chatlists.ExportedInvites; +chatlists.checkChatlistInvite#41c10fff slug:string = chatlists.ChatlistInvite; +chatlists.joinChatlistInvite#a6b1e39a slug:string peers:Vector = Updates; +chatlists.getChatlistUpdates#89419521 chatlist:InputChatlist = chatlists.ChatlistUpdates; +chatlists.joinChatlistUpdates#e089f8f5 chatlist:InputChatlist peers:Vector = Updates; +chatlists.hideChatlistUpdates#66e486fb chatlist:InputChatlist = Bool; +chatlists.getLeaveChatlistSuggestions#fdbcd714 chatlist:InputChatlist = Vector; +chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector = Updates; + +stories.canSendStory#c7dfdfdd peer:InputPeer = Bool; +stories.sendStory#e4e6694b flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector caption:flags.0?string entities:flags.1?Vector privacy_rules:Vector random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int = Updates; +stories.editStory#b583ba46 flags:# peer:InputPeer id:int media:flags.0?InputMedia media_areas:flags.3?Vector caption:flags.1?string entities:flags.1?Vector privacy_rules:flags.2?Vector = Updates; +stories.deleteStories#ae59db5f peer:InputPeer id:Vector = Vector; +stories.togglePinned#9a75a1ef peer:InputPeer id:Vector pinned:Bool = Vector; +stories.getAllStories#eeb0d625 flags:# next:flags.1?true hidden:flags.2?true state:flags.0?string = stories.AllStories; +stories.getPinnedStories#5821a5dc peer:InputPeer offset_id:int limit:int = stories.Stories; +stories.getStoriesArchive#b4352016 peer:InputPeer offset_id:int limit:int = stories.Stories; +stories.getStoriesByID#5774ca74 peer:InputPeer id:Vector = stories.Stories; +stories.toggleAllStoriesHidden#7c2557c4 hidden:Bool = Bool; +stories.readStories#a556dac8 peer:InputPeer max_id:int = Vector; +stories.incrementStoryViews#b2028afb peer:InputPeer id:Vector = Bool; +stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true forwards_first:flags.3?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; +stories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector = stories.StoryViews; +stories.exportStoryLink#7b8def20 peer:InputPeer id:int = ExportedStoryLink; +stories.report#1923fa8c peer:InputPeer id:Vector reason:ReportReason message:string = Bool; +stories.activateStealthMode#57bbd166 flags:# past:flags.0?true future:flags.1?true = Updates; +stories.sendReaction#7fd736b2 flags:# add_to_recent:flags.0?true peer:InputPeer story_id:int reaction:Reaction = Updates; +stories.getPeerStories#2c4ada50 peer:InputPeer = stories.PeerStories; +stories.getAllReadPeerStories#9b5ae7f9 = Updates; +stories.getPeerMaxIDs#535983c3 id:Vector = Vector; +stories.getChatsToSend#a56a8b60 = messages.Chats; +stories.togglePeerStoriesHidden#bd0415c4 peer:InputPeer hidden:Bool = Bool; +stories.getStoryReactionsList#b9b2881f flags:# forwards_first:flags.2?true peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = stories.StoryReactionsList; +stories.togglePinnedToTop#b297e9b peer:InputPeer id:Vector = Bool; +stories.searchPosts#6cea116a flags:# hashtag:flags.0?string area:flags.1?MediaArea offset:string limit:int = stories.FoundStories; + +premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList; +premium.getMyBoosts#be77b4a = premium.MyBoosts; +premium.applyBoost#6b7da746 flags:# slots:flags.0?Vector peer:InputPeer = premium.MyBoosts; +premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; +premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; + +smsjobs.isEligibleToJoin#edc39d0 = smsjobs.EligibilityToJoin; +smsjobs.join#a74ece2d = Bool; +smsjobs.leave#9898ad73 = Bool; +smsjobs.updateSettings#93fa0bf flags:# allow_international:flags.0?true = Bool; +smsjobs.getStatus#10a698e8 = smsjobs.Status; +smsjobs.getSmsJob#778d902f job_id:string = SmsJob; +smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; + +fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; + +test.useError = Error; +test.useConfigSimple = help.ConfigSimple; +test.parseInputAppEvent = InputAppEvent; + +// LAYER 185 diff --git a/compiler/api/source/sys_msgs.tl b/compiler/api/source/sys_msgs.tl index 95b768586e..6a3f6325dc 100644 --- a/compiler/api/source/sys_msgs.tl +++ b/compiler/api/source/sys_msgs.tl @@ -42,9 +42,25 @@ new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = // msg_copy#e06046b2 orig_message:Message = MessageCopy; // Not used // gzip_packed#3072cfa1 packed_data:string = Object; // Parsed manually +http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; + //// 0xd433ad73 = hex(crc32(b"ipPort ipv4:int port:int = IpPort")) +// ipPort ipv4:int port:int = IpPort; +// help.configSimple#d997c3c5 date:int expires:int dc_id:int ip_port_list:Vector = help.ConfigSimple; + ipPort#d433ad73 ipv4:int port:int = IpPort; -help.configSimple#d997c3c5 date:int expires:int dc_id:int ip_port_list:Vector = help.ConfigSimple; +ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort; +accessPointRule#4679b65f phone_prefix_rules:string dc_id:int ips:vector = AccessPointRule; +help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple; + +// tlsClientHello blocks:vector = TlsClientHello; +// +// tlsBlockString data:string = TlsBlock; +// tlsBlockRandom length:int = TlsBlock; +// tlsBlockZero length:int = TlsBlock; +// tlsBlockDomain = TlsBlock; +// tlsBlockGrease seed:int = TlsBlock; +// tlsBlockScope entries:Vector = TlsBlock; ---functions--- @@ -58,5 +74,3 @@ ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong; destroy_session#e7512126 session_id:long = DestroySessionRes; contest.saveDeveloperInfo#9a5f6e95 vk_id:int name:string phone_number:string age:int city:string = Bool; - -http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait; diff --git a/compiler/api/template/class.txt b/compiler/api/template/class.txt deleted file mode 100644 index 8fa495c665..0000000000 --- a/compiler/api/template/class.txt +++ /dev/null @@ -1,26 +0,0 @@ -{notice} - -from io import BytesIO - -from pyrogram.api.core import * - - -class {class_name}(Object): - ID = {object_id} - - def __init__(self{arguments}, **kwargs): - {fields} - - @staticmethod - def read(b: BytesIO, *args) -> "{class_name}": - {read_flags} - {read_types} - return {class_name}({return_arguments}) - - def write(self) -> bytes: - b = BytesIO() - b.write(Int(self.ID, False)) - - {write_flags} - {write_types} - return b.getvalue() diff --git a/compiler/api/template/combinator.txt b/compiler/api/template/combinator.txt new file mode 100644 index 0000000000..fa7a76976b --- /dev/null +++ b/compiler/api/template/combinator.txt @@ -0,0 +1,35 @@ +{notice} + +from io import BytesIO + +from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector +from pyrogram.raw.core import TLObject +from pyrogram import raw +from typing import List, Optional, Any + +{warning} + + +class {name}(TLObject): # type: ignore + """{docstring} + """ + + __slots__: List[str] = [{slots}] + + ID = {id} + QUALNAME = "{qualname}" + + def __init__(self{arguments}) -> None: + {fields} + + @staticmethod + def read(b: BytesIO, *args: Any) -> "{name}": + {read_types} + return {name}({return_arguments}) + + def write(self, *args) -> bytes: + b = BytesIO() + b.write(Int(self.ID, False)) + + {write_types} + return b.getvalue() diff --git a/compiler/api/template/type.txt b/compiler/api/template/type.txt new file mode 100644 index 0000000000..99310359d5 --- /dev/null +++ b/compiler/api/template/type.txt @@ -0,0 +1,23 @@ +{notice} + +{warning} + +from typing import Union +from pyrogram import raw +from pyrogram.raw.core import TLObject + +{name} = Union[{types}] + + +# noinspection PyRedeclaration +class {name}: # type: ignore + """{docstring} + """ + + QUALNAME = "pyrogram.raw.base.{qualname}" + + def __init__(self): + raise TypeError("Base types can only be used for type checking purposes: " + "you tried to use a base type instance as argument, " + "but you need to instantiate one of its constructors instead. " + "More info: https://docs.pyrogram.org/telegram/base/{doc_name}") diff --git a/compiler/docs/__init__.py b/compiler/docs/__init__.py new file mode 100644 index 0000000000..46887cb7a5 --- /dev/null +++ b/compiler/docs/__init__.py @@ -0,0 +1,17 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 . diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py new file mode 100644 index 0000000000..555999bc61 --- /dev/null +++ b/compiler/docs/compiler.py @@ -0,0 +1,845 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 ast +import os +import re +import shutil + +HOME = "compiler/docs" +DESTINATION = "docs/source/telegram" +PYROGRAM_API_DEST = "docs/source/api" + +FUNCTIONS_PATH = "pyrogram/raw/functions" +TYPES_PATH = "pyrogram/raw/types" +BASE_PATH = "pyrogram/raw/base" + +FUNCTIONS_BASE = "functions" +TYPES_BASE = "types" +BASE_BASE = "base" + + +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): + all_entities = {} + + def build(path, level=0): + last = path.split("/")[-1] + + for i in os.listdir(path): + try: + if not i.startswith("__"): + build("/".join([path, i]), level=level + 1) + except NotADirectoryError: + with open(path + "/" + i, encoding="utf-8") as f: + p = ast.parse(f.read()) + + for node in ast.walk(p): + if isinstance(node, ast.ClassDef): + name = node.name + break + else: + continue + + full_path = os.path.basename(path) + "/" + snek(name).replace("_", "-") + ".rst" + + if level: + full_path = base + "/" + full_path + + namespace = path.split("/")[-1] + if namespace in ["base", "types", "functions"]: + namespace = "" + + full_name = f"{(namespace + '.') if namespace else ''}{name}" + + os.makedirs(os.path.dirname(DESTINATION + "/" + full_path), exist_ok=True) + + with open(DESTINATION + "/" + full_path, "w", encoding="utf-8") as f: + f.write( + page_template.format( + title=full_name, + title_markup="=" * len(full_name), + full_class_path="pyrogram.raw.{}".format( + ".".join(full_path.split("/")[:-1]) + "." + name + ) + ) + ) + + if last not in all_entities: + all_entities[last] = [] + + all_entities[last].append(name) + + build(source_path) + + for k, v in sorted(all_entities.items()): + v = sorted(v) + entities = [] + + for i in v: + entities.append(f'{i} <{snek(i).replace("_", "-")}>') + + if k != base: + inner_path = base + "/" + k + "/index" + ".rst" + module = "pyrogram.raw.{}.{}".format(base, k) + else: + for i in sorted(list(all_entities), reverse=True): + if i != base: + entities.insert(0, "{0}/index".format(i)) + + inner_path = base + "/index" + ".rst" + module = "pyrogram.raw.{}".format(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( + title=k.title(), + title_markup="=" * len(k), + module=module, + entities="\n ".join(entities) + ) + ) + + f.write("\n") + + +def pyrogram_api(): + def get_title_list(s: str) -> list: + return [i.strip() for i in [j.strip() for j in s.split("\n") if j] if i] + + # Methods + + categories = dict( + utilities=""" + Utilities + run + start + stop + restart + export_session_string + add_handler + remove_handler + stop_transmission + set_parse_mode + """, + authorization=""" + Authorization + initialize + sign_up + accept_terms_of_service + sign_in + sign_in_bot + connect + send_code + resend_code + recover_password + send_recovery_code + get_password_hint + check_password + log_out + disconnect + terminate + get_me + get_active_sessions + terminate_session + terminate_all_other_sessions + """, + messages=""" + Messages + send_message + forward_messages + copy_message + send_photo + send_audio + send_document + send_video + send_animation + send_voice + send_video_note + send_cached_media + send_paid_media + send_media_group + get_media_group + copy_media_group + send_location + send_venue + send_contact + send_poll + send_dice + send_chat_action + set_reaction + download_media + stream_media + edit_message_text + edit_inline_text + edit_message_caption + edit_inline_caption + edit_message_media + edit_inline_media + edit_message_reply_markup + edit_inline_reply_markup + edit_cached_media + stop_poll + delete_messages + get_chat_sponsored_messages + get_chat_history + get_chat_history_count + read_chat_history + get_messages + view_messages + get_discussion_message + get_discussion_replies + get_discussion_replies_count + search_global + search_global_count + search_messages + search_messages_count + search_public_messages_by_tag + count_public_messages_by_tag + vote_poll + retract_vote + translate_text + translate_message_text + """, + chats=""" + Chats + ban_chat_member + unban_chat_member + restrict_chat_member + promote_chat_member + set_administrator_title + set_chat_permissions + set_chat_photo + delete_chat_photo + set_chat_title + set_chat_description + pin_chat_message + unpin_chat_message + unpin_all_chat_messages + search_chats + join_chat + leave_chat + get_chat + get_chat_members + get_chat_members_count + get_chat_member + + get_dialogs + get_dialogs_count + set_chat_username + get_nearby_chats + archive_chats + unarchive_chats + add_chat_members + create_channel + create_group + create_supergroup + delete_channel + delete_supergroup + delete_user_history + set_slow_mode + set_chat_message_auto_delete_time + mark_chat_unread + get_chat_event_log + get_chat_online_count + get_send_as_chats + set_send_as_chat + set_chat_protected_content + get_created_chats + transfer_chat_ownership + """, + invite_links=""" + Invite Links + export_chat_invite_link + create_chat_invite_link + edit_chat_invite_link + revoke_chat_invite_link + get_chat_admin_invite_links + get_chat_admin_invite_links_count + get_chat_admins_with_invite_links + get_chat_invite_link + get_chat_invite_link_joiners + get_chat_invite_link_joiners_count + delete_chat_invite_link + delete_chat_admin_invite_links + get_chat_join_requests + approve_chat_join_request + approve_all_chat_join_requests + decline_chat_join_request + decline_all_chat_join_requests + """, + chat_topics=""" + Chat Forum Topics + get_forum_topic_icon_stickers + create_forum_topic + edit_forum_topic + close_forum_topic + reopen_forum_topic + delete_forum_topic + hide_forum_topic + unhide_forum_topic + get_forum_topics + get_forum_topic + """, + users=""" + Users + get_chat_photos + get_chat_photos_count + get_users + + set_profile_photo + delete_profile_photos + set_username + update_profile + block_user + unblock_user + get_common_chats + get_default_emoji_statuses + set_emoji_status + set_birthdate + set_personal_chat + delete_account + update_status + """, + contacts=""" + Contacts + add_contact + delete_contacts + import_contacts + get_contacts + get_contacts_count + """, + password=""" + Password + enable_cloud_password + change_cloud_password + remove_cloud_password + """, + bots=""" + Bots + answer_callback_query + request_callback_answer + set_bot_commands + delete_bot_commands + get_bot_commands + set_bot_name + get_bot_name + set_bot_info_description + get_bot_info_description + set_bot_info_short_description + get_bot_info_short_description + set_chat_menu_button + get_chat_menu_button + set_bot_default_privileges + get_bot_default_privileges + send_game + set_game_score + get_game_high_scores + answer_inline_query + get_inline_bot_results + send_inline_bot_result + answer_web_app_query + send_web_app_custom_request + """, + phone=""" + Phone + create_video_chat + discard_group_call + get_video_chat_rtmp_url + invite_group_call_participants + load_group_call_participants + """, + stickers=""" + Stickers + send_sticker + get_custom_emoji_stickers + get_message_effects + get_stickers + """, + stories=""" + Stories + get_stories + """, + payments=""" + Payments + send_invoice + create_invoice_link + answer_shipping_query + answer_pre_checkout_query + refund_star_payment + get_business_connection + get_collectible_item_info + """, + advanced=""" + Advanced + invoke + resolve_peer + get_file + save_file + """ + ) + + root = PYROGRAM_API_DEST + "/methods" + + shutil.rmtree(root, ignore_errors=True) + os.mkdir(root) + + with open(HOME + "/template/methods.rst") as f: + template = f.read() + + with open(root + "/index.rst", "w") as f: + fmt_keys = {} + + for k, v in categories.items(): + name, *methods = get_title_list(v) + fmt_keys.update({k: "\n ".join("{0} <{0}>".format(m) for m in methods)}) + + for method in methods: + with open(root + "/{}.rst".format(method), "w") as f2: + title = "{}()".format(method) + + f2.write(title + "\n" + "=" * len(title) + "\n\n") + f2.write(".. automethod:: pyrogram.Client.{}()".format(method)) + + functions = ["idle", "compose"] + + for func in functions: + with open(root + "/{}.rst".format(func), "w") as f2: + title = "{}()".format(func) + + f2.write(title + "\n" + "=" * len(title) + "\n\n") + f2.write(".. autofunction:: pyrogram.{}()".format(func)) + + f.write(template.format(**fmt_keys)) + + # Types + + categories = dict( + users_chats=""" + Users & Chats + Birthdate + User + Chat + Username + ChatShared + UsersShared + ChatAdminWithInviteLinks + ChatColor + ChatEvent + ChatEventFilter + ChatInviteLink + ChatJoiner + ChatJoinRequest + ChatMember + ChatMemberUpdated + ChatPermissions + ChatPhoto + ChatPrivileges + ChatReactions + VideoChatScheduled + VideoChatStarted + VideoChatEnded + VideoChatParticipantsInvited + Dialog + EmojiStatus + GroupCallParticipant + InviteLinkImporter + Restriction + RtmpUrl + """, + messages_media=""" + Messages & Media + Message + MessageEntity + TextQuote + ExternalReplyInfo + ReplyParameters + MessageOrigin + MessageOriginUser + MessageOriginHiddenUser + MessageOriginChat + MessageOriginChannel + MessageImportInfo + Photo + Animation + Audio + Document + Story + Video + VideoNote + Voice + PaidMediaInfo + PaidMedia + PaidMediaPreview + PaidMediaPhoto + PaidMediaVideo + Contact + Dice + PollOption + InputPollOption + Poll + Location + Venue + WebAppData + MessageAutoDeleteTimerChanged + ChatBoostAdded + ChatBackground + Game + GiftCode + GiftedPremium + GiftedStars + Giveaway + GiveawayCompleted + GiveawayWinners + MessageEffect + MessageReactionCountUpdated + MessageReactionUpdated + MessageReactions + Reaction + ReactionCount + ReactionType + ReactionTypeEmoji + ReactionTypeCustomEmoji + Thumbnail + TranslatedText + StrippedThumbnail + SponsoredMessage + Sticker + WebPage + """, + chat_topics=""" + Chat Forum Topics + ForumTopic + ForumTopicCreated + ForumTopicClosed + ForumTopicEdited + ForumTopicReopened + GeneralForumTopicHidden + GeneralForumTopicUnhidden + """, + bot_commands=""" + Bot Commands + BotCommand + BotCommandScope + BotCommandScopeAllChatAdministrators + BotCommandScopeAllGroupChats + BotCommandScopeAllPrivateChats + BotCommandScopeChat + BotCommandScopeChatAdministrators + BotCommandScopeChatMember + BotCommandScopeDefault + """, + bot_keyboards=""" + Bot keyboards + CallbackGame + CallbackQuery + ForceReply + GameHighScore + InlineKeyboardButton + InlineKeyboardMarkup + KeyboardButton + KeyboardButtonPollType + KeyboardButtonPollTypeRegular + KeyboardButtonPollTypeQuiz + KeyboardButtonRequestChat + KeyboardButtonRequestUsers + ReplyKeyboardMarkup + ReplyKeyboardRemove + LoginUrl + WebAppInfo + MenuButton + MenuButtonCommands + MenuButtonWebApp + MenuButtonDefault + SentWebAppMessage + SwitchInlineQueryChosenChat + """, + inline_mode=""" + Inline Mode + ChosenInlineResult + InlineQuery + InlineQueryResult + InlineQueryResultCachedAnimation + InlineQueryResultCachedAudio + InlineQueryResultCachedDocument + InlineQueryResultCachedPhoto + InlineQueryResultCachedSticker + InlineQueryResultCachedVideo + InlineQueryResultCachedVoice + InlineQueryResultAnimation + InlineQueryResultAudio + InlineQueryResultDocument + InlineQueryResultPhoto + InlineQueryResultVideo + InlineQueryResultVoice + InlineQueryResultArticle + InlineQueryResultContact + InlineQueryResultLocation + InlineQueryResultVenue + """, + authorization=""" + Authorization + ActiveSession + ActiveSessions + SentCode + TermsOfService + """, + input_media=""" + Input Media + InputMedia + InputMediaPhoto + InputMediaVideo + InputMediaAudio + InputMediaAnimation + InputMediaDocument + InputPhoneContact + LinkPreviewOptions + """, + input_paid_media=""" + Input Paid Media + InputPaidMedia + InputPaidMediaPhoto + InputPaidMediaVideo + """, + input_message_content=""" + InputMessageContent + InputMessageContent + InputTextMessageContent + InputLocationMessageContent + InputVenueMessageContent + InputContactMessageContent + InputInvoiceMessageContent + """, + payments=""" + Payments + BusinessConnection + BusinessIntro + BusinessLocation + BusinessOpeningHours + BusinessOpeningHoursInterval + CollectibleItemInfo + LabeledPrice + Invoice + ShippingAddress + OrderInfo + ShippingOption + SuccessfulPayment + RefundedPayment + ShippingQuery + PreCheckoutQuery + """ + ) + + root = PYROGRAM_API_DEST + "/types" + + shutil.rmtree(root, ignore_errors=True) + os.mkdir(root) + + with open(HOME + "/template/types.rst") as f: + template = f.read() + + with open(root + "/index.rst", "w") as f: + fmt_keys = {} + + for k, v in categories.items(): + name, *types = get_title_list(v) + + fmt_keys.update({k: "\n ".join(types)}) + + # noinspection PyShadowingBuiltins + for type in types: + with open(root + "/{}.rst".format(type), "w") as f2: + title = "{}".format(type) + + f2.write(title + "\n" + "=" * len(title) + "\n\n") + f2.write(".. autoclass:: pyrogram.types.{}()\n".format(type)) + + f.write(template.format(**fmt_keys)) + + # Bound Methods + + categories = dict( + message=""" + Message + Message.click + Message.delete + Message.download + Message.forward + Message.copy + Message.pin + Message.unpin + Message.edit + Message.edit_text + Message.edit_cached_media + Message.edit_caption + Message.edit_media + Message.edit_reply_markup + Message.reply + Message.reply_text + Message.reply_animation + Message.reply_audio + Message.reply_cached_media + Message.reply_chat_action + Message.reply_contact + Message.reply_document + Message.reply_game + Message.reply_inline_bot_result + Message.reply_location + Message.reply_media_group + Message.reply_photo + Message.reply_poll + Message.reply_sticker + Message.reply_venue + Message.reply_video + Message.reply_video_note + Message.reply_voice + Message.get_media_group + Message.react + Message.read + Message.view + Message.translate + """, + chat=""" + Chat + Chat.archive + Chat.unarchive + Chat.set_title + Chat.set_description + Chat.set_photo + Chat.ban_member + Chat.unban_member + Chat.restrict_member + Chat.promote_member + Chat.get_member + Chat.get_members + Chat.add_members + Chat.join + Chat.leave + Chat.mark_unread + Chat.set_protected_content + Chat.unpin_all_messages + Chat.set_message_auto_delete_time + """, + user=""" + User + User.archive + User.unarchive + User.block + User.unblock + """, + callback_query=""" + Callback Query + CallbackQuery.answer + CallbackQuery.edit_message_text + CallbackQuery.edit_message_caption + CallbackQuery.edit_message_media + CallbackQuery.edit_message_reply_markup + """, + inline_query=""" + InlineQuery + InlineQuery.answer + """, + pre_checkout_query=""" + PreCheckoutQuery + PreCheckoutQuery.answer + """, + shipping_query=""" + ShippingQuery + ShippingQuery.answer + """, + chat_join_request=""" + ChatJoinRequest + ChatJoinRequest.approve + ChatJoinRequest.decline + """, + story=""" + Story + Story.react + Story.download + """, + active_session=""" + ActiveSession + ActiveSession.terminate + """, + ) + + root = PYROGRAM_API_DEST + "/bound-methods" + + shutil.rmtree(root, ignore_errors=True) + os.mkdir(root) + + with open(HOME + "/template/bound-methods.rst") as f: + template = f.read() + + with open(root + "/index.rst", "w") as f: + fmt_keys = {} + + for k, v in categories.items(): + name, *bound_methods = get_title_list(v) + + fmt_keys.update({"{}_hlist".format(k): "\n ".join("- :meth:`~{}`".format(bm) for bm in bound_methods)}) + + fmt_keys.update( + {"{}_toctree".format(k): "\n ".join("{} <{}>".format(bm.split(".")[1], bm) for bm in bound_methods)}) + + # noinspection PyShadowingBuiltins + for bm in bound_methods: + with open(root + "/{}.rst".format(bm), "w") as f2: + title = "{}()".format(bm) + + f2.write(title + "\n" + "=" * len(title) + "\n\n") + f2.write(".. automethod:: pyrogram.types.{}()".format(bm)) + + f.write(template.format(**fmt_keys)) + + +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() + + with open(HOME + "/template/toctree.txt", encoding="utf-8") as f: + toctree = f.read() + + generate(TYPES_PATH, TYPES_BASE) + generate(FUNCTIONS_PATH, FUNCTIONS_BASE) + generate(BASE_PATH, BASE_BASE) + pyrogram_api() + + +if "__main__" == __name__: + FUNCTIONS_PATH = "../../pyrogram/raw/functions" + TYPES_PATH = "../../pyrogram/raw/types" + BASE_PATH = "../../pyrogram/raw/base" + HOME = "." + DESTINATION = "../../docs/source/telegram" + PYROGRAM_API_DEST = "../../docs/source/api" + + start() diff --git a/compiler/docs/template/bound-methods.rst b/compiler/docs/template/bound-methods.rst new file mode 100644 index 0000000000..f26c907894 --- /dev/null +++ b/compiler/docs/template/bound-methods.rst @@ -0,0 +1,154 @@ +Bound Methods +============= + +Some Pyrogram types define what are called bound methods. Bound methods are functions attached to a type which are +accessed via an instance of that type. They make it even easier to call specific methods by automatically inferring +some of the required arguments. + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + + @app.on_message() + def hello(client, message) + message.reply("hi") + + + app.run() + +----- + +.. currentmodule:: pyrogram.types + +Message +------- + +.. hlist:: + :columns: 3 + + {message_hlist} + +.. toctree:: + :hidden: + + {message_toctree} + +Chat +---- + +.. hlist:: + :columns: 4 + + {chat_hlist} + +.. toctree:: + :hidden: + + {chat_toctree} + +User +---- + +.. hlist:: + :columns: 2 + + {user_hlist} + +.. toctree:: + :hidden: + + {user_toctree} + +CallbackQuery +------------- + +.. hlist:: + :columns: 3 + + {callback_query_hlist} + +.. toctree:: + :hidden: + + {callback_query_toctree} + +InlineQuery +----------- + +.. hlist:: + :columns: 2 + + {inline_query_hlist} + +.. toctree:: + :hidden: + + {inline_query_toctree} + +PreCheckoutQuery +----------------- + +.. hlist:: + :columns: 2 + + {pre_checkout_query_hlist} + +.. toctree:: + :hidden: + + {pre_checkout_query_toctree} + +ShippingQuery +-------------- + +.. hlist:: + :columns: 2 + + {shipping_query_hlist} + +.. toctree:: + :hidden: + + {shipping_query_toctree} + +ChatJoinRequest +--------------- + +.. hlist:: + :columns: 2 + + {chat_join_request_hlist} + +.. toctree:: + :hidden: + + {chat_join_request_toctree} + +Story +------ + +.. hlist:: + :columns: 2 + + {story_hlist} + +.. toctree:: + :hidden: + + {story_toctree} + +ActiveSession +------------- + +.. hlist:: + :columns: 2 + + {active_session_hlist} + +.. toctree:: + :hidden: + + {active_session_toctree} diff --git a/compiler/docs/template/methods.rst b/compiler/docs/template/methods.rst new file mode 100644 index 0000000000..20b25d26c7 --- /dev/null +++ b/compiler/docs/template/methods.rst @@ -0,0 +1,233 @@ +Available Methods +================= + +This page is about Pyrogram methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance, +except for :meth:`~pyrogram.idle()` and :meth:`~pyrogram.compose()`, which are special functions that can be found in +the main package directly. + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + with app: + app.send_message(chat_id="me", text="hi") + +----- + +.. currentmodule:: pyrogram.Client + +Utilities +--------- + +.. autosummary:: + :nosignatures: + + {utilities} + +.. toctree:: + :hidden: + + {utilities} + +.. currentmodule:: pyrogram + +.. autosummary:: + :nosignatures: + + idle + compose + +.. toctree:: + :hidden: + + idle + compose + +.. currentmodule:: pyrogram.Client + +Authorization +------------- + +.. autosummary:: + :nosignatures: + + {authorization} + +.. toctree:: + :hidden: + + {authorization} + +Messages +-------- + +.. autosummary:: + :nosignatures: + + {messages} + +.. toctree:: + :hidden: + + {messages} + +Chats +----- + +.. autosummary:: + :nosignatures: + + {chats} + +.. toctree:: + :hidden: + + {chats} + +Invite Links +------------ + +.. autosummary:: + :nosignatures: + + {invite_links} + +.. toctree:: + :hidden: + + {invite_links} + +Chat Forum Topics +------------------ + +.. autosummary:: + :nosignatures: + + {chat_topics} + +.. toctree:: + :hidden: + + {chat_topics} + +Users +----- + +.. autosummary:: + :nosignatures: + + {users} + +.. toctree:: + :hidden: + + {users} + +Contacts +-------- + +.. autosummary:: + :nosignatures: + + {contacts} + +.. toctree:: + :hidden: + + {contacts} + +Password +-------- + +.. autosummary:: + :nosignatures: + + {password} + +.. toctree:: + :hidden: + + {password} + +Bots +---- + +.. autosummary:: + :nosignatures: + + {bots} + +.. toctree:: + :hidden: + + {bots} + +Stickers +-------- + +.. autosummary:: + :nosignatures: + + {stickers} + +.. toctree:: + :hidden: + + {stickers} + +Stories +-------- + +.. autosummary:: + :nosignatures: + + {stories} + +.. toctree:: + :hidden: + + {stories} + +Payments +--------- + +.. autosummary:: + :nosignatures: + + {payments} + +.. toctree:: + :hidden: + + {payments} + +Phone +------ + +.. autosummary:: + :nosignatures: + + {phone} + +.. toctree:: + :hidden: + + {phone} + +Advanced +-------- + +Methods used only when dealing with the raw Telegram API. +Learn more about how to use the raw API at :doc:`Advanced Usage <../../topics/advanced-usage>`. + +.. autosummary:: + :nosignatures: + + {advanced} + +.. toctree:: + :hidden: + + {advanced} diff --git a/compiler/docs/template/page.txt b/compiler/docs/template/page.txt new file mode 100644 index 0000000000..638a10cf11 --- /dev/null +++ b/compiler/docs/template/page.txt @@ -0,0 +1,5 @@ +{title} +{title_markup} + +.. autoclass:: {full_class_path}() + :members: diff --git a/compiler/docs/template/toctree.txt b/compiler/docs/template/toctree.txt new file mode 100644 index 0000000000..7a36e4a592 --- /dev/null +++ b/compiler/docs/template/toctree.txt @@ -0,0 +1,9 @@ +{title} +{title_markup} + +.. module:: {module} + +.. toctree:: + :titlesonly: + + {entities} \ No newline at end of file diff --git a/compiler/docs/template/types.rst b/compiler/docs/template/types.rst new file mode 100644 index 0000000000..152ab98a7b --- /dev/null +++ b/compiler/docs/template/types.rst @@ -0,0 +1,165 @@ +Available Types +=============== + +This page is about Pyrogram Types. All types listed here are available through the ``pyrogram.types`` package. +Unless required as argument to a client method, most of the types don't need to be manually instantiated because they +are only returned by other methods. You also don't need to import them, unless you want to type-hint your variables. + +.. code-block:: python + + from pyrogram.types import User, Message, ... + +.. note:: + + Optional fields always exist inside the object, but they could be empty and contain the value of ``None``. + Empty fields aren't shown when, for example, using ``print(message)`` and this means that + ``hasattr(message, "photo")`` always returns ``True``. + + To tell whether a field is set or not, do a simple boolean check: ``if message.photo: ...``. + +----- + +.. currentmodule:: pyrogram.types + +Messages & Media +---------------- + +.. autosummary:: + :nosignatures: + + {messages_media} + +.. toctree:: + :hidden: + + {messages_media} + +Users & Chats +------------- + +.. autosummary:: + :nosignatures: + + {users_chats} + +.. toctree:: + :hidden: + + {users_chats} + +Bot keyboards +------------- + +.. autosummary:: + :nosignatures: + + {bot_keyboards} + +.. toctree:: + :hidden: + + {bot_keyboards} + +Bot commands +------------- + +.. autosummary:: + :nosignatures: + + {bot_commands} + +.. toctree:: + :hidden: + + {bot_commands} + +Chat Forum Topics +------------------ + +.. autosummary:: + :nosignatures: + + {chat_topics} + +.. toctree:: + :hidden: + + {chat_topics} + +Input Media +----------- + +.. autosummary:: + :nosignatures: + + {input_media} + +.. toctree:: + :hidden: + + {input_media} + +Input Paid Media +----------------- + +.. autosummary:: + :nosignatures: + + {input_paid_media} + +.. toctree:: + :hidden: + + {input_paid_media} + +Inline Mode +------------ + +.. autosummary:: + :nosignatures: + + {inline_mode} + +.. toctree:: + :hidden: + + {inline_mode} + +InputMessageContent +------------------- + +.. autosummary:: + :nosignatures: + + {input_message_content} + +.. toctree:: + :hidden: + + {input_message_content} + +Authorization +------------- + +.. autosummary:: + :nosignatures: + + {authorization} + +.. toctree:: + :hidden: + + {authorization} + +Payments +--------- + +.. autosummary:: + :nosignatures: + + {payments} + +.. toctree:: + :hidden: + + {payments} diff --git a/compiler/error/__init__.py b/compiler/error/__init__.py deleted file mode 100644 index b9ee0a987b..0000000000 --- a/compiler/error/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 . diff --git a/compiler/error/compiler.py b/compiler/error/compiler.py deleted file mode 100644 index 3d8f656927..0000000000 --- a/compiler/error/compiler.py +++ /dev/null @@ -1,140 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 csv -import os -import re -import shutil - -home = "compiler/error" -dest = "pyrogram/api/errors/exceptions" -notice_path = "NOTICE" - - -def snek(s): - # https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case - 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 caml(s): - s = snek(s).split("_") - return "".join([str(i.title()) for i in s]) - - -def start(): - shutil.rmtree(dest, ignore_errors=True) - os.makedirs(dest) - - files = [i for i in os.listdir("{}/source".format(home))] - - with open(notice_path) as f: - notice = [] - - for line in f.readlines(): - notice.append("# {}".format(line).strip()) - - notice = "\n".join(notice) - - with open("{}/all.py".format(dest), "w") as f_all: - f_all.write(notice + "\n\n") - f_all.write("count = {count}\n\n") - f_all.write("exceptions = {\n") - - count = 0 - - for i in files: - code, name = re.search(r"(\d+)_([A-Z_]+)", i).groups() - - f_all.write(" {}: {{\n".format(code)) - - init = "{}/__init__.py".format(dest) - - if not os.path.exists(init): - with open(init, "w") as f_init: - f_init.write(notice + "\n\n") - - with open(init, "a") as f_init: - f_init.write("from .{}_{} import *\n".format(name.lower(), code)) - - with open("{}/source/{}".format(home, i)) as f_csv, \ - open("{}/{}_{}.py".format(dest, name.lower(), code), "w") as f_class: - reader = csv.reader(f_csv, delimiter="|") - - super_class = caml(name) - name = " ".join([str(i.capitalize()) for i in re.sub(r"_", " ", name).lower().split(" ")]) - - sub_classes = [] - - for j, row in enumerate(reader): - if j == 0: - continue - - count += 1 - - if not row: # Row is empty (blank line) - continue - - id, message = row - - sub_class = caml(re.sub(r"_X", "_", id)) - - f_all.write(" \"{}\": \"{}\",\n".format(id, sub_class)) - - sub_classes.append((sub_class, id, message)) - - with open("{}/template/class.txt".format(home), "r") as f_class_template: - class_template = f_class_template.read() - - with open("{}/template/sub_class.txt".format(home), "r") as f_sub_class_template: - sub_class_template = f_sub_class_template.read() - - class_template = class_template.format( - notice=notice, - super_class=super_class, - code=code, - name="\"{}\"".format(name), - sub_classes="".join([sub_class_template.format( - sub_class=k[0], - super_class=super_class, - id="\"{}\"".format(k[1]), - message="\"{}\"".format(k[2]) - ) for k in sub_classes]) - ) - - f_class.write(class_template) - - f_all.write(" },\n") - - f_all.write("}\n") - - with open("{}/all.py".format(dest)) as f: - content = f.read() - - with open("{}/all.py".format(dest), "w") as f: - f.write(re.sub("{count}", str(count), content)) - - print("Compiling Errors: [100%]") - - -if "__main__" == __name__: - home = "." - dest = "../../pyrogram/api/errors/exceptions" - notice_path = "../../NOTICE" - - start() diff --git a/compiler/error/source/303_SEE_OTHER.csv b/compiler/error/source/303_SEE_OTHER.csv deleted file mode 100644 index 65df560f54..0000000000 --- a/compiler/error/source/303_SEE_OTHER.csv +++ /dev/null @@ -1,5 +0,0 @@ -id|message -FILE_MIGRATE_X|The file to be accessed is currently stored in DC{x} -PHONE_MIGRATE_X|The phone number a user is trying to use for authorization is associated with DC{x} -NETWORK_MIGRATE_X|The source IP address is associated with DC{x} (for registration) -USER_MIGRATE_X|The user whose identity is being used to execute queries is associated with DC{x} (for registration) diff --git a/compiler/error/source/400_BAD_REQUEST.csv b/compiler/error/source/400_BAD_REQUEST.csv deleted file mode 100644 index 71014ba038..0000000000 --- a/compiler/error/source/400_BAD_REQUEST.csv +++ /dev/null @@ -1,31 +0,0 @@ -id|message -FIRSTNAME_INVALID|The first name is invalid -LASTNAME_INVALID|The last name is invalid -PHONE_NUMBER_INVALID|The phone number is invalid -PHONE_CODE_HASH_EMPTY|phone_code_hash is missing -PHONE_CODE_EMPTY|phone_code is missing -PHONE_CODE_EXPIRED|The confirmation code has expired -PHONE_CODE_INVALID|The confirmation code is invalid -API_ID_INVALID|The api_id/api_hash combination is invalid -PHONE_NUMBER_OCCUPIED|The phone number is already in use -PHONE_NUMBER_UNOCCUPIED|The phone number is not yet being used -USERS_TOO_FEW|Not enough users (to create a chat, for example) -USERS_TOO_MUCH|The maximum number of users has been exceeded (to create a chat, for example) -TYPE_CONSTRUCTOR_INVALID|The type constructor is invalid -FILE_PART_INVALID|The file part number is invalid -FILE_PARTS_INVALID|The number of file parts is invalid -FILE_PART_X_MISSING|Part {x} of the file is missing from storage -MD5_CHECKSUM_INVALID|The MD5 checksums do not match -PHOTO_INVALID_DIMENSIONS|The photo dimensions are invalid -FIELD_NAME_INVALID|The field with the name FIELD_NAME is invalid -FIELD_NAME_EMPTY|The field with the name FIELD_NAME is missing -MSG_WAIT_FAILED|A waiting call returned an error -PEER_ID_INVALID|The id/access_hash combination is invalid -MESSAGE_EMPTY|The message sent is empty -ENCRYPTED_MESSAGE_INVALID|The special binding message (bind_auth_key_inner) contains invalid data -INPUT_METHOD_INVALID|The method called is invalid -PASSWORD_HASH_INVALID|Two-step verification password is invalid -USERNAME_NOT_OCCUPIED|The username is not occupied by anyone -USERNAME_INVALID|The username is invalid -MESSAGE_ID_INVALID|The message id is invalid -MESSAGE_NOT_MODIFIED|The message was not modified \ No newline at end of file diff --git a/compiler/error/source/401_UNAUTHORIZED.csv b/compiler/error/source/401_UNAUTHORIZED.csv deleted file mode 100644 index 69cf56f785..0000000000 --- a/compiler/error/source/401_UNAUTHORIZED.csv +++ /dev/null @@ -1,9 +0,0 @@ -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 -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 -AUTH_KEY_PERM_EMPTY|The method is unavailable for temporary authorization key, not bound to permanent -SESSION_PASSWORD_NEEDED|Two-step verification password required diff --git a/compiler/error/source/420_FLOOD.csv b/compiler/error/source/420_FLOOD.csv deleted file mode 100644 index 4674efdaba..0000000000 --- a/compiler/error/source/420_FLOOD.csv +++ /dev/null @@ -1,2 +0,0 @@ -id|message -FLOOD_WAIT_X|A wait of {x} seconds is required diff --git a/compiler/error/source/500_INTERNAL_SERVER_ERROR.csv b/compiler/error/source/500_INTERNAL_SERVER_ERROR.csv deleted file mode 100644 index 98a519fb2e..0000000000 --- a/compiler/error/source/500_INTERNAL_SERVER_ERROR.csv +++ /dev/null @@ -1,2 +0,0 @@ -id|message -AUTH_RESTART|User authorization has restarted diff --git a/compiler/error/template/class.txt b/compiler/error/template/class.txt deleted file mode 100644 index 0c729eb702..0000000000 --- a/compiler/error/template/class.txt +++ /dev/null @@ -1,11 +0,0 @@ -{notice} - -from ..error import Error - - -class {super_class}(Error): - CODE = {code} - NAME = {name} - - -{sub_classes} \ No newline at end of file diff --git a/compiler/error/template/sub_class.txt b/compiler/error/template/sub_class.txt deleted file mode 100644 index bc1634073e..0000000000 --- a/compiler/error/template/sub_class.txt +++ /dev/null @@ -1,5 +0,0 @@ -class {sub_class}({super_class}): - ID = {id} - MESSAGE = {message} - - diff --git a/compiler/errors/__init__.py b/compiler/errors/__init__.py new file mode 100644 index 0000000000..46887cb7a5 --- /dev/null +++ b/compiler/errors/__init__.py @@ -0,0 +1,17 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 . diff --git a/compiler/errors/compiler.py b/compiler/errors/compiler.py new file mode 100644 index 0000000000..0c4ef399b6 --- /dev/null +++ b/compiler/errors/compiler.py @@ -0,0 +1,142 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 csv +import os +import re +import shutil + +HOME = "compiler/errors" +DEST = "pyrogram/errors/exceptions" +NOTICE_PATH = "NOTICE" + + +def snek(s): + # https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case + 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 caml(s): + s = snek(s).split("_") + return "".join([str(i.title()) for i in s]) + + +def start(): + shutil.rmtree(DEST, ignore_errors=True) + os.makedirs(DEST) + + files = [i for i in os.listdir("{}/source".format(HOME))] + + with open(NOTICE_PATH, encoding="utf-8") as f: + notice = [] + + for line in f.readlines(): + notice.append("# {}".format(line).strip()) + + notice = "\n".join(notice) + + with open("{}/all.py".format(DEST), "w", encoding="utf-8") as f_all: + f_all.write(notice + "\n\n") + f_all.write("count = {count}\n\n") + f_all.write("exceptions = {\n") + + count = 0 + + for i in files: + code, name = re.search(r"(\d+)_([A-Z_]+)", i).groups() + + f_all.write(" {}: {{\n".format(code)) + + init = "{}/__init__.py".format(DEST) + + if not os.path.exists(init): + with open(init, "w", encoding="utf-8") as f_init: + f_init.write(notice + "\n\n") + + with open(init, "a", encoding="utf-8") as f_init: + f_init.write("from .{}_{} import *\n".format(name.lower(), code)) + + with open("{}/source/{}".format(HOME, i), encoding="utf-8") as f_csv, \ + open("{}/{}_{}.py".format(DEST, name.lower(), code), "w", encoding="utf-8") as f_class: + reader = csv.reader(f_csv, delimiter="\t") + + super_class = caml(name) + name = " ".join([str(i.capitalize()) for i in re.sub(r"_", " ", name).lower().split(" ")]) + + sub_classes = [] + + f_all.write(" \"_\": \"{}\",\n".format(super_class)) + + for j, row in enumerate(reader): + if j == 0: + continue + + count += 1 + + if not row: # Row is empty (blank line) + continue + + error_id, error_message = row + + sub_class = caml(re.sub(r"_X", "_", error_id)) + sub_class = re.sub(r"^2", "Two", sub_class) + sub_class = re.sub(r" ", "", sub_class) + + f_all.write(" \"{}\": \"{}\",\n".format(error_id, sub_class)) + + sub_classes.append((sub_class, error_id, error_message)) + + with open("{}/template/class.txt".format(HOME), "r", encoding="utf-8") as f_class_template: + class_template = f_class_template.read() + + with open("{}/template/sub_class.txt".format(HOME), "r", encoding="utf-8") as f_sub_class_template: + sub_class_template = f_sub_class_template.read() + + class_template = class_template.format( + notice=notice, + super_class=super_class, + code=code, + docstring='"""{}"""'.format(name), + sub_classes="".join([sub_class_template.format( + sub_class=k[0], + super_class=super_class, + id="\"{}\"".format(k[1]), + docstring='"""{}"""'.format(k[2]) + ) for k in sub_classes]) + ) + + f_class.write(class_template) + + f_all.write(" },\n") + + f_all.write("}\n") + + with open("{}/all.py".format(DEST), encoding="utf-8") as f: + content = f.read() + + with open("{}/all.py".format(DEST), "w", encoding="utf-8") as f: + f.write(re.sub("{count}", str(count), content)) + + +if "__main__" == __name__: + HOME = "." + DEST = "../../pyrogram/errors/exceptions" + NOTICE_PATH = "../../NOTICE" + + start() diff --git a/compiler/errors/sort.py b/compiler/errors/sort.py new file mode 100644 index 0000000000..44713095ea --- /dev/null +++ b/compiler/errors/sort.py @@ -0,0 +1,83 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 csv +from pathlib import Path +import re +import requests # requests==2.28.1 +import sys + +if len(sys.argv) != 2: + sys.exit(1) + +if sys.argv[1] == "sort": + for p in Path("source").glob("*.tsv"): + with open(p) as f: + reader = csv.reader(f, delimiter="\t") + dct = {k: v for k, v in reader if k != "id"} + keys = sorted(dct) + + with open(p, "w") as f: + f.write("id\tmessage\n") + + for i, item in enumerate(keys, start=1): + f.write(f"{item}\t{dct[item]}") + + if i != len(keys): + f.write("\n") + +elif sys.argv[1] == "scrape": + b = "https://core.telegram.org" + c = "/api/errors" + a = requests.get(b + c) + d = a.text + e = r"\here.*\<\/a\>" + f = re.search(e, d) + if f: + a = requests.get( + b + f.group(1) + ) + d = a.json() + e = d.get("errors", []) + for h in e: + dct = {} + + j = d.get("errors").get(h) + for k in j: + if k.endswith("_*"): + continue + g = d.get("descriptions") + l = g.get(k) + m = k.replace("_%d", "_X") + l = l.replace("%d", "{value}") + dct[m] = l + + for p in Path("source/").glob(f"{h}*.tsv"): + with open(p) as f: + reader = csv.reader(f, delimiter="\t") + for k, v in reader: + if k != "id": + dct[k] = v + + keys = sorted(dct) + + for p in Path("source/").glob(f"{h}*.tsv"): + with open(p, "w") as f: + f.write("id\tmessage\n") + for i, item in enumerate(keys, start=1): + f.write(f"{item}\t{dct[item]}\n") diff --git a/compiler/errors/source/303_SEE_OTHER.tsv b/compiler/errors/source/303_SEE_OTHER.tsv new file mode 100644 index 0000000000..301660cefe --- /dev/null +++ b/compiler/errors/source/303_SEE_OTHER.tsv @@ -0,0 +1,6 @@ +id message +FILE_MIGRATE_X The file to be accessed is currently stored in DC{value} +NETWORK_MIGRATE_X The source IP address is associated with DC{value} (for registration) +PHONE_MIGRATE_X The phone number a user is trying to use for authorization is associated with DC{value} +STATS_MIGRATE_X The statistics of the group/channel are stored in DC{value} +USER_MIGRATE_X The user whose identity is being used to execute queries is associated with DC{value} (for registration) \ No newline at end of file diff --git a/compiler/errors/source/400_BAD_REQUEST.tsv b/compiler/errors/source/400_BAD_REQUEST.tsv new file mode 100644 index 0000000000..5261ea3a65 --- /dev/null +++ b/compiler/errors/source/400_BAD_REQUEST.tsv @@ -0,0 +1,521 @@ +id message +ABOUT_TOO_LONG About string too long. +ACCESS_TOKEN_EXPIRED Access token expired. +ACCESS_TOKEN_INVALID Access token invalid. +ADDRESS_INVALID The specified geopoint address is invalid. +ADMINS_TOO_MUCH There are too many admins. +ADMIN_ID_INVALID The specified admin ID is invalid. +ADMIN_RANK_EMOJI_NOT_ALLOWED An admin rank cannot contain emojis. +ADMIN_RANK_INVALID The specified admin rank is invalid. +ADMIN_RIGHTS_EMPTY The chatAdminRights constructor passed in keyboardButtonRequestPeer.peer_type.user_admin_rights has no rights set (i.e. flags is 0). +ALBUM_PHOTOS_TOO_MANY You have uploaded too many profile photos, delete some before retrying. +API_ID_INVALID API ID invalid. +API_ID_PUBLISHED_FLOOD This API id was published somewhere, you can't use it now. +ARTICLE_TITLE_EMPTY The title of the article is empty. +AUDIO_CONTENT_URL_EMPTY The remote URL specified in the content field is empty. +AUDIO_TITLE_EMPTY An empty audio title was provided. +AUTH_BYTES_INVALID The provided authorization is invalid. +AUTH_TOKEN_ALREADY_ACCEPTED The specified auth token was already accepted. +AUTH_TOKEN_EXCEPTION An error occurred while importing the auth token. +AUTH_TOKEN_EXPIRED The authorization token has expired. +AUTH_TOKEN_INVALID The specified auth token is invalid. +AUTH_TOKEN_INVALIDX The specified auth token is invalid. +AUTOARCHIVE_NOT_AVAILABLE The autoarchive setting is not available at this time: please check the value of the [autoarchive_setting_available field in client config »](https://core.telegram.org/api/config#client-configuration) before calling this method. +BANK_CARD_NUMBER_INVALID The specified card number is invalid. +BANNED_RIGHTS_INVALID You provided some invalid flags in the banned rights. +BASE_PORT_LOC_INVALID The base port location is invalid +BIRTHDAY_INVALID The age should be less than 150 year old in Telegram +BOOSTS_EMPTY No boost slots were specified. +BOOSTS_REQUIRED The specified channel must first be [boosted by its users](https://core.telegram.org/api/boost) in order to perform this action. +BOOST_NOT_MODIFIED You're already [boosting](https://core.telegram.org/api/boost) the specified channel. +BOOST_PEER_INVALID The specified `boost_peer` is invalid. +BOTS_TOO_MUCH There are too many bots in this chat/channel. +BOT_APP_INVALID The specified bot app is invalid. +BOT_APP_SHORTNAME_INVALID The specified bot app short name is invalid. +BOT_CHANNELS_NA Bots can't edit admin privileges. +BOT_COMMAND_DESCRIPTION_INVALID The specified command description is invalid. +BOT_COMMAND_INVALID The specified command is invalid. +BOT_DOMAIN_INVALID Bot domain invalid. +BOT_GAMES_DISABLED Bot games cannot be used in this type of chat +BOT_GROUPS_BLOCKED This bot can't be added to groups. +BOT_INLINE_DISABLED This bot can't be used in inline mode. +BOT_INVALID This is not a valid bot. +BOT_METHOD_INVALID The method can't be used by bots +BOT_MISSING Only bots can call this method, please use [@stickers](https://t.me/stickers) if you're a user. +BOT_ONESIDE_NOT_AVAIL Bots can't pin messages in PM just for themselves. +BOT_PAYMENTS_DISABLED Please enable bot payments in botfather before calling this method. +BOT_POLLS_DISABLED Sending polls by bots has been disabled +BOT_RESPONSE_TIMEOUT A timeout occurred while fetching data from the bot. +BOT_SCORE_NOT_MODIFIED The score wasn't modified. +BOT_WEBVIEW_DISABLED A webview cannot be opened in the specified conditions: emitted for example if `from_bot_menu` or `url` are set and `peer` is not the chat with the bot. +BROADCAST_ID_INVALID Broadcast ID invalid. +BROADCAST_PUBLIC_VOTERS_FORBIDDEN You can't forward polls with public voters. +BROADCAST_REQUIRED This method can only be called on a channel, please use stats.getMegagroupStats for supergroups. +BUTTON_DATA_INVALID The data of one or more of the buttons you provided is invalid. +BUTTON_ID_INVALID The button_id parameter is invalid +BUTTON_TEXT_INVALID The specified button text is invalid. +BUTTON_TYPE_INVALID The type of one or more of the buttons you provided is invalid. +BUTTON_URL_INVALID Button URL invalid. +BUTTON_USER_INVALID The user_id passed to inputKeyboardButtonUserProfile is invalid +BUTTON_USER_PRIVACY_RESTRICTED The privacy setting of the user specified in a [inputKeyboardButtonUserProfile](/constructor/inputKeyboardButtonUserProfile) button do not allow creating such a button. +CALL_ALREADY_ACCEPTED The call was already accepted. +CALL_ALREADY_DECLINED The call was already declined. +CALL_OCCUPY_FAILED The call failed because the user is already making another call. +CALL_PEER_INVALID The provided call peer object is invalid. +CALL_PROTOCOL_FLAGS_INVALID Call protocol flags invalid. +CDN_METHOD_INVALID You can't call this method in a CDN DC. +CHANNELS_ADMIN_LOCATED_TOO_MUCH The user has reached the limit of public geogroups. +CHANNELS_ADMIN_PUBLIC_TOO_MUCH You're admin of too many public channels, make some channels private to change the username of this channel. +CHANNELS_TOO_MUCH You have joined too many channels/supergroups. +CHANNEL_ADD_INVALID Internal error. +CHANNEL_BANNED The channel is banned +CHANNEL_FORUM_MISSING This supergroup is not a forum. +CHANNEL_ID_INVALID The specified supergroup ID is invalid. +CHANNEL_INVALID The provided channel is invalid. +CHANNEL_PARICIPANT_MISSING The current user is not in the channel. +CHANNEL_PRIVATE You haven't joined this channel/supergroup. +CHANNEL_TOO_BIG This channel has too many participants (>1000) to be deleted. +CHANNEL_TOO_LARGE Channel is too large to be deleted; this error is issued when trying to delete channels with more than 1000 members (subject to change). +CHARGE_ALREADY_REFUNDED The charge id was already used for a refund. +CHARGE_NOT_FOUND The charge id was not found. +CHATLIST_EXCLUDE_INVALID The specified `exclude_peers` are invalid. +CHAT_ABOUT_NOT_MODIFIED About text has not changed. +CHAT_ABOUT_TOO_LONG Chat about too long. +CHAT_ADMIN_REQUIRED You must be an admin in this chat to do this. +CHAT_DISCUSSION_UNALLOWED You can't enable forum topics in a discussion group linked to a channel. +CHAT_FORWARDS_RESTRICTED You can't forward messages from a protected chat. +CHAT_ID_EMPTY The provided chat ID is empty. +CHAT_ID_INVALID The provided chat id is invalid. +CHAT_INVALID Invalid chat. +CHAT_INVITE_PERMANENT You can't set an expiration date on permanent invite links. +CHAT_LINK_EXISTS The chat is public, you can't hide the history to new users. +CHAT_NOT_MODIFIED No changes were made to chat information because the new information you passed is identical to the current information. +CHAT_PUBLIC_REQUIRED You can only enable join requests in public groups. +CHAT_RESTRICTED You can't send messages in this chat, you were restricted. +CHAT_REVOKE_DATE_UNSUPPORTED `min_date` and `max_date` are not available for using with non-user peers. +CHAT_SEND_INLINE_FORBIDDEN You can't send inline messages in this group. +CHAT_TITLE_EMPTY No chat title provided. +CHAT_TOO_BIG This method is not available for groups with more than `chat_read_mark_size_threshold` members, [see client configuration »](https://core.telegram.org/api/config#client-configuration). +CODE_EMPTY The provided code is empty. +CODE_HASH_INVALID Code hash invalid. +CODE_INVALID Code invalid. +COLOR_INVALID The specified color palette ID was invalid. +CONNECTION_API_ID_INVALID The provided API id is invalid. +CONNECTION_APP_VERSION_EMPTY App version is empty. +CONNECTION_DEVICE_MODEL_EMPTY The device model is empty +CONNECTION_LANG_PACK_INVALID The specified language pack is not valid +CONNECTION_LAYER_INVALID Layer invalid. +CONNECTION_NOT_INITED The connection was not initialized +CONNECTION_SYSTEM_EMPTY The connection to the system is empty +CONNECTION_SYSTEM_LANG_CODE_EMPTY The system language code is empty +CONTACT_ADD_MISSING Contact to add is missing. +CONTACT_ID_INVALID The provided contact ID is invalid. +CONTACT_MISSING The specified user is not a contact. +CONTACT_NAME_EMPTY Contact name empty. +CONTACT_REQ_MISSING Missing contact request. +CREATE_CALL_FAILED An error occurred while creating the call. +CURRENCY_TOTAL_AMOUNT_INVALID The total amount of all prices is invalid. +CUSTOM_REACTIONS_TOO_MANY Too many custom reactions were specified. +DATA_INVALID Encrypted data invalid. +DATA_JSON_INVALID The provided JSON data is invalid. +DATA_TOO_LONG Data too long. +DATE_EMPTY Date empty. +DC_ID_INVALID The provided DC ID is invalid. +DH_G_A_INVALID g_a invalid. +DOCUMENT_INVALID The specified document is invalid. +EMAIL_HASH_EXPIRED Email hash expired. +EMAIL_INVALID The specified email is invalid. +EMAIL_NOT_SETUP In order to change the login email with emailVerifyPurposeLoginChange, an existing login email must already be set using emailVerifyPurposeLoginSetup. +EMAIL_UNCONFIRMED Email unconfirmed. +EMAIL_UNCONFIRMED_X The provided email isn't confirmed, {value} is the length of the verification code that was just sent to the email: use [account.verifyEmail](https://core.telegram.org/method/account.verifyEmail) to enter the received verification code and enable the recovery email. +EMAIL_VERIFY_EXPIRED The verification email has expired. +EMOJI_INVALID The specified theme emoji is valid. +EMOJI_MARKUP_INVALID The specified `video_emoji_markup` was invalid. +EMOJI_NOT_MODIFIED The theme wasn't changed. +EMOTICON_EMPTY The emoji is empty. +EMOTICON_INVALID The specified emoji is invalid. +EMOTICON_STICKERPACK_MISSING inputStickerSetDice.emoji cannot be empty. +ENCRYPTED_MESSAGE_INVALID Encrypted message invalid. +ENCRYPTION_ALREADY_ACCEPTED Secret chat already accepted. +ENCRYPTION_ALREADY_DECLINED The secret chat was already declined. +ENCRYPTION_DECLINED The secret chat was declined. +ENCRYPTION_ID_INVALID The provided secret chat ID is invalid. +ENTITIES_TOO_LONG You provided too many styled message entities. +ENTITY_BOUNDS_INVALID A specified [entity offset or length](/api/entities#entity-length) is invalid, see [here »](/api/entities#entity-length) for info on how to properly compute the entity offset/length. +ENTITY_MENTION_USER_INVALID You mentioned an invalid user. +ERROR_TEXT_EMPTY The provided error message is empty. +EXPIRE_DATE_INVALID The specified expiration date is invalid. +EXPORT_CARD_INVALID Provided card is invalid. +EXTENDED_MEDIA_AMOUNT_INVALID The maximum amount of `star_count` should be less than the `stars_paid_post_amount_max` [client configuration parameters](/api/config). +EXTENDED_MEDIA_PEER_INVALID The specified chat type is invalid. +EXTENDED_MEDIA_TYPE_INVALID The specified extended media type is unsupported. +EXTERNAL_URL_INVALID External URL invalid. +FIELD_NAME_EMPTY The field with the name FIELD_NAME is missing +FIELD_NAME_INVALID The field with the name FIELD_NAME is invalid +FILE_CONTENT_TYPE_INVALID File content-type is invalid. +FILE_EMTPY An empty file was provided. +FILE_ID_INVALID The provided file id is invalid. +FILE_MIGRATE_X The file is in Data Center No. {value} +FILE_PARTS_INVALID The number of file parts is invalid. +FILE_PART_EMPTY The provided file part is empty. +FILE_PART_INVALID The file part number is invalid. +FILE_PART_LENGTH_INVALID The length of a file part is invalid. +FILE_PART_SIZE_CHANGED Provided file part size has changed. +FILE_PART_SIZE_INVALID The provided file part size is invalid. +FILE_PART_TOO_BIG The uploaded file part is too big. +FILE_PART_X_MISSING Part {value} of the file is missing from storage +FILE_REFERENCE_EMPTY An empty [file reference](https://core.telegram.org/api/file_reference) was specified. +FILE_REFERENCE_EXPIRED File reference expired, it must be refetched as described in [the documentation](https://core.telegram.org/api/file_reference). +FILE_REFERENCE_INVALID The specified [file reference](https://core.telegram.org/api/file_reference) is invalid. +FILE_TITLE_EMPTY An empty file title was specified. +FILE_TOKEN_INVALID The specified file token is invalid. +FILTER_ID_INVALID The specified filter ID is invalid. +FILTER_INCLUDE_EMPTY The include_peers vector of the filter is empty. +FILTER_NOT_SUPPORTED The specified filter cannot be used in this context. +FILTER_TITLE_EMPTY The title field of the filter is empty. +FIRSTNAME_INVALID The first name is invalid. +FOLDER_ID_EMPTY An empty folder ID was specified. +FOLDER_ID_INVALID Invalid folder ID. +FORM_ID_EXPIRED The specified id has expired. +FORUM_ENABLED You can't execute the specified action because the group is a [forum](https://core.telegram.org/api/forum), disable forum functionality to continue. +FRESH_CHANGE_ADMINS_FORBIDDEN You were just elected admin, you can't add or modify other admins yet. +FROM_MESSAGE_BOT_DISABLED Bots can't use fromMessage min constructors. +FROM_PEER_INVALID The specified from_id is invalid. +GAME_BOT_INVALID Bots can't send another bot's game. +GENERAL_MODIFY_ICON_FORBIDDEN You can't modify the icon of the "General" topic. +GEO_POINT_INVALID Invalid geoposition provided. +GIFT_SLUG_EXPIRED The specified gift slug has expired. +GIFT_SLUG_INVALID The specified slug is invalid. +GIF_CONTENT_TYPE_INVALID GIF content-type invalid. +GIF_ID_INVALID The provided GIF ID is invalid. +GRAPH_EXPIRED_RELOAD This graph has expired, please obtain a new graph token. +GRAPH_INVALID_RELOAD Invalid graph token provided, please reload the stats and provide the updated token. +GRAPH_OUTDATED_RELOAD The graph is outdated, please get a new async token using stats.getBroadcastStats. +GROUPCALL_ALREADY_DISCARDED The group call was already discarded. +GROUPCALL_FORBIDDEN The group call has already ended. +GROUPCALL_INVALID The specified group call is invalid. +GROUPCALL_JOIN_MISSING You haven't joined this group call. +GROUPCALL_NOT_MODIFIED Group call settings weren't modified. +GROUPCALL_SSRC_DUPLICATE_MUCH The app needs to retry joining the group call with a new SSRC value. +GROUPED_MEDIA_INVALID Invalid grouped media. +GROUP_CALL_INVALID The group call is invalid +HASH_INVALID The provided hash is invalid. +HIDE_REQUESTER_MISSING The join request was missing or was already handled. +IMAGE_PROCESS_FAILED Failure while processing image. +IMPORT_FILE_INVALID The specified chat export file is invalid. +IMPORT_FORMAT_UNRECOGNIZED The specified chat export file was exported from an unsupported chat app. +IMPORT_ID_INVALID The specified import ID is invalid. +IMPORT_TOKEN_INVALID The specified token is invalid. +INLINE_RESULT_EXPIRED The inline query expired. +INPUT_CHATLIST_INVALID The specified folder is invalid. +INPUT_CONSTRUCTOR_INVALID The provided constructor is invalid +INPUT_FETCH_ERROR An error occurred while deserializing TL parameters +INPUT_FETCH_FAIL Failed deserializing TL payload +INPUT_FILTER_INVALID The specified filter is invalid. +INPUT_LAYER_INVALID The provided layer is invalid +INPUT_METHOD_INVALID The method invoked is invalid in the current schema +INPUT_REQUEST_TOO_LONG The input request is too long +INPUT_TEXT_EMPTY The specified text is empty. +INPUT_TEXT_TOO_LONG The specified text is too long. +INPUT_USER_DEACTIVATED The specified user was deleted. +INVITES_TOO_MUCH The maximum number of per-folder invites specified by the `chatlist_invites_limit_default`/`chatlist_invites_limit_premium` [client configuration parameters »](/api/config#chatlist-invites-limit-default) was reached. +INVITE_FORBIDDEN_WITH_JOINAS If the user has anonymously joined a group call as a channel, they can't invite other users to the group call because that would cause deanonymization, because the invite would be sent using the original user ID, not the anonymized channel ID. +INVITE_HASH_EMPTY The invite hash is empty. +INVITE_HASH_EXPIRED The invite link has expired. +INVITE_HASH_INVALID The invite hash is invalid. +INVITE_REQUEST_SENT You have successfully requested to join this chat or channel. +INVITE_REVOKED_MISSING The specified invite link was already revoked or is invalid. +INVITE_SLUG_EMPTY The specified invite slug is empty. +INVITE_SLUG_EXPIRED The specified chat folder link has expired. +INVOICE_PAYLOAD_INVALID The specified invoice payload is invalid. +JOIN_AS_PEER_INVALID The specified peer cannot be used to join a group call. +LANG_CODE_INVALID The specified language code is invalid. +LANG_CODE_NOT_SUPPORTED The specified language code is not supported. +LANG_PACK_INVALID The provided language pack is invalid. +LASTNAME_INVALID The last name is invalid. +LIMIT_INVALID The provided limit is invalid. +LINK_NOT_MODIFIED Discussion link not modified. +LOCATION_INVALID The provided location is invalid. +MAX_DATE_INVALID The specified maximum date is invalid. +MAX_ID_INVALID The provided max ID is invalid. +MAX_QTS_INVALID The specified max_qts is invalid. +MD5_CHECKSUM_INVALID The MD5 checksums do not match. +MEDIA_CAPTION_TOO_LONG The caption is too long. +MEDIA_EMPTY The provided media object is invalid. +MEDIA_FILE_INVALID The specified media file is invalid. +MEDIA_GROUPED_INVALID You tried to send media of different types in an album. +MEDIA_INVALID Media invalid. +MEDIA_NEW_INVALID The new media is invalid. +MEDIA_PREV_INVALID Previous media invalid. +MEDIA_TTL_INVALID The specified media TTL is invalid. +MEDIA_TYPE_INVALID The specified media type cannot be used in stories. +MEDIA_VIDEO_STORY_MISSING +MEGAGROUP_GEO_REQUIRED This method can only be invoked on a geogroup. +MEGAGROUP_ID_INVALID Invalid supergroup ID. +MEGAGROUP_PREHISTORY_HIDDEN Group with hidden history for new members can't be set as discussion groups. +MEGAGROUP_REQUIRED You can only use this method on a supergroup. +MESSAGE_EDIT_TIME_EXPIRED You can't edit this message anymore, too much time has passed since its creation. +MESSAGE_EMPTY The provided message is empty. +MESSAGE_IDS_EMPTY No message ids were provided. +MESSAGE_ID_INVALID The provided message id is invalid. +MESSAGE_NOT_MODIFIED The provided message data is identical to the previous message data, the message wasn't modified. +MESSAGE_POLL_CLOSED Poll closed. +MESSAGE_TOO_LONG The provided message is too long. +METHOD_INVALID The specified method is invalid. +MIN_DATE_INVALID The specified minimum date is invalid. +MSG_ID_INVALID Invalid message ID provided. +MSG_TOO_OLD [`chat_read_mark_expire_period` seconds](https://core.telegram.org/api/config#chat-read-mark-expire-period) have passed since the message was sent, read receipts were deleted. +MSG_VOICE_MISSING The message does not contain a voice message +MSG_WAIT_FAILED A waiting call returned an error. +MULTI_MEDIA_TOO_LONG Too many media files for album. +NEW_SALT_INVALID The new salt is invalid. +NEW_SETTINGS_EMPTY No password is set on the current account, and no new password was specified in `new_settings`. +NEW_SETTINGS_INVALID The new password settings are invalid. +NEXT_OFFSET_INVALID The specified offset is longer than 64 bytes. +NOGENERAL_HIDE_FORBIDDEN The hidden parameter is only valid for the General topic message_thread_id=1 +OFFSET_INVALID The provided offset is invalid. +OFFSET_PEER_ID_INVALID The provided offset peer is invalid. +OPTIONS_TOO_MUCH Too many options provided. +OPTION_INVALID Invalid option selected. +ORDER_INVALID The specified username order is invalid. +PACK_SHORT_NAME_INVALID Short pack name invalid. +PACK_SHORT_NAME_OCCUPIED A stickerpack with this name already exists. +PACK_TITLE_INVALID The stickerpack title is invalid. +PARTICIPANTS_TOO_FEW Not enough participants. +PARTICIPANT_ID_INVALID The specified participant ID is invalid. +PARTICIPANT_JOIN_MISSING Trying to enable a presentation, when the user hasn't joined the Video Chat with [phone.joinGroupCall](https://core.telegram.org/method/phone.joinGroupCall). +PARTICIPANT_VERSION_OUTDATED The other participant does not use an up to date telegram client with support for calls. +PASSWORD_EMPTY The provided password is empty. +PASSWORD_HASH_INVALID The provided password hash is invalid. +PASSWORD_MISSING You must enable 2FA in order to transfer ownership of a channel. +PASSWORD_RECOVERY_EXPIRED The recovery code has expired. +PASSWORD_RECOVERY_NA No email was set, can't recover password via email. +PASSWORD_REQUIRED A [2FA password](https://core.telegram.org/api/srp) must be configured to use Telegram Passport. +PASSWORD_TOO_FRESH_X The password was modified less than 24 hours ago, try again in {value} seconds. +PAYMENT_PROVIDER_INVALID The specified payment provider is invalid. +PEERS_LIST_EMPTY The specified list of peers is empty. +PEER_FLOOD The method can't be used because your account is currently limited +PEER_HISTORY_EMPTY You can't pin an empty chat with a user. +PEER_ID_INVALID The provided peer id is invalid. +PEER_ID_NOT_SUPPORTED The provided peer ID is not supported. +PERSISTENT_TIMESTAMP_EMPTY Persistent timestamp empty. +PERSISTENT_TIMESTAMP_INVALID Persistent timestamp invalid. +PHONE_CODE_EMPTY phone_code is missing. +PHONE_CODE_EXPIRED The phone code you provided has expired. +PHONE_CODE_HASH_EMPTY phone_code_hash is missing. +PHONE_CODE_INVALID The provided phone code is invalid. +PHONE_HASH_EXPIRED An invalid or expired `phone_code_hash` was provided. +PHONE_NOT_OCCUPIED No user is associated to the specified phone number. +PHONE_NUMBER_APP_SIGNUP_FORBIDDEN You can't sign up using this app. +PHONE_NUMBER_BANNED The provided phone number is banned from telegram. +PHONE_NUMBER_FLOOD You asked for the code too many times. +PHONE_NUMBER_INVALID The phone number is invalid. +PHONE_NUMBER_OCCUPIED The phone number is already in use. +PHONE_NUMBER_UNOCCUPIED The phone number is not yet being used. +PHONE_PASSWORD_PROTECTED This phone is password protected. +PHOTO_CONTENT_TYPE_INVALID Photo mime-type invalid. +PHOTO_CONTENT_URL_EMPTY Photo URL invalid. +PHOTO_CROP_FILE_MISSING Photo crop file missing. +PHOTO_CROP_SIZE_SMALL Photo is too small. +PHOTO_EXT_INVALID The extension of the photo is invalid. +PHOTO_FILE_MISSING Profile photo file missing. +PHOTO_ID_INVALID Photo ID invalid. +PHOTO_INVALID Photo invalid. +PHOTO_INVALID_DIMENSIONS The photo dimensions are invalid. +PHOTO_SAVE_FILE_INVALID Internal issues, try again later. +PHOTO_THUMB_URL_EMPTY Photo thumbnail URL is empty. +PHOTO_THUMB_URL_INVALID The photo thumb URL is invalid +PINNED_DIALOGS_TOO_MUCH Too many pinned dialogs. +PIN_RESTRICTED You can't pin messages. +PLATFORM_INVALID The provided platform is invalid. Allowed values are "android", "ios", "wp", "bb", "desktop", "web", "ubp", "other". +POLL_ANSWERS_INVALID Invalid poll answers were provided. +POLL_ANSWER_INVALID One of the poll answers is not acceptable. +POLL_OPTION_DUPLICATE Duplicate poll options provided. +POLL_OPTION_INVALID Invalid poll option provided. +POLL_QUESTION_INVALID One of the poll questions is not acceptable. +POLL_UNSUPPORTED This layer does not support polls in the invoked method +POLL_VOTE_REQUIRED Cast a vote in the poll before calling this method +PREMIUM_ACCOUNT_REQUIRED A premium account is required to execute this action. +PREMIUM_GIFTCODE_WAS_REFUNDED This gift code can't be redeemed because the giveaway organizer requested a refund +PRIVACY_KEY_INVALID The privacy key is invalid. +PRIVACY_TOO_LONG Too many privacy rules were specified, the current limit is 1000. +PRIVACY_VALUE_INVALID The specified privacy rule combination is invalid. +PUBLIC_KEY_REQUIRED A public key is required. +QUERY_ID_EMPTY The query ID is empty. +QUERY_ID_INVALID The query ID is invalid. +QUERY_TOO_SHORT The query string is too short. +QUIZ_ANSWER_MISSING You can forward a quiz while hiding the original author only after choosing an option in the quiz. +QUIZ_CORRECT_ANSWERS_EMPTY No correct quiz answer was specified. +QUIZ_CORRECT_ANSWERS_TOO_MUCH You specified too many correct answers in a quiz, quizzes can only have one right answer! +QUIZ_CORRECT_ANSWER_INVALID An invalid value was provided to the correct_answers field. +QUIZ_MULTIPLE_INVALID Quizzes can't have the multiple_choice flag set! +QUOTE_TEXT_INVALID The quote_text is invalid +RANDOM_ID_EMPTY Random ID empty. +RANDOM_ID_INVALID A provided random ID is invalid. +RANDOM_LENGTH_INVALID Random length invalid. +RANGES_INVALID Invalid range provided. +REACTIONS_TOO_MANY The message already has exactly `reactions_uniq_max` reaction emojis, you can't react with a new emoji, see [the docs for more info »](/api/config#client-configuration). +REACTION_EMPTY Empty reaction provided. +REACTION_INVALID The specified reaction is invalid. +REFLECTOR_NOT_AVAILABLE The call reflector is not available +REPLY_MARKUP_BUY_EMPTY Reply markup for buy button empty. +REPLY_MARKUP_GAME_EMPTY The provided reply markup for the game is empty +REPLY_MARKUP_INVALID The provided reply markup is invalid. +REPLY_MARKUP_TOO_LONG The specified reply_markup is too long. +REPLY_MESSAGE_ID_INVALID The specified reply-to message ID is invalid. +REPLY_TO_INVALID The specified `reply_to` field is invalid. +REPLY_TO_USER_INVALID The replied-to user is invalid. +RESET_REQUEST_MISSING No password reset is in progress. +RESULTS_TOO_MUCH Too many results were provided. +RESULT_ID_DUPLICATE You provided a duplicate result ID. +RESULT_ID_EMPTY Result ID empty. +RESULT_ID_INVALID One of the specified result IDs is invalid. +RESULT_TYPE_INVALID Result type invalid. +REVOTE_NOT_ALLOWED You cannot change your vote. +RIGHTS_NOT_MODIFIED The new admin rights are equal to the old rights, no change was made. +RSA_DECRYPT_FAILED Internal RSA decryption failed. +SAVED_DIALOGS_UNSUPPORTED You cannot use this method +SCHEDULE_BOT_NOT_ALLOWED Bots cannot schedule messages. +SCHEDULE_DATE_INVALID Invalid schedule date provided. +SCHEDULE_DATE_TOO_LATE You can't schedule a message this far in the future. +SCHEDULE_STATUS_PRIVATE Can't schedule until user is online, if the user's last seen timestamp is hidden by their privacy settings. +SCHEDULE_TOO_MUCH There are too many scheduled messages. +SCORE_INVALID The specified game score is invalid. +SEARCH_QUERY_EMPTY The search query is empty. +SEARCH_WITH_LINK_NOT_SUPPORTED You cannot provide a search query and an invite link at the same time. +SECONDS_INVALID Invalid duration provided. +SEND_AS_PEER_INVALID You can't send messages as the specified peer. +SEND_MESSAGE_MEDIA_INVALID Invalid media provided. +SEND_MESSAGE_TYPE_INVALID The message type is invalid. +SESSION_TOO_FRESH_X This session was created less than 24 hours ago, try again in {value} seconds. +SETTINGS_INVALID Invalid settings were provided. +SHA256_HASH_INVALID The provided SHA256 hash is invalid. +SHORTNAME_OCCUPY_FAILED An error occurred when trying to register the short-name used for the sticker pack. Try a different name +SHORT_NAME_INVALID The specified short name is invalid. +SHORT_NAME_OCCUPIED The specified short name is already in use. +SLOTS_EMPTY The specified slot list is empty. +SLOWMODE_MULTI_MSGS_DISABLED Slowmode is enabled, you cannot forward multiple messages to this group. +SLUG_INVALID The specified invoice slug is invalid. +SMS_CODE_CREATE_FAILED An error occurred while creating the SMS code. +SRP_ID_INVALID Invalid SRP ID provided. +SRP_PASSWORD_CHANGED Password has changed. +START_PARAM_EMPTY The start parameter is empty. +START_PARAM_INVALID Start parameter invalid. +START_PARAM_TOO_LONG Start parameter is too long. +STICKERPACK_STICKERS_TOO_MUCH There are too many stickers in this stickerpack, you can't add any more. +STICKERSET_INVALID The provided sticker set is invalid. +STICKERSET_NOT_MODIFIED The sticker set is not modified +STICKERS_EMPTY No sticker provided. +STICKERS_TOO_MUCH There are too many stickers in this stickerpack, you can't add any more. +STICKER_DOCUMENT_INVALID The specified sticker document is invalid. +STICKER_EMOJI_INVALID Sticker emoji invalid. +STICKER_FILE_INVALID Sticker file invalid. +STICKER_GIF_DIMENSIONS The specified video sticker has invalid dimensions. +STICKER_ID_INVALID The provided sticker ID is invalid. +STICKER_INVALID The provided sticker is invalid. +STICKER_MIME_INVALID The specified sticker MIME type is invalid. +STICKER_PNG_DIMENSIONS Sticker png dimensions invalid. +STICKER_PNG_NOPNG One of the specified stickers is not a valid PNG file. +STICKER_TGS_NODOC You must send the animated sticker as a document. +STICKER_TGS_NOTGS Invalid TGS sticker provided. +STICKER_THUMB_PNG_NOPNG Incorrect stickerset thumb file provided, PNG / WEBP expected. +STICKER_THUMB_TGS_NOTGS Incorrect stickerset TGS thumb file provided. +STICKER_VIDEO_BIG The specified video sticker is too big. +STICKER_VIDEO_NODOC You must send the video sticker as a document. +STICKER_VIDEO_NOWEBM The specified video sticker is not in webm format. +STORAGE_KEY_REQUIRED A cloud storage key is required. +STORIES_NEVER_CREATED This peer hasn't ever posted any stories. +STORIES_TOO_MUCH You have hit the maximum active stories limit as specified by the [`story_expiring_limit_*` client configuration parameters](https://core.telegram.org/api/config#story-expiring-limit-default): you should buy a [Premium](/api/premium) subscription, delete an active story, or wait for the oldest story to expire. +STORY_ID_EMPTY You specified no story IDs. +STORY_ID_INVALID The specified story ID is invalid. +STORY_NOT_MODIFIED The new story information you passed is equal to the previous story information, thus it wasn't modified. +STORY_PERIOD_INVALID The specified story period is invalid for this account. +STORY_SEND_FLOOD_MONTHLY_X You've hit the monthly story limit as specified by the [`stories_sent_monthly_limit_*` client configuration parameters](https://core.telegram.org/api/config#stories-sent-monthly-limit-default): wait for the specified number of seconds before posting a new story. +STORY_SEND_FLOOD_WEEKLY_X You've hit the weekly story limit as specified by the [`stories_sent_weekly_limit_*` client configuration parameters](https://core.telegram.org/api/config#stories-sent-weekly-limit-default): wait for the specified number of seconds before posting a new story. +SWITCH_PM_TEXT_EMPTY The switch_pm.text field was empty. +TAKEOUT_INVALID The specified takeout ID is invalid. +TAKEOUT_REQUIRED A [takeout](https://core.telegram.org/api/takeout) session needs to be initialized first, [see here » for more info](/api/takeout). +TASK_ALREADY_EXISTS An email reset was already requested. +TEMP_AUTH_KEY_ALREADY_BOUND The passed temporary key is already bound to another **perm_auth_key_id**. +TEMP_AUTH_KEY_EMPTY No temporary auth key provided. +THEME_FILE_INVALID Invalid theme file provided. +THEME_FORMAT_INVALID Invalid theme format provided. +THEME_INVALID Invalid theme provided. +THEME_MIME_INVALID The theme's MIME type is invalid. +THEME_TITLE_INVALID The specified theme title is invalid. +TITLE_INVALID The specified stickerpack title is invalid. +TMP_PASSWORD_DISABLED The temporary password is disabled. +TMP_PASSWORD_INVALID The temporary password is invalid +TOKEN_EMPTY The specified token is empty. +TOKEN_INVALID The provided token is invalid. +TOKEN_TYPE_INVALID The specified token type is invalid. +TOPICS_EMPTY You specified no topic IDs. +TOPIC_CLOSED This topic was closed, you can't send messages to it anymore. +TOPIC_CLOSE_SEPARATELY The `close` flag cannot be provided together with any of the other flags. +TOPIC_DELETED The specified topic was deleted. +TOPIC_HIDE_SEPARATELY The `hide` flag cannot be provided together with any of the other flags. +TOPIC_ID_INVALID The specified topic ID is invalid. +TOPIC_NOT_MODIFIED The updated topic info is equal to the current topic info, nothing was changed. +TOPIC_TITLE_EMPTY The specified topic title is empty. +TO_LANG_INVALID The specified destination language is invalid. +TRANSCRIPTION_FAILED Audio transcription failed. +TTL_DAYS_INVALID The provided TTL is invalid. +TTL_MEDIA_INVALID Invalid media Time To Live was provided. +TTL_PERIOD_INVALID The specified TTL period is invalid. +TYPES_EMPTY No top peer type was provided. +TYPE_CONSTRUCTOR_INVALID The type constructor is invalid +UNTIL_DATE_INVALID Invalid until date provided. +URL_INVALID Invalid URL provided. +USAGE_LIMIT_INVALID The specified usage limit is invalid. +USERNAMES_ACTIVE_TOO_MUCH The maximum number of active usernames was reached. +USERNAME_INVALID The provided username is not valid. +USERNAME_NOT_MODIFIED The username was not modified. +USERNAME_NOT_OCCUPIED The provided username is not occupied. +USERNAME_OCCUPIED The provided username is already occupied. +USERNAME_PURCHASE_AVAILABLE The specified username can be purchased on https://fragment.com. +USERPIC_UPLOAD_REQUIRED You must have a profile picture to publish your geolocation. +USERS_TOO_FEW Not enough users (to create a chat, for example). +USERS_TOO_MUCH The maximum number of users has been exceeded (to create a chat, for example). +USER_ADMIN_INVALID You're not an admin. +USER_ALREADY_INVITED You have already invited this user. +USER_ALREADY_PARTICIPANT The user is already in the group. +USER_BANNED_IN_CHANNEL You're banned from sending messages in supergroups/channels. +USER_BLOCKED User blocked. +USER_BOT Bots can only be admins in channels. +USER_BOT_INVALID User accounts must provide the `bot` method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts. +USER_BOT_REQUIRED This method can only be called by a bot. +USER_CHANNELS_TOO_MUCH One of the users you tried to add is already in too many channels/supergroups. +USER_CREATOR You can't leave this channel, because you're its creator. +USER_ID_INVALID The provided user ID is invalid. +USER_INVALID Invalid user provided. +USER_IS_BLOCKED You were blocked by this user. +USER_IS_BOT Bots can't send messages to other bots. +USER_KICKED This user was kicked from this supergroup/channel. +USER_NOT_MUTUAL_CONTACT The provided user is not a mutual contact. +USER_NOT_PARTICIPANT You're not a member of this supergroup/channel. +USER_PUBLIC_MISSING Cannot generate a link to stories posted by a peer without a username. +USER_VOLUME_INVALID The specified user volume is invalid. +VENUE_ID_INVALID The specified venue ID is invalid. +VIDEO_CONTENT_TYPE_INVALID The video's content type is invalid. +VIDEO_FILE_INVALID The specified video file is invalid. +VIDEO_TITLE_EMPTY The specified video title is empty. +VOICE_MESSAGES_FORBIDDEN This user's privacy settings forbid you from sending voice messages. +VOLUME_LOC_NOT_FOUND The volume location can't be found +WALLPAPER_FILE_INVALID The specified wallpaper file is invalid. +WALLPAPER_INVALID The specified wallpaper is invalid. +WALLPAPER_MIME_INVALID The specified wallpaper MIME type is invalid. +WALLPAPER_NOT_FOUND The specified wallpaper could not be found. +WC_CONVERT_URL_INVALID WC convert URL invalid. +WEBDOCUMENT_INVALID Invalid webdocument URL provided. +WEBDOCUMENT_MIME_INVALID Invalid webdocument mime type provided. +WEBDOCUMENT_SIZE_TOO_BIG Webdocument is too big! +WEBDOCUMENT_URL_EMPTY The web document URL is empty +WEBDOCUMENT_URL_INVALID The specified webdocument URL is invalid. +WEBPAGE_CURL_FAILED Failure while fetching the webpage with cURL. +WEBPAGE_MEDIA_EMPTY Webpage media empty. +WEBPAGE_NOT_FOUND A preview for the specified webpage `url` could not be generated. +WEBPAGE_URL_INVALID The specified webpage `url` is invalid. +WEBPUSH_AUTH_INVALID The specified web push authentication secret is invalid. +WEBPUSH_KEY_INVALID The specified web push elliptic curve Diffie-Hellman public key is invalid. +WEBPUSH_TOKEN_INVALID The specified web push token is invalid. +YOU_BLOCKED_USER You blocked this user. \ No newline at end of file diff --git a/compiler/errors/source/401_UNAUTHORIZED.tsv b/compiler/errors/source/401_UNAUTHORIZED.tsv new file mode 100644 index 0000000000..32e0265f53 --- /dev/null +++ b/compiler/errors/source/401_UNAUTHORIZED.tsv @@ -0,0 +1,10 @@ +id message +ACTIVE_USER_REQUIRED The method is only available to already activated users +AUTH_KEY_INVALID The key is invalid +AUTH_KEY_PERM_EMPTY The method is unavailable for temporary authorization key, not bound to permanent +AUTH_KEY_UNREGISTERED The key is not registered in the system. Delete your session file and login again +SESSION_EXPIRED The authorization has expired +SESSION_PASSWORD_NEEDED The two-step verification is enabled and a password is required +SESSION_REVOKED The authorization has been invalidated, because of the user terminating all sessions +USER_DEACTIVATED The user has been deleted/deactivated +USER_DEACTIVATED_BAN The user has been deleted/deactivated \ No newline at end of file diff --git a/compiler/errors/source/403_FORBIDDEN.tsv b/compiler/errors/source/403_FORBIDDEN.tsv new file mode 100644 index 0000000000..557f5416b8 --- /dev/null +++ b/compiler/errors/source/403_FORBIDDEN.tsv @@ -0,0 +1,46 @@ +id message +ANONYMOUS_REACTIONS_DISABLED Sorry, anonymous administrators cannot leave reactions or participate in polls. +BROADCAST_FORBIDDEN Channel poll voters and reactions cannot be fetched to prevent deanonymization. +CHANNEL_PUBLIC_GROUP_NA channel/supergroup not available. +CHAT_ADMIN_INVITE_REQUIRED You do not have the rights to do this. +CHAT_ADMIN_REQUIRED You must be an admin in this chat to do this. +CHAT_FORBIDDEN You cannot write in this chat +CHAT_GUEST_SEND_FORBIDDEN You join the discussion group before commenting, see [here »](/api/discussion#requiring-users-to-join-the-group) for more info. +CHAT_SEND_AUDIOS_FORBIDDEN You can't send audio messages in this chat. +CHAT_SEND_DOCS_FORBIDDEN You can't send documents in this chat. +CHAT_SEND_GAME_FORBIDDEN You can't send a game to this chat. +CHAT_SEND_GIFS_FORBIDDEN You can't send gifs in this chat. +CHAT_SEND_INLINE_FORBIDDEN You can't send inline messages in this group. +CHAT_SEND_MEDIA_FORBIDDEN You can't send media in this chat. +CHAT_SEND_PHOTOS_FORBIDDEN You can't send photos in this chat. +CHAT_SEND_PLAIN_FORBIDDEN You can't send non-media (text) messages in this chat. +CHAT_SEND_POLL_FORBIDDEN You can't send polls in this chat. +CHAT_SEND_ROUNDVIDEOS_FORBIDDEN You cannot send video notes in this chat +CHAT_SEND_STICKERS_FORBIDDEN You can't send stickers in this chat. +CHAT_SEND_VIDEOS_FORBIDDEN You can't send videos in this chat. +CHAT_SEND_VOICES_FORBIDDEN You can't send voice recordings in this chat. +CHAT_WRITE_FORBIDDEN You can't write in this chat. +EDIT_BOT_INVITE_FORBIDDEN Normal users can't edit invites that were created by bots. +GROUPCALL_ALREADY_STARTED The groupcall has already started, you can join directly using [phone.joinGroupCall](https://core.telegram.org/method/phone.joinGroupCall). +GROUPCALL_FORBIDDEN The group call has already ended. +INLINE_BOT_REQUIRED Only the inline bot can edit message. +MESSAGE_AUTHOR_REQUIRED Message author required. +MESSAGE_DELETE_FORBIDDEN You can't delete one of the messages you tried to delete. +NOT_ELIGIBLE You are not eligible to take part in Telegram's Premium for SMS initiative +PARTICIPANT_JOIN_MISSING Trying to enable a presentation, when the user hasn't joined the Video Chat with [phone.joinGroupCall](https://core.telegram.org/method/phone.joinGroupCall). +POLL_VOTE_REQUIRED Cast a vote in the poll before calling this method. +PREMIUM_ACCOUNT_REQUIRED A premium account is required to execute this action. +PRIVACY_PREMIUM_REQUIRED You need a [Telegram Premium subscription](https://core.telegram.org/api/premium) to send a message to this user. +PUBLIC_CHANNEL_MISSING You can only export group call invite links for public chats or channels. +RIGHT_FORBIDDEN Your admin rights do not allow you to do this. +SENSITIVE_CHANGE_FORBIDDEN You can't change your sensitive content settings. +TAKEOUT_REQUIRED A [takeout](https://core.telegram.org/api/takeout) session needs to be initialized first, [see here » for more info](/api/takeout). +USER_BOT_INVALID User accounts must provide the `bot` method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts. +USER_CHANNELS_TOO_MUCH One of the users you tried to add is already in too many channels/supergroups. +USER_DELETED You can't send this secret message because the other participant deleted their account. +USER_INVALID Invalid user provided. +USER_IS_BLOCKED You were blocked by this user. +USER_NOT_MUTUAL_CONTACT The provided user is not a mutual contact. +USER_PRIVACY_RESTRICTED The user's privacy settings do not allow you to do this. +USER_RESTRICTED You're spamreported, you can't create channels or chats. +VOICE_MESSAGES_FORBIDDEN This user's privacy settings forbid you from sending voice messages. \ No newline at end of file diff --git a/compiler/errors/source/406_NOT_ACCEPTABLE.tsv b/compiler/errors/source/406_NOT_ACCEPTABLE.tsv new file mode 100644 index 0000000000..19dc3af52b --- /dev/null +++ b/compiler/errors/source/406_NOT_ACCEPTABLE.tsv @@ -0,0 +1,25 @@ +id message +AUTH_KEY_DUPLICATED The same authorization key (session file) was used in more than one place simultaneously. You must delete your session file and log in again with your phone number or bot token +BANNED_RIGHTS_INVALID You provided some invalid flags in the banned rights. +CALL_PROTOCOL_COMPAT_LAYER_INVALID The other side of the call does not support any of the VoIP protocols supported by the local client, as specified by the `protocol.layer` and `protocol.library_versions` fields. +CHANNEL_PRIVATE You haven't joined this channel/supergroup. +CHANNEL_TOO_LARGE Channel is too large to be deleted; this error is issued when trying to delete channels with more than 1000 members (subject to change). +CHAT_FORWARDS_RESTRICTED You can't forward messages from a protected chat. +FILEREF_UPGRADE_NEEDED The client has to be updated in order to support [file references](https://core.telegram.org/api/file_reference). +FRESH_CHANGE_ADMINS_FORBIDDEN You were just elected admin, you can't add or modify other admins yet. +FRESH_CHANGE_PHONE_FORBIDDEN You can't change phone number right after logging in, please wait at least 24 hours. +FRESH_RESET_AUTHORISATION_FORBIDDEN You can't logout other sessions if less than 24 hours have passed since you logged on the current session. +INVITE_HASH_EXPIRED The invite link has expired. +PAYMENT_UNSUPPORTED A detailed description of the error will be received separately as described [here »](https://core.telegram.org/api/errors#406-not-acceptable). +PHONE_NUMBER_INVALID The phone number is invalid. +PHONE_PASSWORD_FLOOD You have tried logging in too many times. +PREVIOUS_CHAT_IMPORT_ACTIVE_WAIT_XMIN Import for this chat is already in progress, wait {value} minutes before starting a new one. +PRIVACY_PREMIUM_REQUIRED You need a [Telegram Premium subscription](https://core.telegram.org/api/premium) to send a message to this user. +SEND_CODE_UNAVAILABLE Returned when all available options for this type of number were already used (e.g. flash-call, then SMS, then this error might be returned to trigger a second resend). +STICKERSET_INVALID The provided sticker set is invalid. +STICKERSET_OWNER_ANONYMOUS Provided stickerset can't be installed as group stickerset to prevent admin deanonymization. +TOPIC_CLOSED This topic was closed, you can't send messages to it anymore. +TOPIC_DELETED The specified topic was deleted. +USERPIC_PRIVACY_REQUIRED You need to disable privacy settings for your profile picture in order to make your geolocation public. +USERPIC_UPLOAD_REQUIRED You must have a profile picture to publish your geolocation. +USER_RESTRICTED You're spamreported, you can't create channels or chats. \ No newline at end of file diff --git a/compiler/errors/source/420_FLOOD.tsv b/compiler/errors/source/420_FLOOD.tsv new file mode 100644 index 0000000000..9e17e5a3c7 --- /dev/null +++ b/compiler/errors/source/420_FLOOD.tsv @@ -0,0 +1,9 @@ +id message +2FA_CONFIRM_WAIT_X Since this account is active and protected by a 2FA password, we will delete it in 1 week for security purposes. You can cancel this process at any time, you'll be able to reset your account in {value} seconds. +FLOOD_PREMIUM_WAIT_X A wait of {value} seconds is required +FLOOD_TEST_PHONE_WAIT_X A wait of {value} seconds is required in the test servers +FLOOD_WAIT_X A wait of {value} seconds is required +PREMIUM_SUB_ACTIVE_UNTIL_X You already have a premium subscription active until unixtime {value} . +SLOWMODE_WAIT_X Slowmode is enabled in this chat: wait {value} seconds before sending another message to this chat. +STORY_SEND_FLOOD_X A wait of {value} seconds is required to continue posting stories +TAKEOUT_INIT_DELAY_X Sorry, for security reasons, you will be able to begin downloading your data in {value} seconds. We have notified all your devices about the export request to make sure it's authorized and to give you time to react if it's not. \ No newline at end of file diff --git a/compiler/errors/source/500_INTERNAL_SERVER_ERROR.tsv b/compiler/errors/source/500_INTERNAL_SERVER_ERROR.tsv new file mode 100644 index 0000000000..dac5110c40 --- /dev/null +++ b/compiler/errors/source/500_INTERNAL_SERVER_ERROR.tsv @@ -0,0 +1,51 @@ +id message +API_CALL_ERROR API call error due to Telegram having internal problems. Please try again later +AUTH_RESTART Restart the authorization process. +CALL_OCCUPY_FAILED The call failed because the user is already making another call. +CDN_UPLOAD_TIMEOUT A server-side timeout occurred while reuploading the file to the CDN DC. +CHAT_ID_GENERATE_FAILED Failure while generating the chat ID. +CHAT_INVALID Invalid chat. +CHAT_OCCUPY_LOC_FAILED An internal error occurred while creating the chat +CHAT_OCCUPY_USERNAME_FAILED Failure to occupy chat username due to Telegram having internal problems. Please try again later +CHP_CALL_FAIL Telegram is having internal problems. Please try again later +ENCRYPTION_OCCUPY_ADMIN_FAILED Failed occupying memory for admin info due to Telegram having internal problems. Please try again later +ENCRYPTION_OCCUPY_FAILED Internal server error while accepting secret chat +FOLDER_DEAC_AUTOFIX_ALL Telegram is having internal problems. Please try again later +GROUPCALL_ADD_PARTICIPANTS_FAILED Failure while adding voice chat member due to Telegram having internal problems. Please try again later +GROUPED_ID_OCCUPY_FAILED Telegram is having internal problems. Please try again later +HISTORY_GET_FAILED The chat history couldn't be retrieved due to Telegram having internal problems. Please try again later +IMAGE_ENGINE_DOWN Image engine down due to Telegram having internal problems. Please try again later +INTERDC_X_CALL_ERROR An error occurred while Telegram was intercommunicating with DC{value}. Please try again later +INTERDC_X_CALL_RICH_ERROR A rich error occurred while Telegram was intercommunicating with DC{value}. Please try again later +MEMBER_FETCH_FAILED Telegram is having internal problems. Please try again later +MEMBER_NO_LOCATION Couldn't find the member's location due to Telegram having internal problems. Please try again later +MEMBER_OCCUPY_PRIMARY_LOC_FAILED Telegram is having internal problems. Please try again later +MEMBER_OCCUPY_USERNAME_FAILED Failure to occupy member username due to Telegram having internal problems. Please try again later +MSGID_DECREASE_RETRY Telegram is having internal problems. Please try again later +MSG_RANGE_UNSYNC Message range unsynchronized due to Telegram having internal problems. Please try again later +MSG_WAIT_FAILED A waiting call returned an error. +MT_SEND_QUEUE_TOO_LONG The MTProto send queue has grown too much due to Telegram having internal problems. Please try again later +NEED_CHAT_INVALID The provided chat is invalid +NEED_MEMBER_INVALID The provided member is invalid or does not exist +No workers running The Telegram server is restarting its workers. Try again later. +PARTICIPANT_CALL_FAILED Failure while making call due to Telegram having internal problems. Please try again later +PERSISTENT_TIMESTAMP_OUTDATED Channel internal replication issues, try again later (treat this like an RPC_CALL_FAIL). +PHOTO_CREATE_FAILED The creation of the photo failed due to Telegram having internal problems. Please try again later +POSTPONED_TIMEOUT Telegram is having internal problems. Please try again later +PTS_CHANGE_EMPTY No PTS change +RANDOM_ID_DUPLICATE You provided a random ID that was already used. +REG_ID_GENERATE_FAILED The registration id failed to generate due to Telegram having internal problems. Please try again later +RPC_CALL_FAIL Telegram is having internal problems. Please try again later +RPC_CONNECT_FAILED Telegram is having internal problems. Please try again later +RPC_MCGET_FAIL Telegram is having internal problems. Please try again later +RPC_SEND_FAIL Telegram is having internal problems. Please try again later +SEND_MEDIA_INVALID The specified media is invalid. +SIGN_IN_FAILED Failure while signing in. +STORAGE_CHECK_FAILED Server storage check failed due to Telegram having internal problems. Please try again later +STORAGE_CHOOSE_VOLUME_FAILED Storage choose volume failed due to Telegram having internal problems. Please try again later +STORE_INVALID_SCALAR_TYPE Telegram is having internal problems. Please try again later +UNKNOWN_METHOD The method you tried to call cannot be called on non-CDN DCs +UPLOAD_NO_VOLUME Telegram is having internal problems. Please try again later +VOLUME_LOC_NOT_FOUND Telegram is having internal problems. Please try again later +WORKER_BUSY_TOO_LONG_RETRY Server workers are too busy right now due to Telegram having internal problems. Please try again later +WP_ID_GENERATE_FAILED Telegram is having internal problems. Please try again later \ No newline at end of file diff --git a/compiler/errors/source/503_SERVICE_UNAVAILABLE.tsv b/compiler/errors/source/503_SERVICE_UNAVAILABLE.tsv new file mode 100644 index 0000000000..0164c93a81 --- /dev/null +++ b/compiler/errors/source/503_SERVICE_UNAVAILABLE.tsv @@ -0,0 +1,4 @@ +id message +ApiCallError Telegram is having internal problems. Please try again later. +Timedout Telegram is having internal problems. Please try again later. +Timeout Telegram is having internal problems. Please try again later. \ No newline at end of file diff --git a/compiler/errors/template/class.txt b/compiler/errors/template/class.txt new file mode 100644 index 0000000000..718472b1ad --- /dev/null +++ b/compiler/errors/template/class.txt @@ -0,0 +1,13 @@ +{notice} + +from ..rpc_error import RPCError + + +class {super_class}(RPCError): + {docstring} + CODE = {code} + """``int``: RPC Error Code""" + NAME = __doc__ + + +{sub_classes} \ No newline at end of file diff --git a/compiler/errors/template/sub_class.txt b/compiler/errors/template/sub_class.txt new file mode 100644 index 0000000000..c855183898 --- /dev/null +++ b/compiler/errors/template/sub_class.txt @@ -0,0 +1,7 @@ +class {sub_class}({super_class}): + {docstring} + ID = {id} + """``str``: RPC Error ID""" + MESSAGE = __doc__ + + diff --git a/docs/source/.readthedocs.yaml b/docs/source/.readthedocs.yaml new file mode 100644 index 0000000000..793c4ee29d --- /dev/null +++ b/docs/source/.readthedocs.yaml @@ -0,0 +1,53 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.11" + # You can also specify other tool versions: + # nodejs: "19" + # rust: "1.64" + # golang: "1.19" + jobs: + post_checkout: + # Cancel building pull requests when there aren't changed in the docs directory or YAML file. + # You can add any other files or directories that you'd like here as well, + # like your docs requirements file, or other files that will change your docs build. + # + # If there are no changes (git diff exits with 0) we force the command to return with 183. + # This is a special exit code on Read the Docs that will cancel the build immediately. + - | + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/unknown_errors -- docs/; + then + exit 183; + fi + pre_build: + - echo "Command run at 'pre_build' step" + - python -m pip install httpx==0.27.0 lxml==5.2.2 + - curl -sL https://github.com/hydrogram/hydrogram/raw/013268c/dev_tools/generate_docs_json.py | python + - ls -al compiler/api/ + - python -m pip install . + - cd compiler/docs && python compiler.py && cd ../.. + - echo "Command run at 'pre_build' step" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/source/conf.py + +# Optionally build your docs in additional formats such as PDF and ePub +formats: + - htmlzip + + +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +python: + install: + - requirements: docs/source/requirements.txt diff --git a/docs/source/_includes/usable-by/bots.rst b/docs/source/_includes/usable-by/bots.rst new file mode 100644 index 0000000000..c6e99f1f22 --- /dev/null +++ b/docs/source/_includes/usable-by/bots.rst @@ -0,0 +1,5 @@ +.. raw:: html + + Usable by + Users + Bots diff --git a/docs/source/_includes/usable-by/users-bots.rst b/docs/source/_includes/usable-by/users-bots.rst new file mode 100644 index 0000000000..7947ae948c --- /dev/null +++ b/docs/source/_includes/usable-by/users-bots.rst @@ -0,0 +1,5 @@ +.. raw:: html + + Usable by + Users + Bots diff --git a/docs/source/_includes/usable-by/users.rst b/docs/source/_includes/usable-by/users.rst new file mode 100644 index 0000000000..ce35fa6113 --- /dev/null +++ b/docs/source/_includes/usable-by/users.rst @@ -0,0 +1,5 @@ +.. raw:: html + + Usable by + Users + Bots diff --git a/docs/source/api/client.rst b/docs/source/api/client.rst new file mode 100644 index 0000000000..88cf72d3b0 --- /dev/null +++ b/docs/source/api/client.rst @@ -0,0 +1,24 @@ +Pyrogram Client +=============== + +You have entered the API Reference section where you can find detailed information about Pyrogram's API. The main Client +class, all available methods and types, filters, handlers, decorators and bound-methods detailed descriptions can be +found starting from this page. + +This page is about the Client class, which exposes high-level methods for an easy access to the API. + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + with app: + app.send_message(chat_id="me", text="Hi!") + +----- + +Details +------- + +.. autoclass:: pyrogram.Client() diff --git a/docs/source/api/decorators.rst b/docs/source/api/decorators.rst new file mode 100644 index 0000000000..0013ba86d2 --- /dev/null +++ b/docs/source/api/decorators.rst @@ -0,0 +1,84 @@ +Decorators +========== + +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 + + 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_edited_message` + + - :meth:`~Client.on_message_reaction_updated` + - :meth:`~Client.on_message_reaction_count_updated` + - :meth:`~Client.on_inline_query` + - :meth:`~Client.on_chosen_inline_result` + - :meth:`~Client.on_callback_query` + + + - :meth:`~Client.on_poll` + + + - :meth:`~Client.on_chat_member_updated` + - :meth:`~Client.on_chat_join_request` + + + - :meth:`~Client.on_deleted_messages` + - :meth:`~Client.on_user_status` + - :meth:`~Client.on_disconnect` + - :meth:`~Client.on_story` + - :meth:`~Client.on_raw_update` + +----- + +Details +------- + +.. Decorators +.. autodecorator:: pyrogram.Client.on_message() +.. autodecorator:: pyrogram.Client.on_edited_message() + +.. autodecorator:: pyrogram.Client.on_message_reaction_updated() +.. autodecorator:: pyrogram.Client.on_message_reaction_count_updated() +.. autodecorator:: pyrogram.Client.on_inline_query() +.. autodecorator:: pyrogram.Client.on_chosen_inline_result() +.. autodecorator:: pyrogram.Client.on_callback_query() +.. autodecorator:: pyrogram.Client.on_shipping_query() +.. autodecorator:: pyrogram.Client.on_pre_checkout_query() +.. autodecorator:: pyrogram.Client.on_poll() + + +.. autodecorator:: pyrogram.Client.on_chat_member_updated() +.. autodecorator:: pyrogram.Client.on_chat_join_request() + + +.. autodecorator:: pyrogram.Client.on_deleted_messages() +.. autodecorator:: pyrogram.Client.on_user_status() +.. autodecorator:: pyrogram.Client.on_disconnect() +.. autodecorator:: pyrogram.Client.on_story() +.. autodecorator:: pyrogram.Client.on_raw_update() diff --git a/docs/source/api/enums/AccentColor.rst b/docs/source/api/enums/AccentColor.rst new file mode 100644 index 0000000000..735ec3c118 --- /dev/null +++ b/docs/source/api/enums/AccentColor.rst @@ -0,0 +1,8 @@ +AccentColor +================== + +.. autoclass:: pyrogram.enums.AccentColor() + :members: + +.. raw:: html + :file: ./cleanup.html diff --git a/docs/source/api/enums/ChatAction.rst b/docs/source/api/enums/ChatAction.rst new file mode 100644 index 0000000000..b66df5fd73 --- /dev/null +++ b/docs/source/api/enums/ChatAction.rst @@ -0,0 +1,8 @@ +ChatAction +========== + +.. autoclass:: pyrogram.enums.ChatAction() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/ChatEventAction.rst b/docs/source/api/enums/ChatEventAction.rst new file mode 100644 index 0000000000..0403e781db --- /dev/null +++ b/docs/source/api/enums/ChatEventAction.rst @@ -0,0 +1,8 @@ +ChatEventAction +=============== + +.. autoclass:: pyrogram.enums.ChatEventAction() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/ChatMemberStatus.rst b/docs/source/api/enums/ChatMemberStatus.rst new file mode 100644 index 0000000000..bff23eda66 --- /dev/null +++ b/docs/source/api/enums/ChatMemberStatus.rst @@ -0,0 +1,8 @@ +ChatMemberStatus +================ + +.. autoclass:: pyrogram.enums.ChatMemberStatus() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/ChatMembersFilter.rst b/docs/source/api/enums/ChatMembersFilter.rst new file mode 100644 index 0000000000..5a970ffc6e --- /dev/null +++ b/docs/source/api/enums/ChatMembersFilter.rst @@ -0,0 +1,8 @@ +ChatMembersFilter +================= + +.. autoclass:: pyrogram.enums.ChatMembersFilter() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/ChatType.rst b/docs/source/api/enums/ChatType.rst new file mode 100644 index 0000000000..dd653055fa --- /dev/null +++ b/docs/source/api/enums/ChatType.rst @@ -0,0 +1,8 @@ +ChatType +======== + +.. autoclass:: pyrogram.enums.ChatType() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/ClientPlatform.rst b/docs/source/api/enums/ClientPlatform.rst new file mode 100644 index 0000000000..c964d45278 --- /dev/null +++ b/docs/source/api/enums/ClientPlatform.rst @@ -0,0 +1,8 @@ +ClientPlatform +================== + +.. autoclass:: pyrogram.enums.ClientPlatform() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/MessageEntityType.rst b/docs/source/api/enums/MessageEntityType.rst new file mode 100644 index 0000000000..c7a8965f12 --- /dev/null +++ b/docs/source/api/enums/MessageEntityType.rst @@ -0,0 +1,8 @@ +MessageEntityType +================= + +.. autoclass:: pyrogram.enums.MessageEntityType() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/MessageMediaType.rst b/docs/source/api/enums/MessageMediaType.rst new file mode 100644 index 0000000000..04e439d20e --- /dev/null +++ b/docs/source/api/enums/MessageMediaType.rst @@ -0,0 +1,8 @@ +MessageMediaType +================ + +.. autoclass:: pyrogram.enums.MessageMediaType() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/MessageServiceType.rst b/docs/source/api/enums/MessageServiceType.rst new file mode 100644 index 0000000000..2de56818d8 --- /dev/null +++ b/docs/source/api/enums/MessageServiceType.rst @@ -0,0 +1,8 @@ +MessageServiceType +================== + +.. autoclass:: pyrogram.enums.MessageServiceType() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/MessagesFilter.rst b/docs/source/api/enums/MessagesFilter.rst new file mode 100644 index 0000000000..090907076a --- /dev/null +++ b/docs/source/api/enums/MessagesFilter.rst @@ -0,0 +1,8 @@ +MessagesFilter +============== + +.. autoclass:: pyrogram.enums.MessagesFilter() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/NextCodeType.rst b/docs/source/api/enums/NextCodeType.rst new file mode 100644 index 0000000000..46164e47d6 --- /dev/null +++ b/docs/source/api/enums/NextCodeType.rst @@ -0,0 +1,8 @@ +NextCodeType +============ + +.. autoclass:: pyrogram.enums.NextCodeType() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/ParseMode.rst b/docs/source/api/enums/ParseMode.rst new file mode 100644 index 0000000000..1bcc74da04 --- /dev/null +++ b/docs/source/api/enums/ParseMode.rst @@ -0,0 +1,8 @@ +ParseMode +========= + +.. autoclass:: pyrogram.enums.ParseMode() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/PollType.rst b/docs/source/api/enums/PollType.rst new file mode 100644 index 0000000000..d00f9ce8a8 --- /dev/null +++ b/docs/source/api/enums/PollType.rst @@ -0,0 +1,8 @@ +PollType +======== + +.. autoclass:: pyrogram.enums.PollType() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/ProfileColor.rst b/docs/source/api/enums/ProfileColor.rst new file mode 100644 index 0000000000..9b93ea5bc8 --- /dev/null +++ b/docs/source/api/enums/ProfileColor.rst @@ -0,0 +1,8 @@ +ProfileColor +================== + +.. autoclass:: pyrogram.enums.ProfileColor() + :members: + +.. raw:: html + :file: ./cleanup.html diff --git a/docs/source/api/enums/SentCodeType.rst b/docs/source/api/enums/SentCodeType.rst new file mode 100644 index 0000000000..d738b195b1 --- /dev/null +++ b/docs/source/api/enums/SentCodeType.rst @@ -0,0 +1,8 @@ +SentCodeType +============ + +.. autoclass:: pyrogram.enums.SentCodeType() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/UserStatus.rst b/docs/source/api/enums/UserStatus.rst new file mode 100644 index 0000000000..c9a77e1bf9 --- /dev/null +++ b/docs/source/api/enums/UserStatus.rst @@ -0,0 +1,8 @@ +UserStatus +========== + +.. autoclass:: pyrogram.enums.UserStatus() + :members: + +.. raw:: html + :file: ./cleanup.html \ No newline at end of file diff --git a/docs/source/api/enums/cleanup.html b/docs/source/api/enums/cleanup.html new file mode 100644 index 0000000000..bb9db7801a --- /dev/null +++ b/docs/source/api/enums/cleanup.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/docs/source/api/enums/index.rst b/docs/source/api/enums/index.rst new file mode 100644 index 0000000000..dfdc7d0b1e --- /dev/null +++ b/docs/source/api/enums/index.rst @@ -0,0 +1,53 @@ +Enumerations +============ + +This page is about Pyrogram enumerations. +Enumerations are types that hold a group of related values to be used whenever a constant value is required. +They will help you deal with those values in a type-safe way and also enable code completion so that you can be sure +to apply only a valid value among the expected ones. + +----- + +.. currentmodule:: pyrogram.enums + +.. autosummary:: + :nosignatures: + + ChatAction + ChatEventAction + ChatMemberStatus + ChatMembersFilter + ChatType + ClientPlatform + MessageEntityType + MessageMediaType + MessageServiceType + MessagesFilter + ParseMode + PollType + ProfileColor + AccentColor + SentCodeType + NextCodeType + UserStatus + +.. toctree:: + :hidden: + + ChatAction + ChatEventAction + ChatMemberStatus + ChatMembersFilter + ChatType + ClientPlatform + MessageEntityType + MessageMediaType + MessageServiceType + MessagesFilter + ParseMode + PollType + ProfileColor + AccentColor + SentCodeType + NextCodeType + UserStatus \ No newline at end of file diff --git a/docs/source/api/errors/bad-request.rst b/docs/source/api/errors/bad-request.rst new file mode 100644 index 0000000000..ab13fdabb2 --- /dev/null +++ b/docs/source/api/errors/bad-request.rst @@ -0,0 +1,7 @@ +400 - BadRequest +---------------- + +.. csv-table:: + :file: ../../../../compiler/errors/source/400_BAD_REQUEST.tsv + :delim: tab + :header-rows: 1 diff --git a/docs/source/api/errors/flood.rst b/docs/source/api/errors/flood.rst new file mode 100644 index 0000000000..e01e012274 --- /dev/null +++ b/docs/source/api/errors/flood.rst @@ -0,0 +1,7 @@ +420 - Flood +----------- + +.. csv-table:: + :file: ../../../../compiler/errors/source/420_FLOOD.tsv + :delim: tab + :header-rows: 1 \ No newline at end of file diff --git a/docs/source/api/errors/forbidden.rst b/docs/source/api/errors/forbidden.rst new file mode 100644 index 0000000000..c2a8dcb80b --- /dev/null +++ b/docs/source/api/errors/forbidden.rst @@ -0,0 +1,7 @@ +403 - Forbidden +--------------- + +.. csv-table:: + :file: ../../../../compiler/errors/source/403_FORBIDDEN.tsv + :delim: tab + :header-rows: 1 \ No newline at end of file diff --git a/docs/source/api/errors/index.rst b/docs/source/api/errors/index.rst new file mode 100644 index 0000000000..c3557b77e2 --- /dev/null +++ b/docs/source/api/errors/index.rst @@ -0,0 +1,52 @@ +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 + + from pyrogram.errors import FloodWait + + try: + ... + except FloodWait as e: + ... + +.. hlist:: + :columns: 1 + + - :doc:`see-other` + - :doc:`bad-request` + - :doc:`unauthorized` + - :doc:`forbidden` + - :doc:`not-acceptable` + - :doc:`flood` + - :doc:`internal-server-error` + +.. toctree:: + :hidden: + + see-other + bad-request + unauthorized + forbidden + not-acceptable + flood + internal-server-error + +.. admonition :: RPC Errors + :class: tip + + There isn't any official list of all possible RPC errors, so the list of known errors is provided on a best-effort basis. When new methods are available, the list may be lacking since we simply don't know what errors can raise from them. Pyrogram creates an `unknown_errors.txt` file in the root directory from where the `Client` is run. + +.. admonition :: PLEASE DO NOT DO THIS + + .. tip:: + + If you do not want this file to be created, set the `PYROGRAM_DONOT_LOG_UNKNOWN_ERRORS` environment variable before running the Pyrogram `Client`. + + .. tip:: + + If you want the file to be created in a different location, set the `PYROGRAM_LOG_UNKNOWN_ERRORS_FILENAME` to a file path of your choice. diff --git a/docs/source/api/errors/internal-server-error.rst b/docs/source/api/errors/internal-server-error.rst new file mode 100644 index 0000000000..996d77eba5 --- /dev/null +++ b/docs/source/api/errors/internal-server-error.rst @@ -0,0 +1,7 @@ +500 - InternalServerError +------------------------- + +.. csv-table:: + :file: ../../../../compiler/errors/source/500_INTERNAL_SERVER_ERROR.tsv + :delim: tab + :header-rows: 1 \ No newline at end of file diff --git a/docs/source/api/errors/not-acceptable.rst b/docs/source/api/errors/not-acceptable.rst new file mode 100644 index 0000000000..79cfa8bcaf --- /dev/null +++ b/docs/source/api/errors/not-acceptable.rst @@ -0,0 +1,7 @@ +406 - NotAcceptable +------------------- + +.. csv-table:: + :file: ../../../../compiler/errors/source/406_NOT_ACCEPTABLE.tsv + :delim: tab + :header-rows: 1 \ No newline at end of file diff --git a/docs/source/api/errors/see-other.rst b/docs/source/api/errors/see-other.rst new file mode 100644 index 0000000000..629b955764 --- /dev/null +++ b/docs/source/api/errors/see-other.rst @@ -0,0 +1,7 @@ +303 - SeeOther +-------------- + +.. csv-table:: + :file: ../../../../compiler/errors/source/303_SEE_OTHER.tsv + :delim: tab + :header-rows: 1 \ No newline at end of file diff --git a/docs/source/api/errors/unauthorized.rst b/docs/source/api/errors/unauthorized.rst new file mode 100644 index 0000000000..c56abeecc3 --- /dev/null +++ b/docs/source/api/errors/unauthorized.rst @@ -0,0 +1,7 @@ +401 - Unauthorized +------------------ + +.. csv-table:: + :file: ../../../../compiler/errors/source/401_UNAUTHORIZED.tsv + :delim: tab + :header-rows: 1 diff --git a/docs/source/api/filters.rst b/docs/source/api/filters.rst new file mode 100644 index 0000000000..eb3c9522b3 --- /dev/null +++ b/docs/source/api/filters.rst @@ -0,0 +1,11 @@ +Update Filters +============== + +Filters are objects that can be used to filter the content of incoming updates. +:doc:`Read more about how filters work <../topics/use-filters>`. + +Details +------- + +.. automodule:: pyrogram.filters + :members: diff --git a/docs/source/api/handlers.rst b/docs/source/api/handlers.rst new file mode 100644 index 0000000000..9aebe5ebd6 --- /dev/null +++ b/docs/source/api/handlers.rst @@ -0,0 +1,85 @@ +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. + +.. code-block:: python + + from pyrogram import Client + from pyrogram.handlers import MessageHandler + + app = Client("my_account") + + + def dump(client, message): + print(message) + + + app.add_handler(MessageHandler(dump)) + + app.run() + + +----- + +.. currentmodule:: pyrogram.handlers + +Index +----- + +.. hlist:: + :columns: 3 + + - :class:`MessageHandler` + - :class:`EditedMessageHandler` + + - :class:`MessageReactionUpdatedHandler` + - :class:`MessageReactionCountUpdatedHandler` + - :class:`InlineQueryHandler` + - :class:`ChosenInlineResultHandler` + - :class:`CallbackQueryHandler` + + + - :class:`PollHandler` + + + - :class:`ChatMemberUpdatedHandler` + - :class:`ChatJoinRequestHandler` + + + - :class:`DeletedMessagesHandler` + - :class:`UserStatusHandler` + + - :class:`DisconnectHandler` + - :class:`StoryHandler` + - :class:`RawUpdateHandler` + +----- + +Details +------- + +.. Handlers +.. autoclass:: MessageHandler() +.. autoclass:: EditedMessageHandler() + +.. autoclass:: MessageReactionUpdatedHandler() +.. autoclass:: MessageReactionCountUpdatedHandler() +.. autoclass:: InlineQueryHandler() +.. autoclass:: ChosenInlineResultHandler() +.. autoclass:: CallbackQueryHandler() +.. autoclass:: ShippingQueryHandler() +.. autoclass:: PreCheckoutQueryHandler() +.. autoclass:: PollHandler() + + +.. autoclass:: ChatMemberUpdatedHandler() +.. autoclass:: ChatJoinRequestHandler() + + +.. autoclass:: DeletedMessagesHandler() +.. autoclass:: UserStatusHandler() +.. autoclass:: DisconnectHandler() +.. autoclass:: StoryHandler() +.. autoclass:: RawUpdateHandler() diff --git a/docs/source/api/storage/Storage.rst b/docs/source/api/storage/Storage.rst new file mode 100644 index 0000000000..4682131487 --- /dev/null +++ b/docs/source/api/storage/Storage.rst @@ -0,0 +1,5 @@ +Storage +======== + +.. autoclass:: pyrogram.storage.Storage() + :members: diff --git a/docs/source/api/storage/index.rst b/docs/source/api/storage/index.rst new file mode 100644 index 0000000000..e6faadeab9 --- /dev/null +++ b/docs/source/api/storage/index.rst @@ -0,0 +1,126 @@ +Pyrogram Storage Engines +========================= + +Storage Engines +=============== + +Every time you login to Telegram, some personal piece of data are created and held by both parties (the client, Pyrogram +and the server, Telegram). This session data is uniquely bound to your own account, indefinitely (until you logout or +decide to manually terminate it) and is used to authorize a client to execute API calls on behalf of your identity. + + +----- + +Persisting Sessions +------------------- + +In order to make a client reconnect successfully between restarts, that is, without having to start a new +authorization process from scratch each time, Pyrogram needs to store the generated session data somewhere. + +Different Storage Engines +------------------------- + +Pyrogram offers two different types of storage engines: a **File Storage** and a **Memory Storage**. +These engines are well integrated in the framework and require a minimal effort to set up. Here's how they work: + +File Storage +^^^^^^^^^^^^ + +This is the most common storage engine. It is implemented by using **SQLite**, which will store the session details. +The database will be saved to disk as a single portable file and is designed to efficiently store and retrieve +data whenever they are needed. + +To use this type of engine, simply pass any name of your choice to the ``name`` parameter of the +:obj:`~pyrogram.Client` constructor, as usual: + +.. code-block:: python + + from pyrogram import Client + + async with Client("my_account") as app: + print(await app.get_me()) + +Once you successfully log in (either with a user or a bot identity), a session file will be created and saved to disk as +``my_account.session``. Any subsequent client restart will make Pyrogram search for a file named that way and the +session database will be automatically loaded. + +Memory Storage +^^^^^^^^^^^^^^ + +In case you don't want to have any session file saved to disk, you can use an in-memory storage by passing True to the +``in_memory`` parameter of the :obj:`~pyrogram.Client` constructor: + +.. code-block:: python + + from pyrogram import Client + + async with Client("my_account", in_memory=True) as app: + print(await app.get_me()) + +This storage engine is still backed by SQLite, but the database exists purely in memory. This means that, once you stop +a client, the entire database is discarded and the session details used for logging in again will be lost forever. + +Session Strings +--------------- + +In case you want to use an in-memory storage, but also want to keep access to the session you created, call +:meth:`~pyrogram.Client.export_session_string` anytime before stopping the client... + +.. code-block:: python + + from pyrogram import Client + + async with Client("my_account", in_memory=True) as app: + print(await app.export_session_string()) + +...and save the resulting string. You can use this string by passing it as Client argument the next time you want to +login using the same session; the storage used will still be in-memory: + +.. code-block:: python + + from pyrogram import Client + + session_string = "...ZnUIFD8jsjXTb8g_vpxx48k1zkov9sapD-tzjz-S4WZv70M..." + + async with Client("my_account", session_string=session_string) as app: + print(await app.get_me()) + +Session strings are useful when you want to run authorized Pyrogram clients on platforms where their ephemeral +filesystems makes it harder for a file-based storage engine to properly work as intended. + +Custom Storages +---------------- + +If you want to use a custom storage engine, you can do so by implementing the :obj:`~pyrogram.storage.Storage` class. This class is an base class that defines the interface that all storage engines must implement. + +This class is a class that cannot be instantiated, but can be used to define a common interface for its subclasses. In this case, the :obj:`~pyrogram.storage.Storage` class defines the interface that all storage engines must implement. + +Custom Storage can be defined in :obj:`~pyrogram.Client` by passing ``storage_engine`` parameter with a :obj:`~pyrogram.storage.Storage` subclass. + +How to use the ``AioSQLiteStorage`` Storage Engine is shown below +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``/path/to/your/file.session`` will be created if does not exist. + +.. code-block:: python + + import asyncio + from pyrogram import Client + from pyrogram.storage.aio_sqlite_storage import AioSQLiteStorage + api_id = 12345 + api_hash = "0123456789abcdef0123456789abcdef" + async def main(): + async with Client( + "my_account", + api_id, + api_hash, + storage_engine=AioSQLiteStorage("/path/to/your/file.session") + ) as app: + await app.send_message(chat_id="me", text="Greetings from **Pyrogram**!") + asyncio.run(main()) + + +Details +------- + +.. autoclass:: pyrogram.storage.Storage() diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000000..cb1d22380c --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,146 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 +import subprocess +import sys + +sys.path.insert(0, os.path.abspath("../..")) + +from pyrogram import __version__ + +commit_id = subprocess.check_output([ + "git", + "rev-parse", + "--short", + "HEAD", +]).decode("UTF-8").strip() + +project = "pyrotgfork" +copyright = "2017-present, Dan" +author = "Dan" +version = __version__ + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + # "sphinx.ext.viewcode", + "sphinx_copybutton", + # "sphinx.ext.coverage", +] + +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None) +} + +master_doc = "index" +source_suffix = ".rst" +autodoc_member_order = "bysource" + +templates_path = ["../resources/templates"] +html_copy_source = False + +napoleon_use_rtype = False +napoleon_use_param = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# Decides the language used for syntax highlighting of code blocks. +highlight_language = "python3" + +copybutton_prompt_text = "$ " + +suppress_warnings = ["image.not_readable"] + +html_title = f"Fork Pyrogram Documentation {version}" +html_theme = "furo" +html_static_path = [os.path.abspath("static")] +print("ABSOLUTE PATH", os.path.abspath("static")) +html_css_files = [ + "css/all.min.css", + "css/custom.css", +] +html_show_sourcelink = True +html_show_copyright = False +html_logo = html_static_path[0] + "/img/pyrogram.png" +html_favicon = html_static_path[0] + "/img/favicon.ico" +html_theme_options = { + "navigation_with_keys": True, + "footer_icons": [ + { + # Telegram channel logo + "name": "Telegram Channel", + "url": "https://Pyrogram.t.me", + "html": ( + '' + '' + ), + "class": "", + }, + { # Github logo + "name": "GitHub", + "url": f"https://github.com/TelegramPlayGround/pyrogram/tree/{commit_id}", + "html": ( + '' + "" + ), + "class": "", + }, + ] +} +latex_engine = "xelatex" +latex_logo = os.path.abspath("static/img/pyrogram.png") +print("latex_logo", latex_logo) + +latex_elements = { + "pointsize": "12pt", + "fontpkg": r""" + \setmainfont{Open Sans} + \setsansfont{Bitter} + \setmonofont{Ubuntu Mono} + """ +} + +# Set canonical URL from the Read the Docs Domain +html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") + +# Tell Jinja2 templates the build is running on Read the Docs +if os.environ.get("READTHEDOCS", "") == "True": + if "html_context" not in globals(): + html_context = {} + html_context["READTHEDOCS"] = True diff --git a/docs/source/faq/client-started-but-nothing-happens.rst b/docs/source/faq/client-started-but-nothing-happens.rst new file mode 100644 index 0000000000..ab85f51832 --- /dev/null +++ b/docs/source/faq/client-started-but-nothing-happens.rst @@ -0,0 +1,11 @@ +Client started, but nothing happens +=================================== + +A possible cause might be network issues, either yours or Telegram's. To check this, add the following code at +the top of your script and run it again. You should see some error mentioning a socket timeout or an unreachable +network: + +.. code-block:: python + + import logging + logging.basicConfig(level=logging.INFO) \ No newline at end of file diff --git a/docs/source/faq/code-hangs-when-calling-stop-restart-add-remove-handler.rst b/docs/source/faq/code-hangs-when-calling-stop-restart-add-remove-handler.rst new file mode 100644 index 0000000000..37d47a6444 --- /dev/null +++ b/docs/source/faq/code-hangs-when-calling-stop-restart-add-remove-handler.rst @@ -0,0 +1,12 @@ +Code hangs when calling stop, restart, add/remove_handler +========================================================= + +You tried to ``.stop()``, ``.restart()``, ``.add_handler()`` or ``.remove_handler()`` inside a running handler, but +that can't be done because the way Pyrogram deals with handlers would make it hang. + +When calling one of the methods above inside an event handler, Pyrogram needs to wait for all running handlers to finish +in order to continue. Since your handler is blocking the execution by waiting for the called method to finish +and since Pyrogram needs to wait for your handler to finish, you are left with a deadlock. + +The solution to this problem is to pass ``block=False`` to such methods so that they return immediately and the actual +code called asynchronously. \ No newline at end of file diff --git a/docs/source/faq/how-to-avoid-flood-waits.rst b/docs/source/faq/how-to-avoid-flood-waits.rst new file mode 100644 index 0000000000..06d1cdc2a9 --- /dev/null +++ b/docs/source/faq/how-to-avoid-flood-waits.rst @@ -0,0 +1,23 @@ +How to avoid Flood Waits? +========================= + +Slow things down and make less requests. Moreover, exact limits are unknown and can change anytime based on normal +usages. + +When a flood wait happens the server will tell you how much time to wait before continuing. +The following shows how to catch the exception in your code and wait the required seconds. + +.. code-block:: python + + import asyncio + from pyrogram.errors import FloodWait + + ... + try: + ... # Your code + except FloodWait as e: + await asyncio.sleep(e.value) # Wait "value" seconds before continuing + ... + + +More info about error handling can be found :doc:`here <../start/errors>`. diff --git a/docs/source/faq/how-to-use-webhooks.rst b/docs/source/faq/how-to-use-webhooks.rst new file mode 100644 index 0000000000..b0dd4008cd --- /dev/null +++ b/docs/source/faq/how-to-use-webhooks.rst @@ -0,0 +1,9 @@ +How to use webhooks? +==================== + +There is no webhook in Pyrogram, simply because there is no HTTP involved. However, a similar technique is +being used to make receiving updates efficient. + +Pyrogram uses persistent connections via TCP sockets to interact with the server and instead of actively asking for +updates every time (polling), Pyrogram will sit down and wait for the server to send updates by itself the very moment +they are available (server push). diff --git a/docs/source/faq/index.rst b/docs/source/faq/index.rst new file mode 100644 index 0000000000..3d4a00362b --- /dev/null +++ b/docs/source/faq/index.rst @@ -0,0 +1,45 @@ +Frequently Asked Questions +========================== + +This FAQ page provides answers to common questions about Pyrogram and, to some extent, Telegram in general. + +**Contents** + +- :doc:`why-is-the-api-key-needed-for-bots` +- :doc:`how-to-use-webhooks` +- :doc:`using-the-same-file-id-across-different-accounts` +- :doc:`using-multiple-clients-at-once-on-the-same-account` +- :doc:`client-started-but-nothing-happens` +- :doc:`what-are-the-ip-addresses-of-telegram-data-centers` +- :doc:`migrating-the-account-to-another-data-center` +- :doc:`why-is-the-client-reacting-slowly-in-supergroups-channels` +- :doc:`peer-id-invalid-error` +- :doc:`code-hangs-when-calling-stop-restart-add-remove-handler` +- :doc:`unicodeencodeerror-codec-cant-encode` +- :doc:`uploading-with-urls-gives-error-webpage-curl-failed` +- :doc:`sqlite3-operationalerror-database-is-locked` +- :doc:`sqlite3-interfaceerror-error-binding-parameter` +- :doc:`socket-send-oserror-timeouterror-connection-lost-reset` +- :doc:`how-to-avoid-flood-waits` +- :doc:`the-account-has-been-limited-deactivated` + +.. toctree:: + :hidden: + + why-is-the-api-key-needed-for-bots + how-to-use-webhooks + using-the-same-file-id-across-different-accounts + using-multiple-clients-at-once-on-the-same-account + client-started-but-nothing-happens + what-are-the-ip-addresses-of-telegram-data-centers + migrating-the-account-to-another-data-center + why-is-the-client-reacting-slowly-in-supergroups-channels + peer-id-invalid-error + code-hangs-when-calling-stop-restart-add-remove-handler + unicodeencodeerror-codec-cant-encode + uploading-with-urls-gives-error-webpage-curl-failed + sqlite3-operationalerror-database-is-locked + sqlite3-interfaceerror-error-binding-parameter + socket-send-oserror-timeouterror-connection-lost-reset + how-to-avoid-flood-waits + the-account-has-been-limited-deactivated \ No newline at end of file diff --git a/docs/source/faq/migrating-the-account-to-another-data-center.rst b/docs/source/faq/migrating-the-account-to-another-data-center.rst new file mode 100644 index 0000000000..7ae76a1e36 --- /dev/null +++ b/docs/source/faq/migrating-the-account-to-another-data-center.rst @@ -0,0 +1,10 @@ +Migrating the account to another data center +============================================ + +This question is asked by people who find their account always being connected to one DC (data center), but are +connecting from a place far away, thus resulting in slower interactions when using the API because of the greater +physical distance between the user and the 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. It's also up to the server to decide whether to automatically migrate a user in case of prolonged usages +from a distant location. \ No newline at end of file diff --git a/docs/source/faq/peer-id-invalid-error.rst b/docs/source/faq/peer-id-invalid-error.rst new file mode 100644 index 0000000000..197ea8374d --- /dev/null +++ b/docs/source/faq/peer-id-invalid-error.rst @@ -0,0 +1,14 @@ +PEER_ID_INVALID error +===================== + +This error could mean several things: + +- The chat id you tried to use is simply wrong, check it again. +- The chat id refers to a group or channel you are not a member of. +- The chat id argument you passed is in form of a string; you have to convert it into an integer with ``int(chat_id)``. +- The chat id refers to a user or chat your current session hasn't met yet. + +About the last point: in order for you to meet a user and thus communicate with them, you should ask yourself how to +contact people using official apps. The answer is the same for Pyrogram too and involves normal usages such as searching +for usernames, meeting them in a common group, having their phone contacts saved, getting a message mentioning them +or obtaining the dialogs list. \ No newline at end of file diff --git a/docs/source/faq/socket-send-oserror-timeouterror-connection-lost-reset.rst b/docs/source/faq/socket-send-oserror-timeouterror-connection-lost-reset.rst new file mode 100644 index 0000000000..85c5065015 --- /dev/null +++ b/docs/source/faq/socket-send-oserror-timeouterror-connection-lost-reset.rst @@ -0,0 +1,12 @@ +socket.send(), OSError(), TimeoutError(), Connection lost/reset +=============================================================== + +If you get any of these errors chances are you ended up with a slow or inconsistent network connection. +Another reason could be because you are blocking the event loop for too long. + +You can consider the following: + +- Use Pyrogram asynchronously in its intended way. +- Use shorter non-asynchronous processing loops. +- Use ``asyncio.sleep()`` instead of ``time.sleep()``. +- Use a stable network connection. diff --git a/docs/source/faq/sqlite3-interfaceerror-error-binding-parameter.rst b/docs/source/faq/sqlite3-interfaceerror-error-binding-parameter.rst new file mode 100644 index 0000000000..02cc8b1522 --- /dev/null +++ b/docs/source/faq/sqlite3-interfaceerror-error-binding-parameter.rst @@ -0,0 +1,13 @@ +sqlite3.InterfaceError: Error binding parameter +=============================================== + +This error occurs when you pass a chat id value of the wrong type when trying to call a method. Most likely, you +accidentally passed the whole user or chat object instead of the id or username. + +.. code-block:: python + + # Wrong. You passed the whole Chat instance + app.send_message(chat, "text") + + # Correct + app.send_message(chat_id=chat.id, text="text") diff --git a/docs/source/faq/sqlite3-operationalerror-database-is-locked.rst b/docs/source/faq/sqlite3-operationalerror-database-is-locked.rst new file mode 100644 index 0000000000..b5cb2d8293 --- /dev/null +++ b/docs/source/faq/sqlite3-operationalerror-database-is-locked.rst @@ -0,0 +1,17 @@ +sqlite3.OperationalError: database is locked +============================================ + +This error occurs when more than one process is using the same session file, that is, when you run two or more clients +at the same time using the same session name or in case another program has accessed the file. + +For example, it could occur when a background script is still running and you forgot about it. In this case, you either +restart your system or find and kill the process that is locking the database. On Unix based systems, you can try the +following: + +#. ``cd`` into your session file directory. +#. ``fuser my_account.session`` to find the process id. +#. ``kill 1234`` to gracefully stop the process. +#. If the last command doesn't help, use ``kill -9 1234`` instead. + +If you want to run multiple clients on the same account, you must authorize your account (either user or bot) +from the beginning every time, and use different session names for each parallel client you are going to use. \ No newline at end of file diff --git a/docs/source/faq/the-account-has-been-limited-deactivated.rst b/docs/source/faq/the-account-has-been-limited-deactivated.rst new file mode 100644 index 0000000000..79d589eaf8 --- /dev/null +++ b/docs/source/faq/the-account-has-been-limited-deactivated.rst @@ -0,0 +1,16 @@ +The account has been limited/deactivated +======================================== + +Pyrogram is a framework that interfaces with Telegram; it is at your commands, meaning it only does what you tell it to +do, the rest is up to you and Telegram (see `Telegram's ToS`_). + +If you found your account being limited/deactivated, it could be due spam/flood/abuse of the API or the usage of certain +virtual/VoIP numbers. + +If you think your account was limited/deactivated by mistake, you can write to recover@telegram.org, contact +`@SpamBot`_ or use `this form`_. + +.. _@SpamBot: https://t.me/spambot +.. _this form: https://telegram.org/support +.. _Telegram's ToS: https://telegram.org/tos + diff --git a/docs/source/faq/unicodeencodeerror-codec-cant-encode.rst b/docs/source/faq/unicodeencodeerror-codec-cant-encode.rst new file mode 100644 index 0000000000..a4511ce5d1 --- /dev/null +++ b/docs/source/faq/unicodeencodeerror-codec-cant-encode.rst @@ -0,0 +1,7 @@ +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 +another terminal altogether. diff --git a/docs/source/faq/uploading-with-urls-gives-error-webpage-curl-failed.rst b/docs/source/faq/uploading-with-urls-gives-error-webpage-curl-failed.rst new file mode 100644 index 0000000000..2b7c5a7e9f --- /dev/null +++ b/docs/source/faq/uploading-with-urls-gives-error-webpage-curl-failed.rst @@ -0,0 +1,7 @@ +Uploading with URLs gives error WEBPAGE_CURL_FAILED +=================================================== + +When uploading media files using an URL, the server automatically tries to download the media and uploads it to the +Telegram cloud. This error usually happens in case the provided URL is not publicly accessible by Telegram itself or the +media file is too large. In such cases, your only option is to download the media yourself and upload it from your +local machine. \ No newline at end of file diff --git a/docs/source/faq/using-multiple-clients-at-once-on-the-same-account.rst b/docs/source/faq/using-multiple-clients-at-once-on-the-same-account.rst new file mode 100644 index 0000000000..b64a03ce5e --- /dev/null +++ b/docs/source/faq/using-multiple-clients-at-once-on-the-same-account.rst @@ -0,0 +1,7 @@ +Using multiple clients at once on the same account +================================================== + +User accounts are able to run multiple sessions in parallel. However, you must not use the same session in more than one client at the same time. +The correct way to run multiple clients on the same account is by authorizing your account from the beginning each time, or by using :doc:`Storage Engines <../topics/storage-engines>`, and use one separate session for each parallel client. + +It is not recommended to run multiple sessions of bot accounts simultaneously in parallel. If you choose to do so, you **agree** to do so at your own risk and with no liablity to anything. diff --git a/docs/source/faq/using-the-same-file-id-across-different-accounts.rst b/docs/source/faq/using-the-same-file-id-across-different-accounts.rst new file mode 100644 index 0000000000..00305ef12d --- /dev/null +++ b/docs/source/faq/using-the-same-file-id-across-different-accounts.rst @@ -0,0 +1,6 @@ +Using the same file_id across different accounts +================================================ + +Telegram file_id strings are bound to the account which generated them. 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. \ No newline at end of file diff --git a/docs/source/faq/what-are-the-ip-addresses-of-telegram-data-centers.rst b/docs/source/faq/what-are-the-ip-addresses-of-telegram-data-centers.rst new file mode 100644 index 0000000000..c951230ba6 --- /dev/null +++ b/docs/source/faq/what-are-the-ip-addresses-of-telegram-data-centers.rst @@ -0,0 +1,30 @@ +What are the IP addresses of Telegram Data Centers? +=================================================== + +Telegram is currently composed by a decentralized, multi-DC infrastructure (currently 5 DCs, each of which can +work independently) spread across different locations worldwide. However, some of the less busy DCs have been lately +dismissed and their IP addresses are now kept as aliases to the nearest one. + +.. csv-table:: Production Environment + :header: ID, Location, IPv4, IPv6 + :widths: auto + :align: center + + DC1, "MIA, Miami FL, USA", ``149.154.175.53``, ``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.130``, ``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`` + +.. centered:: More info about the Test Environment can be found :doc:`here <../topics/test-servers>`. + +***** Alias DC \ No newline at end of file diff --git a/docs/source/faq/why-is-the-api-key-needed-for-bots.rst b/docs/source/faq/why-is-the-api-key-needed-for-bots.rst new file mode 100644 index 0000000000..2e062d405d --- /dev/null +++ b/docs/source/faq/why-is-the-api-key-needed-for-bots.rst @@ -0,0 +1,12 @@ +Why is the API key needed for bots? +=================================== + +Requests against the official bot API endpoints are made via JSON/HTTP and are handled by an intermediate server +application that implements the MTProto protocol and uses its own API key to communicate with the MTProto servers. + +.. figure:: //_static/img/mtproto-vs-bot-api.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. \ No newline at end of file diff --git a/docs/source/faq/why-is-the-client-reacting-slowly-in-supergroups-channels.rst b/docs/source/faq/why-is-the-client-reacting-slowly-in-supergroups-channels.rst new file mode 100644 index 0000000000..4d19616469 --- /dev/null +++ b/docs/source/faq/why-is-the-client-reacting-slowly-in-supergroups-channels.rst @@ -0,0 +1,18 @@ +Why is the client reacting slowly in supergroups/channels? +========================================================== + +Because of how Telegram works internally, every message you receive and send must pass through the creator's DC, and in +the worst case where you, the creator and another member all belong to three different DCs, the other member messages +have to go through from their DC to the creator's DC and finally to your DC. This is applied to each message and member +of a supergroup/channel and the process will inevitably take its time. + +Another reason that makes responses come slowly is that messages are dispatched by priority. Depending on the kind +of member, some users receive messages faster than others and for big and busy supergroups the delay might become +noticeable, especially if you are among the lower end of the priority list: + +1. Creator. +2. Administrators. +3. Bots. +4. Mentioned users. +5. Recent online users. +6. Everyone else. \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000000..7ad1a51da3 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,187 @@ +Welcome to ``PyroTGFork`` +========================== + +.. admonition :: A Word of Warning + :class: tip + + We merge changes made to few of pyrogram forks plus changes made by us to this repository. All the features are just customized feature mostly for personal use; there is no guarantee in them being stable, **USE AT YOUR OWN RISK**. + + +.. raw:: html + + + +

+ Telegram MTProto API Framework for Python + +
+ + Homepage + + • + + Development + + • + + Releases + + • + + News + +

+ +.. code-block:: python + + from pyrogram import Client, filters + + app = Client("my_account") + + @app.on_message(filters.private) + async def hello(client, message): + await message.reply("Hello from Pyrogram!") + + app.run() + +**Pyrogram** is a modern, elegant and asynchronous :doc:`MTProto API ` framework. +It enables you to easily interact with the main Telegram API through a user account (custom client) or a bot identity +(bot API alternative) using Python. + +.. admonition :: USE AT YOUR OWN RISK + :class: tip + + All of the repositories that we merge features from are listed in :doc:`Release Notes ` file. + + +Support +------- + +If you'd like to support Pyrogram, you can consider: + +- `Become a GitHub sponsor `_. +- `Become a LiberaPay patron `_. +- `Become an OpenCollective backer `_. + +How the Documentation is Organized +---------------------------------- + +Contents are organized into sections composed of self-contained topics which can be all accessed from the sidebar, or by +following them in order using the :guilabel:`Next` button at the end of each page. +You can also switch to Dark or Light theme or leave on Auto (follows system preferences) by using the dedicated button +in the top left corner. + +Here below you can, instead, find a list of the most relevant pages for a quick access. + +First Steps +^^^^^^^^^^^ + +.. hlist:: + :columns: 1 + + - :doc:`Quick Start `: Overview to get you started quickly. + - :doc:`Invoking 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: 1 + + - :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:`Enumerations `: List of available enumerations. + - :doc:`Bound Methods `: List of convenient bound methods. + +Meta +^^^^ + +.. hlist:: + :columns: 1 + + - :doc:`Pyrogram FAQ `: Answers to common Pyrogram questions. + - :doc:`Support Pyrogram `: Ways to show your appreciation. + - :doc:`Release Notes `: Changes in this Fork. + +.. toctree:: + :hidden: + :caption: Introduction + + intro/quickstart + intro/install + +.. toctree:: + :hidden: + :caption: Getting Started + + start/setup + start/auth + start/invoking + start/updates + start/errors + start/examples/index + +.. toctree:: + :hidden: + :caption: API Reference + + api/client + api/methods/index + api/types/index + api/bound-methods/index + api/enums/index + api/handlers + api/decorators + api/errors/index + api/filters + +.. toctree:: + :hidden: + :caption: Topic Guides + + topics/use-filters + topics/create-filters + topics/more-on-updates + topics/client-settings + topics/speedups + topics/text-formatting + topics/storage-engines + topics/synchronous + topics/smart-plugins + topics/serializing + topics/proxy + topics/scheduling + topics/mtproto-vs-botapi + topics/debugging + topics/test-servers + topics/message-identifiers + topics/advanced-usage + topics/voice-calls + +.. toctree:: + :hidden: + :caption: Meta + + faq/index + support + releases/index + +.. toctree:: + :hidden: + :caption: Telegram Raw API + + TL Schema Explorer + TL Diff + telegram/functions/index + telegram/types/index + telegram/base/index diff --git a/docs/source/intro/install.rst b/docs/source/intro/install.rst new file mode 100644 index 0000000000..9e35721a97 --- /dev/null +++ b/docs/source/intro/install.rst @@ -0,0 +1,40 @@ +Install Guide +============= + +Being a modern Python framework, Pyrogram requires an up to date version of Python to be installed in your system. +We recommend using the latest versions of both Python 3 and pip. + + +----- + +Install Pyrogram +---------------- + +Bleeding Edge +------------- + +You can install the development version from the git appropriate branch using this command: + + .. code-block:: text + + $ pip uninstall -y pyrogram && pip install pyrotgfork + +- or, with :doc:`TgCrypto <../topics/speedups>` as extra requirement (recommended): + + .. code-block:: text + + $ pip install pyrotgfork[fast] + +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. + +.. parsed-literal:: + + >>> from pyrogram import __version__ + >>> __version__ + '2.0.106-TL-158' + +.. _`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 0000000000..99c415491b --- /dev/null +++ b/docs/source/intro/quickstart.rst @@ -0,0 +1,60 @@ +Quick Start +=========== + +The next few steps serve as a quick start to see Pyrogram in action as fast as possible. + +Get Pyrogram Real Fast +---------------------- + +.. admonition :: Cloud Credits + :class: tip + + If you need a cloud server to host your applications, try Hetzner Cloud. You can sign up with + `this link `_ to get €20 in cloud credits. + +0. Create a Virtual Environment with ``python3 -m venv venv``. + +0. Activate the Virtual Environment with ``source ./venv/bin/activate``. + +1. Install Pyrogram with ``pip uninstall -y pyrogram && pip install pyrotgfork``. + +2. Get your own Telegram API key from https://my.telegram.org/apps. + +3. Open the text editor of your choice and paste the following: + + .. code-block:: python + + import asyncio + from pyrogram import Client + + api_id = 12345 + api_hash = "0123456789abcdef0123456789abcdef" + + + async def main(): + async with Client("my_account", api_id, api_hash) as app: + await app.send_message(chat_id="me", text="Greetings from **Pyrogram**!") + + + asyncio.run(main()) + +4. Replace *api_id* and *api_hash* values with your own. + +5. Save the file as ``hello.py``. + +6. Run the script with ``python3 hello.py`` + +7. Follow the instructions on your terminal to login. + +8. Watch Pyrogram send a message to yourself. + +Enjoy the API +------------- + +That was just a quick overview. In the next few pages of the introduction, we'll take a much more in-depth look of what +we have just done above. + +If you are feeling eager to continue you can take a shortcut to :doc:`../start/invoking` and come back +later to learn some more details. + +.. _community: https://t.me/Pyrogram diff --git a/docs/source/releases/changes-in-this-fork.rst b/docs/source/releases/changes-in-this-fork.rst new file mode 100644 index 0000000000..636aff25ed --- /dev/null +++ b/docs/source/releases/changes-in-this-fork.rst @@ -0,0 +1,318 @@ +Changes in this Fork +===================== + +This page lists all the documented changes of this fork, +in reverse chronological order. You should read this when upgrading +to this fork to know where your code can break, and where +it can take advantage of new goodies! + +`For a more detailed description, please check the commits. `_ + +If you found any issue or have any suggestions, feel free to make `an issue `_ on github. + ++------------------------+ +| Scheme layer used: 185 | ++------------------------+ + +- Added the parameter ``chat_list`` to the methods :meth:`~pyrogram.Client.get_dialogs` and :meth:`~pyrogram.Client.get_dialogs_count`. +- Added ``gifted_stars`` service message to the class :obj:`~pyrogram.types.Message`. +- Added the fields ``have_access``, ``has_main_web_app``, ``active_user_count`` to the class :obj:`~pyrogram.types.User`, which is returned in response to :meth:`~pyrogram.Client.get_me`. +- Added the parameter ``business_connection_id`` to the methods :meth:`~pyrogram.Client.pin_chat_message` and :meth:`~pyrogram.Client.unpin_chat_message`, allowing bots to manage pinned messages on behalf of a business account. +- View `new and changed `__ `raw API methods `__. + + ++------------------------+ +| Scheme layer used: 184 | ++------------------------+ + +- Updated :obj:`~pyrogram.filters.via_bot`, to optionally support filtering invalid bot ``user_id``. +- Added the :meth:`~pyrogram.Client.get_active_sessions`, :meth:`~pyrogram.Client.terminate_session`, :meth:`~pyrogram.types.ActiveSession.terminate`, and :meth:`~pyrogram.Client.terminate_all_other_sessions`. +- Added the ``is_automatic_forward`` to the :obj:`~pyrogram.types.Message`. +- Added the parameters ``offset_id`` to the :meth:`~pyrogram.Client.search_messages` and the parameters ``min_date``, ``max_date``, ``min_id``, ``max_id``, ``saved_messages_topic_id`` to the :meth:`~pyrogram.Client.search_messages_count`. +- Dynamic session ReStart + restart optimizations (`#56 `__) +- Added the :meth:`~pyrogram.Client.delete_account`, :meth:`~pyrogram.Client.transfer_chat_ownership`, :meth:`~pyrogram.Client.update_status` (`#49 `__, `#51 `__) +- Added the class :obj:`~pyrogram.types.RefundedPayment`, containing information about a refunded payment. +- Added the field ``refunded_payment`` to the class :obj:`~pyrogram.types.Message`, describing a service message about a refunded payment. +- `View new and changed raw API methods `__. + + ++------------------------+ +| Scheme layer used: 183 | ++------------------------+ + +- Added the classes :obj:`~pyrogram.types.PaidMedia`, :obj:`~pyrogram.types.PaidMediaInfo`, :obj:`~pyrogram.types.PaidMediaPreview`, :obj:`~pyrogram.types.PaidMediaPhoto` and :obj:`~pyrogram.types.PaidMediaVideo`, containing information about paid media. +- Added the method :meth:`~pyrogram.Client.send_paid_media` and the classes :obj:`~pyrogram.types.InputPaidMedia`, :obj:`~pyrogram.types.InputPaidMediaPhoto` and :obj:`~pyrogram.types.InputPaidMediaVideo`, to support sending paid media. +- Added the field ``paid_media`` to the classes :obj:`~pyrogram.types.Message` and :obj:`~pyrogram.types.ExternalReplyInfo`. +- Added :meth:`~pyrogram.Client.get_stories`. +- Added filters :obj:`~pyrogram.filters.thread` and :obj:`~pyrogram.filters.self_destruct`. +- Added the field ``can_send_paid_media`` to the class :obj:`~pyrogram.types.Chat`. +- Added support for launching Web Apps via ``t.me`` link in the class :obj:`~pyrogram.types.MenuButtonWebApp`. +- `View new and changed raw API methods `__. + ++------------------------+ +| Scheme layer used: 182 | ++------------------------+ + +- Updated the parameter ``business_connection_id`` to the methods :meth:`~pyrogram.types.Message.edit_text`, :meth:`~pyrogram.types.Message.edit_media`, :meth:`~pyrogram.types.Message.edit_reply_markup`, :meth:`~pyrogram.types.CallbackQuery.edit_message_text`, :meth:`~pyrogram.types.CallbackQuery.edit_message_media`, :meth:`~pyrogram.types.CallbackQuery.edit_message_reply_markup`. +- Added the parameter ``business_connection_id`` to the methods :meth:`~pyrogram.Client.edit_message_text`, :meth:`~pyrogram.Client.edit_message_media`, :meth:`~pyrogram.Client.edit_cached_media`, :meth:`~pyrogram.Client.edit_message_caption` and :meth:`~pyrogram.Client.edit_message_reply_markup`, allowing the bot to edit business messages. +- Added the parameter ``business_connection_id`` to the method :meth:`~pyrogram.Client.stop_poll`, allowing the bot to stop polls it sent on behalf of a business account. +- Added support for callback queries originating from a message sent on behalf of a business account. + ++------------------------+ +| Scheme layer used: 181 | ++------------------------+ + +- Added the classes :obj:`~pyrogram.types.InputLocationMessageContent`, :obj:`~pyrogram.types.InputVenueMessageContent`, :obj:`~pyrogram.types.InputContactMessageContent`, :obj:`~pyrogram.types.InputInvoiceMessageContent`.` +- Added ``background`` to :obj:`~pyrogram.types.Chat` (`#40 `_) +- Added the methods :meth:`~pyrogram.Client.translate_text`, :meth:`~pyrogram.Client.translate_message_text`, :meth:`~pyrogram.types.Message.translate` and the type :obj:`~pyrogram.types.TranslatedText` (`#39 `_). +- Added the methods :meth:`~pyrogram.Client.create_video_chat`, :meth:`~pyrogram.Client.discard_group_call`, :meth:`~pyrogram.Client.get_video_chat_rtmp_url` and the type :obj:`~pyrogram.types.RtmpUrl` (`#37 `_). +- Added :meth:`~Client.on_story` to listen to story updates. +- Ability to run in `replit` environment without creating `a deployment `_. Set the environment variable ``PYROGRAM_REPLIT_NWTRAFIK_PORT`` value to ``5222`` if you want to connect to Production Telegram Servers, **OR** Set the environment variable ``PYROGRAM_REPLIT_WNTRAFIK_PORT`` value to ``5223`` if you want to connect to Test Telegram Servers, before starting the :obj:`~pyrogram.Client`. +- Added the :meth:`~pyrogram.Client.invite_group_call_participants` (`#35 `_). +- Added the types :obj:`~pyrogram.types.LabeledPrice`, :obj:`~pyrogram.types.OrderInfo`, :obj:`~pyrogram.types.PreCheckoutQuery`, :obj:`~pyrogram.types.ShippingAddress`, :obj:`~pyrogram.types.ShippingOption`, :obj:`~pyrogram.types.ShippingQuery` and :obj:`~pyrogram.types.SuccessfulPayment`. +- Added the ``successful_payment`` parameter to the :obj:`~pyrogram.types.Message`. Added the filter :obj:`~pyrogram.filters.successful_payment` to detect service messages of Successful Payment type. +- Added the methods :meth:`~pyrogram.Client.send_invoice`, :meth:`~pyrogram.Client.answer_pre_checkout_query` (:meth:`~pyrogram.types.PreCheckoutQuery.answer`), :meth:`~pyrogram.Client.answer_shipping_query` (:meth:`~pyrogram.types.ShippingQuery.answer`), :meth:`~pyrogram.Client.refund_star_payment` and :meth:`~pyrogram.Client.create_invoice_link`. +- Added the :meth:`~pyrogram.Client.send_web_app_custom_request`. +- Added the :meth:`~pyrogram.Client.search_public_messages_by_tag` and :meth:`~pyrogram.Client.count_public_messages_by_tag`. +- Added the ``fetch_replies`` parameter to :obj:`~pyrogram.Client`. +- Added the :meth:`~pyrogram.Client.get_message_effects`. +- Added the parameter ``message_effect_id`` to the methods :meth:`~pyrogram.Client.send_message`, :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_audio`, :meth:`~pyrogram.Client.send_document`, :meth:`~pyrogram.Client.send_sticker`, :meth:`~pyrogram.Client.send_video_note`, :meth:`~pyrogram.Client.send_voice`, :meth:`~pyrogram.Client.send_location`, :meth:`~pyrogram.Client.send_venue`, :meth:`~pyrogram.Client.send_contact`, :meth:`~pyrogram.Client.send_poll`, :meth:`~pyrogram.Client.send_dice`, :meth:`~pyrogram.Client.send_game`, and :meth:`~pyrogram.Client.send_media_group`, and the corresponding ``reply_*`` methods in the class :obj:`~pyrogram.types.Message`. +- Added the field ``effect_id`` to the class :obj:`~pyrogram.types.Message`. +- Added the field ``show_caption_above_media`` to the classes :obj:`~pyrogram.types.Message`, :obj:`~pyrogram.types.InputMediaAnimation`, :obj:`~pyrogram.types.InputMediaPhoto`, :obj:`~pyrogram.types.InputMediaVideo`, :obj:`~pyrogram.types.InlineQueryResultAnimation`, :obj:`~pyrogram.types.InlineQueryResultCachedAnimation`, :obj:`~pyrogram.types.InlineQueryResultPhoto`, :obj:`~pyrogram.types.InlineQueryResultCachedPhoto`, :obj:`~pyrogram.types.InlineQueryResultVideo`, :obj:`~pyrogram.types.InlineQueryResultCachedVideo`, :meth:`~pyrogram.Client.send_cached_media`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.copy_message` and :meth:`~pyrogram.Client.edit_message_caption`, and the corresponding ``reply_*`` methods. +- Added support for :obj:`~pyrogram.enums.MessageEntityType.EXPANDABLE_BLOCKQUOTE` entities in received messages. +- Added support for :obj:`~pyrogram.enums.MessageEntityType.EXPANDABLE_BLOCKQUOTE` entity parsing in :obj:`~pyrogram.enums.ParseMode.HTML` parse mode. +- Allowed to explicitly specify :obj:`~pyrogram.enums.MessageEntityType.EXPANDABLE_BLOCKQUOTE` entities in formatted texts. +- `View new and changed raw API methods `__. + ++------------------------+ +| Scheme layer used: 179 | ++------------------------+ + +- Add ``invoice`` to :obj:`~pyrogram.types.Message` and :obj:`~pyrogram.types.ExternalReplyInfo`. +- Add ``link_preview_options`` to :obj:`~pyrogram.Client`. +- Support for the updated Channel ID format. `#28 `_ +- Improvements to :meth:`~pyrogram.Client.save_file` and :meth:`~pyrogram.Client.get_file` to handle the new `FLOOD_PREMIUM_WAIT `_ errors. +- Added ``has_animation``, ``is_personal``, ``minithumbnail`` parameters to :obj:`~pyrogram.types.ChatPhoto`. +- Changed return type of :meth:`~pyrogram.Client.get_chat_photos` to return :obj:`~pyrogram.types.Photo` or :obj:`~pyrogram.types.Animation`. +- Added :meth:`~pyrogram.Client.get_chat_sponsored_messages` and the type :obj:`~pyrogram.types.SponsoredMessage`, by stealing unauthored changes from `KurimuzonAkuma/pyrogram#55 `_. +- Added :meth:`~pyrogram.Client.load_group_call_participants` and the type :obj:`~pyrogram.types.GroupCallParticipant`, by stealing unauthored changes from `6df467f `_. +- Added :meth:`~pyrogram.Client.view_messages` and the bound methods :meth:`~pyrogram.types.Message.read` and :meth:`~pyrogram.types.Message.view`. +- Added the field ``question_entities`` to the class :obj:`~pyrogram.types.Poll`. +- Added the field ``text_entities`` to the class :obj:`~pyrogram.types.PollOption`. +- Added the parameters ``question_parse_mode`` and ``question_entities`` to the method :meth:`~pyrogram.Client.send_poll`. +- Added the class :obj:`~pyrogram.types.InputPollOption` and changed the type of the parameter ``options`` in the method :meth:`~pyrogram.Client.send_poll` to Array of :obj:`~pyrogram.types.InputPollOption`. +- Added the field ``max_reaction_count`` to the class :obj:`~pyrogram.types.Chat`. +- Added the field ``via_join_request`` to the class :obj:`~pyrogram.types.ChatMemberUpdated`. +- Added the class :obj:`~pyrogram.types.TextQuote` and the field ``quote`` of type :obj:`~pyrogram.types.TextQuote` to the class :obj:`~pyrogram.types.Message`, which contains the part of the replied message text or caption that is quoted in the current message. +- Added ``full_name`` to :obj:`~pyrogram.types.Chat` and :obj:`~pyrogram.types.User` only for :obj:`~pyrogram.enums.ChatType.PRIVATE`. +- Added ``revoke_messages`` parameter to :meth:`~pyrogram.Client.ban_chat_member` and :meth:`~pyrogram.types.Chat.ban_member`. +- Added :meth:`~pyrogram.Client.get_collectible_item_info`. +- Added ``reverse`` parameter to :meth:`~pyrogram.Client.get_chat_history`. (`855e69e `_, `a086b49 `_) +- `View new and changed raw API methods `__. + ++------------------------+ +| Scheme layer used: 178 | ++------------------------+ + +- Added :meth:`~pyrogram.Client.search_chats`. +- Added :meth:`~pyrogram.Client.get_bot_name`, :meth:`~pyrogram.Client.get_bot_info_description`, :meth:`~pyrogram.Client.get_bot_info_short_description`, :meth:`~pyrogram.Client.set_bot_name`, :meth:`~pyrogram.Client.set_bot_info_description`, :meth:`~pyrogram.Client.set_bot_info_short_description`. +- Added :meth:`~pyrogram.Client.edit_cached_media` and :meth:`~pyrogram.types.Message.edit_cached_media`. +- Steal `d51eef3 `_ without attribution. +- Added ``max_reaction_count`` to :obj:`~pyrogram.types.ChatReactions`. +- Added ``personal_chat_message`` to :obj:`~pyrogram.types.Chat`. +- Added ``only_in_channels`` parameter to :meth:`~pyrogram.Client.search_global` and :meth:`~pyrogram.Client.search_global_count`. + ++------------------------+ +| Scheme layer used: 177 | ++------------------------+ + +- Added ``emoji_message_interaction`` parameter to :meth:`~pyrogram.Client.send_chat_action` and :meth:`~pyrogram.types.Message.reply_chat_action`. +- **BOTS ONLY**: Updated :obj:`~pyrogram.handlers.ChatMemberUpdatedHandler` to handle updates when the bot is blocked or unblocked by a user. +- Added missing parameters in :meth:`~pyrogram.Client.create_group`, :meth:`~pyrogram.Client.create_supergroup`, :meth:`~pyrogram.Client.create_channel`. +- Try to return the service message (when applicable) in the methods :meth:`~pyrogram.Client.add_chat_members`, :meth:`~pyrogram.Client.promote_chat_member` +- Add :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION` and :obj:`~pyrogram.enums.ChatAction.WATCH_EMOJI_ANIMATION` in :meth:`~pyrogram.Client.send_chat_action` and :meth:`~pyrogram.types.Message.reply_chat_action`. +- Attempted to revert the Backward Incompatible changes in the commits `fb118f95d `_ and `848bc8644 `_. +- Added ``callback_data_with_password`` to :obj:`~pyrogram.types.InlineKeyboardButton` and added support in :meth:`~pyrogram.types.Message.click` for such buttons. +- PR from upstream: `1391 `_ without attribution. +- Added ``gifted_premium`` service message to :obj:`~pyrogram.types.Message`. +- Added :meth:`~pyrogram.Client.get_stickers`. +- Added ``filters.users_shared`` and ``filters.chat_shared``. +- Added the field ``origin`` of type :obj:`~pyrogram.types.MessageOrigin` in the class :obj:`~pyrogram.types.ExternalReplyInfo`. +- Added the class :obj:`~pyrogram.types.MessageOrigin` and replaced the fields ``forward_from``, ``forward_from_chat``, ``forward_from_message_id``, ``forward_signature``, ``forward_sender_name``, and ``forward_date`` with the field ``forward_origin`` of type :obj:`~pyrogram.types.MessageOrigin` in the class :obj:`~pyrogram.types.Message`. +- Added ``accent_color``, ``profile_color``, ``emoji_status``, ``is_close_friend`` to :obj:`~pyrogram.types.Chat` and :obj:`~pyrogram.types.User`. +- Added the method :meth:`~pyrogram.Client.get_created_chats`. +- Added the class :obj:`~pyrogram.types.ForumTopic` and the methods :meth:`~pyrogram.Client.get_forum_topics`, :meth:`~pyrogram.Client.get_forum_topic`. +- Install the version, from PyPI, using ``pip uninstall -y pyrogram && pip install pyrotgfork==2.1.17``. +- Added the classes :obj:`~pyrogram.types.BusinessOpeningHours` and :obj:`~pyrogram.types.BusinessOpeningHoursInterval` and the field ``business_opening_hours`` to the class :obj:`~pyrogram.types.Chat`. +- Added the class :obj:`~pyrogram.types.BusinessLocation` and the field ``business_location`` to the class :obj:`~pyrogram.types.Chat`. +- Added the class :obj:`~pyrogram.types.BusinessIntro` and the field ``business_intro`` to the class :obj:`~pyrogram.types.Chat`. +- Added the parameter ``business_connection_id`` to the methods :meth:`~pyrogram.Client.send_message`, :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_audio`, :meth:`~pyrogram.Client.send_document`, :meth:`~pyrogram.Client.send_sticker`, :meth:`~pyrogram.Client.send_video_note`, :meth:`~pyrogram.Client.send_voice`, :meth:`~pyrogram.Client.send_location`, :meth:`~pyrogram.Client.send_venue`, :meth:`~pyrogram.Client.send_contact`, :meth:`~pyrogram.Client.send_poll`, :meth:`~pyrogram.Client.send_game`, :meth:`~pyrogram.Client.send_media_group`, :meth:`~pyrogram.Client.send_dice`, :meth:`~pyrogram.Client.send_chat_action`, :meth:`~pyrogram.Client.send_cached_media` and :meth:`~pyrogram.Client.copy_message` and the corresponding reply_* methods. +- Added :meth:`~pyrogram.Client.get_business_connection`. +- Added ``active_usernames`` to :obj:`~pyrogram.types.Chat` and :obj:`~pyrogram.types.User`. +- Added :obj:`~pyrogram.types.BusinessConnection`. +- Added support for ``https://t.me/m/blah`` links in the ``link`` parameter of :meth:`~pyrogram.Client.get_messages` +- Added the parameter ``message_thread_id`` to the :meth:`~pyrogram.Client.search_messages` and :meth:`~pyrogram.Client.search_messages_count`. +- Added the parameter ``chat_list`` to :meth:`~pyrogram.Client.search_global` and :meth:`~pyrogram.Client.search_global_count`. +- PR from upstream: `1411 `_ without attribution. +- **BOTS ONLY**: Handled the parameter ``business_connection_id`` to the update handlers :obj:`~pyrogram.handlers.MessageHandler`, :obj:`~pyrogram.handlers.EditedMessageHandler`, :obj:`~pyrogram.handlers.DeletedMessagesHandler`. +- Added the field ``business_connection_id`` to the class :obj:`~pyrogram.types.Message`. +- Bug fix for the ``users_shared``, ``chat_shared`` logic in :obj:`~pyrogram.types.Message`. +- Added :meth:`~pyrogram.Client.set_birthdate` and :meth:`~pyrogram.Client.set_personal_chat`, for user accounts only. +- Added the field ``birthdate`` to the class :obj:`~pyrogram.types.Chat`. +- Added the field ``is_from_offline`` to the class :obj:`~pyrogram.types.Message`. +- Added the field ``sender_business_bot`` to the class :obj:`~pyrogram.types.Message`. +- Added the fields ``users_shared``, ``chat_shared`` to the class :obj:`~pyrogram.types.Message`. +- Added the field ``personal_chat`` to the class :obj:`~pyrogram.types.Chat`. +- Added the field ``can_connect_to_business`` to the class :obj:`~pyrogram.types.User`. +- Rearrange :meth:`~pyrogram.Client.send_sticker` parameter names. +- Added the fields ``request_title``, ``request_username``, and ``request_photo`` to the class :obj:`~pyrogram.types.KeyboardButtonRequestChat`. +- Added the fields ``request_name``, ``request_username``, and ``request_photo`` to the class :obj:`~pyrogram.types.KeyboardButtonRequestUsers`. + ++------------------------+ +| Scheme layer used: 176 | ++------------------------+ + +- Add ``message_thread_id`` parameter to :meth:`~pyrogram.Client.unpin_all_chat_messages`. +- Add :meth:`~pyrogram.Client.create_forum_topic`, :meth:`~pyrogram.Client.edit_forum_topic`, :meth:`~pyrogram.Client.close_forum_topic`, :meth:`~pyrogram.Client.reopen_forum_topic`, :meth:`~pyrogram.Client.hide_forum_topic`, :meth:`~pyrogram.Client.unhide_forum_topic`, :meth:`~pyrogram.Client.delete_forum_topic`, :meth:`~pyrogram.Client.get_forum_topic_icon_stickers`. +- Add ``AioSQLiteStorage``, by stealing the following commits: + - `fded06e `_ +- Add ``skip_updates`` parameter to :obj:`~pyrogram.Client` class, by stealing the following commits: + - `c16c83a `_ + - `55aa162 `_ +- Add ``public``, ``for_my_bot`` to :meth:`~pyrogram.Client.delete_profile_photos`. +- Make ``photo_ids`` parameter as optional in :meth:`~pyrogram.Client.delete_profile_photos`. +- Add ``supergroup_chat_created`` to :obj:`~pyrogram.types.Message`. +- Add ``forum_topic_created``, ``forum_topic_closed``, ``forum_topic_edited``, ``forum_topic_reopened``, ``general_forum_topic_hidden``, ``general_forum_topic_unhidden`` to :obj:`~pyrogram.types.Message`. +- Add ``custom_action`` to :obj:`~pyrogram.types.Message`. +- Add ``public``, ``for_my_bot``, ``photo_frame_start_timestamp`` to :meth:`~pyrogram.Client.set_profile_photo`. +- Add ``inline_need_location``, ``can_be_edited`` to :obj:`~pyrogram.types.User`. +- Add ``giveaway``, ``giveaway_created``, ``giveaway_completed`` and ``giveaway_winners`` in :obj:`~pyrogram.types.Message` and :obj:`~pyrogram.types.ExternalReplyInfo`. +- Bug fix for :meth:`~pyrogram.Client.send_message` with the ``message_thread_id`` parameter. +- Added ``request_users`` and ``request_chat`` to :obj:`~pyrogram.types.KeyboardButton`. +- **NOTE**: using the ``scheduled`` parameter, please be aware about using the correct :doc:`Message Identifiers <../../topics/message-identifiers>`. + - Add ``is_scheduled`` parameter to :meth:`~pyrogram.Client.delete_messages`. + - Add ``schedule_date`` parameter to :meth:`~pyrogram.Client.edit_message_caption`, :meth:`~pyrogram.Client.edit_message_media`, :meth:`~pyrogram.Client.edit_message_text`. + - Added ``is_scheduled`` to :meth:`~pyrogram.Client.get_messages`. + - Added ``is_scheduled`` to :meth:`~pyrogram.Client.get_chat_history`. +- Added new parameter ``client_platform`` to :obj:`~pyrogram.Client`. +- PR from upstream: `1403 `_. +- Added ``story`` to :obj:`~pyrogram.types.ExternalReplyInfo`. +- Added ``story_id`` to :obj:`~pyrogram.types.ReplyParameters`. +- Added support for clicking (:obj:`~pyrogram.types.WebAppInfo`, :obj:`~pyrogram.types.LoginUrl`, ``user_id``, ``switch_inline_query_chosen_chat``) buttons in :meth:`~pyrogram.types.Message.click`. +- Rewrote :meth:`~pyrogram.Client.download_media` to support Story, and also made it future proof. +- `Fix bug in clicking UpdateBotCallbackQuery buttons `_ + ++-------------+ +| PmOItrOAe | ++-------------+ + +- Renamed ``placeholder`` to ``input_field_placeholder`` in :obj:`~pyrogram.types.ForceReply` and :obj:`~pyrogram.types.ReplyKeyboardMarkup`. +- Add ``link`` parameter in :meth:`~pyrogram.Client.get_messages` +- `fix(filters): add type hints in filters.py `_ +- Documentation Builder Fixes +- `faster-pyrogram `__ is not polished or documented for anyone else's use. We don't have the capacity to support `faster-pyrogram `__ as an independent open-source project, nor any desire for it to become an alternative to Pyrogram. Our goal in making this code available is a unified faster Pyrogram. `... `__ + ++-----------------------------+ +| Leaked Scheme Layers (2) | ++-----------------------------+ + +- `Add ttl_seconds attribute to Voice and VideoNote class `_ +- `#713 `_ +- Removed :obj:`~pyrogram.types.ChatPreview` class, and merged the parameters with the :obj:`~pyrogram.types.Chat` class. +- Added ``description``, ``accent_color_id``, ``is_verified``, ``is_scam``, ``is_fake``, ``is_public``, ``join_by_request`` attributes to the class :obj:`~pyrogram.types.ChatPreview`. +- Added ``force_full`` parameter to :meth:`~pyrogram.Client.get_chat`. +- Bug Fix for :meth:`~pyrogram.Client.get_chat` and :meth:`~pyrogram.Client.join_chat` when ``https://t.me/username`` was passed. +- Added missing attributes to the class :obj:`~pyrogram.types.Story` when it is available. +- Added the field ``reply_to_story`` to the class :obj:`~pyrogram.types.Message`. +- Added the field ``user_chat_id`` to the class :obj:`~pyrogram.types.ChatJoinRequest`. +- Added the field ``switch_inline_query_chosen_chat`` of the type :obj:`~pyrogram.types.SwitchInlineQueryChosenChat` to the class :obj:`~pyrogram.types.InlineKeyboardButton`, which allows bots to switch to inline mode in a chosen chat of the given type. +- Add support for ``pay`` in :obj:`~pyrogram.types.InlineKeyboardButton` +- `#1345 `_ +- `Add undocumented things `_ +- `Add missing enums.SentCodeType `_ +- `#693 `_ +- Revert `e678c05 `_ and stole squashed unauthored changes from `bcd18d5 `_ + ++------------------------+ +| Scheme layer used: 174 | ++------------------------+ + +- Added the field ``story`` to the class :obj:`~pyrogram.types.Message` for messages with forwarded stories. Currently, it holds no information. +- Added the class :obj:`~pyrogram.types.ChatBoostAdded` and the field ``boost_added`` to the class :obj:`~pyrogram.types.Message` for service messages about a user boosting a chat. +- Added the field ``custom_emoji_sticker_set_name`` to the class :obj:`~pyrogram.types.Chat`. +- Added the field ``unrestrict_boost_count`` to the class :obj:`~pyrogram.types.Chat`. +- Added the field ``sender_boost_count`` to the class :obj:`~pyrogram.types.Message`. + ++------------------------+ +| Scheme layer used: 173 | ++------------------------+ + +- Fix ConnectionResetError when only ping task (`#24 `_) +- Added ``is_topic_message`` to the :obj:`~pyrogram.types.Message` object. +- Added ``has_visible_history``, ``has_hidden_members``, ``has_aggressive_anti_spam_enabled``, ``message_auto_delete_time``, ``slow_mode_delay``, ``slowmode_next_send_date``, ``is_forum`` to the :obj:`~pyrogram.types.Chat` object. +- Added ``add_to_recent``, ``story_id`` parameters in :meth:`~pyrogram.Client.set_reaction`. +- Bug fix in parsing ``Vector`` (Thanks to `@AmarnathCJD `_ and `@roj1512 `_). +- Documentation Fix of ``max_concurrent_transmissions`` type hint. +- Bug Fix in the ``get_file`` method. (Thanks to `@ALiwoto `_). +- Added missing attributes to :obj:`~pyrogram.types.ChatPermissions` and :obj:`~pyrogram.types.ChatPrivileges`. +- `Bug Fix for MIN_CHAT_ID `_. +- Added new parameter ``no_joined_notifications`` to :obj:`~pyrogram.Client`. +- Fix history TTL Service Message Parse. +- Thanks to `... `_. If you want to change the location of the ``unknown_errors.txt`` file that is created by :obj:`~pyrogram.Client`, set the environment variable ``PYROGRAM_LOG_UNKNOWN_ERRORS_FILENAME`` value to the path where the file should get created. +- Renamed ``force_document`` to ``disable_content_type_detection`` in :meth:`~pyrogram.Client.send_document` and :meth:`~pyrogram.types.Message.reply_document`. +- Added missing attributes ``added_to_attachment_menu``, ``can_be_added_to_attachment_menu``, ``can_join_groups``, ``can_read_all_group_messages``, ``supports_inline_queries``, ``restricts_new_chats`` to the :obj:`~pyrogram.types.User`. +- Migrate project to ``pyproject.toml`` from ``setup.py``. +- PRs from upstream: `1366 `_, `1305 `_, `1288 `_, `1262 `_, `1253 `_, `1234 `_, `1210 `_, `1201 `_, `1197 `_, `1143 `_, `1059 `_. +- Bug fix for :meth:`~pyrogram.Client.send_audio` and :meth:`~pyrogram.Client.send_voice`. (Thanks to `... `_). +- Add `waveform` parameter to :meth:`~pyrogram.Client.send_voice`. +- Added `view_once` parameter to :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_video_note`, :meth:`~pyrogram.Client.send_voice`. +- Add missing parameters to :meth:`~pyrogram.types.Message.reply_photo`, :meth:`~pyrogram.types.Message.reply_video`, :meth:`~pyrogram.types.Message.reply_video_note`, :meth:`~pyrogram.types.Message.reply_voice`. + ++------------------------+ +| Scheme layer used: 170 | ++------------------------+ + +- Stole documentation from `PyrogramMod `_. +- Renamed ``send_reaction`` to :meth:`~pyrogram.Client.set_reaction`. +- Added support for :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_voice` messages that could be played once. +- Added the field ``via_chat_folder_invite_link`` to the class :obj:`~pyrogram.types.ChatMemberUpdated`. +- **BOTS ONLY**: Added updates about a reaction change on a message with non-anonymous reactions, represented by the class :obj:`~pyrogram.handlers.MessageReactionUpdatedHandler` and the field ``message_reaction`` in the class Update. +- **BOTS ONLY**: Added updates about reaction changes on a message with anonymous reactions, represented by the class :obj:`~pyrogram.handlers.MessageReactionCountUpdatedHandler` and the field ``message_reaction_count`` in the class Update. +- Replaced the parameter ``disable_web_page_preview`` with :obj:`~pyrogram.types.LinkPreviewOptions` in the methods :meth:`~pyrogram.Client.send_message` and :meth:`~pyrogram.Client.edit_message_text`. +- Replaced the field ``disable_web_page_preview`` with :obj:`~pyrogram.types.LinkPreviewOptions` in the class :obj:`~pyrogram.types.InputTextMessageContent`. +- Added missing parameters to :meth:`~pyrogram.Client.forward_messages`. +- Added the class :obj:`~pyrogram.types.ReplyParameters` and replaced parameters ``reply_to_message_id`` in the methods :meth:`~pyrogram.Client.copy_message`, :meth:`~pyrogram.Client.forward_messages`, :meth:`~pyrogram.Client.send_message`, :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_audio`, :meth:`~pyrogram.Client.send_document`, :meth:`~pyrogram.Client.send_sticker`, :meth:`~pyrogram.Client.send_video_note`, :meth:`~pyrogram.Client.send_voice`, :meth:`~pyrogram.Client.send_location`, :meth:`~pyrogram.Client.send_venue`, :meth:`~pyrogram.Client.send_contact`, :meth:`~pyrogram.Client.send_poll`, :meth:`~pyrogram.Client.send_dice`, :meth:`~pyrogram.Client.send_game`, :meth:`~pyrogram.Client.send_media_group`, :meth:`~pyrogram.Client.copy_media_group`, :meth:`~pyrogram.Client.send_inline_bot_result`, :meth:`~pyrogram.Client.send_cached_media`, and the corresponding reply_* methods with the field ``reply_parameters`` of type :obj:`~pyrogram.types.ReplyParameters`. +- Bug fixes for sending ``ttl_seconds`` and ``has_spoiler``. + ++------------------------+ +| Scheme layer used: 169 | ++------------------------+ + +- Changed condition in :meth:`~pyrogram.Client.join_chat` and :meth:`~pyrogram.Client.get_chat`. +- Added ``disable_content_type_detection`` parameter to :obj:`~pyrogram.types.InputMediaVideo`. +- Added ``has_spoiler`` parameter to :meth:`~pyrogram.Client.copy_message`. +- Improved :meth:`~pyrogram.Client.get_chat_history`: add ``min_id`` and ``max_id`` params. +- `Prevent connection to dc every time in get_file `_ +- Added ``_raw`` to the :obj:`~pyrogram.types.Chat`, :obj:`~pyrogram.types.Dialog`, :obj:`~pyrogram.types.Message` and :obj:`~pyrogram.types.User` objects. +- Fix downloading media to ``WORKDIR`` when ``WORKDIR`` was not specified. +- `Update multiple fragment chat usernames `_ +- `Custom Storage Engines `_ +- Documentation fix for ``user.mention`` in :obj:`~pyrogram.types.User`. + ++------------------------+ +| Scheme layer used: 167 | ++------------------------+ + +- Fixed the TL flags being Python reserved keywords: ``from`` and ``self``. + ++------------------------+ +| Scheme layer used: 161 | ++------------------------+ + +- Added ``my_stories_from`` to the :meth:`~pyrogram.Client.block_user` and :meth:`~pyrogram.Client.unblock_user` methods. + ++------------------------+ +| Scheme layer used: 160 | ++------------------------+ + +- Added ``message_thread_id`` to the methods :meth:`~pyrogram.Client.copy_message`, :meth:`~pyrogram.Client.forward_messages`, :meth:`~pyrogram.Client.send_message`, :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_audio`, :meth:`~pyrogram.Client.send_document`, :meth:`~pyrogram.Client.send_sticker`, :meth:`~pyrogram.Client.send_video_note`, :meth:`~pyrogram.Client.send_voice`, :meth:`~pyrogram.Client.send_location`, :meth:`~pyrogram.Client.send_venue`, :meth:`~pyrogram.Client.send_contact`, :meth:`~pyrogram.Client.send_poll`, :meth:`~pyrogram.Client.send_dice`, :meth:`~pyrogram.Client.send_game`, :meth:`~pyrogram.Client.send_media_group`, :meth:`~pyrogram.Client.copy_media_group`, :meth:`~pyrogram.Client.send_inline_bot_result`, :meth:`~pyrogram.Client.send_cached_media`. diff --git a/docs/source/releases/index.rst b/docs/source/releases/index.rst new file mode 100644 index 0000000000..0bfbafd4e4 --- /dev/null +++ b/docs/source/releases/index.rst @@ -0,0 +1,10 @@ +============== +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 changes in order to find incompatible code in your application, but also to take advantage of new features and improvements. + +- :doc:`Changes in this Fork ` +- `Previous Changes `_. \ No newline at end of file diff --git a/docs/source/requirements.txt b/docs/source/requirements.txt new file mode 100644 index 0000000000..dc06c27f17 --- /dev/null +++ b/docs/source/requirements.txt @@ -0,0 +1,5 @@ +Sphinx<=7.2.6 +furo<=2023.9.10 +sphinx-autobuild<=2021.3.14 +sphinx-copybutton<=0.5.2 +pygments<=2.17.2 diff --git a/docs/source/start/auth.rst b/docs/source/start/auth.rst new file mode 100644 index 0000000000..7364701713 --- /dev/null +++ b/docs/source/start/auth.rst @@ -0,0 +1,89 @@ +Authorization +============= + +Once a :doc:`project is set up `, 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 ``name`` of your choice (e.g.: "my_account") and call +the :meth:`~pyrogram.Client.run` method: + +.. code-block:: python + + from pyrogram import Client + + api_id = 12345 + api_hash = "0123456789abcdef0123456789abcdef" + + app = Client("my_account", api_id=api_id, api_hash=api_hash) + + app.run() + +This starts an interactive shell asking you to input your **phone number**, including your `Country Code`_ (the plus +``+`` and minus ``-`` symbols can be omitted) and the **phone code** you will receive in your devices that are already +authorized or via SMS: + +.. code-block:: text + + Enter phone number: +1-123-456-7890 + Is "+1-123-456-7890" correct? (y/n): y + Enter phone code: 12345 + Logged in successfully + +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 is personal and will be loaded again when you restart your app. +You can now remove the api_id and api_hash values from the code as they are not needed anymore. + +.. 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 <../start/setup>` with Pyrogram, even when using bots. + +The authorization process is automatically managed. All you need to do is choose a ``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 + + api_id = 12345 + api_hash = "0123456789abcdef0123456789abcdef" + bot_token = "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11" + + app = Client( + "my_bot", + api_id=api_id, api_hash=api_hash, + bot_token=bot_token + ) + + app.run() + +.. _Country Code: https://en.wikipedia.org/wiki/List_of_country_calling_codes +.. _Bot Father: https://t.me/botfather + +.. note:: + + The API key (api_id and api_hash) and the bot_token are not required anymore after a successful authorization. + This means you can now simply use the following: + + .. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + app.run() \ 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 0000000000..f6346fd1b8 --- /dev/null +++ b/docs/source/start/errors.rst @@ -0,0 +1,107 @@ +Error Handling +============== + +Errors can 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`` 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:: + + Avoid catching this error everywhere, 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 are subclass-ed from the ``RPCError``: + +.. code-block:: python + + from pyrogram.errors import BadRequest, Forbidden, ... + +- :doc:`303 - SeeOther <../api/errors/see-other>` +- :doc:`400 - BadRequest <../api/errors/bad-request>` +- :doc:`401 - Unauthorized <../api/errors/unauthorized>` +- :doc:`403 - Forbidden <../api/errors/forbidden>` +- :doc:`406 - NotAcceptable <../api/errors/not-acceptable>` +- :doc:`420 - Flood <../api/errors/flood>` +- :doc:`500 - InternalServerError <../api/errors/internal-server-error>` + +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 about a specific error yet, it raises a generic error from its known category, +for example, an unknown error with error code ``400``, will be raised as a ``BadRequest``. This way you can catch the +whole category of errors and be sure to also handle these unknown errors. + +.. admonition :: RPC Errors + :class: tip + + There isn't any official list of all possible RPC errors, so the list of known errors is provided on a best-effort basis. When new methods are available, the list may be lacking since we simply don't know what errors can raise from them. Pyrogram creates an `unknown_errors.txt` file in the root directory from where the `Client` is run. + +.. admonition :: `... `__ + + If you want the file to be created in a different location, set the ``PYROGRAM_LOG_UNKNOWN_ERRORS_FILENAME`` to an absolute file path of your choice. + + +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, some other errors contain the DC number on which the request must be repeated on. +The value is stored in the ``value`` attribute of the exception object: + +.. code-block:: python + + import asyncio + from pyrogram.errors import FloodWait + + ... + try: + ... # Your code + except FloodWait as e: + await asyncio.sleep(e.value) # Wait N seconds before continuing + ... \ No newline at end of file diff --git a/docs/source/start/examples/bot_keyboards.rst b/docs/source/start/examples/bot_keyboards.rst new file mode 100644 index 0000000000..196eaef155 --- /dev/null +++ b/docs/source/start/examples/bot_keyboards.rst @@ -0,0 +1,70 @@ +bot_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. + +:meth:`~pyrogram.Client.send_message` is used as example, but a keyboard can be sent with any other send_* methods, +like :meth:`~pyrogram.Client.send_audio`, :meth:`~pyrogram.Client.send_document`, :meth:`~pyrogram.Client.send_location`, etc... + +.. include:: /_includes/usable-by/bots.rst + +.. code-block:: python + + from pyrogram import Client + from pyrogram.types import (ReplyKeyboardMarkup, InlineKeyboardMarkup, + InlineKeyboardButton) + + # Create a client using your bot token + app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11") + + + async def main(): + async with app: + await app.send_message( + chat_id="@PyrogramChat", # Edit this + text="This is a ReplyKeyboardMarkup example", + reply_markup=ReplyKeyboardMarkup( + [ + ["A", "B", "C", "D"], # First row + ["E", "F", "G"], # Second row + ["H", "I"], # Third row + ["J"] # Fourth row + ], + resize_keyboard=True # Make the keyboard smaller + ) + ) + + await app.send_message( + chat_id="@PyrogramChat", # Edit this + text="This is a InlineKeyboardMarkup example", + reply_markup=InlineKeyboardMarkup( + [ + [ # First row + InlineKeyboardButton( # Generates a callback query when pressed + "Button", + callback_data="data" + ), + InlineKeyboardButton( # Opens a web URL + "URL", + url="https://docs.pyrogram.org" + ), + ], + [ # Second row + InlineKeyboardButton( # Opens the inline interface + "Choose chat", + switch_inline_query="pyrogram" + ), + InlineKeyboardButton( # Opens the inline interface in the current chat + "Inline here", + switch_inline_query_current_chat="pyrogram" + ) + ] + ] + ) + ) + + + app.run(main()) diff --git a/docs/source/start/examples/callback_queries.rst b/docs/source/start/examples/callback_queries.rst new file mode 100644 index 0000000000..baf96dafb5 --- /dev/null +++ b/docs/source/start/examples/callback_queries.rst @@ -0,0 +1,23 @@ +callback_queries +================ + +This example shows how to handle callback queries, i.e.: queries coming from inline button presses. +It uses the :meth:`~pyrogram.Client.on_callback_query` decorator to register a :obj:`~pyrogram.handlers.CallbackQueryHandler`. + +.. include:: /_includes/usable-by/bots.rst + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11") + + + @app.on_callback_query() + async def answer(client, callback_query): + await callback_query.answer( + f"Button contains: '{callback_query.data}'", + show_alert=True) + + + app.run() # Automatically start() and idle() \ No newline at end of file diff --git a/docs/source/start/examples/echo_bot.rst b/docs/source/start/examples/echo_bot.rst new file mode 100644 index 0000000000..c333fdbc09 --- /dev/null +++ b/docs/source/start/examples/echo_bot.rst @@ -0,0 +1,23 @@ +echo_bot +======== + +This simple echo bot replies to every private text message. + +It uses the :meth:`~pyrogram.Client.on_message` decorator to register a :obj:`~pyrogram.handlers.MessageHandler` and applies two filters on it: +``filters.text`` and ``filters.private`` to make sure it will reply to private text messages only. + +.. include:: /_includes/usable-by/users-bots.rst + +.. code-block:: python + + from pyrogram import Client, filters + + app = Client("my_account") + + + @app.on_message(filters.text & filters.private) + async def echo(client, message): + await message.reply(message.text) + + + app.run() # Automatically start() and idle() diff --git a/docs/source/start/examples/get_chat_history.rst b/docs/source/start/examples/get_chat_history.rst new file mode 100644 index 0000000000..dd84064250 --- /dev/null +++ b/docs/source/start/examples/get_chat_history.rst @@ -0,0 +1,22 @@ +get_history +=========== + +This example shows how to get the full message history of a chat, starting from the latest message. + +.. include:: /_includes/usable-by/users.rst + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + + async def main(): + async with app: + # "me" refers to your own chat (Saved Messages) + async for message in app.get_chat_history("me"): + print(message) + + + app.run(main()) \ No newline at end of file diff --git a/docs/source/start/examples/get_chat_members.rst b/docs/source/start/examples/get_chat_members.rst new file mode 100644 index 0000000000..058e054d12 --- /dev/null +++ b/docs/source/start/examples/get_chat_members.rst @@ -0,0 +1,24 @@ +get_chat_members +================ + +This example shows how to get all the members of a chat. + +.. include:: /_includes/usable-by/users-bots.rst + +.. code-block:: python + + from pyrogram import Client + + # Target channel/supergroup + TARGET = -100123456789 + + app = Client("my_account") + + + async def main(): + async with app: + async for member in app.get_chat_members(TARGET): + print(member) + + + app.run(main()) \ No newline at end of file diff --git a/docs/source/start/examples/get_dialogs.rst b/docs/source/start/examples/get_dialogs.rst new file mode 100644 index 0000000000..b089c118a3 --- /dev/null +++ b/docs/source/start/examples/get_dialogs.rst @@ -0,0 +1,21 @@ +get_dialogs +=========== + +This example shows how to get the full dialogs list (as user). + +.. include:: /_includes/usable-by/users.rst + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + + async def main(): + async with app: + async for dialog in app.get_dialogs(): + print(dialog.chat.title or dialog.chat.first_name) + + + app.run(main()) \ No newline at end of file diff --git a/docs/source/start/examples/hello_world.rst b/docs/source/start/examples/hello_world.rst new file mode 100644 index 0000000000..180336379b --- /dev/null +++ b/docs/source/start/examples/hello_world.rst @@ -0,0 +1,22 @@ +hello_world +=========== + +This example demonstrates a basic API usage + +.. include:: /_includes/usable-by/users.rst + +.. code-block:: python + + from pyrogram import Client + + # Create a new Client instance + app = Client("my_account") + + + async def main(): + async with app: + # Send a message, Markdown is enabled by default + await app.send_message(chat_id="me", text="Hi there! I'm using **Pyrogram**") + + + app.run(main()) diff --git a/docs/source/start/examples/index.rst b/docs/source/start/examples/index.rst new file mode 100644 index 0000000000..a6236df9ec --- /dev/null +++ b/docs/source/start/examples/index.rst @@ -0,0 +1,50 @@ +Examples +======== + +This page contains example scripts to show you how Pyrogram looks like. + +Every script is working right away (provided you correctly set up your credentials), meaning you can simply copy-paste +and run. The only things you have to change are session names and target chats, where applicable. + +The examples listed below can be treated as building blocks for your own applications and are meant to be simple enough +to give you a basic idea. + +----- + +.. csv-table:: + :header: Example, Description + :widths: auto + :align: center + + :doc:`hello_world`, "Demonstration of basic API usage" + :doc:`echo_bot`, "Echo every private text message" + :doc:`tg_business_echo_bot`, "Reply back the same message, in `Business `_ Chats" + :doc:`welcome_bot`, "An example Welcome Bot, updated to support the `new Telegram Updates `_" + :doc:`get_chat_history`, "Get the full message history of a chat" + :doc:`get_chat_members`, "Get all the members of a chat" + :doc:`get_dialogs`, "Get all of your dialog chats" + :doc:`callback_queries`, "Handle callback queries (as bot) coming from inline button presses" + :doc:`inline_queries`, "Handle inline queries (as bot) and answer with results" + :doc:`use_inline_bots`, "Query an inline bot (as user) and send a result to a chat" + :doc:`bot_keyboards`, "Send normal and inline keyboards using regular bots" + :doc:`send_voice`, "Download audio file and reupload as Voice Message with waveforms" + :doc:`raw_updates`, "Handle raw updates (old, should be avoided)" + +For more advanced examples, see https://github.com/ColinShark/Pyrogram-Snippets. + +.. toctree:: + :hidden: + + hello_world + echo_bot + tg_business_echo_bot + welcome_bot + get_chat_history + get_chat_members + get_dialogs + callback_queries + inline_queries + use_inline_bots + bot_keyboards + send_voice + raw_updates diff --git a/docs/source/start/examples/inline_queries.rst b/docs/source/start/examples/inline_queries.rst new file mode 100644 index 0000000000..bc60f95960 --- /dev/null +++ b/docs/source/start/examples/inline_queries.rst @@ -0,0 +1,61 @@ +inline_queries +============== + +This example shows how to handle inline queries. + +Two results are generated when users invoke the bot inline mode, e.g.: @pyrogrambot hi. +It uses the :meth:`~pyrogram.Client.on_inline_query` decorator to register an :obj:`~pyrogram.handlers.InlineQueryHandler`. + +.. include:: /_includes/usable-by/bots.rst + +.. code-block:: python + + from pyrogram import Client + from pyrogram.types import (InlineQueryResultArticle, InputTextMessageContent, + InlineKeyboardMarkup, InlineKeyboardButton) + + app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11") + + + @app.on_inline_query() + async def answer(client, inline_query): + await inline_query.answer( + results=[ + InlineQueryResultArticle( + title="Installation", + input_message_content=InputTextMessageContent( + "Here's how to install **Pyrogram**" + ), + url="https://docs.pyrogram.org/intro/install", + description="How to install Pyrogram", + reply_markup=InlineKeyboardMarkup( + [ + [InlineKeyboardButton( + "Open website", + url="https://docs.pyrogram.org/intro/install" + )] + ] + ) + ), + InlineQueryResultArticle( + title="Usage", + input_message_content=InputTextMessageContent( + "Here's how to use **Pyrogram**" + ), + url="https://docs.pyrogram.org/start/invoking", + description="How to use Pyrogram", + reply_markup=InlineKeyboardMarkup( + [ + [InlineKeyboardButton( + "Open website", + url="https://docs.pyrogram.org/start/invoking" + )] + ] + ) + ) + ], + cache_time=1 + ) + + + app.run() # Automatically start() and idle() \ No newline at end of file diff --git a/docs/source/start/examples/raw_updates.rst b/docs/source/start/examples/raw_updates.rst new file mode 100644 index 0000000000..797457d2e0 --- /dev/null +++ b/docs/source/start/examples/raw_updates.rst @@ -0,0 +1,20 @@ +raw_updates +=========== + +This example shows how to handle raw updates. + +.. include:: /_includes/usable-by/users-bots.rst + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + + @app.on_raw_update() + async def raw(client, update, users, chats): + print(update) + + + app.run() # Automatically start() and idle() diff --git a/docs/source/start/examples/send_voice.rst b/docs/source/start/examples/send_voice.rst new file mode 100644 index 0000000000..e6ca71bdc5 --- /dev/null +++ b/docs/source/start/examples/send_voice.rst @@ -0,0 +1,19 @@ +send_voice +=========== + +.. include:: /_includes/usable-by/users-bots.rst + +.. code-block:: python + + from pyrogram import Client, filters + + app = Client("my_account") + + @app.on_message(filters.audio) + async def re_upload_as_voice(client, message): + # Downlaod the Voice + o = await message.download() + # Re Upload the Audio as Telegram Voice Message + await message.reply_voice(o, waveform=b'\xff\xbf\xf7\xde\xff\xcf\xbd\xbd\xf7\xfb\xff\xff\xff\xde{\xff?\xf7\xf6\xde\xef\xff\xff\xff{\xef\xfd\xff\xdc\xdb{\xbf\xff\xff\xff\xef\xbd\xf7\xffso\xef\xfd\xfe\xff') + + app.run() # Automatically start() and idle() diff --git a/docs/source/start/examples/tg_business_echo_bot.rst b/docs/source/start/examples/tg_business_echo_bot.rst new file mode 100644 index 0000000000..1ebd2f4fe0 --- /dev/null +++ b/docs/source/start/examples/tg_business_echo_bot.rst @@ -0,0 +1,26 @@ +business_echo_bot +================== + +This simple echo bot replies to every private business message. + +It uses the :meth:`~pyrogram.Client.on_message` decorator to register a :obj:`~pyrogram.handlers.MessageHandler` and applies two filters on it: +``filters.tg_business`` and ``filters.private`` to make sure it will reply to private business messages only. + +.. include:: /_includes/usable-by/bots.rst + +.. code-block:: python + + from pyrogram import Client, filters + + app = Client("my_account") + + + @app.on_message(filters.tg_business & filters.private) + async def echo(client, message): + await message.copy(message.chat.id) + + + app.run() # Automatically start() and idle() + + +You can explore more :doc:`advanced usages <../../topics/advanced-usage>` by directly working with the **raw Telegram API**. diff --git a/docs/source/start/examples/use_inline_bots.rst b/docs/source/start/examples/use_inline_bots.rst new file mode 100644 index 0000000000..ee6e375f9a --- /dev/null +++ b/docs/source/start/examples/use_inline_bots.rst @@ -0,0 +1,27 @@ +use_inline_bots +=============== + +This example shows how to query an inline bot (as user). + +.. include:: /_includes/usable-by/users.rst + +.. code-block:: python + + from pyrogram import Client + + # Create a new Client + app = Client("my_account") + + + async def main(): + async with app: + # Get bot results for "hello" from the inline bot @vid + bot_results = await app.get_inline_bot_results("vid", "hello") + + # Send the first result to your own chat (Saved Messages) + await app.send_inline_bot_result( + "me", bot_results.query_id, + bot_results.results[0].id) + + + app.run(main()) \ No newline at end of file diff --git a/docs/source/start/examples/welcome_bot.rst b/docs/source/start/examples/welcome_bot.rst new file mode 100644 index 0000000000..be9a80afcf --- /dev/null +++ b/docs/source/start/examples/welcome_bot.rst @@ -0,0 +1,37 @@ +welcome_bot +=========== + +This example uses the ``emoji`` module to easily add emoji in your text messages and ``filters`` +to make it only work for specific messages in a specific chat. + +.. include:: /_includes/usable-by/bots.rst + +.. code-block:: python + + from pyrogram import Client, emoji, filters + + # Target chat. Can also be a list of multiple chat ids/usernames + TARGET = -100123456789 + # Welcome message template + MESSAGE = "{} Welcome to [Pyrogram](https://docs.pyrogram.org/)'s group chat {}!" + + app = Client("my_account") + + + # Filter in only new_chat_members updates generated in TARGET chat + @app.on_chat_member_updated(filters.chat(TARGET)) + async def welcome(client, chat_member_updated): + if chat_member_updated.old_chat_member: + return # it's not a new join + # Build the new members list (with mentions) by using their first_name + new_member = chat_member_updated.new_chat_member.user.mention + added_by = message.from_user.id # is equal to new_member if user wasn't added + # Build the welcome message by using an emoji and the list we built above + text = MESSAGE.format(emoji.SPARKLES, new_member) + # send a message to the chat + await client.send_message( + chat_id=chat_member_updated.chat.id, + text=text + ) + + app.run() # Automatically start() and idle() diff --git a/docs/source/start/invoking.rst b/docs/source/start/invoking.rst new file mode 100644 index 0000000000..4cf60ffa43 --- /dev/null +++ b/docs/source/start/invoking.rst @@ -0,0 +1,106 @@ +Invoking 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 framework. + + +----- + +Basic Usage +----------- + +Making API calls with Pyrogram is very simple. Here's a basic example we are going to examine step by step: + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + + async def main(): + async with app: + await app.send_message(chat_id="me", text="Hi!") + + + app.run(main()) + +Step-by-step +^^^^^^^^^^^^ + +#. Let's begin by importing the Client class. + + .. 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") + +#. Async methods must be invoked within an async context. + Here we define an async function and put our code inside. Also notice the ``await`` keyword in front of the method + call; this is required for all asynchronous methods. + + .. code-block:: python + + async def main(): + async with app: + await app.send_message(chat_id="me", text="Hi!") + +#. Finally, we tell Python to schedule our ``main()`` async function by using Pyrogram's :meth:`~pyrogram.Client.run` + method. + + .. code-block:: python + + app.run(main()) + +Context Manager +--------------- + +The ``async with`` statement starts a context manager, which is used as a shortcut for starting, executing and stopping +the Client, asynchronously. It does so by automatically calling :meth:`~pyrogram.Client.start` and +:meth:`~pyrogram.Client.stop` in a more convenient way which also gracefully stops the client, even in case of +unhandled exceptions in your code. + +Below there's the same example as above, but without the use of the context manager: + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + + async def main(): + await app.start() + await app.send_message(chat_id="me", text="Hi!") + await app.stop() + + + app.run(main()) + +Using asyncio.run() +------------------- + +Alternatively to the :meth:`~pyrogram.Client.run` method, you can use Python's ``asyncio.run()`` to execute the main +function, with one little caveat: the Client instance (and possibly other asyncio resources you are going to use) must +be instantiated inside the main function. + +.. code-block:: python + + import asyncio + from pyrogram import Client + + + async def main(): + app = Client("my_account") + + async with app: + await app.send_message(chat_id="me", text="Hi!") + + + asyncio.run(main()) \ No newline at end of file diff --git a/docs/source/start/setup.rst b/docs/source/start/setup.rst new file mode 100644 index 0000000000..65d5d8a317 --- /dev/null +++ b/docs/source/start/setup.rst @@ -0,0 +1,35 @@ +Project Setup +============= + +We have just :doc:`installed Pyrogram <../intro/install>`. In this page we'll discuss what you need to do in order to set up a +project with the framework. + +----- + +API Key +------- + +The first step requires you to obtain a valid Telegram API key (api_id and api_hash pair): + +#. Visit https://my.telegram.org/apps and log in with your Telegram account. +#. Fill out the form with your details and register a new Telegram application. +#. Done. The API key consists of two parts: **api_id** and **api_hash**. Keep it secret. + +.. note:: + + The API key defines a token for a Telegram *application* you are going to build. + This means that you are able to authorize multiple users or bots with a single API key. + +Configuration +------------- + +Having the API key from the previous step in handy, we can now begin to configure a Pyrogram project: pass your API key to Pyrogram by using the *api_id* and *api_hash* parameters of the Client class: + +.. code-block:: python + + from pyrogram import Client + + api_id = 12345 + api_hash = "0123456789abcdef0123456789abcdef" + + app = Client("my_account", api_id=api_id, api_hash=api_hash) \ No newline at end of file diff --git a/docs/source/start/updates.rst b/docs/source/start/updates.rst new file mode 100644 index 0000000000..495298d2b1 --- /dev/null +++ b/docs/source/start/updates.rst @@ -0,0 +1,74 @@ +Handling Updates +================ + +:doc:`Invoking API methods ` sequentially is one way to use Pyrogram. This page deals with Telegram updates +and how to handle new incoming messages or other events in Pyrogram. + + +----- + +Defining Updates +---------------- + +Updates are 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 examine the one which will be in charge for handling :class:`~pyrogram.types.Message` +updates coming from all around your chats. Every other kind of handler shares the same setup logic and you should not +have troubles settings them up once you learn from this section. + +Using Decorators +^^^^^^^^^^^^^^^^ + +The most elegant way to register a message handler is by using the :meth:`~pyrogram.Client.on_message` decorator: + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + + @app.on_message() + async def my_handler(client, message): + await message.forward("me") + + + app.run() + +The defined function ``my_handler``, which accepts the two arguments *(client, message)*, will be the function that gets +executed every time a new message arrives. + +In the last line we see again the :meth:`~pyrogram.Client.run` method, this time used without any argument. +Its purpose here is simply to automatically :meth:`~pyrogram.Client.start`, keep the Client online so that it can listen +for updates and :meth:`~pyrogram.Client.stop` it once you hit ``CTRL+C``. + +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. It is useful in case you want to programmatically add handlers. + +.. code-block:: python + + from pyrogram import Client + from pyrogram.handlers import MessageHandler + + + async def my_function(client, message): + await message.forward("me") + + + app = Client("my_account") + + my_handler = MessageHandler(my_function) + app.add_handler(my_handler) + + app.run() diff --git a/docs/source/static/css/all.min.css b/docs/source/static/css/all.min.css new file mode 100644 index 0000000000..2bb265353d --- /dev/null +++ b/docs/source/static/css/all.min.css @@ -0,0 +1 @@ +@import "https://fonts.googleapis.com/css2?family=Bitter:wght@400;600&family=Open+Sans:ital,wght@0,400;0,600;1,400;1,600&family=Ubuntu+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap";@font-face{font-family:taratype;src:url(./../fonts/TaraType.ttf) format("truetype")}:root{--border-radius: 0.5em}body{font-family:open sans,sans-serif;--color-brand-primary: #404040;--color-brand-content: #93774b;--color-foreground-primary: #404040;--color-background-primary: #f9f8f7;--color-background-secondary: #f3f2f1;--color-admonition-background: #eeeeee;--color-table-border: #e1e4e5;--color-background-border: #dddddd;--color-guilabel-background: #f3f2f1;--color-guilabel-border: #dddddd;--color-admonition-title--note: #93774b;--color-admonition-title-background--note: #e4e0d7;--color-admonition-title--seealso: #93774b;--color-admonition-title-background--seealso: #e4e0d7;--color-border: #dddddd;--color-button: #f3f6f6;--color-background-highlight: #f3f2f1;--color-title: #303030;--color-link-hover: #bf431d;--color-carbon-ads-link: #606060;--color-carbon-ads-text: #637381;--color-carbon-ads-poweredby: #d0d0d0;--color-carbon-ads-background: #f7f6f5;--color-carbon-ads-border: #dddddd;--color-pyrogram-text: #3b3936;--color-support-pyrogram: #5e594c;--color-strong: #404040;--color-green: darkgreen;--color-red: darkred;--font-size--small: 100%;--font-size--small--2: 97%;--font-size--small--3: 94%;--font-size--small--4: 91%;--header-height: calc(var(--sidebar-item-line-height) + var(--sidebar-item-spacing-vertical)*6);-webkit-font-smoothing:auto;font-size:16px}@media(prefers-color-scheme:dark){body:not([data-theme=light]){--color-brand-primary: #bfbcb9;--color-brand-content: #b7a280;--color-foreground-primary: #bfbcb9;--color-background-primary: #202020;--color-background-secondary: #181818;--color-admonition-background: #282828;--color-table-border: #707070;--color-guilabel-background: #323232;--color-guilabel-border: #505050;--color-admonition-title--note: #b7a280;--color-admonition-title-background--note: #303030;--color-admonition-title--seealso: #b7a280;--color-admonition-title-background--seealso: #303030;--color-border: #505050;--color-button: #303030;--color-background-highlight: #323232;--color-title: #b9b9b9;--color-link-hover: #e85823;--color-carbon-ads-link: #aaaaaa;--color-carbon-ads-text: #bfbcb9;--color-carbon-ads-poweredby: #505050;--color-carbon-ads-background: #323232;--color-carbon-ads-border: #505050;--color-pyrogram-text: #b9b9b9;--color-support-pyrogram: #999999;--color-strong: #cfccc9;--color-green: green;--color-red: red}}h1,h2,h3,h4,h5,h6{font-family:Bitter,serif;font-weight:600;color:var(--color-title)}h1{font-size:175%}h2{font-size:150%}h3{font-size:125%}h4{font-size:115%}h5{font-size:110%}h6{font-size:100%}article[role=main] .highlight pre{font-family:ubuntu mono,monospace;font-size:var(--font-size--normal);line-height:1.2;border:1px solid var(--color-border);border-radius:var(--border-radius);background-color:var(--color-background-highlight)}.highlight{border-radius:var(--border-radius)}p code.literal{padding:0 4px;background-color:var(--color-background-highlight);border-color:var(--color-border);border-width:0;border-radius:.5em}p code.xref.literal{border-width:1px}.admonition{border-radius:var(--border-radius);font-size:var(--font-size--normal);border-left:0}p.admonition-title{font-size:var(--font-size--normal);font-weight:700}p.admonition-title:before{height:21px;width:21px}.related-pages a{font-size:var(--font-size--normal);background-color:var(--color-button);border-radius:var(--border-radius);border:1px solid rgba(0,0,0,.1);box-shadow:inset 0 1px 2px -1px hsl(0deg 0% 100%/50%),inset 0 -2px 0 0 rgb(0 0 0/10%)}.related-pages a.prev-page{padding:6px 10px}.related-pages a.next-page{padding:6px 10px}.page-info .context{font-size:18px;color:var(--color-foreground-primary)}.sidebar-container{width:18em}@media(max-width:67em){.sidebar-drawer{width:18em;left:-18em}}.toc-drawer{width:18em}@media(max-width:82em){.toc-drawer{right:-18em}}table.docutils{border:1px solid var(--color-table-border);border-radius:var(--border-radius);border-collapse:separate;overflow:hidden;width:100%}table.docutils th{border-right:none}table.docutils td{border-bottom-width:1px;border-left-width:1px;border-top-width:0;border-right-width:0}table.docutils td p{padding:5px}table.docutils:not(.field-list) tr:nth-child(2n-1) td{background-color:var(--color-background-highlight)}table.docutils tbody>td:first-child{border-left-width:0}table.docutils tbody>tr:last-child td{border-bottom-width:0}table.docutils th:last-child{width:100%}table>caption{font-size:24px;font-weight:700;font-family:bitter;border-bottom:1px solid var(--color-table-border);padding:5px}dt{text-transform:none!important;background-color:var(--color-background-highlight)!important;border-radius:var(--border-radius)!important;padding:2px 8px;width:fit-content;border-left:2px solid var(--color-border)!important}.sig-prename,.sig-name{color:var(--color-foreground-primary)}.banner{border-radius:var(--border-radius);border:1px solid #888;color:#888;padding:15px;margin:20px auto;text-align:center;font-size:20px;width:auto;background-image:repeating-linear-gradient(135deg,rgba(128,128,128,0.1),transparent 10%)}.top-bar{display:flex;align-items:center;justify-content:space-between;margin-top:20px}.github-buttons{display:flex}.github-button{border-radius:var(--border-radius);overflow:hidden;margin-left:10px;border:1px solid var(--color-border);border-spacing:0}.github-button td{padding:4px 8px;border-left:1px solid var(--color-border);width:100%;height:100%}.github-button td:first-child{border-left-width:0;background-color:var(--color-background-highlight)}.horizontal-line{margin-top:25px;border-top:1px solid var(--color-background-border)}@media(max-width:67em){.top-bar{display:flex;flex-direction:column;align-items:flex-end}.view-on-github{margin-bottom:10px}}.index-logo{margin-bottom:-30px}.sidebar-brand{margin-bottom:10px;padding:0 2px}.sidebar-logo-container{margin-top:20px;margin-bottom:0}.sidebar-logo{width:48px;display:inline}.pyrogram-text{font-family:TaraType,sans-serif;font-size:calc(var(--font-size--normal) * 3);color:var(--color-pyrogram-text);letter-spacing:.0425em;position:relative;top:-15px;font-weight:700;display:inline}.pyrogram-text-index{font-size:72px;position:relative}.pyrogram-logo-index{display:inline}.pyrogram-logo-index img{width:72px}.support-pyrogram{color:var(--color-support-pyrogram);border:1px solid var(--color-support-pyrogram);border-radius:var(--border-radius);width:fit-content;margin:auto;user-select:none;padding:6px 12px;margin-bottom:10px}.support-pyrogram:hover{background-color:rgba(255,255,255,.05)}.pyrogram-version{border-top:1px solid var(--color-background-border);border-bottom:1px solid var(--color-background-border);border-radius:0;padding:10px;margin-top:10px;margin-bottom:20px;text-align:center;color:var(--color-foreground-muted)}.ca-wrap{text-align:center;margin-top:20px}#carbonads{display:inline-block;overflow:hidden;padding:6px;line-height:1.25;max-width:330px;font-size:14px;border:1px var(--color-carbon-ads-border) solid;background-color:var(--color-carbon-ads-background);border-radius:var(--border-radius)}#carbonads a{color:var(--color-carbon-ads-link);text-decoration:none}#carbonads span{position:relative;display:block;overflow:hidden;border-radius:0}.carbon-img{float:left;margin-right:1em}.carbon-img img{display:block;border-radius:var(--border-radius)}.carbon-text{display:block;float:left;max-width:calc(100% - 128px - 1em);text-align:left;color:var(--color-carbon-ads-text);margin-left:-6px}.carbon-poweredby{position:absolute;left:calc(100% - 74px - 1em);bottom:0;display:block;font-size:12px;color:var(--color-carbon-ads-poweredby);font-weight:500}#carbonads a.carbon-poweredby{color:var(--color-carbon-ads-poweredby)}.footer{display:flex;align-items:center;justify-content:space-between;font-size:var(--font-size--normal)}.right{float:right}.left{float:left}.footer-logo{display:flex;max-height:80px;padding-right:5px}.copyright{display:flex;align-items:center}.links a{padding-left:5px}.mobile-header{font-family:TaraType,monospace;font-weight:700;letter-spacing:.0425em}.mobile-header .header-center img{width:38px}.mobile-header .header-center a{display:flex;align-items:flex-end}@media(max-width:67em){.mobile-header{align-items:center}.mobile-header .header-right{padding-top:10px;align-items:baseline;margin-right:20px;height:unset}.mobile-header .header-left{align-items:baseline;margin-left:10px;height:unset}}.mobile-header-title{position:absolute;margin-left:auto;margin-right:auto;width:fit-content;left:0;right:0;text-align:center;margin-top:10px}.mobile-header-title a{color:var(--color-foreground-primary)}.theme-toggle svg{width:1.75rem;height:1.75rem}.icon svg{width:1.75rem;height:1.75rem}.sidebar-tree label{margin-right:10px}blockquote{border-radius:var(--border-radius)}.bottom-of-page{font-size:var(--font-size--normal)}a{text-decoration:none}a:hover,a.reference:hover,.sidebar-tree .toctree-l1>.reference:hover{color:var(--color-link-hover)}b,strong{color:var(--color-strong)}.content{justify-content:unset}.sidebar-tree .current>.reference::before{content:"➤ "}.toc-tree .reference::before{content:"• "}.toc-tree li.scroll-current>.reference:before{content:"➤ "}table.hlist{margin-top:-20px}.highlight button.copybtn svg{color:var(--color-foreground-primary)}.toc-tree .reference{color:var(--color-brand-primary)}ul.breadcrumbs{margin-bottom:0;padding:0;list-style:none;font-size:18px}ul.breadcrumbs li{display:inline}.usable-by{border:1px solid var(--color-border);border-radius:var(--border-radius);padding:2px 5px;background-color:var(--color-background-highlight)}.content-icon-container{margin-top:1.9rem;margin-bottom:0} \ No newline at end of file diff --git a/docs/source/static/css/custom.css b/docs/source/static/css/custom.css new file mode 100644 index 0000000000..d101d69f21 --- /dev/null +++ b/docs/source/static/css/custom.css @@ -0,0 +1,16 @@ +:root { + --color-green: green; + --color-red: red; +} + +.usable-by { + border: 1px ; + border-radius: .2em; + padding: 2px 5px; + /* background-color: #1a1c1e; */ +} + +.sidebar-logo { + width:128px; + height:auto; +} diff --git a/docs/source/static/fonts/TaraType.ttf b/docs/source/static/fonts/TaraType.ttf new file mode 100644 index 0000000000..29ff720953 Binary files /dev/null and b/docs/source/static/fonts/TaraType.ttf differ diff --git a/docs/source/static/img/favicon.ico b/docs/source/static/img/favicon.ico new file mode 100644 index 0000000000..9034e0d242 Binary files /dev/null and b/docs/source/static/img/favicon.ico differ diff --git a/docs/source/static/img/pyrogram.png b/docs/source/static/img/pyrogram.png new file mode 100644 index 0000000000..751af30444 Binary files /dev/null and b/docs/source/static/img/pyrogram.png differ diff --git a/docs/source/support.rst b/docs/source/support.rst new file mode 100644 index 0000000000..8efa4bc19f --- /dev/null +++ b/docs/source/support.rst @@ -0,0 +1,63 @@ +Support Pyrogram +================ + +.. raw:: html + + + +
+ Star + + Fork +
+ +
+ +Pyrogram is a free and open source project. +If you enjoy Pyrogram and would like to show your appreciation, consider donating or becoming +a sponsor of the project. You can support Pyrogram via the ways shown below: + +----- + +GitHub Sponsor +-------------- + +`Become a GitHub sponsor `_. + +.. raw:: html + + Sponsor + +----- + +LiberaPay Patron +---------------- + +`Become a LiberaPay patron `_. + +.. raw:: html + + + +----- + +OpenCollective Backer +--------------------- + +`Become an OpenCollective backer `_ + +.. raw:: html + + \ No newline at end of file diff --git a/docs/source/topics/advanced-usage.rst b/docs/source/topics/advanced-usage.rst new file mode 100644 index 0000000000..3f7e8440e4 --- /dev/null +++ b/docs/source/topics/advanced-usage.rst @@ -0,0 +1,120 @@ +Advanced Usage +============== + +Pyrogram's API -- which consists of well documented :doc:`methods <../api/methods/index>` and +:doc:`types <../api/types/index>` -- exists to provide an easier interface to the more complex 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. + + +----- + +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:`~pyrogram.raw.functions` and :mod:`~pyrogram.raw.types`. + +As already hinted, raw functions and types can be less convenient. This section will therefore explain some pitfalls to +take into consideration when working with the raw API. + +.. tip:: + + Every available high-level method in Pyrogram is built on top of these raw functions. + +Invoking Functions +------------------ + +Unlike the :doc:`methods <../api/methods/index>` 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. + +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.raw.functions``, ``pyrogram.raw.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:`~pyrogram.Client.invoke` method provided by the +Client class and pass the function object you created. + +Here's some examples: + +- Update first name, last name and bio: + + .. code-block:: python + + from pyrogram import Client + from pyrogram.raw import functions + + async with Client("my_account") as app: + await app.invoke( + functions.account.UpdateProfile( + first_name="First Name", last_name="Last Name", + about="New bio text" + ) + ) + +- Set online/offline status: + + .. code-block:: python + + from pyrogram import Client + from pyrogram.raw import functions, types + + async with Client("my_account") as app: + # Set online status + await app.invoke(functions.account.UpdateStatus(offline=False)) + + # Set offline status + await app.invoke(functions.account.UpdateStatus(offline=True)) + +- Get chat info: + + .. code-block:: python + + from pyrogram import Client + from pyrogram.raw import functions, types + + async with Client("my_account") as app: + r = await app.invoke( + functions.channels.GetFullChannel( + channel=app.resolve_peer("username") + ) + ) + + print(r) + +Chat IDs +-------- + +The way Telegram works makes it not possible to directly send a message to a user or a chat by using their IDs only. +Instead, a pair of ``id`` and ``access_hash`` wrapped in a so called ``InputPeer`` is always needed. Pyrogram allows +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: + +- :class:`~pyrogram.raw.types.InputPeerUser` - Users +- :class:`~pyrogram.raw.types.InputPeerChat` - Basic Chats +- :class:`~pyrogram.raw.types.InputPeerChannel` - Channels & Supergroups + +But you don't necessarily have to manually instantiate each object because Pyrogram already provides +: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 +all positive within their respective raw types. + +Things are different when working with Pyrogram's API because having them in the same space could lead to +collisions, and that's why Pyrogram uses a slightly different representation for each 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 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. + +.. _Community: https://t.me/Pyrogram \ No newline at end of file diff --git a/docs/source/topics/client-settings.rst b/docs/source/topics/client-settings.rst new file mode 100644 index 0000000000..b62a6c9d2b --- /dev/null +++ b/docs/source/topics/client-settings.rst @@ -0,0 +1,42 @@ +Client Settings +=============== + +You can control the way your client appears in the Active Sessions menu of an official client by changing some client +settings. By default you will see something like the following: + +- Device Model: ``CPython x.y.z`` +- Application: ``Pyrogram x.y.z`` +- System Version: ``Linux x.y.z`` + + +----- + +Set Custom Values +----------------- + +To set custom values, you can pass the arguments directly in the Client's constructor. + +.. code-block:: python + + app = Client( + "my_account", + app_version="1.2.3", + device_model="PC", + system_version="Linux" + ) + +Set Custom Languages +-------------------- + +To tell Telegram in which language should speak to you (terms of service, bots, service messages, ...) you can +set ``lang_code`` in `ISO 639-1 `_ standard (defaults to "en", +English). + +With the following code we make Telegram know we want it to speak in Italian (it): + +.. code-block:: python + + app = Client( + "my_account", + lang_code="it", + ) \ No newline at end of file diff --git a/docs/source/topics/create-filters.rst b/docs/source/topics/create-filters.rst new file mode 100644 index 0000000000..2366807e64 --- /dev/null +++ b/docs/source/topics/create-filters.rst @@ -0,0 +1,105 @@ +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 you can use +:meth:`filters.create() `. + + +----- + +Custom Filters +-------------- + +An example to demonstrate how custom filters work is to show how to create and use one for the +:class:`~pyrogram.handlers.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.types import InlineKeyboardMarkup, InlineKeyboardButton + + await app.send_message( + chat_id="username", # Change this to your username or id + text="Pyrogram custom filter test", + reply_markup=InlineKeyboardMarkup( + [[InlineKeyboardButton("Press me", "pyrogram")]] + ) + ) + +Basic Filters +------------- + +For this basic filter we will be using only the first parameter of :meth:`~pyrogram.filters.create`. + +The heart of a filter is its callback function, which accepts three arguments *(self, client, update)* and returns +either ``True``, in case you want the update to pass the filter or ``False`` otherwise. + +In this example we are matching the query data to "pyrogram", which means that the filter will only allow callback +queries containing "pyrogram" as data: + +.. code-block:: python + + from pyrogram import filters + + async def func(_, __, query): + return query.data == "pyrogram" + + static_data_filter = filters.create(func) + + +The first two arguments of the callback function are unused here and because of this we named them using underscores. + +Finally, the filter usage remains the same: + +.. code-block:: python + + @app.on_callback_query(static_data_filter) + async def pyrogram_data(_, query): + query.answer("it works!") + +Filters with Arguments +---------------------- + +A more flexible filter would be one that accepts "pyrogram" or any other string as argument at usage time. +A dynamic filter like this will make use of named arguments for the :meth:`~pyrogram.filters.create` method and the +first argument of the callback function, which is a reference to the filter object itself holding the extra data passed +via named arguments. + +This is how a dynamic custom filter looks like: + +.. code-block:: python + + from pyrogram import filters + + def dynamic_data_filter(data): + async def func(flt, _, query): + return flt.data == query.data + + # "data" kwarg is accessed with "flt.data" above + return filters.create(func, data=data) + +And finally its usage: + +.. code-block:: python + + @app.on_callback_query(dynamic_data_filter("pyrogram")) + async def pyrogram_data(_, query): + query.answer("it works!") + + +Method Calls Inside Filters +--------------------------- + +The missing piece we haven't covered yet is the second argument of a filter callback function, namely, the ``client`` +argument. This is a reference to the :obj:`~pyrogram.Client` instance that is running the filter and it is useful in +case you would like to make some API calls before deciding whether the filter should allow the update or not: + +.. code-block:: python + + async def func(_, client, query): + # r = await client.some_api_method() + # check response "r" and decide to return True or False + ... \ No newline at end of file diff --git a/docs/source/topics/debugging.rst b/docs/source/topics/debugging.rst new file mode 100644 index 0000000000..b1d3b6fdc1 --- /dev/null +++ b/docs/source/topics/debugging.rst @@ -0,0 +1,118 @@ +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 since 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 + + me = await app.get_users("me") + print(me) # User + +This will show a JSON representation of the object returned by :meth:`~pyrogram.Client.get_users`, which is a +:class:`~pyrogram.types.User` instance, in this case. The output on your terminal will be something similar to this: + +.. code-block:: json + + { + "_": "User", + "id": 123456789, + "is_self": true, + "is_contact": false, + "is_mutual_contact": false, + "is_deleted": false, + "is_bot": false, + "is_verified": false, + "is_restricted": false, + "is_support": false, + "first_name": "Pyrogram", + "photo": { + "_": "ChatPhoto", + "small_file_id": "AbCdE...EdCbA", + "small_photo_unique_id": "VwXyZ...ZyXwV", + "big_file_id": "AbCdE...EdCbA", + "big_photo_unique_id": "VwXyZ...ZyXwV" + } + } + +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 +fully-fledged Python objects and the correct way to access any attribute of them is by using the dot notation ``.``: + +.. code-block:: python + + photo = me.photo + print(photo) # ChatPhoto + +.. code-block:: json + + { + "_": "ChatPhoto", + "small_file_id": "AbCdE...EdCbA", + "small_photo_unique_id": "VwXyZ...ZyXwV", + "big_file_id": "AbCdE...EdCbA", + "big_photo_unique_id": "VwXyZ...ZyXwV" + } + +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 + + status = me.status + print(type(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.types import UserStatus + + status = me.status + print(isinstance(status, UserStatus)) + +.. code-block:: text + + True + +.. raw:: html + + \ No newline at end of file diff --git a/docs/source/topics/message-identifiers.rst b/docs/source/topics/message-identifiers.rst new file mode 100644 index 0000000000..f529ead437 --- /dev/null +++ b/docs/source/topics/message-identifiers.rst @@ -0,0 +1,114 @@ +Message identifiers +=========================== + +This is an in-depth explanation (`copied `_) for how the :obj:`pyrogram.types.Message` ``id`` works. + +.. note:: + + You can safely skip this section if you're not interested. + +Every account, whether it's an user account or bot account, has its own message counter. +This counter starts at 1, and is incremented by 1 every time a new message is received. +In private conversations or small groups, each account will receive a copy each message. +The message identifier will be based on the message counter of the receiving account. + +In megagroups and broadcast channels, the message counter instead belongs to the channel itself. +It also starts at 1 and is incremented by 1 for every message sent to the group or channel. +This means every account will see the same message identifier for a given mesasge in a group or channel. + +This design has the following implications: + +* The message identifier alone is enough to uniquely identify a message only if it's not from a megagroup or channel. + This is why :obj:`~pyrogram.handlers.DeletedMessagesHandler` does not need to (and doesn't always) include chat information. +* Messages cannot be deleted for one-side only in megagroups or channels. + Because every account shares the same identifier for the message, it cannot be deleted only for some. +* Links to messages only work for everyone inside megagroups or channels. + In private conversations and small groups, each account will have their own counter, and the identifiers won't match. + +Let's look at a concrete example. + +* You are logged in as User-A. +* Both User-B and User-C are your mutual contacts. +* You have share a small group called Group-S with User-B. +* You also share a megagroup called Group-M with User-C. + + +.. figure:: https://te.legra.ph/file/110b577d4511bb978cc96.png + :align: center + + +Every account and channel has just been created. +This means everyone has a message counter of one. + +First, User-A will sent a welcome message to both User-B and User-C:: + +.. + User-A → User-B: Hey, welcome! + + User-A → User-C: ¡Bienvenido! + +* For User-A, "Hey, welcome!" will have the message identifier 1. The message with "¡Bienvenido!" will have an ID of 2. +* For User-B, "Hey, welcome" will have ID 1. +* For User-B, "¡Bienvenido!" will have ID 1. + +.. csv-table:: Message identifiers + :header: "Message", "User-A", "User-B", "User-C", "Group-S", "Group-M" + + "Hey, welcome!", 1, 1, "", "", "" + "¡Bienvenido!", 2, "", 1, "", "" + +Next, User-B and User-C will respond to User-A:: + +.. + User-B → User-A: Thanks! + + User-C → User-A: Gracias :) + +.. csv-table:: Message identifiers + :header: "Message", "User-A", "User-B", "User-C", "Group-S", "Group-M" + + "Hey, welcome!", 1, 1, "", "", "" + "¡Bienvenido!", 2, "", 1, "", "" + "Thanks!", 3, 2, "", "", "" + "Gracias :)", 4, "", 2, "", "" + +Notice how for each message, the counter goes up by one, and they are independent. + +Let's see what happens when User-B sends a message to Group-S:: + +.. + User-B → Group-S: Nice group + +.. csv-table:: Message identifiers + :header: "Message", "User-A", "User-B", "User-C", "Group-S", "Group-M" + + "Hey, welcome!", 1, 1, "", "", "" + "¡Bienvenido!", 2, "", 1, "", "" + "Thanks!", 3, 2, "", "", "" + "Gracias :)", 4, "", 2, "", "" + "Nice group", 5, 3, "", "", "" + +While the message was sent to a different chat, the group itself doesn't have a counter. +The message identifiers are still unique for each account. +The chat where the message was sent can be completely ignored. + +Megagroups behave differently:: + +.. + User-C → Group-M: Buen grupo + +.. csv-table:: Message identifiers + :header: "Message", "User-A", "User-B", "User-C", "Group-S", "Group-M" + + "Hey, welcome!", 1, 1, "", "", "" + "¡Bienvenido!", 2, "", 1, "", "" + "Thanks!", 3, 2, "", "", "" + "Gracias :)", 4, "", 2, "", "" + "Nice group", 5, 3, "", "", "" + "Buen grupo", "", "", "", "", 1 + +The group has its own message counter. +Each user won't get a copy of the message with their own identifier, but rather everyone sees the same message. + +For scheduled messages, the message counter instead belongs to the peer itself. +Bots cannot schedule messages in Telegram, and only users can schedule messages. diff --git a/docs/source/topics/more-on-updates.rst b/docs/source/topics/more-on-updates.rst new file mode 100644 index 0000000000..f52e3aed97 --- /dev/null +++ b/docs/source/topics/more-on-updates.rst @@ -0,0 +1,222 @@ +More on Updates +=============== + +Here we'll show some advanced usages when working with :doc:`update handlers <../start/updates>` and +:doc:`filters `. + + +----- + +Handler Groups +-------------- + +If you register handlers with overlapping (conflicting) filters, only the first one is executed and any other handler +will be ignored. This is intended by design. + +In order to handle the very same update more than once, you have to register your handler in a different dispatching +group. Dispatching groups hold one or more handlers and are processed sequentially, they are identified by a number +(number 0 being the default) and sorted, that is, a lower group number has a higher priority: + +For example, take these two handlers: + +.. code-block:: python + + @app.on_message(filters.text | filters.sticker) + async def text_or_sticker(client, message): + print("Text or Sticker") + + + @app.on_message(filters.text) + async def just_text(client, message): + 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 handler using a different group: + +.. code-block:: python + + @app.on_message(filters.text, group=1) + async def just_text(client, message): + print("Just Text") + +Or, if you want ``just_text`` to be executed *before* ``text_or_sticker`` (note ``-1``, which is less than ``0``): + +.. code-block:: python + + @app.on_message(filters.text, group=-1) + async def just_text(client, message): + print("Just Text") + +With :meth:`~pyrogram.Client.add_handler` (without decorators) the same can be achieved with: + +.. code-block:: python + + app.add_handler(MessageHandler(just_text, filters.text), -1) + +Update propagation +------------------ + +Registering multiple handlers, each in a different group, becomes useful when you want to handle the same update more +than once. Any incoming update will be sequentially processed by all of your registered functions by respecting the +groups priority policy described above. Even in case any handler raises an unhandled exception, Pyrogram will still +continue to propagate the same update to the next groups until all the handlers are done. Example: + +.. code-block:: python + + @app.on_message(filters.private) + async def _(client, message): + print(0) + + + @app.on_message(filters.private, group=1) + async def _(client, message): + raise Exception("Unhandled exception!") # Simulate an unhandled exception + + + @app.on_message(filters.private, group=2) + async def _(client, message): + print(2) + +All these handlers will handle the same kind of messages, that are, messages sent or received in private chats. +The output for each incoming update will therefore be: + +.. code-block:: text + + 0 + Exception: Unhandled exception! + 2 + +Stop Propagation +^^^^^^^^^^^^^^^^ + +In order to prevent further propagation of an update in the dispatching phase, you can do *one* of the following: + +- Call the update's bound-method ``.stop_propagation()`` (preferred way). +- Manually ``raise StopPropagation`` exception (more suitable for raw updates only). + +.. note:: + + Internally, the propagation is stopped by handling a custom exception. ``.stop_propagation()`` is just an elegant + and intuitive way to ``raise StopPropagation``; this also means that any code coming *after* calling the method + won't be executed as your function just raised an exception to signal the dispatcher not to propagate the + update anymore. + +Example with ``stop_propagation()``: + +.. code-block:: python + + @app.on_message(filters.private) + async def _(client, message): + print(0) + + + @app.on_message(filters.private, group=1) + async def _(client, message): + print(1) + message.stop_propagation() + + + @app.on_message(filters.private, group=2) + async def _(client, message): + print(2) + +Example with ``raise StopPropagation``: + +.. code-block:: python + + from pyrogram import StopPropagation + + @app.on_message(filters.private) + async def _(client, message): + print(0) + + + @app.on_message(filters.private, group=1) + async ef _(client, message): + print(1) + raise StopPropagation + + + @app.on_message(filters.private, group=2) + async def _(client, message): + print(2) + +Each handler is registered in a different group, but the handler in group number 2 will never be executed because the +propagation was stopped earlier. The output of both (equivalent) examples will be: + +.. code-block:: text + + 0 + 1 + +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** 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). + +.. note:: + + Internally, the propagation is continued by handling a custom exception. ``.continue_propagation()`` is just an + elegant and intuitive way to ``raise ContinuePropagation``; this also means that any code coming *after* calling the + method won't be executed as your function just raised an exception to signal the dispatcher to continue with the + next available handler. + + +Example with ``continue_propagation()``: + +.. code-block:: python + + @app.on_message(filters.private) + async def _(client, message): + print(0) + message.continue_propagation() + + + @app.on_message(filters.private) + async def _(client, message): + print(1) + message.continue_propagation() + + + @app.on_message(filters.private) + async def _(client, message): + print(2) + +Example with ``raise ContinuePropagation``: + +.. code-block:: python + + from pyrogram import ContinuePropagation + + @app.on_message(filters.private) + async def _(client, message): + print(0) + raise ContinuePropagation + + + @app.on_message(filters.private) + async def _(client, message): + print(1) + raise ContinuePropagation + + + @app.on_message(filters.private) + async def _(client, message): + print(2) + +Three handlers are registered in the same group, and all of them will be executed because the propagation was continued +in each handler (except in the last one, where is useless to do so since there is no more handlers after). +The output of both (equivalent) examples will be: + +.. code-block:: text + + 0 + 1 + 2 diff --git a/docs/source/topics/mtproto-vs-botapi.rst b/docs/source/topics/mtproto-vs-botapi.rst new file mode 100644 index 0000000000..535347d00b --- /dev/null +++ b/docs/source/topics/mtproto-vs-botapi.rst @@ -0,0 +1,102 @@ +MTProto vs. Bot API +=================== + +Pyrogram is a framework written from the ground up that acts as a fully-fledged Telegram client based on the MTProto +API. This means that Pyrogram is able to execute any official client and bot API action and more. 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 in order to distinguish it +from the Bot API. The main Telegram 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. Clients that make use of Telegram's main API, such as +Pyrogram, implement all these details. + +.. _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 Telegram 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:: //_static/img/mtproto-vs-bot-api.png + :align: center + +.. _Bot API: https://core.telegram.org/bots/api + +Advantages of the MTProto API +----------------------------- + +Here is a non-exhaustive 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 2000 MiB each (~2 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 (for both user and bot identities)** + - :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:`+` **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 diff --git a/docs/source/topics/proxy.rst b/docs/source/topics/proxy.rst new file mode 100644 index 0000000000..25777fdaf1 --- /dev/null +++ b/docs/source/topics/proxy.rst @@ -0,0 +1,30 @@ +Proxy Settings +============== + +Pyrogram supports proxies with and without authentication. This feature allows Pyrogram to exchange data with Telegram +through an intermediate SOCKS 4/5 or HTTP (CONNECT) proxy server. + + +----- + +Usage +----- + +To use Pyrogram with a proxy, use the *proxy* parameter in the Client class. If your proxy doesn't require authorization +you can omit ``username`` and ``password``. + +.. code-block:: python + + from pyrogram import Client + + proxy = { + "scheme": "socks5", # "socks4", "socks5" and "http" are supported + "hostname": "11.22.33.44", + "port": 1234, + "username": "username", + "password": "password" + } + + app = Client("my_account", proxy=proxy) + + app.run() diff --git a/docs/source/topics/scheduling.rst b/docs/source/topics/scheduling.rst new file mode 100644 index 0000000000..983ea32182 --- /dev/null +++ b/docs/source/topics/scheduling.rst @@ -0,0 +1,61 @@ +Scheduling Tasks +================ + +Scheduling tasks means executing one or more functions periodically at pre-defined intervals or after a delay. This is +useful, for example, to send recurring messages to specific chats or users. + +This page will show examples on how to integrate Pyrogram with ``apscheduler`` in both asynchronous and +non-asynchronous contexts. For more detailed information, you can visit and learn from the library documentation. + + +----- + +Using apscheduler +----------------- + +- Install with ``pip3 install apscheduler`` +- Documentation: https://apscheduler.readthedocs.io + +Asynchronously +^^^^^^^^^^^^^^ + +.. code-block:: python + + from apscheduler.schedulers.asyncio import AsyncIOScheduler + + from pyrogram import Client + + app = Client("my_account") + + + async def job(): + await app.send_message(chat_id="me", text="Hi!") + + + scheduler = AsyncIOScheduler() + scheduler.add_job(job, "interval", seconds=3) + + scheduler.start() + app.run() + +Non-Asynchronously +^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + from apscheduler.schedulers.background import BackgroundScheduler + + from pyrogram import Client + + app = Client("my_account") + + + def job(): + app.send_message(chat_id="me", text="Hi!") + + + scheduler = BackgroundScheduler() + scheduler.add_job(job, "interval", seconds=3) + + scheduler.start() + app.run() diff --git a/docs/source/topics/serializing.rst b/docs/source/topics/serializing.rst new file mode 100644 index 0000000000..3898316741 --- /dev/null +++ b/docs/source/topics/serializing.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 you can use ``str(obj)``. + +.. code-block:: python + + ... + + async with app: + r = await app.get_chat("me") + 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 + + ... + + async with app: + r = await app.get_chat("me") + + 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/topics/smart-plugins.rst b/docs/source/topics/smart-plugins.rst new file mode 100644 index 0000000000..c28f58910c --- /dev/null +++ b/docs/source/topics/smart-plugins.rst @@ -0,0 +1,302 @@ +Smart Plugins +============= + +Pyrogram embeds a smart, lightweight yet powerful plugin system that is meant to further simplify the organization +of large projects and to provide a way for creating pluggable (modular) components that can be easily shared across +different Pyrogram applications with minimal boilerplate code. + +.. tip:: + + Smart Plugins are completely optional and disabled by default. + + +----- + +Introduction +------------ + +Prior to the Smart Plugin system, pluggable handlers were already possible. For example, if you wanted to modularize +your applications, you had to put your function definitions in separate files and register them inside your main script +after importing your modules, like this: + +.. note:: + + This is an example application that replies in private chats with two messages: one containing the same + text message you sent and the other containing the reversed text message. + + Example: *"Pyrogram"* replies with *"Pyrogram"* and *"margoryP"* + +.. code-block:: text + + myproject/ + handlers.py + main.py + +- ``handlers.py`` + + .. code-block:: python + + async def echo(client, message): + await message.reply(message.text) + + + async def echo_reversed(client, message): + await message.reply(message.text[::-1]) + +- ``main.py`` + + .. code-block:: python + + from pyrogram import Client, filters + from pyrogram.handlers import MessageHandler + + from handlers import echo, echo_reversed + + app = Client("my_account") + + app.add_handler( + MessageHandler( + echo, + filters.text & filters.private)) + + app.add_handler( + MessageHandler( + echo_reversed, + filters.text & filters.private), + group=1) + + 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:`~pyrogram.Client.add_handler` and manually instantiate each +:class:`~pyrogram.handlers.MessageHandler` object because you can't use decorators for your functions. +So, what if you could? Smart Plugins solve this issue by taking care of handlers registration automatically. + +Using Smart Plugins +------------------- + +Setting up your Pyrogram project to accommodate Smart Plugins is pretty straightforward: + +#. Create a new folder to store all the plugins (e.g.: "plugins", "handlers", ...). +#. Put your python files full of plugins inside. Organize them as you wish. +#. Enable plugins in your Client. + +.. note:: + + This is the same example application as shown above, written using the Smart Plugin system. + +.. code-block:: text + + myproject/ + plugins/ + handlers.py + main.py + +- ``plugins/handlers.py`` + + .. code-block:: python + + from pyrogram import Client, filters + + + @Client.on_message(filters.text & filters.private) + async def echo(client, message): + await message.reply(message.text) + + + @Client.on_message(filters.text & filters.private, group=1) + async def echo_reversed(client, message): + await message.reply(message.text[::-1]) + +- ``main.py`` + + .. code-block:: python + + from pyrogram import Client + + plugins = dict(root="plugins") + + Client("my_account", plugins=plugins).run() + + +The first important thing to note is the new ``plugins`` folder. You can put *any python file* in *any subfolder* and +each file can contain *any decorated function* (handlers) with one limitation: within a single module (file) you must +use different names for each decorated function. + +The second thing is telling Pyrogram where to look for your plugins: you can use the Client parameter "plugins"; +the *root* value must match the name of your plugins root folder. Your Pyrogram Client instance will **automatically** +scan the folder upon starting to search for valid handlers and register them for you. + +Then you'll notice you can now use decorators. That's right, you can apply the usual decorators to your callback +functions in a static way, i.e. **without having the Client instance around**: simply use ``@Client`` (Client class) +instead of the usual ``@app`` (Client instance) and things will work just the same. + +Specifying the Plugins to include +--------------------------------- + +By default, if you don't explicitly supply a list of plugins, every valid one found inside your plugins root folder will +be included by following the alphabetical order of the directory structure (files and subfolders); the single handlers +found inside each module will be, instead, loaded in the order they are defined, from top to bottom. + +.. 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, by design. 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`` +directives in the dictionary passed as Client argument. Here's how they work: + +- If both ``include`` and ``exclude`` are omitted, all plugins are loaded as described above. +- If ``include`` is given, only the specified plugins will be loaded, in the order they are passed. +- If ``exclude`` is given, the plugins specified here will be unloaded. + +The ``include`` and ``exclude`` value is a **list of strings**. Each string containing the path of the module relative +to the plugins root folder, in Python notation (dots instead of slashes). + + E.g.: ``subfolder.module`` refers to ``plugins/subfolder/module.py``, with ``root="plugins"``. + +You can also choose the order in which the single handlers inside a module are loaded, thus overriding the default +top-to-bottom loading policy. You can do this by appending the name of the functions to the module path, each one +separated by a blank space. + + E.g.: ``subfolder.module fn2 fn1 fn3`` will load *fn2*, *fn1* and *fn3* from *subfolder.module*, in this order. + +Examples +^^^^^^^^ + +Given this plugins folder structure with three modules, each containing their own handlers (fn1, fn2, etc...), which are +also organized in subfolders: + +.. code-block:: text + + myproject/ + plugins/ + subfolder1/ + plugins1.py + - fn1 + - fn2 + - fn3 + subfolder2/ + plugins2.py + ... + plugins0.py + ... + ... + +- Load every handler from every module, namely *plugins0.py*, *plugins1.py* and *plugins2.py* in alphabetical order + (files) and definition order (handlers inside files): + + .. code-block:: python + + plugins = dict(root="plugins") + + Client("my_account", plugins=plugins).run() + +- Load only handlers defined inside *plugins2.py* and *plugins0.py*, in this order: + + .. code-block:: python + + plugins = dict( + root="plugins", + include=[ + "subfolder2.plugins2", + "plugins0" + ] + ) + + Client("my_account", plugins=plugins).run() + +- Load everything except the handlers inside *plugins2.py*: + + .. code-block:: python + + plugins = dict( + root="plugins", + exclude=["subfolder2.plugins2"] + ) + + Client("my_account", plugins=plugins).run() + +- Load only *fn3*, *fn1* and *fn2* (in this order) from *plugins1.py*: + + .. code-block:: python + + plugins = dict( + root="plugins", + include=["subfolder1.plugins1 fn3 fn1 fn2"] + ) + + Client("my_account", plugins=plugins).run() + +Load/Unload Plugins 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 a special ``handlers`` attribute pointing to a list of tuples of +*(handler: Handler, group: int)* is attached to the function object itself. + +- ``plugins/handlers.py`` + + .. code-block:: python + + @Client.on_message(filters.text & filters.private) + async def echo(client, message): + await message.reply(message.text) + + print(echo) + print(echo.handlers) + +- Printing ``echo`` will show something like ````. + +- Printing ``echo.handlers`` will reveal the handlers, that is, a list of tuples containing the actual handlers and + the groups they were registered on ``[(, 0)]``. + +Unloading +^^^^^^^^^ + +In order to unload a plugin, all you need to do is obtain a reference to it by importing the relevant module and call +:meth:`~pyrogram.Client.remove_handler` Client's method with your function's *handler* instance: + +- ``main.py`` + + .. code-block:: python + + from plugins.handlers import echo + + handlers = echo.handlers + + for h in handlers: + app.remove_handler(*h) + +The star ``*`` operator is used to unpack the tuple into positional arguments so that *remove_handler* will receive +exactly what is needed. The same could have been achieved with: + +.. code-block:: python + + handlers = echo.handlers + handler, group = handlers[0] + + app.remove_handler(handler, group) + +Loading +^^^^^^^ + +Similarly to the unloading process, in order to load again a previously unloaded plugin you do the same, but this time +using :meth:`~pyrogram.Client.add_handler` instead. Example: + +- ``main.py`` + + .. code-block:: python + + from plugins.handlers import echo + + ... + + handlers = echo.handlers + + for h in handlers: + app.add_handler(*h) \ No newline at end of file diff --git a/docs/source/topics/speedups.rst b/docs/source/topics/speedups.rst new file mode 100644 index 0000000000..9ace67e66a --- /dev/null +++ b/docs/source/topics/speedups.rst @@ -0,0 +1,84 @@ +Speedups +======== + +Pyrogram's speed can be boosted up by using TgCrypto and uvloop. + + +----- + +TgCrypto +-------- + +TgCrypto_ is a high-performance, easy-to-install cryptography library specifically written in C for Pyrogram as a Python +extension. It is a replacement for a slower Python-only alternative and implements the cryptographic algorithms Telegram +requires, namely: AES-256-IGE, AES-256-CTR and AES-256-CBC. + +Installation +^^^^^^^^^^^^ + +.. code-block:: bash + + $ pip3 install -U PyTgCrypto + +Usage +^^^^^ + +Pyrogram will automatically make use of TgCrypto when detected, all you need to do is to install it. + +uvloop +------ + +uvloop_ is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is implemented in Cython and uses +libuv under the hood. It makes asyncio 2-4x faster. + +Installation +^^^^^^^^^^^^ + +.. code-block:: bash + + $ pip3 install -U uvloop + +Usage +^^^^^ + +Call ``uvloop.install()`` before calling ``asyncio.run()`` or ``app.run()``. + +.. code-block:: python + + import asyncio + import uvloop + + from pyrogram import Client + + + async def main(): + app = Client("my_account") + + async with app: + print(await app.get_me()) + + + uvloop.install() + asyncio.run(main()) + +The ``uvloop.install()`` call also needs to be placed before creating a Client instance. + +.. code-block:: python + + import uvloop + from pyrogram import Client + + uvloop.install() + + app = Client("my_account") + + + @app.on_message() + async def hello(client, message): + print(await client.get_me()) + + + app.run() + +.. _TgCrypto: https://github.com/pyrogram/tgcrypto +.. _uvloop: https://github.com/MagicStack/uvloop diff --git a/docs/source/topics/storage-engines.rst b/docs/source/topics/storage-engines.rst new file mode 100644 index 0000000000..d3c065b3dd --- /dev/null +++ b/docs/source/topics/storage-engines.rst @@ -0,0 +1,148 @@ +Storage Engines +=============== + +Every time you login to Telegram, some personal piece of data are created and held by both parties (the client, Pyrogram +and the server, Telegram). This session data is uniquely bound to your own account, indefinitely (until you logout or +decide to manually terminate it) and is used to authorize a client to execute API calls on behalf of your identity. + + +----- + +Persisting Sessions +------------------- + +In order to make a client reconnect successfully between restarts, that is, without having to start a new +authorization process from scratch each time, Pyrogram needs to store the generated session data somewhere. + +Different Storage Engines +------------------------- + +Pyrogram offers two different types of storage engines: a **File Storage** and a **Memory Storage**. +These engines are well integrated in the framework and require a minimal effort to set up. Here's how they work: + +File Storage +^^^^^^^^^^^^ + +This is the most common storage engine. It is implemented by using **SQLite**, which will store the session details. +The database will be saved to disk as a single portable file and is designed to efficiently store and retrieve +data whenever they are needed. + +To use this type of engine, simply pass any name of your choice to the ``name`` parameter of the +:obj:`~pyrogram.Client` constructor, as usual: + +.. code-block:: python + + from pyrogram import Client + + async with Client("my_account") as app: + print(await app.get_me()) + +Once you successfully log in (either with a user or a bot identity), a session file will be created and saved to disk as +``my_account.session``. Any subsequent client restart will make Pyrogram search for a file named that way and the +session database will be automatically loaded. + +Memory Storage +^^^^^^^^^^^^^^ + +In case you don't want to have any session file saved to disk, you can use an in-memory storage by passing True to the +``in_memory`` parameter of the :obj:`~pyrogram.Client` constructor: + +.. code-block:: python + + from pyrogram import Client + + async with Client("my_account", in_memory=True) as app: + print(await app.get_me()) + +This storage engine is still backed by SQLite, but the database exists purely in memory. This means that, once you stop +a client, the entire database is discarded and the session details used for logging in again will be lost forever. + +Session Strings +--------------- + +In case you want to use an in-memory storage, but also want to keep access to the session you created, call +:meth:`~pyrogram.Client.export_session_string` anytime before stopping the client... + +.. code-block:: python + + from pyrogram import Client + + async with Client("my_account", in_memory=True) as app: + print(await app.export_session_string()) + +...and save the resulting string. You can use this string by passing it as Client argument the next time you want to +login using the same session; the storage used will still be in-memory: + +.. code-block:: python + + from pyrogram import Client + + session_string = "...ZnUIFD8jsjXTb8g_vpxx48k1zkov9sapD-tzjz-S4WZv70M..." + + async with Client("my_account", session_string=session_string) as app: + print(await app.get_me()) + +Session strings are useful when you want to run authorized Pyrogram clients on platforms where their ephemeral +filesystems makes it harder for a file-based storage engine to properly work as intended. + +Custom Storages +--------------- + +If you want to use a custom storage engine, you can do so by implementing the :obj:`~pyrogram.storage.Storage` class. This class is an base class that defines the interface that all storage engines must implement. + +This class is a class that cannot be instantiated, but can be used to define a common interface for its subclasses. In this case, the :obj:`~pyrogram.storage.Storage` class defines the interface that all storage engines must implement. + +Custom Storage can be defined in :obj:`~pyrogram.Client` by passing ``storage_engine`` parameter with a :obj:`~pyrogram.storage.Storage` subclass. + +Example of File Storage (using ``aiosqlite==0.20.0``) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +How to use this Storage Engine is shown below. + +This storage is almost completely identical to the default File Storage, but instead has an extra dependency required to run it. + +``/path/to/your/file.session`` will be created if does not exist. + +.. code-block:: python + + from pyrogram import Client + from pyrogram.storage.aio_sqlite_storage import AioSQLiteStorage + + async with Client( + "my_account", + storage_engine=AioSQLiteStorage("/path/to/your/file.session") + ) as app: + await app.send_message(chat_id="me", text="Greetings from **Pyrogram**!") + +Example of Telethon Storage +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you want to use sessions from telethon in pyrogram (originally incompatible), you can use this `storage `_. + +This storage is almost completely identical and once used in pyrogram can be reused in telethon without breaking session integrity. + +.. code-block:: python + + from pyrogram import Client + from .tele_storage import TelethonStorage # assumes that the path downloaded is accurate + + workdir = Path(__file__).parent + test_mode = False + is_bot = False # Pass True if your session is bot session + + async with Client( + "my_account", + api_id=api_id, + api_hash=api_hash, + lang_code="ru", + workdir=workdir, + test_mode=test_mode, + storage_engine=TelethonStorage( + name="my_account", + workdir=workdir, + api_id=api_id, + test_mode=test_mode, + is_bot=is_bot + ) + ) as app: + await app.send_message(chat_id="me", text="Greetings from **Pyrogram**!") diff --git a/docs/source/topics/synchronous.rst b/docs/source/topics/synchronous.rst new file mode 100644 index 0000000000..9593ce35d3 --- /dev/null +++ b/docs/source/topics/synchronous.rst @@ -0,0 +1,84 @@ +Synchronous Usage +================= + +Pyrogram is an asynchronous framework and as such is subject to the asynchronous rules. It can, however, run in +synchronous mode (also known as non-asynchronous or sync/non-async for short). This mode exists mainly as a convenience +way for invoking methods without the need of ``async``/``await`` keywords and the extra boilerplate, but **it's not the +intended way to use the framework**. + +You can use Pyrogram in this synchronous mode when you want to write something short and contained without the +async boilerplate or in case you want to combine Pyrogram with other libraries that are not async. + +.. warning:: + + You have to be very careful when using the framework in its synchronous, non-native form, especially when combined + with other non-async libraries because thread blocking operations that clog the asynchronous event loop underneath + will make the program run erratically. + + +----- + +Synchronous Invocations +----------------------- + +The following is a standard example of running asynchronous functions with Python's asyncio. +Pyrogram is being used inside the main function with its asynchronous interface. + +.. code-block:: python + + import asyncio + from pyrogram import Client + + + async def main(): + app = Client("my_account") + + async with app: + await app.send_message(chat_id="me", text="Hi!") + + + asyncio.run(main()) + +To run Pyrogram synchronously, use the non-async context manager as shown in the following example. +As you can see, the non-async example becomes less cluttered. + +.. code-block:: python + + from pyrogram import Client + + app = Client("my_account") + + with app: + app.send_message(chat_id="me", text="Hi!") + +Synchronous handlers +-------------------- + +You can also have synchronous handlers; you only need to define the callback function without using ``async def`` and +invoke API methods by not placing ``await`` in front of them. Mixing ``def`` and ``async def`` handlers together is also +possible. + +.. code-block:: python + + @app.on_message() + async def handler1(client, message): + await message.forward("me") + + @app.on_edited_message() + def handler2(client, message): + message.forward("me") + +uvloop usage +------------ + +When using Pyrogram in its synchronous mode combined with uvloop, you need to call ``uvloop.install()`` before importing +Pyrogram. + +.. code-block:: python + + import uvloop + uvloop.install() + + from pyrogram import Client + + ... \ No newline at end of file diff --git a/docs/source/topics/test-servers.rst b/docs/source/topics/test-servers.rst new file mode 100644 index 0000000000..42f941cc3e --- /dev/null +++ b/docs/source/topics/test-servers.rst @@ -0,0 +1,39 @@ +Test Servers +============ + +If you wish to test your application in a separate environment, Pyrogram is able to authorize your account into +Telegram's test servers without hassle. All you need to do is start a new session (e.g.: "my_account_test") using +``test_mode=True``: + +.. code-block:: python + + from pyrogram import Client + + async with Client("my_account_test", test_mode=True) as app: + print(await app.get_me()) + +.. note:: + + If this is the first time you login into test servers, you will be asked to register your account first. + Accounts registered on test servers reside in a different, parallel instance of a Telegram server. + + +----- + +Test Mode in Official Apps +-------------------------- + +You can also login yourself into test servers using official desktop apps, such as Telegram Web and Telegram Desktop: + +- **Telegram Web**: Login here: https://web.telegram.org/?legacy=1&test=1 +- **Telegram Desktop**: Hold ``Shift+Alt`` and right click on "Add account", then choose "Test server". +- **iOS**: Tap 10 times on the Settings icon > Accounts > Login to another account > Test. +- **macSwift**: click the Settings icon 10 times to open the Debug Menu, ⌘ + click "Add Account" and log in via phone number. + +Test Numbers +------------ + +Beside normal numbers, the test environment allows you to login with reserved test numbers. +Valid phone numbers follow the pattern ``99966XYYYY``, where ``X`` is the DC number (1 to 3) and ``YYYY`` are random +numbers. Users with such numbers always get ``XXXXX`` or ``XXXXXX`` as the confirmation code (the DC number, repeated +five or six times). \ No newline at end of file diff --git a/docs/source/topics/text-formatting.rst b/docs/source/topics/text-formatting.rst new file mode 100644 index 0000000000..93e9e23c5f --- /dev/null +++ b/docs/source/topics/text-formatting.rst @@ -0,0 +1,245 @@ +Text Formatting +=============== + +.. role:: strike + :class: strike + +.. role:: underline + :class: underline + +.. role:: bold-underline + :class: bold-underline + +.. role:: strike-italic + :class: strike-italic + +Pyrogram uses a custom Markdown dialect for text formatting which adds some unique features that make writing styled +texts easier in both Markdown and HTML. You can send sophisticated text messages and media captions using a +variety of decorations that can also be nested in order to combine multiple styles together. + + +----- + +Basic Styles +------------ + +When formatting your messages, you can choose between Markdown-style, HTML-style or both (default). The following is a +list of the basic styles currently supported by Pyrogram. + +- **bold** +- *italic* +- :underline:`underline` +- :strike:`strike` +- blockquote +- ``inline fixed-width code`` +- .. code-block:: text + + pre-formatted + fixed-width + code block +- spoiler +- `text URL `_ +- `user text mention `_ + + + +Markdown Style +-------------- + +To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the *parse_mode* parameter when using +:meth:`~pyrogram.Client.send_message`. Use the following syntax in your message: + +.. code-block:: text + + **bold** + + __italic__ + + --underline-- + + ~~strike~~ + + > blockquote + + `inline fixed-width code` + + ``` + pre-formatted + fixed-width + code block + ``` + + ||spoiler|| + + [text URL](https://docs.pyrogram.org/) + + [text user mention](tg://user?id=123456789) + + +**Example**: + +.. code-block:: python + + from pyrogram import enums + + await app.send_message( + chat_id="me", + text=( + "**bold**, " + "__italic__, " + "--underline--, " + "~~strike~~, " + "||spoiler||, " + "[URL](https://docs.pyrogram.org), " + "`code`, " + "```" + "for i in range(10):\n" + " print(i)" + "```" + ), + parse_mode=enums.ParseMode.MARKDOWN + ) + +HTML Style +---------- + +To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode* parameter when using +:meth:`~pyrogram.Client.send_message`. The following tags are currently supported: + +.. code-block:: text + + bold, bold + + italic, italic + + underline + + strike, strike, strike + + spoiler + + text URL + + inline mention + + inline fixed-width code + + 🔥 + +
+    pre-formatted
+      fixed-width
+        code block
+    
+ +**Example**: + +.. code-block:: python + + from pyrogram import enums + + await app.send_message( + chat_id="me", + text=( + "bold, " + "italic, " + "underline, " + "strike, " + "spoiler, " + "URL, " + "code\n\n" + "
"
+            "for i in range(10):\n"
+            "    print(i)"
+            "
" + ), + parse_mode=enums.ParseMode.HTML + ) + +.. note:: + + All ``<``, ``>`` and ``&`` symbols that are not a part of a tag or an HTML entity must be replaced with the + corresponding HTML entities (``<`` with ``<``, ``>`` with ``>`` and ``&`` with ``&``). You can use this + snippet to quickly escape those characters: + + .. code-block:: python + + import html + + text = "" + text = html.escape(text) + + print(text) + + .. code-block:: text + + <my text> + +Different Styles +---------------- + +By default, when ignoring the *parse_mode* parameter, both Markdown and HTML styles are enabled together. +This means you can combine together both syntaxes in the same text: + +.. code-block:: python + + await app.send_message(chat_id="me", text="**bold**, italic") + +Result: + + **bold**, *italic* + +If you don't like this behaviour you can always choose to only enable either Markdown or HTML in strict mode by passing +:obj:`~pyrogram.enums.MARKDOWN` or :obj:`~pyrogram.enums.HTML` as argument to the *parse_mode* parameter. + +.. code-block:: python + + from pyrogram import enums + + await app.send_message(chat_id="me", text="**bold**, italic", parse_mode=enums.ParseMode.MARKDOWN) + await app.send_message(chat_id="me", text="**bold**, italic", parse_mode=enums.ParseMode.HTML) + +Result: + + **bold**, italic + + \*\*bold**, *italic* + +In case you want to completely turn off the style parser, simply pass :obj:`~pyrogram.enums.DISABLED` to *parse_mode*. +The text will be sent as-is. + +.. code-block:: python + + from pyrogram import enums + + await app.send_message(chat_id="me", text="**bold**, italic", parse_mode=enums.ParseMode.DISABLED) + +Result: + + \*\*bold**, italic + +Nested and Overlapping Entities +------------------------------- + +You can also style texts with more than one decoration at once by nesting entities together. For example, you can send +a text message with both :bold-underline:`bold and underline` styles, or a text that has both :strike-italic:`italic and +strike` styles, and you can still combine both Markdown and HTML together. + +Here there are some example texts you can try sending: + +**Markdown**: + +- ``**bold, --underline--**`` +- ``**bold __italic --underline ~~strike~~--__**`` +- ``**bold __and** italic__`` + +**HTML**: + +- ``bold, underline`` +- ``bold italic underline strike`` +- ``bold and italic`` + +**Combined**: + +- ``--you can combine HTML with **Markdown**--`` +- ``**and also overlap** --entities this way--`` diff --git a/docs/source/topics/use-filters.rst b/docs/source/topics/use-filters.rst new file mode 100644 index 0000000000..0cc38fcb30 --- /dev/null +++ b/docs/source/topics/use-filters.rst @@ -0,0 +1,110 @@ +Using Filters +============= + +So far we've seen :doc:`how to register a callback function <../start/updates>` that executes every time an update comes +from the server, but there's much more than that to come. + +Here we'll discuss about :obj:`~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 a :class:`~pyrogram.types.Sticker` object and + ignore any other message. Filters are passed as the first argument of the decorator: + + .. code-block:: python + + from pyrogram import filters + + + @app.on_message(filters.sticker) + async 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 + + from pyrogram import filters + from pyrogram.handlers import MessageHandler + + + async def my_handler(client, message): + print(message) + + + app.add_handler(MessageHandler(my_handler, filters.sticker)) + +Combining Filters +----------------- + +Filters can 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 **or** a **photo**. + + .. code-block:: python + + @app.on_message(filters.text | filters.photo) + async 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)) + async 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"])) + async 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")) + async 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")) + async def start_command(client, message): + print("This is the /start command") + + + @app.on_message(filters.command("help")) + async def help_command(client, message): + print("This is the /help command") + + + @app.on_message(filters.chat("PyrogramChat")) + async def from_pyrogramchat(client, message): + print("New message in @PyrogramChat") diff --git a/docs/source/topics/voice-calls.rst b/docs/source/topics/voice-calls.rst new file mode 100644 index 0000000000..aef4030ca8 --- /dev/null +++ b/docs/source/topics/voice-calls.rst @@ -0,0 +1,19 @@ +Voice Calls +=========== + +Both private voice calls and group voice calls are currently supported by third-party, external libraries that integrate +with Pyrogram. + +Libraries +--------- + +There are currently two main libraries (with very similar names) you can use: + +1. https://github.com/pytgcalls/pytgcalls +2. https://github.com/MarshalX/tgcalls + +Older implementations +--------------------- + +An older implementation of Telegram voice calls can be found at https://github.com/bakatrouble/pylibtgvoip (currently +outdated due to the deprecation of the Telegram VoIP library used underneath). \ No newline at end of file diff --git a/hatch_build.py b/hatch_build.py new file mode 100644 index 0000000000..15b5470ed1 --- /dev/null +++ b/hatch_build.py @@ -0,0 +1,38 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2023-present Hydrogram +# +# 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 sys +from hatchling.builders.hooks.plugin.interface import BuildHookInterface + +# Add the current directory to the path, so we can import the compiler. +sys.path.insert(0, ".") + + +class CustomHook(BuildHookInterface): + """A custom build hook for Pyrogram.""" + + def initialize(self, version, build_data): + """Initialize the hook.""" + if self.target_name not in ["wheel", "install"]: + return + + from compiler.api.compiler import start as compile_api + from compiler.errors.compiler import start as compile_errors + + compile_api() + compile_errors() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..098feed1fe --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,103 @@ +[project] +name = "pyrotgfork" +dynamic = ["version"] +description = "Fork of Pyrogram. Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots" +authors = [{ name = "SpEcHIDe", email = "pyrogram@iamidiotareyoutoo.com" }] +dependencies = ["pyaes<=1.6.1", "pysocks<=1.7.1"] +readme = "README.md" +license = "LGPL-3.0-or-later" +requires-python = ">=3.7" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Internet", + "Topic :: Communications", + "Topic :: Communications :: Chat", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Libraries :: Application Frameworks", +] +keywords = ["telegram chat messenger mtproto api client library python"] + +[tool.hatch.version] +path = "pyrogram/__init__.py" + +# Used to call hatch_build.py +[tool.hatch.build.hooks.custom] + +[project.urls] +Homepage = "https://telegramplayground.github.io/pyrogram/" +Tracker = "https://github.com/TelegramPlayGround/Pyrogram/issues" +Source = "https://github.com/TelegramPlayGround/Pyrogram" +Documentation = "https://telegramplayground.github.io/pyrogram/releases/changes-in-this-fork.html" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build] +include = ["pyrogram/py.typed"] +exclude = ["tests", "docs", "requirements.lock", "requirements-dev.lock", ".github", ".gitignore"] + +[tool.hatch.build.targets.sdist] +include = [ + "compiler", + "pyrogram", +] +exclude = [ + ".github/", + "docs/", + "tests/", + ".editorconfig", + ".gitignore", + ".pre-commit-config.yaml", + "CODE_OF_CONDUCT.rst", + "CONTRIBUTING.rst", + "requirements.lock", + "requirements-dev.lock", + ".gitignore", +] + +[tool.hatch.build.targets.wheel] +ignore-vcs = true +packages = ["pyrogram"] + +[project.optional-dependencies] +dev = [ + "keyring<=25.1.0", + "hatch<=1.7.0", + "pytest<=7.4.3", + "pytest-asyncio<=0.21.1", + "pytest-cov<=4.1.0", + "twine<=4.0.2" +] + +docs = [ + "Sphinx<=7.2.6", + "furo<=2023.9.10", + "sphinx-autobuild<=2021.3.14", + "sphinx-copybutton<=0.5.2", + "pygments<=2.17.2" +] + +fast = [ + "PyTgCrypto==1.2.6", + "uvloop>0.18.0,<=0.19.0" +] diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py index e51c2d4b8d..db336c6698 100644 --- a/pyrogram/__init__.py +++ b/pyrogram/__init__.py @@ -1,23 +1,45 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . -__copyright__ = "Copyright (C) 2017 Dan Tès " -__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)" -__version__ = "0.0.1a0" +__fork_name__ = "pyrotgfork" +__version__ = "2.1.33.2" +__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)" +__copyright__ = "Copyright (C) 2017-present Dan " +from concurrent.futures.thread import ThreadPoolExecutor + + +class StopTransmission(Exception): + pass + + +class StopPropagation(StopAsyncIteration): + pass + + +class ContinuePropagation(StopAsyncIteration): + pass + + +from . import raw, types, filters, handlers, emoji, enums from .client import Client +from .sync import idle, compose + +__version__ = f"{__version__}-TL-{raw.all.layer}" + +crypto_executor = ThreadPoolExecutor(1, thread_name_prefix="CryptoWorker") diff --git a/pyrogram/api/__init__.py b/pyrogram/api/__init__.py deleted file mode 100644 index 36e3ebb900..0000000000 --- a/pyrogram/api/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 importlib import import_module - -from .all import objects -from .core.object import Object - -for k, v in objects.items(): - path, name = v.rsplit(".", 1) - Object.all[k] = getattr(import_module("pyrogram.api." + path), name) diff --git a/pyrogram/api/core/__init__.py b/pyrogram/api/core/__init__.py deleted file mode 100644 index 078374f351..0000000000 --- a/pyrogram/api/core/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 .future_salt import FutureSalt -from .future_salts import FutureSalts -from .gzip_packed import GzipPacked -from .message import Message -from .msg_container import MsgContainer -from .object import Object -from .primitives import * diff --git a/pyrogram/api/core/future_salt.py b/pyrogram/api/core/future_salt.py deleted file mode 100644 index e9ef5a0f5f..0000000000 --- a/pyrogram/api/core/future_salt.py +++ /dev/null @@ -1,40 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 datetime import datetime -from io import BytesIO - -from .object import Object -from .primitives import Int, Long - - -class FutureSalt(Object): - ID = 0x0949d9dc - - def __init__(self, valid_since: int or datetime, valid_until: int or datetime, 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)) - 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 deleted file mode 100644 index 7fe08020ad..0000000000 --- a/pyrogram/api/core/future_salts.py +++ /dev/null @@ -1,43 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 datetime import datetime -from io import BytesIO - -from . import FutureSalt -from .object import Object -from .primitives import Int, Long - - -class FutureSalts(Object): - ID = 0xae500895 - - def __init__(self, req_msg_id: int, now: int or datetime, salts: list): - self.req_msg_id = req_msg_id - self.now = now - self.salts = salts - - @staticmethod - def read(b: BytesIO, *args) -> "FutureSalts": - req_msg_id = Long.read(b) - now = datetime.fromtimestamp(Int.read(b)) - - count = Int.read(b) - salts = [FutureSalt.read(b) for _ in range(count)] - - return FutureSalts(req_msg_id, now, salts) diff --git a/pyrogram/api/core/gzip_packed.py b/pyrogram/api/core/gzip_packed.py deleted file mode 100644 index 0a3afb2644..0000000000 --- a/pyrogram/api/core/gzip_packed.py +++ /dev/null @@ -1,56 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 gzip import compress, decompress -from io import BytesIO - -from .object import Object -from .primitives import Int, Bytes - - -class GzipPacked(Object): - ID = 0x3072cfa1 - - def __init__(self, packed_data: Object): - 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( - BytesIO( - decompress( - Bytes.read(b) - ) - ) - ) - - def write(self) -> bytes: - b = BytesIO() - - b.write(Int(self.ID, False)) - - b.write( - Bytes( - compress( - self.packed_data.write() - ) - ) - ) - - return b.getvalue() diff --git a/pyrogram/api/core/message.py b/pyrogram/api/core/message.py deleted file mode 100644 index 181a0e995a..0000000000 --- a/pyrogram/api/core/message.py +++ /dev/null @@ -1,51 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 io import BytesIO - -from .object import Object -from .primitives import Int, Long - - -class Message(Object): - ID = 0x5bb8e511 # hex(crc32(b"message msg_id:long seqno:int bytes:int body:Object = Message")) - - def __init__(self, body: Object, msg_id: int, seq_no: int, length: int): - self.msg_id = msg_id - self.seq_no = seq_no - self.length = length - self.body = body - - @staticmethod - def read(b: BytesIO, *args) -> "Message": - msg_id = Long.read(b) - seq_no = Int.read(b) - length = Int.read(b) - body = b.read(length) - - return Message(Object.read(BytesIO(body)), msg_id, seq_no, length) - - def write(self) -> bytes: - b = BytesIO() - - b.write(Long(self.msg_id)) - b.write(Int(self.seq_no)) - b.write(Int(self.length)) - b.write(self.body.write()) - - return b.getvalue() diff --git a/pyrogram/api/core/msg_container.py b/pyrogram/api/core/msg_container.py deleted file mode 100644 index 58a49bf9d7..0000000000 --- a/pyrogram/api/core/msg_container.py +++ /dev/null @@ -1,48 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 io import BytesIO - -from .message import Message -from .object import Object -from .primitives import Int - - -class MsgContainer(Object): - ID = 0x73f1f8dc - - def __init__(self, messages: list): - self.messages = messages - - @staticmethod - def read(b: BytesIO, *args) -> "MsgContainer": - count = Int.read(b) - return MsgContainer([Message.read(b) for _ in range(count)]) - - def write(self) -> bytes: - b = BytesIO() - - b.write(Int(self.ID, False)) - - count = len(self.messages) - b.write(Int(count)) - - for message in self.messages: - b.write(message.write()) - - return b.getvalue() diff --git a/pyrogram/api/core/object.py b/pyrogram/api/core/object.py deleted file mode 100644 index 58b370bc7d..0000000000 --- a/pyrogram/api/core/object.py +++ /dev/null @@ -1,63 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 JSONEncoder, dumps - -from ..all import objects - - -class Object: - all = {} - - @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, cls=Encoder, indent=4) - - def __eq__(self, other) -> bool: - return self.__dict__ == other.__dict__ - - def __len__(self) -> int: - return len(self.write()) - - def __call__(self): - pass - - -class Encoder(JSONEncoder): - def default(self, o: Object): - try: - content = o.__dict__ - except AttributeError: - if isinstance(o, datetime): - return o.strftime("%d-%b-%Y %H:%M:%S") - else: - return repr(o) - - return OrderedDict( - [("_", objects.get(getattr(o, "ID", None), None))] - + [i for i in content.items()] - ) diff --git a/pyrogram/api/core/primitives/__init__.py b/pyrogram/api/core/primitives/__init__.py deleted file mode 100644 index 159d85ae64..0000000000 --- a/pyrogram/api/core/primitives/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 .bool import Bool, BoolTrue, BoolFalse -from .bytes import Bytes -from .double import Double -from .int import Int, Long, Int128, Int256 -from .string import String -from .vector import Vector diff --git a/pyrogram/api/core/primitives/bool.py b/pyrogram/api/core/primitives/bool.py deleted file mode 100644 index 1c08c839b8..0000000000 --- a/pyrogram/api/core/primitives/bool.py +++ /dev/null @@ -1,47 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 io import BytesIO - -from ..object import Object - - -class BoolFalse(Object): - ID = 0xbc799737 - value = False - - @classmethod - def read(cls, *args) -> bool: - return cls.value - - def __new__(cls) -> bytes: - return int.to_bytes(cls.ID, 4, "little") - - -class BoolTrue(BoolFalse): - ID = 0x997275b5 - value = True - - -class Bool(Object): - @classmethod - def read(cls, b: BytesIO) -> bool: - return int.from_bytes(b.read(4), "little") == BoolTrue.ID - - def __new__(cls, value: bool) -> BoolTrue or BoolFalse: - return BoolTrue() if value else BoolFalse() diff --git a/pyrogram/api/core/primitives/bytes.py b/pyrogram/api/core/primitives/bytes.py deleted file mode 100644 index 261a5dadf8..0000000000 --- a/pyrogram/api/core/primitives/bytes.py +++ /dev/null @@ -1,54 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 io import BytesIO - -from ..object import Object - - -class Bytes(Object): - @staticmethod - def read(b: BytesIO, *args) -> bytes: - length = int.from_bytes(b.read(1), "little") - - if length <= 253: - x = b.read(length) - b.read(-(length + 1) % 4) - else: - length = int.from_bytes(b.read(3), "little") - x = b.read(length) - b.read(-length % 4) - - return x - - def __new__(cls, value: bytes) -> bytes: - length = len(value) - - if length <= 253: - return ( - bytes([length]) - + value - + bytes(-(length + 1) % 4) - ) - else: - return ( - bytes([254]) - + int.to_bytes(length, 3, "little") - + value - + bytes(-length % 4) - ) diff --git a/pyrogram/api/core/primitives/double.py b/pyrogram/api/core/primitives/double.py deleted file mode 100644 index 281a3c3a8e..0000000000 --- a/pyrogram/api/core/primitives/double.py +++ /dev/null @@ -1,31 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 io import BytesIO -from struct import unpack, pack - -from ..object import Object - - -class Double(Object): - @staticmethod - def read(b: BytesIO, *args) -> float: - return unpack("d", b.read(8))[0] - - def __new__(cls, value: float) -> bytes: - return pack("d", value) diff --git a/pyrogram/api/core/primitives/int.py b/pyrogram/api/core/primitives/int.py deleted file mode 100644 index cfc8f7ee98..0000000000 --- a/pyrogram/api/core/primitives/int.py +++ /dev/null @@ -1,49 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 io import BytesIO - -from ..object import Object - - -class Int(Object): - SIZE = 4 - - @classmethod - def read(cls, b: BytesIO, signed: bool = True) -> int: - return int.from_bytes(b.read(cls.SIZE), "little", signed=signed) - - def __new__(cls, value: int, signed: bool = True) -> bytes: - return int.to_bytes(value, cls.SIZE, "little", signed=signed) - - -class Long(Int): - SIZE = 8 - - # TODO: PyCharm can't infer types when overriding parent's __new__ and is showing unnecessary warnings. - # Add this to shut warnings down - def __new__(cls, *args): - return super().__new__(cls, *args) - - -class Int128(Int): - SIZE = 16 - - -class Int256(Int): - SIZE = 32 diff --git a/pyrogram/api/core/primitives/string.py b/pyrogram/api/core/primitives/string.py deleted file mode 100644 index 493dacd950..0000000000 --- a/pyrogram/api/core/primitives/string.py +++ /dev/null @@ -1,30 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 io import BytesIO - -from . import Bytes - - -class String(Bytes): - @staticmethod - def read(b: BytesIO, *args) -> str: - return super(String, String).read(b).decode() - - def __new__(cls, value: str) -> bytes: - return super().__new__(cls, value.encode()) diff --git a/pyrogram/api/core/primitives/vector.py b/pyrogram/api/core/primitives/vector.py deleted file mode 100644 index 60890ae6f6..0000000000 --- a/pyrogram/api/core/primitives/vector.py +++ /dev/null @@ -1,44 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 io import BytesIO - -from . import Int -from ..object import Object - - -class Vector(Object): - ID = 0x1cb5c415 - - @staticmethod - def read(b: BytesIO, t: Object = None) -> list: - return [ - t.read(b) if t - else Object.read(b) - for _ in range(Int.read(b)) - ] - - def __new__(cls, value: list, t: Object = None) -> bytes: - return b"".join( - [Int(cls.ID, False), Int(len(value))] - + [ - t(i) if t - else i.write() - for i in value - ] - ) diff --git a/pyrogram/api/errors/__init__.py b/pyrogram/api/errors/__init__.py deleted file mode 100644 index fc50428056..0000000000 --- a/pyrogram/api/errors/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 .exceptions import * diff --git a/pyrogram/api/errors/error.py b/pyrogram/api/errors/error.py deleted file mode 100644 index d3ea1e6ed7..0000000000 --- a/pyrogram/api/errors/error.py +++ /dev/null @@ -1,70 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 re -from importlib import import_module - -from pyrogram.api.types import RpcError -from .exceptions.all import exceptions - - -class Error(Exception): - ID = None - CODE = None - NAME = None - MESSAGE = None - - def __init__(self, x: int or RpcError = None, query_type: type = None): - super().__init__("[{} {}]: {}".format(self.CODE, self.ID or self.NAME, self.MESSAGE.format(x=x))) - - try: - self.x = int(x) - except (ValueError, TypeError): - self.x = x - - # TODO: Proper log unknown errors - if self.CODE == 520: - with open("unknown_errors.txt", "a") as f: - f.write("{}\t{}\t{}\n".format(x.error_code, x.error_message, query_type)) - - @staticmethod - def raise_it(rpc_error: RpcError, query_type: type): - code = rpc_error.error_code - - if code not in exceptions: - raise UnknownError(rpc_error, query_type) - - message = rpc_error.error_message - id = re.sub(r"_\d+", "_X", message) - - if id not in exceptions[code]: - raise UnknownError(rpc_error, query_type) - - x = re.search(r"_(\d+)", message) - x = x.group(1) if x is not None else x - - raise getattr( - import_module("pyrogram.api.errors"), - exceptions[code][id] - )(x) - - -class UnknownError(Error): - CODE = 520 - NAME = "Unknown error" - MESSAGE = "{x}" diff --git a/pyrogram/client.py b/pyrogram/client.py new file mode 100644 index 0000000000..5426dd3091 --- /dev/null +++ b/pyrogram/client.py @@ -0,0 +1,1153 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 asyncio +import functools +import inspect +import logging +import os +import platform +import re +import shutil +import sys +from concurrent.futures.thread import ThreadPoolExecutor +from datetime import datetime, timedelta +from hashlib import sha256 +from importlib import import_module +from io import StringIO, BytesIO +from mimetypes import MimeTypes +from pathlib import Path +from typing import Union, List, Optional, Callable, AsyncGenerator, Type + +import pyrogram +from pyrogram import __version__, __license__ +from pyrogram import enums +from pyrogram import raw +from pyrogram import utils +from pyrogram.crypto import aes +from pyrogram.errors import CDNFileHashMismatch +from pyrogram.errors import ( + SessionPasswordNeeded, + VolumeLocNotFound, ChannelPrivate, + BadRequest, AuthBytesInvalid +) +from pyrogram.handlers.handler import Handler +from pyrogram.methods import Methods +from pyrogram.session import Auth, Session +from pyrogram.storage import Storage, FileStorage, MemoryStorage +from pyrogram.types import User, TermsOfService +from pyrogram.utils import ainput +from .connection import Connection +from .connection.transport import TCP, TCPAbridged +from .dispatcher import Dispatcher +from .file_id import FileId, FileType, ThumbnailSource +from .mime_types import mime_types +from .parser import Parser +from .session.internals import MsgId + +log = logging.getLogger(__name__) + + +class Client(Methods): + """Pyrogram Client, the main means for interacting with Telegram. + + Parameters: + name (``str``): + A name for the client, e.g.: "my_account". + + api_id (``int`` | ``str``, *optional*): + The *api_id* part of the Telegram API key, as integer or string. + E.g.: 12345 or "12345". + + api_hash (``str``, *optional*): + The *api_hash* part of the Telegram API key, as string. + E.g.: "0123456789abcdef0123456789abcdef". + + app_version (``str``, *optional*): + Application version. + Defaults to "Pyrogram x.y.z". + + device_model (``str``, *optional*): + Device model. + Defaults to *platform.python_implementation() + " " + platform.python_version()*. + + system_version (``str``, *optional*): + Operating System version. + Defaults to *platform.system() + " " + platform.release()*. + + lang_pack (``str``, *optional*): + Name of the language pack used on the client. + Defaults to "" (empty string). + + lang_code (``str``, *optional*): + Code of the language used on the client, in ISO 639-1 standard. + Defaults to "en". + + system_lang_code (``str``, *optional*): + Code of the language used on the system, in ISO 639-1 standard. + Defaults to "en". + + ipv6 (``bool``, *optional*): + Pass True to connect to Telegram using IPv6. + Defaults to False (IPv4). + + proxy (``dict``, *optional*): + The Proxy settings as dict. + E.g.: *dict(scheme="socks5", hostname="11.22.33.44", port=1234, username="user", password="pass")*. + The *username* and *password* can be omitted if the proxy doesn't require authorization. + + test_mode (``bool``, *optional*): + Enable or disable login to the test servers. + Only applicable for new sessions and will be ignored in case previously created sessions are loaded. + Defaults to False. + + bot_token (``str``, *optional*): + Pass the Bot API token to create a bot session, e.g.: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11" + Only applicable for new sessions. + + session_string (``str``, *optional*): + Pass a session string to load the session in-memory. + Implies ``in_memory=True``. + + in_memory (``bool``, *optional*): + Pass True to start an in-memory session that will be discarded as soon as the client stops. + In order to reconnect again using an in-memory session without having to login again, you can use + :meth:`~pyrogram.Client.export_session_string` before stopping the client to get a session string you can + pass to the ``session_string`` parameter. + Defaults to False. + + phone_number (``str``, *optional*): + Pass the phone number as string (with the Country Code prefix included) to avoid entering it manually. + Only applicable for new sessions. + + phone_code (``str``, *optional*): + Pass the phone code as string (for test numbers only) to avoid entering it manually. + Only applicable for new sessions. + + password (``str``, *optional*): + Pass the Two-Step Verification password as string (if required) to avoid entering it manually. + Only applicable for new sessions. + + workers (``int``, *optional*): + Number of maximum concurrent workers for handling incoming updates. + Defaults to ``min(32, os.cpu_count() + 4)``. + + workdir (``str``, *optional*): + Define a custom working directory. + The working directory is the location in the filesystem where Pyrogram will store the session files. + Defaults to the parent directory of the main script. + + plugins (``dict``, *optional*): + Smart Plugins settings as dict, e.g.: *dict(root="plugins")*. + + parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*): + Set the global parse mode of the client. By default, texts are parsed using both Markdown and HTML styles. + You can combine both syntaxes together. + + no_updates (``bool``, *optional*): + Pass True to disable incoming updates. + When updates are disabled the client can't receive messages or other updates. + Useful for batch programs that don't need to deal with updates. + Defaults to False (updates enabled and received). + + skip_updates (``bool``, *optional*): + Pass True to skip pending updates that arrived while the client was offline. + Defaults to True. + + takeout (``bool``, *optional*): + Pass True to let the client use a takeout session instead of a normal one, implies *no_updates=True*. + Useful for exporting Telegram data. Methods invoked inside a takeout session (such as get_chat_history, + download_media, ...) are less prone to throw FloodWait exceptions. + Only available for users, bots will ignore this parameter. + Defaults to False (normal session). + + sleep_threshold (``int``, *optional*): + Set a sleep threshold for flood wait exceptions happening globally in this client instance, below which any + request that raises a flood wait will be automatically invoked again after sleeping for the required amount + of time. Flood wait exceptions requiring higher waiting times will be raised. + Defaults to 10 seconds. + + hide_password (``bool``, *optional*): + Pass True to hide the password when typing it during the login. + Defaults to False, because ``getpass`` (the library used) is known to be problematic in some + terminal environments. + + max_concurrent_transmissions (``int``, *optional*): + Set the maximum amount of concurrent transmissions (uploads & downloads). + A value that is too high may result in network related issues. + Defaults to 1. + + max_message_cache_size (``int``, *optional*): + Set the maximum size of the message cache. + Defaults to 10000. + + max_business_user_connection_cache_size (``int``, *optional*): + Set the maximum size of the message cache. + Defaults to 10000. + + storage_engine (:obj:`~pyrogram.storage.Storage`, *optional*): + Pass an instance of your own implementation of session storage engine. + Useful when you want to store your session in databases like Mongo, Redis, etc. + :doc:`Storage Engines <../../topics/storage-engines>` + + no_joined_notifications (``bool``, *optional*): + Pass True to disable notification about the current user joining Telegram for other users that added them to contact list. + Pass False to Notify people on Telegram who know my phone number that I signed up. + Defaults to False + + client_platform (:obj:`~pyrogram.enums.ClientPlatform`, *optional*): + The platform where this client is running. + Defaults to 'other' + + link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*): + Set the global link preview options for the client. By default, no link preview option is set. + + fetch_replies (``int``, *optional*): + Set the number of replies to be fetched when parsing the :obj:`~pyrogram.types.Message` object. Defaults to 1. + :doc:`More on Errors <../../api/errors/index>` + + """ + + APP_VERSION = f"Pyrogram {__version__}" + DEVICE_MODEL = f"{platform.python_implementation()} {platform.python_version()}" + SYSTEM_VERSION = f"{platform.system()} {platform.release()}" + + LANG_PACK = "" + LANG_CODE = "en" + SYSTEM_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-]+)$") + TME_PUBLIC_LINK_RE = re.compile(r"^(?:https?://)?(?:www|([\w-]+)\.)?(?:t(?:elegram)?\.(?:org|me|dog))/?([\w-]+)?$") + WORKERS = min(32, (os.cpu_count() or 0) + 4) # os.cpu_count() can be None + WORKDIR = PARENT_DIR + + # Interval of seconds in which the updates watchdog will kick in + UPDATES_WATCHDOG_INTERVAL = 15 * 60 + + MAX_CONCURRENT_TRANSMISSIONS = 1 + MAX_CACHE_SIZE = 10000 + + mimetypes = MimeTypes() + mimetypes.readfp(StringIO(mime_types)) + + def __init__( + self, + name: str, + api_id: Union[int, str] = None, + api_hash: str = None, + app_version: str = APP_VERSION, + device_model: str = DEVICE_MODEL, + system_version: str = SYSTEM_VERSION, + lang_pack: str = LANG_PACK, + lang_code: str = LANG_CODE, + system_lang_code: str = SYSTEM_LANG_CODE, + ipv6: bool = False, + proxy: dict = None, + test_mode: bool = False, + bot_token: str = None, + session_string: str = None, + in_memory: bool = None, + phone_number: str = None, + phone_code: str = None, + password: str = None, + workers: int = WORKERS, + workdir: str = WORKDIR, + plugins: dict = None, + parse_mode: "enums.ParseMode" = enums.ParseMode.DEFAULT, + no_updates: bool = None, + skip_updates: bool = True, + takeout: bool = None, + sleep_threshold: int = Session.SLEEP_THRESHOLD, + hide_password: bool = False, + max_concurrent_transmissions: int = MAX_CONCURRENT_TRANSMISSIONS, + max_message_cache_size: int = MAX_CACHE_SIZE, + max_business_user_connection_cache_size: int = MAX_CACHE_SIZE, + storage_engine: Storage = None, + no_joined_notifications: bool = False, + client_platform: enums.ClientPlatform = enums.ClientPlatform.OTHER, + link_preview_options: "types.LinkPreviewOptions" = None, + fetch_replies: int = 1, + _un_docu_gnihts: List = [] + ): + super().__init__() + + self.name = name + self.api_id = int(api_id) if api_id else None + self.api_hash = api_hash + self.app_version = app_version + self.device_model = device_model + self.system_version = system_version + self.lang_pack = lang_pack.lower() + self.lang_code = lang_code.lower() + self.system_lang_code = system_lang_code.lower() + self.ipv6 = ipv6 + self.proxy = proxy + self.test_mode = test_mode + self.bot_token = bot_token + self.session_string = session_string + self.in_memory = in_memory + self.phone_number = phone_number + self.phone_code = phone_code + self.password = password + self.workers = workers + self.WORKDIR = Path(workdir) + self.plugins = plugins + self.parse_mode = parse_mode + self.no_updates = no_updates + self.skip_updates = skip_updates + self.takeout = takeout + self.sleep_threshold = sleep_threshold + self.hide_password = hide_password + self.max_concurrent_transmissions = max_concurrent_transmissions + self.max_message_cache_size = max_message_cache_size + self.max_business_user_connection_cache_size = max_business_user_connection_cache_size + self.no_joined_notifications = no_joined_notifications + self.client_platform = client_platform + self._un_docu_gnihts = _un_docu_gnihts + self.link_preview_options = link_preview_options + self.fetch_replies = fetch_replies + + self.executor = ThreadPoolExecutor(self.workers, thread_name_prefix="Handler") + + if self.session_string: + self.storage = MemoryStorage(self.name, self.session_string) + elif self.in_memory: + self.storage = MemoryStorage(self.name) + elif isinstance(storage_engine, Storage): + self.storage = storage_engine + else: + self.storage = FileStorage(self.name, self.WORKDIR) + + self.connection_factory = Connection + self.protocol_factory = TCPAbridged + + self.dispatcher = Dispatcher(self) + + self.rnd_id = MsgId + + self.parser = Parser(self) + + self.session = None + + self.media_sessions = {} + self.media_sessions_lock = asyncio.Lock() + + self.save_file_semaphore = asyncio.Semaphore(self.max_concurrent_transmissions) + self.get_file_semaphore = asyncio.Semaphore(self.max_concurrent_transmissions) + + self.is_connected = None + self.is_initialized = None + + self.takeout_id = None + + self.disconnect_handler = None + + self.me: Optional[User] = None + + self.message_cache = Cache(self.max_message_cache_size) + self.business_user_connection_cache = Cache(self.max_business_user_connection_cache_size) + + # Sometimes, for some reason, the server will stop sending updates and will only respond to pings. + # This watchdog will invoke updates.GetState in order to wake up the server and enable it sending updates again + # after some idle time has been detected. + self.updates_watchdog_task = None + self.updates_watchdog_event = asyncio.Event() + self.last_update_time = datetime.now() + + self.loop = asyncio.get_event_loop() + + def __enter__(self): + return self.start() + + def __exit__(self, *args): + try: + self.stop() + except ConnectionError: + pass + + async def __aenter__(self): + return await self.start() + + async def __aexit__(self, *args): + try: + await self.stop() + except ConnectionError: + pass + + async def updates_watchdog(self): + while True: + try: + await asyncio.wait_for(self.updates_watchdog_event.wait(), self.UPDATES_WATCHDOG_INTERVAL) + except asyncio.TimeoutError: + pass + else: + break + + if datetime.now() - self.last_update_time > timedelta(seconds=self.UPDATES_WATCHDOG_INTERVAL): + await self.invoke(raw.functions.updates.GetState()) + + async def authorize(self) -> User: + if self.bot_token: + return await self.sign_in_bot(self.bot_token) + + print(f"Welcome to Pyrogram (version {__version__})") + print(f"Pyrogram is free software and comes with ABSOLUTELY NO WARRANTY. Licensed\n" + f"under the terms of the {__license__}.\n") + + while True: + try: + if not self.phone_number: + while True: + value = await ainput("Enter phone number or bot token: ") + + if not value: + continue + + confirm = (await ainput(f'Is "{value}" correct? (y/N): ')).lower() + + if confirm == "y": + break + + if ":" in value: + self.bot_token = value + return await self.sign_in_bot(value) + else: + self.phone_number = value + + sent_code = await self.send_code(self.phone_number) + except BadRequest as e: + print(e.MESSAGE) + self.phone_number = None + self.bot_token = None + else: + break + + sent_code_descriptions = { + enums.SentCodeType.APP: "Telegram app", + enums.SentCodeType.CALL: "phone call", + enums.SentCodeType.FLASH_CALL: "phone flash call", + enums.SentCodeType.MISSED_CALL: "", + enums.SentCodeType.SMS: "SMS", + enums.SentCodeType.FRAGMENT_SMS: "Fragment SMS", + enums.SentCodeType.FIREBASE_SMS: "SMS after Firebase attestation", + enums.SentCodeType.EMAIL_CODE: "email", + enums.SentCodeType.SETUP_EMAIL_REQUIRED: "add and verify email required", + } + + print(f"The confirmation code has been sent via {sent_code_descriptions[sent_code.type]}") + + while True: + if not self.phone_code: + self.phone_code = await ainput("Enter confirmation code: ") + + try: + signed_in = await self.sign_in(self.phone_number, sent_code.phone_code_hash, self.phone_code) + except BadRequest as e: + print(e.MESSAGE) + self.phone_code = None + except SessionPasswordNeeded as e: + print(e.MESSAGE) + + while True: + print("Password hint: {}".format(await self.get_password_hint())) + + if not self.password: + self.password = await ainput("Enter password (empty to recover): ", hide=self.hide_password) + + try: + if not self.password: + confirm = await ainput("Confirm password recovery (y/n): ") + + if confirm == "y": + email_pattern = await self.send_recovery_code() + print(f"The recovery code has been sent to {email_pattern}") + + while True: + recovery_code = await ainput("Enter recovery code: ") + + try: + return await self.recover_password(recovery_code) + except BadRequest as e: + print(e.MESSAGE) + except Exception as e: + log.exception(e) + raise + else: + self.password = None + else: + return await self.check_password(self.password) + except BadRequest as e: + print(e.MESSAGE) + self.password = None + else: + break + + if isinstance(signed_in, User): + return signed_in + + while True: + first_name = await ainput("Enter first name: ") + last_name = await ainput("Enter last name (empty to skip): ") + + try: + signed_up = await self.sign_up( + self.phone_number, + sent_code.phone_code_hash, + first_name, + last_name + ) + except BadRequest as e: + print(e.MESSAGE) + else: + break + + if isinstance(signed_in, TermsOfService): + print("\n" + signed_in.text + "\n") + await self.accept_terms_of_service(signed_in.id) + + return signed_up + + def set_parse_mode(self, parse_mode: Optional["enums.ParseMode"]): + """Set the parse mode to be used globally by the client. + + When setting the parse mode with this method, all other methods having a *parse_mode* parameter will follow the + global value by default. + + Parameters: + parse_mode (:obj:`~pyrogram.enums.ParseMode`): + By default, texts are parsed using both Markdown and HTML styles. + You can combine both syntaxes together. + + Example: + .. code-block:: python + + from pyrogram import enums + + # Default combined mode: Markdown + HTML + await app.send_message(chat_id="me", text="1. **markdown** and html") + + # Force Markdown-only, HTML is disabled + app.set_parse_mode(enums.ParseMode.MARKDOWN) + await app.send_message(chat_id="me", text="2. **markdown** and html") + + # Force HTML-only, Markdown is disabled + app.set_parse_mode(enums.ParseMode.HTML) + await app.send_message(chat_id="me", text="3. **markdown** and html") + + # Disable the parser completely + app.set_parse_mode(enums.ParseMode.DISABLED) + await app.send_message(chat_id="me", text="4. **markdown** and html") + + # Bring back the default combined mode + app.set_parse_mode(enums.ParseMode.DEFAULT) + await app.send_message(chat_id="me", text="5. **markdown** and html") + """ + + self.parse_mode = parse_mode + + async def fetch_peers(self, peers: List[Union[raw.types.User, raw.types.Chat, raw.types.Channel]]) -> bool: + is_min = False + parsed_peers = [] + + for peer in peers: + if getattr(peer, "min", False): + is_min = True + continue + + usernames = None + phone_number = None + + if isinstance(peer, raw.types.User): + peer_id = peer.id + access_hash = peer.access_hash + usernames = ( + [peer.username.lower()] if peer.username + else [username.username.lower() for username in peer.usernames] if peer.usernames + else None + ) + phone_number = peer.phone + peer_type = "bot" if peer.bot else "user" + elif isinstance(peer, (raw.types.Chat, raw.types.ChatForbidden)): + peer_id = -peer.id + access_hash = 0 + peer_type = "group" + elif isinstance(peer, raw.types.Channel): + peer_id = utils.get_channel_id(peer.id) + access_hash = peer.access_hash + usernames = ( + [peer.username.lower()] if peer.username + else [username.username.lower() for username in peer.usernames] if peer.usernames + else None + ) + peer_type = "channel" if peer.broadcast else "supergroup" + elif isinstance(peer, raw.types.ChannelForbidden): + peer_id = utils.get_channel_id(peer.id) + access_hash = peer.access_hash + peer_type = "channel" if peer.broadcast else "supergroup" + else: + continue + + parsed_peers.append((peer_id, access_hash, peer_type, usernames, phone_number)) + + await self.storage.update_peers(parsed_peers) + + return is_min + + async def handle_updates(self, updates): + self.last_update_time = datetime.now() + + if isinstance(updates, (raw.types.Updates, raw.types.UpdatesCombined)): + is_min = any(( + await self.fetch_peers(updates.users), + await 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( + getattr( + getattr( + update, "message", None + ), "peer_id", None + ), "channel_id", None + ) or getattr(update, "channel_id", None) + + pts = getattr(update, "pts", None) + pts_count = getattr(update, "pts_count", None) + + if pts and not self.skip_updates: + await self.storage.update_state( + ( + utils.get_channel_id(channel_id) if channel_id else 0, + pts, + None, + updates.date, + updates.seq + ) + ) + + if isinstance(update, raw.types.UpdateChannelTooLong): + log.info(update) + + if isinstance(update, raw.types.UpdateNewChannelMessage) and is_min: + message = update.message + + if not isinstance(message, raw.types.MessageEmpty): + try: + diff = await self.invoke( + raw.functions.updates.GetChannelDifference( + channel=await self.resolve_peer(utils.get_channel_id(channel_id)), + filter=raw.types.ChannelMessagesFilter( + ranges=[raw.types.MessageRange( + min_id=update.message.id, + max_id=update.message.id + )] + ), + pts=pts - pts_count, + limit=pts + ) + ) + except ChannelPrivate: + pass + else: + if not isinstance(diff, raw.types.updates.ChannelDifferenceEmpty): + users.update({u.id: u for u in diff.users}) + chats.update({c.id: c for c in diff.chats}) + + self.dispatcher.updates_queue.put_nowait((update, users, chats)) + elif isinstance(updates, (raw.types.UpdateShortMessage, raw.types.UpdateShortChatMessage)): + if not self.skip_updates: + await self.storage.update_state( + ( + 0, + updates.pts, + None, + updates.date, + None + ) + ) + + diff = await self.invoke( + raw.functions.updates.GetDifference( + pts=updates.pts - updates.pts_count, + date=updates.date, + qts=-1 + ) + ) + + if diff.new_messages: + self.dispatcher.updates_queue.put_nowait(( + raw.types.UpdateNewMessage( + message=diff.new_messages[0], + pts=updates.pts, + pts_count=updates.pts_count + ), + {u.id: u for u in diff.users}, + {c.id: c for c in diff.chats} + )) + else: + if diff.other_updates: # The other_updates list can be empty + self.dispatcher.updates_queue.put_nowait((diff.other_updates[0], {}, {})) + elif isinstance(updates, raw.types.UpdateShort): + self.dispatcher.updates_queue.put_nowait((updates.update, {}, {})) + elif isinstance(updates, raw.types.UpdatesTooLong): + log.info(updates) + + async def load_session(self): + await self.storage.open() + + session_empty = any([ + await self.storage.test_mode() is None, + await self.storage.auth_key() is None, + await self.storage.user_id() is None, + await self.storage.is_bot() is None + ]) + + if session_empty: + if not self.api_id or not self.api_hash: + raise AttributeError("The API key is required for new authorizations. " + "More info: https://docs.pyrogram.org/start/auth") + + await self.storage.api_id(self.api_id) + + await self.storage.dc_id(2) + await self.storage.date(0) + + await self.storage.test_mode(self.test_mode) + await self.storage.auth_key( + await Auth( + self, await self.storage.dc_id(), + await self.storage.test_mode() + ).create() + ) + await self.storage.user_id(None) + await self.storage.is_bot(None) + else: + # Needed for migration from storage v2 to v3 + if not await self.storage.api_id(): + if self.api_id: + await self.storage.api_id(self.api_id) + else: + while True: + try: + value = int(await ainput("Enter the api_id part of the API key: ")) + + if value <= 0: + print("Invalid value") + continue + + confirm = (await ainput(f'Is "{value}" correct? (y/N): ')).lower() + + if confirm == "y": + await self.storage.api_id(value) + break + except Exception as e: + print(e) + + def load_plugins(self): + if self.plugins: + plugins = self.plugins.copy() + + for option in ["include", "exclude"]: + if plugins.get(option, []): + plugins[option] = [ + (i.split()[0], i.split()[1:] or None) + for i in self.plugins[option] + ] + else: + return + + if plugins.get("enabled", True): + root = plugins["root"] + include = plugins.get("include", []) + exclude = plugins.get("exclude", []) + + count = 0 + + if not include: + for path in sorted(Path(root.replace(".", "/")).rglob("*.py")): + module_path = '.'.join(path.parent.parts + (path.stem,)) + module = import_module(module_path) + + for name in vars(module).keys(): + # noinspection PyBroadException + try: + for handler, group in getattr(module, name).handlers: + if isinstance(handler, Handler) and isinstance(group, int): + self.add_handler(handler, group) + + log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format( + self.name, type(handler).__name__, name, group, module_path)) + + count += 1 + except Exception: + pass + else: + for path, handlers in include: + module_path = root + "." + path + warn_non_existent_functions = True + + try: + module = import_module(module_path) + except ImportError: + log.warning('[%s] [LOAD] Ignoring non-existent module "%s"', self.name, module_path) + continue + + if "__path__" in dir(module): + log.warning('[%s] [LOAD] Ignoring namespace "%s"', self.name, module_path) + continue + + if handlers is None: + handlers = vars(module).keys() + warn_non_existent_functions = False + + for name in handlers: + # noinspection PyBroadException + try: + for handler, group in getattr(module, name).handlers: + if isinstance(handler, Handler) and isinstance(group, int): + self.add_handler(handler, group) + + log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format( + self.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( + self.name, name, module_path)) + + if exclude: + for path, handlers in exclude: + module_path = root + "." + path + warn_non_existent_functions = True + + try: + module = import_module(module_path) + except ImportError: + log.warning('[%s] [UNLOAD] Ignoring non-existent module "%s"', self.name, module_path) + continue + + if "__path__" in dir(module): + log.warning('[%s] [UNLOAD] Ignoring namespace "%s"', self.name, module_path) + continue + + if handlers is None: + handlers = vars(module).keys() + warn_non_existent_functions = False + + for name in handlers: + # noinspection PyBroadException + try: + for handler, group in getattr(module, name).handlers: + if isinstance(handler, Handler) and isinstance(group, int): + self.remove_handler(handler, group) + + log.info('[{}] [UNLOAD] {}("{}") from group {} in "{}"'.format( + self.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( + self.name, name, module_path)) + + if count > 0: + log.info('[{}] Successfully loaded {} plugin{} from "{}"'.format( + self.name, count, "s" if count > 1 else "", root)) + else: + log.warning('[%s] No plugin loaded from "%s"', self.name, root) + + async def handle_download(self, packet): + file_id, directory, file_name, in_memory, file_size, progress, progress_args = packet + + os.makedirs(directory, exist_ok=True) if not in_memory else None + temp_file_path = os.path.abspath(re.sub("\\\\", "/", os.path.join(directory, file_name))) + ".temp" + file = BytesIO() if in_memory else open(temp_file_path, "wb") + + try: + async for chunk in self.get_file(file_id, file_size, 0, 0, progress, progress_args): + file.write(chunk) + except BaseException as e: + if not in_memory: + file.close() + os.remove(temp_file_path) + + if isinstance(e, asyncio.CancelledError): + raise e + + return None + else: + if in_memory: + file.name = file_name + return file + else: + file.close() + file_path = os.path.splitext(temp_file_path)[0] + shutil.move(temp_file_path, file_path) + return file_path + + async def get_file( + self, + file_id: FileId, + file_size: int = 0, + limit: int = 0, + offset: int = 0, + progress: Callable = None, + progress_args: tuple = () + ) -> Optional[AsyncGenerator[bytes, None]]: + async with self.get_file_semaphore: + file_type = file_id.file_type + + if file_type == FileType.CHAT_PHOTO: + if file_id.chat_id > 0: + peer = raw.types.InputPeerUser( + user_id=file_id.chat_id, + access_hash=file_id.chat_access_hash + ) + else: + if file_id.chat_access_hash == 0: + peer = raw.types.InputPeerChat( + chat_id=-file_id.chat_id + ) + else: + peer = raw.types.InputPeerChannel( + channel_id=utils.get_channel_id(file_id.chat_id), + access_hash=file_id.chat_access_hash + ) + + location = raw.types.InputPeerPhotoFileLocation( + peer=peer, + photo_id=file_id.media_id, + big=file_id.thumbnail_source == ThumbnailSource.CHAT_PHOTO_BIG + ) + elif file_type == FileType.PHOTO: + location = raw.types.InputPhotoFileLocation( + id=file_id.media_id, + access_hash=file_id.access_hash, + file_reference=file_id.file_reference, + thumb_size=file_id.thumbnail_size + ) + else: + location = raw.types.InputDocumentFileLocation( + id=file_id.media_id, + access_hash=file_id.access_hash, + file_reference=file_id.file_reference, + thumb_size=file_id.thumbnail_size + ) + + current = 0 + total = abs(limit) or (1 << 31) - 1 + chunk_size = 1024 * 1024 + offset_bytes = abs(offset) * chunk_size + + dc_id = file_id.dc_id + + try: + session = self.media_sessions.get(dc_id) + if not session: + session = self.media_sessions[dc_id] = Session( + self, dc_id, + await Auth(self, dc_id, await self.storage.test_mode()).create() + if dc_id != await self.storage.dc_id() + else await self.storage.auth_key(), + await self.storage.test_mode(), + is_media=True + ) + await session.start() + + if dc_id != await self.storage.dc_id(): + for _ in range(3): + exported_auth = await self.invoke( + raw.functions.auth.ExportAuthorization( + dc_id=dc_id + ) + ) + + try: + await session.invoke( + raw.functions.auth.ImportAuthorization( + id=exported_auth.id, + bytes=exported_auth.bytes + ) + ) + except AuthBytesInvalid: + continue + else: + break + else: + raise AuthBytesInvalid + + r = await session.invoke( + raw.functions.upload.GetFile( + location=location, + offset=offset_bytes, + limit=chunk_size + ) + ) + + if isinstance(r, raw.types.upload.File): + while True: + chunk = r.bytes + + yield chunk + + current += 1 + offset_bytes += chunk_size + + if progress: + func = functools.partial( + progress, + min(offset_bytes, file_size) + if file_size != 0 + else offset_bytes, + file_size, + *progress_args + ) + + if inspect.iscoroutinefunction(progress): + await func() + else: + await self.loop.run_in_executor(self.executor, func) + + if len(chunk) < chunk_size or current >= total: + break + + r = await session.invoke( + raw.functions.upload.GetFile( + location=location, + offset=offset_bytes, + limit=chunk_size + ) + ) + + elif isinstance(r, raw.types.upload.FileCdnRedirect): + cdn_session = Session( + self, r.dc_id, await Auth(self, r.dc_id, await self.storage.test_mode()).create(), + await self.storage.test_mode(), is_media=True, is_cdn=True + ) + + try: + await cdn_session.start() + + while True: + r2 = await cdn_session.invoke( + raw.functions.upload.GetCdnFile( + file_token=r.file_token, + offset=offset_bytes, + limit=chunk_size + ) + ) + + if isinstance(r2, raw.types.upload.CdnFileReuploadNeeded): + try: + await session.invoke( + raw.functions.upload.ReuploadCdnFile( + file_token=r.file_token, + request_token=r2.request_token + ) + ) + except VolumeLocNotFound: + break + else: + continue + + chunk = r2.bytes + + # https://core.telegram.org/cdn#decrypting-files + decrypted_chunk = aes.ctr256_decrypt( + chunk, + r.encryption_key, + bytearray( + r.encryption_iv[:-4] + + (offset_bytes // 16).to_bytes(4, "big") + ) + ) + + hashes = await session.invoke( + raw.functions.upload.GetCdnFileHashes( + file_token=r.file_token, + offset=offset_bytes + ) + ) + + # https://core.telegram.org/cdn#verifying-files + for i, h in enumerate(hashes): + cdn_chunk = decrypted_chunk[h.limit * i: h.limit * (i + 1)] + CDNFileHashMismatch.check( + h.hash == sha256(cdn_chunk).digest(), + "h.hash == sha256(cdn_chunk).digest()" + ) + + yield decrypted_chunk + + current += 1 + offset_bytes += chunk_size + + if progress: + func = functools.partial( + progress, + min(offset_bytes, file_size) if file_size != 0 else offset_bytes, + file_size, + *progress_args + ) + + if inspect.iscoroutinefunction(progress): + await func() + else: + await self.loop.run_in_executor(self.executor, func) + + if len(chunk) < chunk_size or current >= total: + break + except Exception as e: + raise e + finally: + await cdn_session.stop() + except pyrogram.StopTransmission: + raise + except Exception as e: + log.exception(e) + + def guess_mime_type(self, filename: str) -> Optional[str]: + return self.mimetypes.guess_type(filename)[0] + + def guess_extension(self, mime_type: str) -> Optional[str]: + return self.mimetypes.guess_extension(mime_type) + + +class Cache: + def __init__(self, capacity: int): + self.capacity = capacity + self.store = {} + + def __getitem__(self, key): + return self.store.get(key, None) + + def __setitem__(self, key, value): + if key in self.store: + del self.store[key] + + self.store[key] = value + + if len(self.store) > self.capacity: + for _ in range(self.capacity // 2 + 1): + del self.store[next(iter(self.store))] diff --git a/pyrogram/client/__init__.py b/pyrogram/client/__init__.py deleted file mode 100644 index 9828292b76..0000000000 --- a/pyrogram/client/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 .client import Client diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py deleted file mode 100644 index 81693d7058..0000000000 --- a/pyrogram/client/client.py +++ /dev/null @@ -1,517 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 base64 -import json -import logging -import time -from collections import namedtuple -from configparser import ConfigParser -from hashlib import sha256 - -from pyrogram.api import functions, types -from pyrogram.api.core import Object -from pyrogram.api.errors import ( - PhoneMigrate, NetworkMigrate, PhoneNumberInvalid, - PhoneNumberUnoccupied, PhoneCodeInvalid, PhoneCodeHashEmpty, - PhoneCodeExpired, PhoneCodeEmpty, SessionPasswordNeeded, - PasswordHashInvalid, FloodWait, PeerIdInvalid -) -from pyrogram.api.types import ( - User, Chat, Channel, - PeerUser, PeerChat, PeerChannel, - Dialog, Message, - InputPeerEmpty, InputPeerSelf, - InputPeerUser, InputPeerChat, InputPeerChannel) -from pyrogram.extensions import Markdown -from pyrogram.session import Auth, Session - -log = logging.getLogger(__name__) - -Config = namedtuple("Config", ["api_id", "api_hash"]) - - -class Client: - DIALOGS_AT_ONCE = 100 - - CHAT_ACTIONS = { - "cancel": types.SendMessageCancelAction, - "typing": types.SendMessageTypingAction, - "playing": types.SendMessageGamePlayAction, - "choose_contact": types.SendMessageChooseContactAction, - "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, - } - - def __init__(self, session_name: str, test_mode: bool = False): - self.session_name = session_name - self.test_mode = test_mode - - self.dc_id = None - self.auth_key = None - self.user_id = None - - self.rnd_id = None - - self.peers_by_id = {} - self.peers_by_username = {} - - self.config = None - self.session = None - - self.update_handler = None - - # TODO: Better update handler - def set_update_handler(self, callback: callable): - self.update_handler = callback - - def send(self, data: Object): - return self.session.send(data) - - def authorize(self): - while True: - phone_number = input("Enter phone number: ") - - while True: - confirm = input("Is \"{}\" correct? (y/n): ".format(phone_number)) - - if confirm in ("y", "1"): - break - elif confirm in ("n", "2"): - phone_number = input("Enter phone number: ") - - try: - r = self.send( - functions.auth.SendCode( - phone_number, - self.config.api_id, - self.config.api_hash - ) - ) - except (PhoneMigrate, NetworkMigrate) as e: - self.session.stop() - - self.dc_id = e.x - self.auth_key = Auth(self.dc_id, self.test_mode).create() - - self.session = Session(self.dc_id, self.test_mode, self.auth_key, self.config.api_id) - self.session.start() - - r = self.send( - functions.auth.SendCode( - phone_number, - self.config.api_id, - self.config.api_hash - ) - ) - break - except PhoneNumberInvalid as e: - print(e.MESSAGE) - except FloodWait as e: - print(e.MESSAGE.format(x=e.x)) - time.sleep(e.x) - except Exception as e: - log.error(e, exc_info=True) - else: - break - - phone_registered = r.phone_registered - phone_code_hash = r.phone_code_hash - - while True: - phone_code = input("Enter phone code: ") - - try: - if phone_registered: - r = self.send( - functions.auth.SignIn( - phone_number, - phone_code_hash, - phone_code - ) - ) - else: - try: - self.send( - functions.auth.SignIn( - phone_number, - phone_code_hash, - phone_code - ) - ) - except PhoneNumberUnoccupied: - pass - - first_name = input("First name: ") - last_name = input("Last name: ") - - r = self.send( - functions.auth.SignUp( - phone_number, - phone_code_hash, - phone_code, - first_name, - last_name - ) - ) - except (PhoneCodeInvalid, PhoneCodeEmpty, PhoneCodeExpired, PhoneCodeHashEmpty) as e: - print(e.MESSAGE) - except SessionPasswordNeeded as e: - print(e.MESSAGE) - - while True: - try: - r = self.send(functions.account.GetPassword()) - - print("Hint: {}".format(r.hint)) - password = input("Enter password: ") # TODO: Use getpass - - password = r.current_salt + password.encode() + r.current_salt - password_hash = sha256(password).digest() - - r = self.send(functions.auth.CheckPassword(password_hash)) - except PasswordHashInvalid as e: - print(e.MESSAGE) - except FloodWait as e: - print(e.MESSAGE.format(x=e.x)) - time.sleep(e.x) - except Exception as e: - log.error(e, exc_info=True) - else: - break - break - except FloodWait as e: - print(e.MESSAGE.format(x=e.x)) - time.sleep(e.x) - except Exception as e: - log.error(e, exc_info=True) - else: - break - - return r.user.id - - def load_config(self): - config = ConfigParser() - config.read("config.ini") - - self.config = Config( - int(config["pyrogram"]["api_id"]), - config["pyrogram"]["api_hash"] - ) - - def load_session(self, session_name): - try: - with open("{}.session".format(session_name)) as f: - s = json.load(f) - except FileNotFoundError: - self.dc_id = 1 - self.auth_key = Auth(self.dc_id, self.test_mode).create() - else: - self.dc_id = s["dc_id"] - self.test_mode = s["test_mode"] - self.auth_key = base64.b64decode("".join(s["auth_key"])) - self.user_id = s["user_id"] - - def save_session(self): - auth_key = base64.b64encode(self.auth_key).decode() - auth_key = [auth_key[i: i + 43] for i in range(0, len(auth_key), 43)] - - with open("{}.session".format(self.session_name), "w") as f: - json.dump( - dict( - dc_id=self.dc_id, - test_mode=self.test_mode, - auth_key=auth_key, - user_id=self.user_id, - ), - f, - indent=4 - ) - - def start(self): - self.load_config() - self.load_session(self.session_name) - - self.session = Session(self.dc_id, self.test_mode, self.auth_key, self.config.api_id) - - terms = self.session.start() - - if self.user_id is None: - print("\n".join(terms.splitlines()), "\n") - - self.user_id = self.authorize() - self.save_session() - - self.session.update_handler = self.update_handler - self.rnd_id = self.session.msg_id - self.get_dialogs() - - def stop(self): - self.session.stop() - - def get_dialogs(self): - peers = [] - - def parse_dialogs(d) -> int: - oldest_date = 1 << 32 - - for dialog in d.dialogs: # type: Dialog - # Only search for Users, Chats and Channels - if not isinstance(dialog.peer, (PeerUser, PeerChat, PeerChannel)): - continue - - if isinstance(dialog.peer, PeerUser): - peer_type = "user" - peer_id = dialog.peer.user_id - elif isinstance(dialog.peer, PeerChat): - peer_type = "chat" - peer_id = dialog.peer.chat_id - elif isinstance(dialog.peer, PeerChannel): - peer_type = "channel" - peer_id = dialog.peer.channel_id - else: - continue - - for message in d.messages: # type: Message - # Only search for Messages - if not isinstance(message, Message): - continue - - is_this = peer_id == message.from_id or dialog.peer == message.to_id - - if is_this: - for entity in (d.users if peer_type == "user" else d.chats): # type: User or Chat or Channel - if entity.id == peer_id: - peers.append( - dict( - id=peer_id, - access_hash=getattr(entity, "access_hash", None), - type=peer_type, - first_name=getattr(entity, "first_name", None), - last_name=getattr(entity, "last_name", None), - title=getattr(entity, "title", None), - username=getattr(entity, "username", None), - ) - ) - - if message.date < oldest_date: - oldest_date = message.date - - break - break - - return oldest_date - - pinned_dialogs = self.send(functions.messages.GetPinnedDialogs()) - parse_dialogs(pinned_dialogs) - - dialogs = self.send( - functions.messages.GetDialogs( - 0, 0, InputPeerEmpty(), - self.DIALOGS_AT_ONCE, True - ) - ) - - offset_date = parse_dialogs(dialogs) - logging.info("Dialogs count: {}".format(len(peers))) - - while len(dialogs.dialogs) == self.DIALOGS_AT_ONCE: - dialogs = self.send( - functions.messages.GetDialogs( - offset_date, 0, types.InputPeerEmpty(), - self.DIALOGS_AT_ONCE, True - ) - ) - - offset_date = parse_dialogs(dialogs) - logging.info("Dialogs count: {}".format(len(peers))) - - for i in peers: - id = i["id"] - username = i["username"] - - self.peers_by_id[id] = i - - if username: - username = username.lower() - self.peers_by_username[username] = i - - def resolve_peer(self, chat_id: int or str): - if chat_id in ("self", "me"): - input_peer = InputPeerSelf() - else: - try: - peer = ( - self.peers_by_username[chat_id.lower()] - if isinstance(chat_id, str) - else self.peers_by_id[chat_id] - ) - except KeyError: - raise PeerIdInvalid - - peer_type = peer["type"] - peer_id = peer["id"] - peer_access_hash = peer["access_hash"] - - if peer_type == "user": - input_peer = InputPeerUser( - peer_id, - peer_access_hash - ) - elif peer_type == "chat": - input_peer = InputPeerChat( - peer_id - ) - elif peer_type == "channel": - input_peer = InputPeerChannel( - peer_id, - peer_access_hash - ) - else: - raise PeerIdInvalid - - return input_peer - - def get_me(self): - return self.send( - functions.users.GetFullUser( - InputPeerSelf() - ) - ) - - def send_message(self, - chat_id: int or str, - text: str, - disable_web_page_preview: bool = None, - disable_notification: bool = None, - reply_to_msg_id: int = None): - return self.send( - functions.messages.SendMessage( - peer=self.resolve_peer(chat_id), - no_webpage=disable_web_page_preview or None, - silent=disable_notification or None, - reply_to_msg_id=reply_to_msg_id, - random_id=self.rnd_id(), - **Markdown.parse(text) - ) - ) - - def forward_messages(self, - chat_id: int or str, - from_chat_id: int or str, - message_ids: list, - disable_notification: bool = None): - return self.send( - functions.messages.ForwardMessages( - to_peer=self.resolve_peer(chat_id), - from_peer=self.resolve_peer(from_chat_id), - id=message_ids, - silent=disable_notification or None, - random_id=[self.rnd_id() for _ in message_ids] - ) - ) - - def send_location(self, - chat_id: int or str, - latitude: float, - longitude: float, - disable_notification: bool = None, - reply_to_message_id: int = None): - return self.send( - functions.messages.SendMedia( - peer=self.resolve_peer(chat_id), - media=types.InputMediaGeoPoint( - types.InputGeoPoint( - latitude, - longitude - ) - ), - silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id, - random_id=self.rnd_id() - ) - ) - - def send_contact(self, - chat_id: int or str, - phone_number: str, - first_name: str, - last_name: str, - disable_notification: bool = None, - reply_to_message_id: int = None): - return self.send( - functions.messages.SendMedia( - peer=self.resolve_peer(chat_id), - media=types.InputMediaContact( - phone_number, - first_name, - last_name - ), - silent=disable_notification or None, - reply_to_msg_id=reply_to_message_id, - random_id=self.rnd_id() - ) - ) - - def send_chat_action(self, - chat_id: int or str, - action: str, - progress: int = 0): - return self.send( - functions.messages.SetTyping( - peer=self.resolve_peer(chat_id), - action=self.CHAT_ACTIONS.get( - action.lower(), - types.SendMessageTypingAction - )(progress=progress) - ) - ) - - def edit_message_text(self, - chat_id: int or str, - message_id: int, - text: str, - disable_web_page_preview: bool = None): - return self.send( - functions.messages.EditMessage( - peer=self.resolve_peer(chat_id), - id=message_id, - no_webpage=disable_web_page_preview or None, - **Markdown.parse(text) - ) - ) - - def delete_messages(self, - message_ids: list, - revoke: bool = None): - # TODO: Maybe "revoke" is superfluous. - # If I want to delete a message, chances are I want it to - # be deleted even from the other side - return self.send( - functions.messages.DeleteMessages( - id=message_ids, - revoke=revoke or None - ) - ) diff --git a/pyrogram/connection/__init__.py b/pyrogram/connection/__init__.py index 17f9de0e9b..4665ce913f 100644 --- a/pyrogram/connection/__init__.py +++ b/pyrogram/connection/__init__.py @@ -1,19 +1,19 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . from .connection import Connection diff --git a/pyrogram/connection/connection.py b/pyrogram/connection/connection.py index 430df8fd00..8db9724fb4 100644 --- a/pyrogram/connection/connection.py +++ b/pyrogram/connection/connection.py @@ -1,59 +1,81 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . +import asyncio import logging -import time +from typing import Optional, Type -from .transport import * +from .transport import TCP, TCPAbridged +from ..session.internals import DataCenter log = logging.getLogger(__name__) class Connection: - MODES = { - 0: TCPFull, - 1: TCPAbridged, - 2: TCPIntermediate - } + MAX_CONNECTION_ATTEMPTS = 3 - def __init__(self, ipv4: str, mode: int = 1): - self.address = (ipv4, 80) - self.mode = self.MODES.get(mode, TCPAbridged) - self.connection = None + def __init__( + self, + dc_id: int, + test_mode: bool, + ipv6: bool, + proxy: dict, + media: bool = False, + protocol_factory: Type[TCP] = TCPAbridged + ) -> None: + self.dc_id = dc_id + self.test_mode = test_mode + self.ipv6 = ipv6 + self.proxy = proxy + self.media = media + self.protocol_factory = protocol_factory - def connect(self): - while True: - self.connection = self.mode() + self.address = DataCenter(dc_id, test_mode, ipv6, media) + self.protocol: Optional[TCP] = None + + async def connect(self) -> None: + for i in range(Connection.MAX_CONNECTION_ATTEMPTS): + self.protocol = self.protocol_factory(ipv6=self.ipv6, proxy=self.proxy) try: log.info("Connecting...") - self.connection.connect(self.address) - except OSError: - self.connection.close() - time.sleep(1) + await self.protocol.connect(self.address) + except OSError as e: + log.warning("Unable to connect due to network issues: %s", e) + await self.protocol.close() + await asyncio.sleep(1) else: + log.info("Connected! %s DC%s%s - IPv%s", + "Test" if self.test_mode else "Production", + self.dc_id, + " (media)" if self.media else "", + "6" if self.ipv6 else "4") break + else: + log.warning("Connection failed! Trying again...") + raise ConnectionError - def close(self): - self.connection.close() + async def close(self) -> None: + await self.protocol.close() + log.info("Disconnected") - def send(self, data: bytes): - self.connection.send(data) + async def send(self, data: bytes) -> None: + await self.protocol.send(data) - def recv(self) -> bytes or None: - return self.connection.recv() + async def recv(self) -> Optional[bytes]: + return await self.protocol.recv() diff --git a/pyrogram/connection/transport/__init__.py b/pyrogram/connection/transport/__init__.py index 385976a107..2d08832a70 100644 --- a/pyrogram/connection/transport/__init__.py +++ b/pyrogram/connection/transport/__init__.py @@ -1,19 +1,19 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . from .tcp import * diff --git a/pyrogram/connection/transport/tcp/__init__.py b/pyrogram/connection/transport/tcp/__init__.py index 7ecf7cf626..bae35e8825 100644 --- a/pyrogram/connection/transport/tcp/__init__.py +++ b/pyrogram/connection/transport/tcp/__init__.py @@ -1,21 +1,24 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . +from .tcp import TCP, Proxy from .tcp_abridged import TCPAbridged +from .tcp_abridged_o import TCPAbridgedO from .tcp_full import TCPFull from .tcp_intermediate import TCPIntermediate +from .tcp_intermediate_o import TCPIntermediateO diff --git a/pyrogram/connection/transport/tcp/tcp.py b/pyrogram/connection/transport/tcp/tcp.py index 17fdcba654..9994fb8220 100644 --- a/pyrogram/connection/transport/tcp/tcp.py +++ b/pyrogram/connection/transport/tcp/tcp.py @@ -1,48 +1,168 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . +import asyncio +import ipaddress import logging import socket +from concurrent.futures import ThreadPoolExecutor +from typing import Tuple, Dict, TypedDict, Optional + +import socks log = logging.getLogger(__name__) +proxy_type_by_scheme: Dict[str, int] = { + "SOCKS4": socks.SOCKS4, + "SOCKS5": socks.SOCKS5, + "HTTP": socks.HTTP, +} + + +class Proxy(TypedDict): + scheme: str + hostname: str + port: int + username: Optional[str] + password: Optional[str] + + +class TCP: + TIMEOUT = 10 + + def __init__(self, ipv6: bool, proxy: Proxy) -> None: + self.ipv6 = ipv6 + self.proxy = proxy + + self.reader: Optional[asyncio.StreamReader] = None + self.writer: Optional[asyncio.StreamWriter] = None + + self.lock = asyncio.Lock() + self.loop = asyncio.get_event_loop() + + async def _connect_via_proxy( + self, + destination: Tuple[str, int] + ) -> None: + scheme = self.proxy.get("scheme") + if scheme is None: + raise ValueError("No scheme specified") + + proxy_type = proxy_type_by_scheme.get(scheme.upper()) + if proxy_type is None: + raise ValueError(f"Unknown proxy type {scheme}") + + hostname = self.proxy.get("hostname") + port = self.proxy.get("port") + username = self.proxy.get("username") + password = self.proxy.get("password") -class TCP(socket.socket): - def __init__(self): - super().__init__() + try: + ip_address = ipaddress.ip_address(hostname) + except ValueError: + is_proxy_ipv6 = False + else: + is_proxy_ipv6 = isinstance(ip_address, ipaddress.IPv6Address) - def send(self, *args): - pass + proxy_family = socket.AF_INET6 if is_proxy_ipv6 else socket.AF_INET + sock = socks.socksocket(proxy_family) - def recv(self, *args): - pass + sock.set_proxy( + proxy_type=proxy_type, + addr=hostname, + port=port, + username=username, + password=password + ) + sock.settimeout(TCP.TIMEOUT) + + await self.loop.sock_connect( + sock=sock, + address=destination + ) + + sock.setblocking(False) + + self.reader, self.writer = await asyncio.open_connection( + sock=sock + ) + + async def _connect_via_direct( + self, + destination: Tuple[str, int] + ) -> None: + host, port = destination + family = socket.AF_INET6 if self.ipv6 else socket.AF_INET + self.reader, self.writer = await asyncio.open_connection( + host=host, + port=port, + family=family + ) + + async def _connect(self, destination: Tuple[str, int]) -> None: + if self.proxy: + await self._connect_via_proxy(destination) + else: + await self._connect_via_direct(destination) + + async def connect(self, address: Tuple[str, int]) -> None: + try: + await asyncio.wait_for(self._connect(address), TCP.TIMEOUT) + except asyncio.TimeoutError: # Re-raise as TimeoutError. asyncio.TimeoutError is deprecated in 3.11 + raise TimeoutError("Connection timed out") + + async def close(self) -> None: + if self.writer is None: + return None + + try: + self.writer.close() + await asyncio.wait_for(self.writer.wait_closed(), TCP.TIMEOUT) + except Exception as e: + log.info("Close exception: %s %s", type(e).__name__, e) + + async def send(self, data: bytes) -> None: + if self.writer is None: + return None + + async with self.lock: + try: + self.writer.write(data) + await self.writer.drain() + except Exception as e: + # error coming somewhere here + log.exception("Send exception: %s %s", type(e).__name__, e) + raise OSError(e) - def recvall(self, length: int) -> bytes or None: + async def recv(self, length: int = 0) -> Optional[bytes]: data = b"" while len(data) < length: try: - packet = super().recv(length - len(data)) - except OSError: + chunk = await asyncio.wait_for( + self.reader.read(length - len(data)), + TCP.TIMEOUT + ) + except (OSError, asyncio.TimeoutError): return None else: - if packet: - data += packet + if chunk: + data += chunk else: return None diff --git a/pyrogram/connection/transport/tcp/tcp_abridged.py b/pyrogram/connection/transport/tcp/tcp_abridged.py index c6615b14d4..4cb4c1b2a3 100644 --- a/pyrogram/connection/transport/tcp/tcp_abridged.py +++ b/pyrogram/connection/transport/tcp/tcp_abridged.py @@ -1,67 +1,57 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . import logging +from typing import Optional, Tuple -from .tcp import TCP +from .tcp import TCP, Proxy log = logging.getLogger(__name__) class TCPAbridged(TCP): - def __init__(self): - super().__init__() - self.is_first_packet = None + def __init__(self, ipv6: bool, proxy: Proxy) -> None: + super().__init__(ipv6, proxy) - def connect(self, address: tuple): - super().connect(address) - self.is_first_packet = True - log.info("Connected!") + async def connect(self, address: Tuple[str, int]) -> None: + await super().connect(address) + await super().send(b"\xef") - def send(self, data: bytes): + async def send(self, data: bytes, *args) -> None: length = len(data) // 4 - data = ( - bytes([length]) + data - if length <= 126 - else b"\x7f" + int.to_bytes(length, 3, "little") + data + await super().send( + (bytes([length]) + if length <= 126 + else b"\x7f" + length.to_bytes(3, "little")) + + data ) - if self.is_first_packet: - data = b"\xef" + data - self.is_first_packet = False - - super().sendall(data) - - def recv(self) -> bytes or None: - length = self.recvall(1) + async def recv(self, length: int = 0) -> Optional[bytes]: + length = await super().recv(1) if length is None: return None if length == b"\x7f": - length = self.recvall(3) + length = await super().recv(3) if length is None: return None - length = int.from_bytes(length, "little") * 4 - - packet = self.recvall(length) - - return packet + return await super().recv(int.from_bytes(length, "little") * 4) diff --git a/pyrogram/connection/transport/tcp/tcp_abridged_o.py b/pyrogram/connection/transport/tcp/tcp_abridged_o.py new file mode 100644 index 0000000000..20efb5ec3f --- /dev/null +++ b/pyrogram/connection/transport/tcp/tcp_abridged_o.py @@ -0,0 +1,86 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 +import os +from typing import Optional, Tuple + +import pyrogram +from pyrogram.crypto import aes +from .tcp import TCP, Proxy + +log = logging.getLogger(__name__) + + +class TCPAbridgedO(TCP): + RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4) + + def __init__(self, ipv6: bool, proxy: Proxy) -> None: + super().__init__(ipv6, proxy) + + self.encrypt = None + self.decrypt = None + + async def connect(self, address: Tuple[str, int]) -> None: + await super().connect(address) + + while True: + nonce = bytearray(os.urandom(64)) + + if bytes([nonce[0]]) != b"\xef" and nonce[:4] not in self.RESERVED and nonce[4:8] != b"\x00" * 4: + nonce[56] = nonce[57] = nonce[58] = nonce[59] = 0xef + break + + temp = bytearray(nonce[55:7:-1]) + + self.encrypt = (nonce[8:40], nonce[40:56], bytearray(1)) + self.decrypt = (temp[0:32], temp[32:48], bytearray(1)) + + nonce[56:64] = aes.ctr256_encrypt(nonce, *self.encrypt)[56:64] + + await super().send(nonce) + + async def send(self, data: bytes, *args) -> None: + length = len(data) // 4 + data = (bytes([length]) if length <= 126 else b"\x7f" + length.to_bytes(3, "little")) + data + payload = await self.loop.run_in_executor(pyrogram.crypto_executor, aes.ctr256_encrypt, data, *self.encrypt) + + await super().send(payload) + + async def recv(self, length: int = 0) -> Optional[bytes]: + length = await super().recv(1) + + if length is None: + return None + + length = aes.ctr256_decrypt(length, *self.decrypt) + + if length == b"\x7f": + length = await super().recv(3) + + if length is None: + return None + + length = aes.ctr256_decrypt(length, *self.decrypt) + + data = await super().recv(int.from_bytes(length, "little") * 4) + + if data is None: + return None + + return await self.loop.run_in_executor(pyrogram.crypto_executor, aes.ctr256_decrypt, data, *self.decrypt) diff --git a/pyrogram/connection/transport/tcp/tcp_full.py b/pyrogram/connection/transport/tcp/tcp_full.py index 417d5d5bf2..ad9d981718 100644 --- a/pyrogram/connection/transport/tcp/tcp_full.py +++ b/pyrogram/connection/transport/tcp/tcp_full.py @@ -1,68 +1,64 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . import logging from binascii import crc32 from struct import pack, unpack -from threading import Lock +from typing import Optional, Tuple -from .tcp import TCP +from .tcp import TCP, Proxy log = logging.getLogger(__name__) class TCPFull(TCP): - def __init__(self): - super().__init__() - self.seq_no = None - self.lock = Lock() + def __init__(self, ipv6: bool, proxy: Proxy) -> None: + super().__init__(ipv6, proxy) - def connect(self, address: tuple): - super().connect(address) - self.seq_no = 0 - log.info("Connected!") + self.seq_no: Optional[int] = None - def send(self, data: bytes): - with self.lock: - # 12 = packet_length (4), seq_no (4), crc32 (4) (at the end) - data = pack(" None: + await super().connect(address) + self.seq_no = 0 - self.seq_no += 1 + async def send(self, data: bytes, *args) -> None: + data = pack(" bytes or None: - length = self.recvall(4) + async def recv(self, length: int = 0) -> Optional[bytes]: + length = await super().recv(4) if length is None: return None - packet = self.recvall(unpack(" +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . import logging from struct import pack, unpack +from typing import Optional, Tuple -from .tcp_abridged import TCP +from .tcp import TCP, Proxy log = logging.getLogger(__name__) class TCPIntermediate(TCP): - def __init__(self): - super().__init__() - self.is_first_packet = None + def __init__(self, ipv6: bool, proxy: Proxy) -> None: + super().__init__(ipv6, proxy) - def connect(self, address: tuple): - super().connect(address) - self.is_first_packet = True - log.info("Connected!") + async def connect(self, address: Tuple[str, int]) -> None: + await super().connect(address) + await super().send(b"\xee" * 4) - def send(self, data: bytes): - length = len(data) - data = pack(" None: + await super().send(pack(" bytes or None: - length = self.recvall(4) + async def recv(self, length: int = 0) -> Optional[bytes]: + length = await super().recv(4) if length is None: return None - packet = self.recvall(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 logging +import os +from struct import pack, unpack +from typing import Optional, Tuple + +from pyrogram.crypto import aes +from .tcp import TCP, Proxy + +log = logging.getLogger(__name__) + + +class TCPIntermediateO(TCP): + RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4) + + def __init__(self, ipv6: bool, proxy: Proxy) -> None: + super().__init__(ipv6, proxy) + + self.encrypt = None + self.decrypt = None + + async def connect(self, address: Tuple[str, int]) -> None: + await super().connect(address) + + while True: + nonce = bytearray(os.urandom(64)) + + if bytes([nonce[0]]) != b"\xef" and nonce[:4] not in self.RESERVED and nonce[4:8] != b"\x00" * 4: + nonce[56] = nonce[57] = nonce[58] = nonce[59] = 0xee + break + + temp = bytearray(nonce[55:7:-1]) + + self.encrypt = (nonce[8:40], nonce[40:56], bytearray(1)) + self.decrypt = (temp[0:32], temp[32:48], bytearray(1)) + + nonce[56:64] = aes.ctr256_encrypt(nonce, *self.encrypt)[56:64] + + await super().send(nonce) + + async def send(self, data: bytes, *args) -> None: + await super().send( + aes.ctr256_encrypt( + pack(" Optional[bytes]: + length = await super().recv(4) + + if length is None: + return None + + length = aes.ctr256_decrypt(length, *self.decrypt) + + data = await super().recv(unpack(" +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 .ige import IGE -from .kdf import KDF2 -from .prime import Prime -from .rsa import RSA +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . diff --git a/pyrogram/crypto/aes.py b/pyrogram/crypto/aes.py new file mode 100644 index 0000000000..bb937128df --- /dev/null +++ b/pyrogram/crypto/aes.py @@ -0,0 +1,130 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 + +log = logging.getLogger(__name__) + +try: + import tgcrypto + + log.info("Using TgCrypto") + + + def ige256_encrypt(data: bytes, key: bytes, iv: bytes) -> bytes: + return tgcrypto.ige256_encrypt(data, key, iv) + + + def ige256_decrypt(data: bytes, key: bytes, iv: bytes) -> bytes: + return tgcrypto.ige256_decrypt(data, key, iv) + + + def ctr256_encrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes: + return tgcrypto.ctr256_encrypt(data, key, iv, state or bytearray(1)) + + + def ctr256_decrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes: + return tgcrypto.ctr256_decrypt(data, key, iv, state or bytearray(1)) + + + def xor(a: bytes, b: bytes) -> bytes: + return int.to_bytes( + int.from_bytes(a, "big") ^ int.from_bytes(b, "big"), + len(a), + "big", + ) +except ImportError: + import pyaes + + log.warning( + "TgCrypto is missing! " + "Pyrogram will work the same, but at a much slower speed. " + "More info: https://docs.pyrogram.org/topics/speedups" + ) + + + def ige256_encrypt(data: bytes, key: bytes, iv: bytes) -> bytes: + return ige(data, key, iv, True) + + + def ige256_decrypt(data: bytes, key: bytes, iv: bytes) -> bytes: + return ige(data, key, iv, False) + + + def ctr256_encrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes: + return ctr(data, key, iv, state or bytearray(1)) + + + def ctr256_decrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes: + return ctr(data, key, iv, state or bytearray(1)) + + + def xor(a: bytes, b: bytes) -> bytes: + return int.to_bytes( + int.from_bytes(a, "big") ^ int.from_bytes(b, "big"), + len(a), + "big", + ) + + + def ige(data: bytes, key: bytes, iv: bytes, encrypt: bool) -> bytes: + cipher = pyaes.AES(key) + + iv_1 = iv[:16] + iv_2 = iv[16:] + + data = [data[i: i + 16] for i in range(0, len(data), 16)] + + if encrypt: + for i, chunk in enumerate(data): + iv_1 = data[i] = xor(cipher.encrypt(xor(chunk, iv_1)), iv_2) + iv_2 = chunk + else: + for i, chunk in enumerate(data): + iv_2 = data[i] = xor(cipher.decrypt(xor(chunk, iv_2)), iv_1) + iv_1 = chunk + + return b"".join(data) + + + def ctr(data: bytes, key: bytes, iv: bytearray, state: bytearray) -> bytes: + cipher = pyaes.AES(key) + + out = bytearray(data) + chunk = cipher.encrypt(iv) + + for i in range(0, len(data), 16): + for j in range(0, min(len(data) - i, 16)): + out[i + j] ^= chunk[state[0]] + + state[0] += 1 + + if state[0] >= 16: + state[0] = 0 + + if state[0] == 0: + for k in range(15, -1, -1): + try: + iv[k] += 1 + break + except ValueError: + iv[k] = 0 + + chunk = cipher.encrypt(iv) + + return out diff --git a/pyrogram/crypto/ige.py b/pyrogram/crypto/ige.py deleted file mode 100644 index 06bddfe263..0000000000 --- a/pyrogram/crypto/ige.py +++ /dev/null @@ -1,65 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 . - -# TODO: Workaround -try: - from pyaes import AES -except ImportError: - pass - -BLOCK_SIZE = 16 - - -# TODO: Performance optimization - -class IGE: - @classmethod - def encrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes: - return cls.ige(data, key, iv, True) - - @classmethod - def decrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes: - return cls.ige(data, key, iv, False) - - @staticmethod - def xor(a: bytes, b: bytes) -> bytes: - return int.to_bytes( - int.from_bytes(a, "big") ^ int.from_bytes(b, "big"), - len(a), - "big", - ) - - @classmethod - def ige(cls, data: bytes, key: bytes, iv: bytes, encrypt: bool) -> bytes: - cipher = AES(key) - - iv_1 = iv[:BLOCK_SIZE] - iv_2 = iv[BLOCK_SIZE:] - - data = [data[i: i + BLOCK_SIZE] for i in range(0, len(data), BLOCK_SIZE)] - - if encrypt: - for i, chunk in enumerate(data): - iv_1 = data[i] = cls.xor(cipher.encrypt(cls.xor(chunk, iv_1)), iv_2) - iv_2 = chunk - else: - for i, chunk in enumerate(data): - iv_2 = data[i] = cls.xor(cipher.decrypt(cls.xor(chunk, iv_2)), iv_1) - iv_1 = chunk - - return b"".join(data) diff --git a/pyrogram/crypto/kdf.py b/pyrogram/crypto/kdf.py deleted file mode 100644 index b37a6de44e..0000000000 --- a/pyrogram/crypto/kdf.py +++ /dev/null @@ -1,49 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 hashlib import sha256 - - -# class KDF: -# def __new__(cls, auth_key: bytes, msg_key: bytes, outgoing: bool) -> tuple: -# # https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector -# x = 0 if outgoing else 8 -# -# sha1_a = sha1(msg_key + auth_key[x:x + 32]).digest() -# sha1_b = sha1(auth_key[x + 32:x + 48] + msg_key + auth_key[x + 48:x + 64]).digest() -# sha1_c = sha1(auth_key[x + 64:x + 96] + msg_key).digest() -# sha1_d = sha1(msg_key + auth_key[x + 96:x + 128]).digest() -# -# aes_key = sha1_a[:8] + sha1_b[8:20] + sha1_c[4:16] -# aes_iv = sha1_a[8:20] + sha1_b[:8] + sha1_c[16:20] + sha1_d[:8] -# -# return aes_key, aes_iv - - -class KDF2: - def __new__(cls, auth_key: bytes, msg_key: bytes, outgoing: bool) -> tuple: - # https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector - x = 0 if outgoing else 8 - - sha256_a = sha256(msg_key + auth_key[x: x + 36]).digest() - sha256_b = sha256(auth_key[x + 40:x + 76] + msg_key).digest() # 76 = 40 + 36 - - aes_key = sha256_a[:8] + sha256_b[8:24] + sha256_a[24:32] - aes_iv = sha256_b[:8] + sha256_a[8:24] + sha256_b[24:32] - - return aes_key, aes_iv diff --git a/pyrogram/crypto/mtproto.py b/pyrogram/crypto/mtproto.py new file mode 100644 index 0000000000..6d1521a47b --- /dev/null +++ b/pyrogram/crypto/mtproto.py @@ -0,0 +1,100 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 hashlib import sha256 +from io import BytesIO +from os import urandom + +from pyrogram.errors import SecurityCheckMismatch +from pyrogram.raw.core import Message, Long +from . import aes + + +def kdf(auth_key: bytes, msg_key: bytes, outgoing: bool) -> tuple: + # https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector + x = 0 if outgoing else 8 + + sha256_a = sha256(msg_key + auth_key[x: x + 36]).digest() + sha256_b = sha256(auth_key[x + 40:x + 76] + msg_key).digest() # 76 = 40 + 36 + + aes_key = sha256_a[:8] + sha256_b[8:24] + sha256_a[24:32] + aes_iv = sha256_b[:8] + sha256_a[8:24] + sha256_b[24:32] + + return aes_key, aes_iv + + +def pack(message: Message, salt: int, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> bytes: + data = Long(salt) + session_id + message.write() + padding = urandom(-(len(data) + 12) % 16 + 12) + + # 88 = 88 + 0 (outgoing message) + msg_key_large = sha256(auth_key[88: 88 + 32] + data + padding).digest() + msg_key = msg_key_large[8:24] + aes_key, aes_iv = kdf(auth_key, msg_key, True) + + return auth_key_id + msg_key + aes.ige256_encrypt(data + padding, aes_key, aes_iv) + + +def unpack( + b: BytesIO, + session_id: bytes, + auth_key: bytes, + auth_key_id: bytes +) -> Message: + SecurityCheckMismatch.check(b.read(8) == auth_key_id, "b.read(8) == auth_key_id") + + msg_key = b.read(16) + aes_key, aes_iv = kdf(auth_key, msg_key, False) + data = BytesIO(aes.ige256_decrypt(b.read(), aes_key, aes_iv)) + data.read(8) # Salt + + # https://core.telegram.org/mtproto/security_guidelines#checking-session-id + SecurityCheckMismatch.check(data.read(8) == session_id, "data.read(8) == session_id") + + try: + message = Message.read(data) + except KeyError as e: + if e.args[0] == 0: + raise ConnectionError(f"Received empty data. Check your internet connection.") + + left = data.read().hex() + + left = [left[i:i + 64] for i in range(0, len(left), 64)] + left = [[left[i:i + 8] for i in range(0, len(left), 8)] for left in left] + left = "\n".join(" ".join(x for x in left) for left in left) + + raise ValueError(f"The server sent an unknown constructor: {hex(e.args[0])}\n{left}") + + # https://core.telegram.org/mtproto/security_guidelines#checking-sha256-hash-value-of-msg-key + # 96 = 88 + 8 (incoming message) + SecurityCheckMismatch.check( + msg_key == sha256(auth_key[96:96 + 32] + data.getvalue()).digest()[8:24], + "msg_key == sha256(auth_key[96:96 + 32] + data.getvalue()).digest()[8:24]" + ) + + # https://core.telegram.org/mtproto/security_guidelines#checking-message-length + data.seek(32) # Get to the payload, skip salt (8) + session_id (8) + msg_id (8) + seq_no (4) + length (4) + payload = data.read() + padding = payload[message.length:] + SecurityCheckMismatch.check(12 <= len(padding) <= 1024, "12 <= len(padding) <= 1024") + SecurityCheckMismatch.check(len(payload) % 4 == 0, "len(payload) % 4 == 0") + + # https://core.telegram.org/mtproto/security_guidelines#checking-msg-id + SecurityCheckMismatch.check(message.msg_id % 2 != 0, "message.msg_id % 2 != 0") + + return message diff --git a/pyrogram/crypto/prime.py b/pyrogram/crypto/prime.py index 706ab87c1f..e919e22ce4 100644 --- a/pyrogram/crypto/prime.py +++ b/pyrogram/crypto/prime.py @@ -1,73 +1,82 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . from random import randint +CURRENT_DH_PRIME = int( + "C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F" + "48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C37" + "20FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F64" + "2477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4" + "A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754" + "FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4" + "E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F" + "0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5B", + 16 +) -class Prime: - # Recursive variant - # @classmethod - # def gcd(cls, a: int, b: int) -> int: - # return cls.gcd(b, a % b) if b else a - @staticmethod - def gcd(a: int, b: int) -> int: - while b: - a, b = b, a % b +# Recursive variant +# def gcd(cls, a: int, b: int) -> int: +# return cls.gcd(b, a % b) if b else a - return a +def gcd(a: int, b: int) -> int: + while b: + a, b = b, a % b - @classmethod - def decompose(cls, pq: int) -> int: - # https://comeoncodeon.wordpress.com/2010/09/18/pollard-rho-brent-integer-factorization/ - if pq % 2 == 0: - return 2 + return a - y, c, m = randint(1, pq - 1), randint(1, pq - 1), randint(1, pq - 1) - g = r = q = 1 - x = ys = 0 - while g == 1: - x = y +def decompose(pq: int) -> int: + # https://comeoncodeon.wordpress.com/2010/09/18/pollard-rho-brent-integer-factorization/ + if pq % 2 == 0: + return 2 - for i in range(r): - y = (pow(y, 2, pq) + c) % pq + y, c, m = randint(1, pq - 1), randint(1, pq - 1), randint(1, pq - 1) + g = r = q = 1 + x = ys = 0 + + while g == 1: + x = y - k = 0 + for i in range(r): + y = (pow(y, 2, pq) + c) % pq - while k < r and g == 1: - ys = y + k = 0 - for i in range(min(m, r - k)): - y = (pow(y, 2, pq) + c) % pq - q = q * (abs(x - y)) % pq + while k < r and g == 1: + ys = y + + for i in range(min(m, r - k)): + y = (pow(y, 2, pq) + c) % pq + q = q * (abs(x - y)) % pq - g = cls.gcd(q, pq) - k += m + g = gcd(q, pq) + k += m - r *= 2 + r *= 2 - if g == pq: - while True: - ys = (pow(ys, 2, pq) + c) % pq - g = cls.gcd(abs(x - ys), pq) + if g == pq: + while True: + ys = (pow(ys, 2, pq) + c) % pq + g = gcd(abs(x - ys), pq) - if g > 1: - break + if g > 1: + break - return g + return g diff --git a/pyrogram/crypto/rsa.py b/pyrogram/crypto/rsa.py index 0ff1252ce9..25c2322957 100644 --- a/pyrogram/crypto/rsa.py +++ b/pyrogram/crypto/rsa.py @@ -1,64 +1,259 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 Dan Tès +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan # -# This file is part of Pyrogram. +# 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 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. +# 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 . +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . from collections import namedtuple PublicKey = namedtuple("PublicKey", ["m", "e"]) +# To get modulus and exponent: +# +# [RSA PUBLIC KEY]: +# grep -v -- - public.key | tr -d \\n | base64 -d | openssl asn1parse -inform DER -i +# +# [PUBLIC KEY]: +# openssl rsa -pubin -in key -text -noout + +server_public_keys = { + # -4344800451088585951 + 0xc3b42b026ce86b21 - (1 << 64): PublicKey( # Telegram servers #1 + # -----BEGIN RSA PUBLIC KEY----- + # MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6 + # lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS + # an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw + # Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+ + # 8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n + # Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB + # -----END RSA PUBLIC KEY----- + int( + "C150023E2F70DB7985DED064759CFECF0AF328E69A41DAF4D6F01B538135A6F9" + "1F8F8B2A0EC9BA9720CE352EFCF6C5680FFC424BD634864902DE0B4BD6D49F4E" + "580230E3AE97D95C8B19442B3C0A10D8F5633FECEDD6926A7F6DAB0DDB7D457F" + "9EA81B8465FCD6FFFEED114011DF91C059CAEDAF97625F6C96ECC74725556934" + "EF781D866B34F011FCE4D835A090196E9A5F0E4449AF7EB697DDB9076494CA5F" + "81104A305B6DD27665722C46B60E5DF680FB16B210607EF217652E60236C255F" + "6A28315F4083A96791D7214BF64C1DF4FD0DB1944FB26A2A57031B32EEE64AD1" + "5A8BA68885CDE74A5BFC920F6ABF59BA5C75506373E7130F9042DA922179251F", + 16 + ), # Modulus + int("010001", 16) # Exponent + ), + + # 847625836280919973 + 0x10bc35f3509f7b7a5 - (1 << 64): PublicKey( # Telegram servers #2 + # -----BEGIN PUBLIC KEY----- + # MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAruw2yP/BCcsJliRoW5eB + # VBVle9dtjJw+OYED160Wybum9SXtBBLXriwt4rROd9csv0t0OHCaTmRqBcQ0J8fx + # hN6/cpR1GWgOZRUAiQxoMnlt0R93LCX/j1dnVa/gVbCjdSxpbrfY2g2L4frzjJvd + # l84Kd9ORYjDEAyFnEA7dD556OptgLQQ2e2iVNq8NZLYTzLp5YpOdO1doK+ttrltg + # gTCy5SrKeLoCPPbOgGsdxJxyz5KKcZnSLj16yE5HvJQn0CNpRdENvRUXe6tBP78O + # 39oJ8BTHp9oIjd6XWXAsp2CvK45Ol8wFXGF710w9lwCGNbmNxNYhtIkdqfsEcwR5 + # JwIDAQAB + # -----END PUBLIC KEY----- + int( + "AEEC36C8FFC109CB099624685B97815415657BD76D8C9C3E398103D7AD16C9BB" + "A6F525ED0412D7AE2C2DE2B44E77D72CBF4B7438709A4E646A05C43427C7F184" + "DEBF72947519680E651500890C6832796DD11F772C25FF8F576755AFE055B0A3" + "752C696EB7D8DA0D8BE1FAF38C9BDD97CE0A77D3916230C4032167100EDD0F9E" + "7A3A9B602D04367B689536AF0D64B613CCBA7962939D3B57682BEB6DAE5B6081" + "30B2E52ACA78BA023CF6CE806B1DC49C72CF928A7199D22E3D7AC84E47BC9427" + "D0236945D10DBD15177BAB413FBF0EDFDA09F014C7A7DA088DDE9759702CA760" + "AF2B8E4E97CC055C617BD74C3D97008635B98DC4D621B4891DA9FB0473047927", + 16 + ), # Modulus + int("010001", 16) # Exponent + ), + + # 1562291298945373506 + 0x115ae5fa8b5529542 - (1 << 64): PublicKey( # Telegram servers #3 + # -----BEGIN PUBLIC KEY----- + # MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvfLHfYH2r9R70w8prHbl + # Wt/nDkh+XkgpflqQVcnAfSuTtO05lNPspQmL8Y2XjVT4t8cT6xAkdgfmmvnvRPOO + # KPi0OfJXoRVylFzAQG/j83u5K3kRLbae7fLccVhKZhY46lvsueI1hQdLgNV9n1cQ + # 3TDS2pQOCtovG4eDl9wacrXOJTG2990VjgnIKNA0UMoP+KF03qzryqIt3oTvZq03 + # DyWdGK+AZjgBLaDKSnC6qD2cFY81UryRWOab8zKkWAnhw2kFpcqhI0jdV5QaSCEx + # vnsjVaX0Y1N0870931/5Jb9ICe4nweZ9kSDF/gip3kWLG0o8XQpChDfyvsqB9OLV + # /wIDAQAB + # -----END PUBLIC KEY----- + int( + "BDF2C77D81F6AFD47BD30F29AC76E55ADFE70E487E5E48297E5A9055C9C07D2B" + "93B4ED3994D3ECA5098BF18D978D54F8B7C713EB10247607E69AF9EF44F38E28" + "F8B439F257A11572945CC0406FE3F37BB92B79112DB69EEDF2DC71584A661638" + "EA5BECB9E23585074B80D57D9F5710DD30D2DA940E0ADA2F1B878397DC1A72B5" + "CE2531B6F7DD158E09C828D03450CA0FF8A174DEACEBCAA22DDE84EF66AD370F" + "259D18AF806638012DA0CA4A70BAA83D9C158F3552BC9158E69BF332A45809E1" + "C36905A5CAA12348DD57941A482131BE7B2355A5F4635374F3BD3DDF5FF925BF" + "4809EE27C1E67D9120C5FE08A9DE458B1B4A3C5D0A428437F2BECA81F4E2D5FF", + 16 + ), # Modulus + int("010001", 16) # Exponent + ), + + # -5859577972006586033 + 0xaeae98e13cd7f94f - (1 << 64): PublicKey( # Telegram servers #4 + # -----BEGIN PUBLIC KEY----- + # MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/ditzm+mPND6xkhzwFI + # z6J/968CtkcSE/7Z2qAJiXbmZ3UDJPGrzqTDHkO30R8VeRM/Kz2f4nR05GIFiITl + # 4bEjvpy7xqRDspJcCFIOcyXm8abVDhF+th6knSU0yLtNKuQVP6voMrnt9MV1X92L + # GZQLgdHZbPQz0Z5qIpaKhdyA8DEvWWvSUwwc+yi1/gGaybwlzZwqXYoPOhwMebzK + # Uk0xW14htcJrRrq+PXXQbRzTMynseCoPIoke0dtCodbA3qQxQovE16q9zz4Otv2k + # 4j63cz53J+mhkVWAeWxVGI0lltJmWtEYK6er8VqqWot3nqmWMXogrgRLggv/Nbbo + # oQIDAQAB + # -----END PUBLIC KEY----- + int( + "B3F762B739BE98F343EB1921CF0148CFA27FF7AF02B6471213FED9DAA0098976" + "E667750324F1ABCEA4C31E43B7D11F1579133F2B3D9FE27474E462058884E5E1" + "B123BE9CBBC6A443B2925C08520E7325E6F1A6D50E117EB61EA49D2534C8BB4D" + "2AE4153FABE832B9EDF4C5755FDD8B19940B81D1D96CF433D19E6A22968A85DC" + "80F0312F596BD2530C1CFB28B5FE019AC9BC25CD9C2A5D8A0F3A1C0C79BCCA52" + "4D315B5E21B5C26B46BABE3D75D06D1CD33329EC782A0F22891ED1DB42A1D6C0" + "DEA431428BC4D7AABDCF3E0EB6FDA4E23EB7733E7727E9A1915580796C55188D" + "2596D2665AD1182BA7ABF15AAA5A8B779EA996317A20AE044B820BFF35B6E8A1", + 16 + ), # Modulus + int("010001", 16) # Exponent + ), + + # 6491968696586960280 + 0x15a181b2235057d98 - (1 << 64): PublicKey( # Telegram servers #5 + # -----BEGIN PUBLIC KEY----- + # MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvmpxVY7ld/8DAjz6F6q0 + # 5shjg8/4p6047bn6/m8yPy1RBsvIyvuDuGnP/RzPEhzXQ9UJ5Ynmh2XJZgHoE9xb + # nfxL5BXHplJhMtADXKM9bWB11PU1Eioc3+AXBB8QiNFBn2XI5UkO5hPhbb9mJpjA + # 9Uhw8EdfqJP8QetVsI/xrCEbwEXe0xvifRLJbY08/Gp66KpQvy7g8w7VB8wlgePe + # xW3pT13Ap6vuC+mQuJPyiHvSxjEKHgqePji9NP3tJUFQjcECqcm0yV7/2d0t/pbC + # m+ZH1sadZspQCEPPrtbkQBlvHb4OLiIWPGHKSMeRFvp3IWcmdJqXahxLCUS1Eh6M + # AQIDAQAB + # -----END PUBLIC KEY----- + int( + "BE6A71558EE577FF03023CFA17AAB4E6C86383CFF8A7AD38EDB9FAFE6F323F2D" + "5106CBC8CAFB83B869CFFD1CCF121CD743D509E589E68765C96601E813DC5B9D" + "FC4BE415C7A6526132D0035CA33D6D6075D4F535122A1CDFE017041F1088D141" + "9F65C8E5490EE613E16DBF662698C0F54870F0475FA893FC41EB55B08FF1AC21" + "1BC045DED31BE27D12C96D8D3CFC6A7AE8AA50BF2EE0F30ED507CC2581E3DEC5" + "6DE94F5DC0A7ABEE0BE990B893F2887BD2C6310A1E0A9E3E38BD34FDED254150" + "8DC102A9C9B4C95EFFD9DD2DFE96C29BE647D6C69D66CA500843CFAED6E44019" + "6F1DBE0E2E22163C61CA48C79116FA77216726749A976A1C4B0944B5121E8C01", + 16 + ), # Modulus + int("010001", 16) # Exponent + ), + + # -7395192255793472640 + 0x995effd323b5db80 - (1 << 64): PublicKey( # CDN DC-121 + # -----BEGIN RSA PUBLIC KEY----- + # MIIBCgKCAQEA4tWHcGJlElkxuxKQJwFjJaulmVHgdxNA3wgI2E8XbNnA88y51Xog + # V5m8BEYuTSP4llXZY4ZSJW5VlFXnmsJT/hmjyeFqqTajyAW6nb9vwZX291QvqD/1 + # ZCFBy7TLvCM0lbNIEhcLMf33ZV8AetLAd+uRLF6QHosys5w0iJ7x+UbGwDxyfeic + # 8EJJnsKaXrUOwRycMRN+V/zDySa0EYl1u1EB1MDX1/jIV1IQEbLvdBH4vsVTVEdW + # KHlzOcFzT9qX/g8XibCPiHLJvqQb8hVibvs9NaANyClcBEt3mOucG1/46Lilkc/K + # d4nlCcohk0jIHNp8symUzNWRPUGmTs3SPwIDAQAB + # -----END RSA PUBLIC KEY----- + int( + "E2D587706265125931BB129027016325ABA59951E0771340DF0808D84F176CD9" + "C0F3CCB9D57A205799BC04462E4D23F89655D9638652256E559455E79AC253FE" + "19A3C9E16AA936A3C805BA9DBF6FC195F6F7542FA83FF5642141CBB4CBBC2334" + "95B34812170B31FDF7655F007AD2C077EB912C5E901E8B32B39C34889EF1F946" + "C6C03C727DE89CF042499EC29A5EB50EC11C9C31137E57FCC3C926B4118975BB" + "5101D4C0D7D7F8C857521011B2EF7411F8BEC55354475628797339C1734FDA97" + "FE0F1789B08F8872C9BEA41BF215626EFB3D35A00DC8295C044B7798EB9C1B5F" + "F8E8B8A591CFCA7789E509CA219348C81CDA7CB32994CCD5913D41A64ECDD23F", + 16 + ), # Modulus + int("010001", 16) # Exponent + ), + + # 2685959930972952888 + 0x1254672538e935938 - (1 << 64): PublicKey( # CDN DC-140 + # -----BEGIN RSA PUBLIC KEY----- + # MIIBCgKCAQEAzuHVC7sE50Kho/yDVZtWnlmA5Bf/aM8KZY3WzS16w6w1sBqipj8o + # gMGG7ULbGBtYmKEaI7IIJO6WM2m1MaXVnsqS8d7PaGAZiy8rSN3S7S2a8wp4RXZe + # hs0JAXvZeIz45iByCMBfycbJKmSweYkesRUI7hUO8eQhmm/UYUEpJY7VOt0Iemiu + # URSpqlRQ2FlcyHahYUNcvbICb4+/AP7coKBn6cB5FyzM7MCcKxbEKOx3Y3MUnbZq + # q5pN6/eRazkegyrlp4kuJ94KsbRFHFX5Dx8uzjrO9wi8LF7gIgZu5DRMcmjXJKq6 + # rGZ2Z9cnrD8pVu1L2vcInd4K6ximZS2hbwIDAQAB + # -----END RSA PUBLIC KEY----- + int( + "CEE1D50BBB04E742A1A3FC83559B569E5980E417FF68CF0A658DD6CD2D7AC3AC" + "35B01AA2A63F2880C186ED42DB181B5898A11A23B20824EE963369B531A5D59E" + "CA92F1DECF6860198B2F2B48DDD2ED2D9AF30A7845765E86CD09017BD9788CF8" + "E6207208C05FC9C6C92A64B079891EB11508EE150EF1E4219A6FD4614129258E" + "D53ADD087A68AE5114A9AA5450D8595CC876A161435CBDB2026F8FBF00FEDCA0" + "A067E9C079172CCCECC09C2B16C428EC776373149DB66AAB9A4DEBF7916B391E" + "832AE5A7892E27DE0AB1B4451C55F90F1F2ECE3ACEF708BC2C5EE022066EE434" + "4C7268D724AABAAC667667D727AC3F2956ED4BDAF7089DDE0AEB18A6652DA16F", + 16 + ), # Modulus + int("010001", 16) # Exponent + ), + + # -3997872768018684475 + 0xc884b3e62d09e5c5 - (1 << 64): PublicKey( # CDN DC-201 + # -----BEGIN RSA PUBLIC KEY----- + # MIIBCgKCAQEAug6fETVb7NkXYYu5ueZuM0pqw1heuqUrZNYomQN0lS0o7i6mAWwb + # 1/FiscFK+y4LQSSEx+oUzXAhjmll9fmb4e7PbUiXo8MuXO0Rj3e5416DXfTiOYGW + # XlFRV0aQzu8agy1epKwkFDidnmy7g5rJJV0q1+3eR+Jk2OEc/B6lMAOv3fBU6xhE + # ZByN9gqc6fvkNo13PQ8JYZUSGttzLlYy76uFmvFBhRsJU+LNQ2+bsTHwafSffVYl + # Z2boJOblvqbRWe453CzssaSWywGXOQmWvVbEe7F8q1ki/s7S8BxYWrhSLJ6bsu9V + # ZWnIHD9vB34QF8IABPRE93mhCOHBqJxSBQIDAQAB + # -----END RSA PUBLIC KEY----- + int( + "BA0E9F11355BECD917618BB9B9E66E334A6AC3585EBAA52B64D628990374952D" + "28EE2EA6016C1BD7F162B1C14AFB2E0B412484C7EA14CD70218E6965F5F99BE1" + "EECF6D4897A3C32E5CED118F77B9E35E835DF4E23981965E5151574690CEEF1A" + "832D5EA4AC2414389D9E6CBB839AC9255D2AD7EDDE47E264D8E11CFC1EA53003" + "AFDDF054EB1844641C8DF60A9CE9FBE4368D773D0F096195121ADB732E5632EF" + "AB859AF141851B0953E2CD436F9BB131F069F49F7D56256766E824E6E5BEA6D1" + "59EE39DC2CECB1A496CB0197390996BD56C47BB17CAB5922FECED2F01C585AB8" + "522C9E9BB2EF556569C81C3F6F077E1017C20004F444F779A108E1C1A89C5205", + 16 + ), # Modulus + int("010001", 16) # Exponent + ), -class RSA: - # To get modulus and exponent: - # grep -v -- - public.key | tr -d \\n | base64 -d | openssl asn1parse -inform DER -i + # -4960899639492471258 + 0xbb27580fd5b01626 - (1 << 64): PublicKey( # CDN DC-203 + # -----BEGIN RSA PUBLIC KEY----- + # MIIBCgKCAQEAv/L6td+mj7Dl81NHfu+Xf1KNtvZPR1tS5xFqkiUson1u7D2ulK05 + # jM8HKvpV1o+1HPPqhaXhasvsX90u3TIHRQ0zuJKJxKAiZo3GK7phHozjAJ9VUFbO + # 7jKAa5BTE9tXgA5ZwJAiQWb3U6ykwRzk3fFRe5WaW7xfVUiepxyWGdr1eecoWCfB + # af1TCXfcS7vcyljNT03pwt2YyS5iXE5IB5wBB5yqSSm4GYtWWR67UjIsXBd77TRp + # foLGpfOdUHxBz4ZSj8D76m1zlpID5J2pF6bH4+ZCz0SUpv3j7bE8WFlvgMfwEPhw + # xMYidRGayq9YlLlYd4D+Yoq0U6jS3MWTRQIDAQAB + # -----END RSA PUBLIC KEY----- + int( + "BFF2FAB5DFA68FB0E5F353477EEF977F528DB6F64F475B52E7116A92252CA27D" + "6EEC3DAE94AD398CCF072AFA55D68FB51CF3EA85A5E16ACBEC5FDD2EDD320745" + "0D33B89289C4A022668DC62BBA611E8CE3009F555056CEEE32806B905313DB57" + "800E59C090224166F753ACA4C11CE4DDF1517B959A5BBC5F55489EA71C9619DA" + "F579E7285827C169FD530977DC4BBBDCCA58CD4F4DE9C2DD98C92E625C4E4807" + "9C01079CAA4929B8198B56591EBB52322C5C177BED34697E82C6A5F39D507C41" + "CF86528FC0FBEA6D73969203E49DA917A6C7E3E642CF4494A6FDE3EDB13C5859" + "6F80C7F010F870C4C62275119ACAAF5894B9587780FE628AB453A8D2DCC59345", + 16 + ), # Modulus + int("010001", 16) # Exponent + ) +} - # TODO Add CDNs keys - server_public_keys = { - 0xc3b42b026ce86b21 - (1 << 64): PublicKey( - # -----BEGIN RSA PUBLIC KEY----- - # MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6 - # lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS - # an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw - # Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+ - # 8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n - # Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB - # -----END RSA PUBLIC KEY----- - int( - "C150023E2F70DB7985DED064759CFECF0AF328E69A41DAF4D6F01B538135A6F9" - "1F8F8B2A0EC9BA9720CE352EFCF6C5680FFC424BD634864902DE0B4BD6D49F4E" - "580230E3AE97D95C8B19442B3C0A10D8F5633FECEDD6926A7F6DAB0DDB7D457F" - "9EA81B8465FCD6FFFEED114011DF91C059CAEDAF97625F6C96ECC74725556934" - "EF781D866B34F011FCE4D835A090196E9A5F0E4449AF7EB697DDB9076494CA5F" - "81104A305B6DD27665722C46B60E5DF680FB16B210607EF217652E60236C255F" - "6A28315F4083A96791D7214BF64C1DF4FD0DB1944FB26A2A57031B32EEE64AD1" - "5A8BA68885CDE74A5BFC920F6ABF59BA5C75506373E7130F9042DA922179251F", - 16 - ), # Modulus - int("010001", 16) # Exponent - ) - } - @classmethod - def encrypt(cls, data: bytes, fingerprint: int) -> bytes: - return int.to_bytes( - pow( - int.from_bytes(data, "big"), - cls.server_public_keys[fingerprint].e, - cls.server_public_keys[fingerprint].m - ), - 256, - "big" - ) +def encrypt(data: bytes, fingerprint: int) -> bytes: + return pow( + int.from_bytes(data, "big"), + server_public_keys[fingerprint].e, + server_public_keys[fingerprint].m + ).to_bytes(256, "big") diff --git a/pyrogram/dispatcher.py b/pyrogram/dispatcher.py new file mode 100644 index 0000000000..d461c0707d --- /dev/null +++ b/pyrogram/dispatcher.py @@ -0,0 +1,435 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 asyncio +import inspect +import logging +from collections import OrderedDict + +import pyrogram +from pyrogram import errors, utils, raw +from pyrogram.handlers import ( + MessageHandler, EditedMessageHandler, + + + MessageReactionUpdatedHandler, + MessageReactionCountUpdatedHandler, + InlineQueryHandler, + ChosenInlineResultHandler, + CallbackQueryHandler, + ShippingQueryHandler, + PreCheckoutQueryHandler, + PollHandler, + + + ChatMemberUpdatedHandler, + ChatJoinRequestHandler, + + + DeletedMessagesHandler, + UserStatusHandler, + StoryHandler, + RawUpdateHandler +) +from pyrogram.raw.types import ( + UpdateNewMessage, UpdateNewChannelMessage, UpdateNewScheduledMessage, + UpdateEditMessage, UpdateEditChannelMessage, + UpdateDeleteMessages, UpdateDeleteChannelMessages, + UpdateBotCallbackQuery, UpdateInlineBotCallbackQuery, + UpdateUserStatus, UpdateBotInlineQuery, UpdateMessagePoll, + UpdateBotInlineSend, UpdateChatParticipant, UpdateChannelParticipant, UpdateBotStopped, + UpdateBotChatInviteRequester, + UpdateBotMessageReaction, + UpdateBotMessageReactions, + UpdateBotNewBusinessMessage, + UpdateBotEditBusinessMessage, + UpdateBotDeleteBusinessMessage, + UpdateBotPrecheckoutQuery, + UpdateBotShippingQuery, + UpdateStory, + UpdateBusinessBotCallbackQuery, +) + +log = logging.getLogger(__name__) + + +class Dispatcher: + NEW_MESSAGE_UPDATES = (UpdateNewMessage, UpdateNewChannelMessage, UpdateNewScheduledMessage, UpdateBotNewBusinessMessage) + EDIT_MESSAGE_UPDATES = (UpdateEditMessage, UpdateEditChannelMessage, UpdateBotEditBusinessMessage) + DELETE_MESSAGES_UPDATES = (UpdateDeleteMessages, UpdateDeleteChannelMessages, UpdateBotDeleteBusinessMessage) + CALLBACK_QUERY_UPDATES = (UpdateBotCallbackQuery, UpdateInlineBotCallbackQuery, UpdateBusinessBotCallbackQuery) + CHAT_MEMBER_UPDATES = (UpdateChatParticipant, UpdateChannelParticipant, UpdateBotStopped,) + USER_STATUS_UPDATES = (UpdateUserStatus,) + BOT_INLINE_QUERY_UPDATES = (UpdateBotInlineQuery,) + POLL_UPDATES = (UpdateMessagePoll,) + CHOSEN_INLINE_RESULT_UPDATES = (UpdateBotInlineSend,) + CHAT_JOIN_REQUEST_UPDATES = (UpdateBotChatInviteRequester,) + MESSAGE_BOT_NA_REACTION_UPDATES = (UpdateBotMessageReaction,) + MESSAGE_BOT_A_REACTION_UPDATES = (UpdateBotMessageReactions,) + PRE_CHECKOUT_QUERY_UPDATES = (UpdateBotPrecheckoutQuery,) + SHIPPING_QUERY_UPDATES = (UpdateBotShippingQuery,) + NEW_STORY_UPDATES = (UpdateStory,) + + def __init__(self, client: "pyrogram.Client"): + self.client = client + self.loop = asyncio.get_event_loop() + + self.handler_worker_tasks = [] + self.locks_list = [] + + self.updates_queue = asyncio.Queue() + self.groups = OrderedDict() + + async def message_parser(update, users, chats): + business_connection_id = getattr(update, "connection_id", None) + return ( + await pyrogram.types.Message._parse( + self.client, + update.message, + users, + chats, + is_scheduled=isinstance(update, UpdateNewScheduledMessage), + business_connection_id=business_connection_id, + raw_reply_to_message=getattr(update, "reply_to_message", None), + replies=0 if business_connection_id else self.client.fetch_replies + ), + MessageHandler + ) + + async def edited_message_parser(update, users, chats): + # Edited messages are parsed the same way as new messages, but the handler is different + parsed, _ = await message_parser(update, users, chats) + + return ( + parsed, + EditedMessageHandler + ) + + async def deleted_messages_parser(update, users, chats): + return ( + await utils.parse_deleted_messages(self.client, update, users, chats), + DeletedMessagesHandler + ) + + async def callback_query_parser(update, users, chats): + return ( + await pyrogram.types.CallbackQuery._parse(self.client, update, users, chats), + CallbackQueryHandler + ) + + async def user_status_parser(update, users, chats): + return ( + pyrogram.types.User._parse_user_status(self.client, update), + UserStatusHandler + ) + + async def inline_query_parser(update, users, chats): + return ( + pyrogram.types.InlineQuery._parse(self.client, update, users), + InlineQueryHandler + ) + + async def poll_parser(update, users, chats): + return ( + pyrogram.types.Poll._parse_update(self.client, update), + PollHandler + ) + + async def chosen_inline_result_parser(update, users, chats): + return ( + pyrogram.types.ChosenInlineResult._parse(self.client, update, users), + ChosenInlineResultHandler + ) + + async def chat_member_updated_parser(update, users, chats): + return ( + pyrogram.types.ChatMemberUpdated._parse(self.client, update, users, chats), + ChatMemberUpdatedHandler + ) + + async def chat_join_request_parser(update, users, chats): + return ( + pyrogram.types.ChatJoinRequest._parse(self.client, update, users, chats), + ChatJoinRequestHandler + ) + + + async def message_bot_na_reaction_parser(update, users, chats): + return ( + pyrogram.types.MessageReactionUpdated._parse(self.client, update, users, chats), + MessageReactionUpdatedHandler + ) + + async def message_bot_a_reaction_parser(update, users, chats): + return ( + pyrogram.types.MessageReactionCountUpdated._parse(self.client, update, users, chats), + MessageReactionCountUpdatedHandler + ) + + async def shipping_query_parser(update, users, chats): + return ( + await pyrogram.types.ShippingQuery._parse(self.client, update, users), + ShippingQueryHandler + ) + + async def pre_checkout_query_parser(update, users, chats): + return ( + await pyrogram.types.PreCheckoutQuery._parse(self.client, update, users), + PreCheckoutQueryHandler + ) + + async def story_parser(update, users, chats): + return ( + await pyrogram.types.Story._parse( + self.client, + users, + chats, + None, None, + update, + None, None + ), + StoryHandler + ) + + self.update_parsers = { + Dispatcher.NEW_MESSAGE_UPDATES: message_parser, + Dispatcher.EDIT_MESSAGE_UPDATES: edited_message_parser, + Dispatcher.DELETE_MESSAGES_UPDATES: deleted_messages_parser, + Dispatcher.CALLBACK_QUERY_UPDATES: callback_query_parser, + Dispatcher.USER_STATUS_UPDATES: user_status_parser, + Dispatcher.BOT_INLINE_QUERY_UPDATES: inline_query_parser, + Dispatcher.POLL_UPDATES: poll_parser, + Dispatcher.CHOSEN_INLINE_RESULT_UPDATES: chosen_inline_result_parser, + Dispatcher.CHAT_MEMBER_UPDATES: chat_member_updated_parser, + Dispatcher.CHAT_JOIN_REQUEST_UPDATES: chat_join_request_parser, + Dispatcher.MESSAGE_BOT_NA_REACTION_UPDATES: message_bot_na_reaction_parser, + Dispatcher.MESSAGE_BOT_A_REACTION_UPDATES: message_bot_a_reaction_parser, + Dispatcher.SHIPPING_QUERY_UPDATES: shipping_query_parser, + Dispatcher.PRE_CHECKOUT_QUERY_UPDATES: pre_checkout_query_parser, + Dispatcher.NEW_STORY_UPDATES: story_parser, + } + + self.update_parsers = {key: value for key_tuple, value in self.update_parsers.items() for key in key_tuple} + + + async def start(self): + if not self.client.no_updates: + for i in range(self.client.workers): + self.locks_list.append(asyncio.Lock()) + + self.handler_worker_tasks.append( + self.loop.create_task(self.handler_worker(self.locks_list[-1])) + ) + + log.info("Started %s HandlerTasks", self.client.workers) + + if not self.client.skip_updates: + states = await self.client.storage.update_state() + + if not states: + log.info("No states found, skipping recovery.") + return + + message_updates_counter = 0 + other_updates_counter = 0 + + for state in states: + id, local_pts, _, local_date, _ = state + + prev_pts = 0 + + while True: + try: + diff = await self.client.invoke( + raw.functions.updates.GetChannelDifference( + channel=await self.client.resolve_peer(id), + filter=raw.types.ChannelMessagesFilterEmpty(), + pts=local_pts, + limit=10000 + ) if id < 0 else + raw.functions.updates.GetDifference( + pts=local_pts, + date=local_date, + qts=0 + ) + ) + except (errors.ChannelPrivate, errors.ChannelInvalid): + break + + if isinstance(diff, raw.types.updates.DifferenceEmpty): + break + elif isinstance(diff, raw.types.updates.DifferenceTooLong): + break + elif isinstance(diff, raw.types.updates.Difference): + local_pts = diff.state.pts + elif isinstance(diff, raw.types.updates.DifferenceSlice): + local_pts = diff.intermediate_state.pts + local_date = diff.intermediate_state.date + + if prev_pts == local_pts: + break + + prev_pts = local_pts + elif isinstance(diff, raw.types.updates.ChannelDifferenceEmpty): + break + elif isinstance(diff, raw.types.updates.ChannelDifferenceTooLong): + break + elif isinstance(diff, raw.types.updates.ChannelDifference): + local_pts = diff.pts + + users = {i.id: i for i in diff.users} + chats = {i.id: i for i in diff.chats} + + for message in diff.new_messages: + message_updates_counter += 1 + self.updates_queue.put_nowait( + ( + raw.types.UpdateNewMessage( + message=message, + pts=local_pts, + pts_count=-1 + ) if id == self.client.me.id else + raw.types.UpdateNewChannelMessage( + message=message, + pts=local_pts, + pts_count=-1 + ), + users, + chats + ) + ) + + for update in diff.other_updates: + other_updates_counter += 1 + self.updates_queue.put_nowait( + (update, users, chats) + ) + + if isinstance(diff, (raw.types.updates.Difference, raw.types.updates.ChannelDifference)): + break + + await self.client.storage.update_state(id) + + log.info("Recovered %s messages and %s updates.", message_updates_counter, other_updates_counter) + + async def stop(self): + if not self.client.no_updates: + for i in range(self.client.workers): + self.updates_queue.put_nowait(None) + + for i in self.handler_worker_tasks: + await i + + self.handler_worker_tasks.clear() + self.groups.clear() + + log.info("Stopped %s HandlerTasks", self.client.workers) + + def add_handler(self, handler, group: int): + async def fn(): + for lock in self.locks_list: + await lock.acquire() + + try: + if group not in self.groups: + self.groups[group] = [] + self.groups = OrderedDict(sorted(self.groups.items())) + + self.groups[group].append(handler) + finally: + for lock in self.locks_list: + lock.release() + + self.loop.create_task(fn()) + + def remove_handler(self, handler, group: int): + async def fn(): + for lock in self.locks_list: + await lock.acquire() + + try: + if group not in self.groups: + raise ValueError(f"Group {group} does not exist. Handler was not removed.") + + self.groups[group].remove(handler) + finally: + for lock in self.locks_list: + lock.release() + + self.loop.create_task(fn()) + + async def handler_worker(self, lock): + while True: + packet = await self.updates_queue.get() + + if packet is None: + break + + try: + update, users, chats = packet + parser = self.update_parsers.get(type(update), None) + + parsed_update, handler_type = ( + await parser(update, users, chats) + if parser is not None + else (None, type(None)) + ) + + async with lock: + for group in self.groups.values(): + for handler in group: + args = None + + if isinstance(handler, handler_type): + try: + if await handler.check(self.client, parsed_update): + args = (parsed_update,) + except Exception as e: + log.exception(e) + continue + + elif isinstance(handler, RawUpdateHandler): + args = (update, users, chats) + + if args is None: + continue + + try: + if inspect.iscoroutinefunction(handler.callback): + await handler.callback(self.client, *args) + else: + await self.loop.run_in_executor( + self.client.executor, + handler.callback, + self.client, + *args + ) + except pyrogram.StopPropagation: + raise + except pyrogram.ContinuePropagation: + continue + except Exception as e: + log.exception(e) + + break + except pyrogram.StopPropagation: + pass + except Exception as e: + log.exception(e) + finally: + self.updates_queue.task_done() diff --git a/pyrogram/emoji.py b/pyrogram/emoji.py new file mode 100644 index 0000000000..d135faf74d --- /dev/null +++ b/pyrogram/emoji.py @@ -0,0 +1,4019 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 . + +GRINNING_FACE = "\U0001f600" +GRINNING_FACE_WITH_BIG_EYES = "\U0001f603" +GRINNING_FACE_WITH_SMILING_EYES = "\U0001f604" +BEAMING_FACE_WITH_SMILING_EYES = "\U0001f601" +GRINNING_SQUINTING_FACE = "\U0001f606" +GRINNING_FACE_WITH_SWEAT = "\U0001f605" +ROLLING_ON_THE_FLOOR_LAUGHING = "\U0001f923" +FACE_WITH_TEARS_OF_JOY = "\U0001f602" +SLIGHTLY_SMILING_FACE = "\U0001f642" +UPSIDE_DOWN_FACE = "\U0001f643" +MELTING_FACE = "\U0001fae0" +WINKING_FACE = "\U0001f609" +SMILING_FACE_WITH_SMILING_EYES = "\U0001f60a" +SMILING_FACE_WITH_HALO = "\U0001f607" +SMILING_FACE_WITH_HEARTS = "\U0001f970" +SMILING_FACE_WITH_HEART_EYES = "\U0001f60d" +STAR_STRUCK = "\U0001f929" +FACE_BLOWING_A_KISS = "\U0001f618" +KISSING_FACE = "\U0001f617" +SMILING_FACE = "\u263a\ufe0f" +KISSING_FACE_WITH_CLOSED_EYES = "\U0001f61a" +KISSING_FACE_WITH_SMILING_EYES = "\U0001f619" +SMILING_FACE_WITH_TEAR = "\U0001f972" +FACE_SAVORING_FOOD = "\U0001f60b" +FACE_WITH_TONGUE = "\U0001f61b" +WINKING_FACE_WITH_TONGUE = "\U0001f61c" +ZANY_FACE = "\U0001f92a" +SQUINTING_FACE_WITH_TONGUE = "\U0001f61d" +MONEY_MOUTH_FACE = "\U0001f911" +SMILING_FACE_WITH_OPEN_HANDS = "\U0001f917" +FACE_WITH_HAND_OVER_MOUTH = "\U0001f92d" +FACE_WITH_OPEN_EYES_AND_HAND_OVER_MOUTH = "\U0001fae2" +FACE_WITH_PEEKING_EYE = "\U0001fae3" +SHUSHING_FACE = "\U0001f92b" +THINKING_FACE = "\U0001f914" +SALUTING_FACE = "\U0001fae1" +ZIPPER_MOUTH_FACE = "\U0001f910" +FACE_WITH_RAISED_EYEBROW = "\U0001f928" +NEUTRAL_FACE = "\U0001f610" +EXPRESSIONLESS_FACE = "\U0001f611" +FACE_WITHOUT_MOUTH = "\U0001f636" +DOTTED_LINE_FACE = "\U0001fae5" +FACE_IN_CLOUDS = "\U0001f636\u200d\U0001f32b\ufe0f" +SMIRKING_FACE = "\U0001f60f" +UNAMUSED_FACE = "\U0001f612" +FACE_WITH_ROLLING_EYES = "\U0001f644" +GRIMACING_FACE = "\U0001f62c" +FACE_EXHALING = "\U0001f62e\u200d\U0001f4a8" +LYING_FACE = "\U0001f925" +RELIEVED_FACE = "\U0001f60c" +PENSIVE_FACE = "\U0001f614" +SLEEPY_FACE = "\U0001f62a" +DROOLING_FACE = "\U0001f924" +SLEEPING_FACE = "\U0001f634" +FACE_WITH_MEDICAL_MASK = "\U0001f637" +FACE_WITH_THERMOMETER = "\U0001f912" +FACE_WITH_HEAD_BANDAGE = "\U0001f915" +NAUSEATED_FACE = "\U0001f922" +FACE_VOMITING = "\U0001f92e" +SNEEZING_FACE = "\U0001f927" +HOT_FACE = "\U0001f975" +COLD_FACE = "\U0001f976" +WOOZY_FACE = "\U0001f974" +FACE_WITH_CROSSED_OUT_EYES = "\U0001f635" +FACE_WITH_SPIRAL_EYES = "\U0001f635\u200d\U0001f4ab" +EXPLODING_HEAD = "\U0001f92f" +COWBOY_HAT_FACE = "\U0001f920" +PARTYING_FACE = "\U0001f973" +DISGUISED_FACE = "\U0001f978" +SMILING_FACE_WITH_SUNGLASSES = "\U0001f60e" +NERD_FACE = "\U0001f913" +FACE_WITH_MONOCLE = "\U0001f9d0" +CONFUSED_FACE = "\U0001f615" +FACE_WITH_DIAGONAL_MOUTH = "\U0001fae4" +WORRIED_FACE = "\U0001f61f" +SLIGHTLY_FROWNING_FACE = "\U0001f641" +FROWNING_FACE = "\u2639\ufe0f" +FACE_WITH_OPEN_MOUTH = "\U0001f62e" +HUSHED_FACE = "\U0001f62f" +ASTONISHED_FACE = "\U0001f632" +FLUSHED_FACE = "\U0001f633" +PLEADING_FACE = "\U0001f97a" +FACE_HOLDING_BACK_TEARS = "\U0001f979" +FROWNING_FACE_WITH_OPEN_MOUTH = "\U0001f626" +ANGUISHED_FACE = "\U0001f627" +FEARFUL_FACE = "\U0001f628" +ANXIOUS_FACE_WITH_SWEAT = "\U0001f630" +SAD_BUT_RELIEVED_FACE = "\U0001f625" +CRYING_FACE = "\U0001f622" +LOUDLY_CRYING_FACE = "\U0001f62d" +FACE_SCREAMING_IN_FEAR = "\U0001f631" +CONFOUNDED_FACE = "\U0001f616" +PERSEVERING_FACE = "\U0001f623" +DISAPPOINTED_FACE = "\U0001f61e" +DOWNCAST_FACE_WITH_SWEAT = "\U0001f613" +WEARY_FACE = "\U0001f629" +TIRED_FACE = "\U0001f62b" +YAWNING_FACE = "\U0001f971" +FACE_WITH_STEAM_FROM_NOSE = "\U0001f624" +ENRAGED_FACE = "\U0001f621" +ANGRY_FACE = "\U0001f620" +FACE_WITH_SYMBOLS_ON_MOUTH = "\U0001f92c" +SMILING_FACE_WITH_HORNS = "\U0001f608" +ANGRY_FACE_WITH_HORNS = "\U0001f47f" +SKULL = "\U0001f480" +SKULL_AND_CROSSBONES = "\u2620\ufe0f" +PILE_OF_POO = "\U0001f4a9" +CLOWN_FACE = "\U0001f921" +OGRE = "\U0001f479" +GOBLIN = "\U0001f47a" +GHOST = "\U0001f47b" +ALIEN = "\U0001f47d" +ALIEN_MONSTER = "\U0001f47e" +ROBOT = "\U0001f916" +GRINNING_CAT = "\U0001f63a" +GRINNING_CAT_WITH_SMILING_EYES = "\U0001f638" +CAT_WITH_TEARS_OF_JOY = "\U0001f639" +SMILING_CAT_WITH_HEART_EYES = "\U0001f63b" +CAT_WITH_WRY_SMILE = "\U0001f63c" +KISSING_CAT = "\U0001f63d" +WEARY_CAT = "\U0001f640" +CRYING_CAT = "\U0001f63f" +POUTING_CAT = "\U0001f63e" +SEE_NO_EVIL_MONKEY = "\U0001f648" +HEAR_NO_EVIL_MONKEY = "\U0001f649" +SPEAK_NO_EVIL_MONKEY = "\U0001f64a" +KISS_MARK = "\U0001f48b" +LOVE_LETTER = "\U0001f48c" +HEART_WITH_ARROW = "\U0001f498" +HEART_WITH_RIBBON = "\U0001f49d" +SPARKLING_HEART = "\U0001f496" +GROWING_HEART = "\U0001f497" +BEATING_HEART = "\U0001f493" +REVOLVING_HEARTS = "\U0001f49e" +TWO_HEARTS = "\U0001f495" +HEART_DECORATION = "\U0001f49f" +HEART_EXCLAMATION = "\u2763\ufe0f" +BROKEN_HEART = "\U0001f494" +HEART_ON_FIRE = "\u2764\ufe0f\u200d\U0001f525" +MENDING_HEART = "\u2764\ufe0f\u200d\U0001fa79" +RED_HEART = "\u2764\ufe0f" +ORANGE_HEART = "\U0001f9e1" +YELLOW_HEART = "\U0001f49b" +GREEN_HEART = "\U0001f49a" +BLUE_HEART = "\U0001f499" +PURPLE_HEART = "\U0001f49c" +BROWN_HEART = "\U0001f90e" +BLACK_HEART = "\U0001f5a4" +WHITE_HEART = "\U0001f90d" +HUNDRED_POINTS = "\U0001f4af" +ANGER_SYMBOL = "\U0001f4a2" +COLLISION = "\U0001f4a5" +DIZZY = "\U0001f4ab" +SWEAT_DROPLETS = "\U0001f4a6" +DASHING_AWAY = "\U0001f4a8" +HOLE = "\U0001f573\ufe0f" +BOMB = "\U0001f4a3" +SPEECH_BALLOON = "\U0001f4ac" +EYE_IN_SPEECH_BUBBLE = "\U0001f441\ufe0f\u200d\U0001f5e8\ufe0f" +LEFT_SPEECH_BUBBLE = "\U0001f5e8\ufe0f" +RIGHT_ANGER_BUBBLE = "\U0001f5ef\ufe0f" +THOUGHT_BALLOON = "\U0001f4ad" +ZZZ = "\U0001f4a4" +WAVING_HAND = "\U0001f44b" +WAVING_HAND_LIGHT_SKIN_TONE = "\U0001f44b\U0001f3fb" +WAVING_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f44b\U0001f3fc" +WAVING_HAND_MEDIUM_SKIN_TONE = "\U0001f44b\U0001f3fd" +WAVING_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f44b\U0001f3fe" +WAVING_HAND_DARK_SKIN_TONE = "\U0001f44b\U0001f3ff" +RAISED_BACK_OF_HAND = "\U0001f91a" +RAISED_BACK_OF_HAND_LIGHT_SKIN_TONE = "\U0001f91a\U0001f3fb" +RAISED_BACK_OF_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f91a\U0001f3fc" +RAISED_BACK_OF_HAND_MEDIUM_SKIN_TONE = "\U0001f91a\U0001f3fd" +RAISED_BACK_OF_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f91a\U0001f3fe" +RAISED_BACK_OF_HAND_DARK_SKIN_TONE = "\U0001f91a\U0001f3ff" +HAND_WITH_FINGERS_SPLAYED = "\U0001f590\ufe0f" +HAND_WITH_FINGERS_SPLAYED_LIGHT_SKIN_TONE = "\U0001f590\U0001f3fb" +HAND_WITH_FINGERS_SPLAYED_MEDIUM_LIGHT_SKIN_TONE = "\U0001f590\U0001f3fc" +HAND_WITH_FINGERS_SPLAYED_MEDIUM_SKIN_TONE = "\U0001f590\U0001f3fd" +HAND_WITH_FINGERS_SPLAYED_MEDIUM_DARK_SKIN_TONE = "\U0001f590\U0001f3fe" +HAND_WITH_FINGERS_SPLAYED_DARK_SKIN_TONE = "\U0001f590\U0001f3ff" +RAISED_HAND = "\u270b" +RAISED_HAND_LIGHT_SKIN_TONE = "\u270b\U0001f3fb" +RAISED_HAND_MEDIUM_LIGHT_SKIN_TONE = "\u270b\U0001f3fc" +RAISED_HAND_MEDIUM_SKIN_TONE = "\u270b\U0001f3fd" +RAISED_HAND_MEDIUM_DARK_SKIN_TONE = "\u270b\U0001f3fe" +RAISED_HAND_DARK_SKIN_TONE = "\u270b\U0001f3ff" +VULCAN_SALUTE = "\U0001f596" +VULCAN_SALUTE_LIGHT_SKIN_TONE = "\U0001f596\U0001f3fb" +VULCAN_SALUTE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f596\U0001f3fc" +VULCAN_SALUTE_MEDIUM_SKIN_TONE = "\U0001f596\U0001f3fd" +VULCAN_SALUTE_MEDIUM_DARK_SKIN_TONE = "\U0001f596\U0001f3fe" +VULCAN_SALUTE_DARK_SKIN_TONE = "\U0001f596\U0001f3ff" +RIGHTWARDS_HAND = "\U0001faf1" +RIGHTWARDS_HAND_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fb" +RIGHTWARDS_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fc" +RIGHTWARDS_HAND_MEDIUM_SKIN_TONE = "\U0001faf1\U0001f3fd" +RIGHTWARDS_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001faf1\U0001f3fe" +RIGHTWARDS_HAND_DARK_SKIN_TONE = "\U0001faf1\U0001f3ff" +LEFTWARDS_HAND = "\U0001faf2" +LEFTWARDS_HAND_LIGHT_SKIN_TONE = "\U0001faf2\U0001f3fb" +LEFTWARDS_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf2\U0001f3fc" +LEFTWARDS_HAND_MEDIUM_SKIN_TONE = "\U0001faf2\U0001f3fd" +LEFTWARDS_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001faf2\U0001f3fe" +LEFTWARDS_HAND_DARK_SKIN_TONE = "\U0001faf2\U0001f3ff" +PALM_DOWN_HAND = "\U0001faf3" +PALM_DOWN_HAND_LIGHT_SKIN_TONE = "\U0001faf3\U0001f3fb" +PALM_DOWN_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf3\U0001f3fc" +PALM_DOWN_HAND_MEDIUM_SKIN_TONE = "\U0001faf3\U0001f3fd" +PALM_DOWN_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001faf3\U0001f3fe" +PALM_DOWN_HAND_DARK_SKIN_TONE = "\U0001faf3\U0001f3ff" +PALM_UP_HAND = "\U0001faf4" +PALM_UP_HAND_LIGHT_SKIN_TONE = "\U0001faf4\U0001f3fb" +PALM_UP_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf4\U0001f3fc" +PALM_UP_HAND_MEDIUM_SKIN_TONE = "\U0001faf4\U0001f3fd" +PALM_UP_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001faf4\U0001f3fe" +PALM_UP_HAND_DARK_SKIN_TONE = "\U0001faf4\U0001f3ff" +OK_HAND = "\U0001f44c" +OK_HAND_LIGHT_SKIN_TONE = "\U0001f44c\U0001f3fb" +OK_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f44c\U0001f3fc" +OK_HAND_MEDIUM_SKIN_TONE = "\U0001f44c\U0001f3fd" +OK_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f44c\U0001f3fe" +OK_HAND_DARK_SKIN_TONE = "\U0001f44c\U0001f3ff" +PINCHED_FINGERS = "\U0001f90c" +PINCHED_FINGERS_LIGHT_SKIN_TONE = "\U0001f90c\U0001f3fb" +PINCHED_FINGERS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f90c\U0001f3fc" +PINCHED_FINGERS_MEDIUM_SKIN_TONE = "\U0001f90c\U0001f3fd" +PINCHED_FINGERS_MEDIUM_DARK_SKIN_TONE = "\U0001f90c\U0001f3fe" +PINCHED_FINGERS_DARK_SKIN_TONE = "\U0001f90c\U0001f3ff" +PINCHING_HAND = "\U0001f90f" +PINCHING_HAND_LIGHT_SKIN_TONE = "\U0001f90f\U0001f3fb" +PINCHING_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f90f\U0001f3fc" +PINCHING_HAND_MEDIUM_SKIN_TONE = "\U0001f90f\U0001f3fd" +PINCHING_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f90f\U0001f3fe" +PINCHING_HAND_DARK_SKIN_TONE = "\U0001f90f\U0001f3ff" +VICTORY_HAND = "\u270c\ufe0f" +VICTORY_HAND_LIGHT_SKIN_TONE = "\u270c\U0001f3fb" +VICTORY_HAND_MEDIUM_LIGHT_SKIN_TONE = "\u270c\U0001f3fc" +VICTORY_HAND_MEDIUM_SKIN_TONE = "\u270c\U0001f3fd" +VICTORY_HAND_MEDIUM_DARK_SKIN_TONE = "\u270c\U0001f3fe" +VICTORY_HAND_DARK_SKIN_TONE = "\u270c\U0001f3ff" +CROSSED_FINGERS = "\U0001f91e" +CROSSED_FINGERS_LIGHT_SKIN_TONE = "\U0001f91e\U0001f3fb" +CROSSED_FINGERS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f91e\U0001f3fc" +CROSSED_FINGERS_MEDIUM_SKIN_TONE = "\U0001f91e\U0001f3fd" +CROSSED_FINGERS_MEDIUM_DARK_SKIN_TONE = "\U0001f91e\U0001f3fe" +CROSSED_FINGERS_DARK_SKIN_TONE = "\U0001f91e\U0001f3ff" +HAND_WITH_INDEX_FINGER_AND_THUMB_CROSSED = "\U0001faf0" +HAND_WITH_INDEX_FINGER_AND_THUMB_CROSSED_LIGHT_SKIN_TONE = "\U0001faf0\U0001f3fb" +HAND_WITH_INDEX_FINGER_AND_THUMB_CROSSED_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf0\U0001f3fc" +HAND_WITH_INDEX_FINGER_AND_THUMB_CROSSED_MEDIUM_SKIN_TONE = "\U0001faf0\U0001f3fd" +HAND_WITH_INDEX_FINGER_AND_THUMB_CROSSED_MEDIUM_DARK_SKIN_TONE = "\U0001faf0\U0001f3fe" +HAND_WITH_INDEX_FINGER_AND_THUMB_CROSSED_DARK_SKIN_TONE = "\U0001faf0\U0001f3ff" +LOVE_YOU_GESTURE = "\U0001f91f" +LOVE_YOU_GESTURE_LIGHT_SKIN_TONE = "\U0001f91f\U0001f3fb" +LOVE_YOU_GESTURE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f91f\U0001f3fc" +LOVE_YOU_GESTURE_MEDIUM_SKIN_TONE = "\U0001f91f\U0001f3fd" +LOVE_YOU_GESTURE_MEDIUM_DARK_SKIN_TONE = "\U0001f91f\U0001f3fe" +LOVE_YOU_GESTURE_DARK_SKIN_TONE = "\U0001f91f\U0001f3ff" +SIGN_OF_THE_HORNS = "\U0001f918" +SIGN_OF_THE_HORNS_LIGHT_SKIN_TONE = "\U0001f918\U0001f3fb" +SIGN_OF_THE_HORNS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f918\U0001f3fc" +SIGN_OF_THE_HORNS_MEDIUM_SKIN_TONE = "\U0001f918\U0001f3fd" +SIGN_OF_THE_HORNS_MEDIUM_DARK_SKIN_TONE = "\U0001f918\U0001f3fe" +SIGN_OF_THE_HORNS_DARK_SKIN_TONE = "\U0001f918\U0001f3ff" +CALL_ME_HAND = "\U0001f919" +CALL_ME_HAND_LIGHT_SKIN_TONE = "\U0001f919\U0001f3fb" +CALL_ME_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f919\U0001f3fc" +CALL_ME_HAND_MEDIUM_SKIN_TONE = "\U0001f919\U0001f3fd" +CALL_ME_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f919\U0001f3fe" +CALL_ME_HAND_DARK_SKIN_TONE = "\U0001f919\U0001f3ff" +BACKHAND_INDEX_POINTING_LEFT = "\U0001f448" +BACKHAND_INDEX_POINTING_LEFT_LIGHT_SKIN_TONE = "\U0001f448\U0001f3fb" +BACKHAND_INDEX_POINTING_LEFT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f448\U0001f3fc" +BACKHAND_INDEX_POINTING_LEFT_MEDIUM_SKIN_TONE = "\U0001f448\U0001f3fd" +BACKHAND_INDEX_POINTING_LEFT_MEDIUM_DARK_SKIN_TONE = "\U0001f448\U0001f3fe" +BACKHAND_INDEX_POINTING_LEFT_DARK_SKIN_TONE = "\U0001f448\U0001f3ff" +BACKHAND_INDEX_POINTING_RIGHT = "\U0001f449" +BACKHAND_INDEX_POINTING_RIGHT_LIGHT_SKIN_TONE = "\U0001f449\U0001f3fb" +BACKHAND_INDEX_POINTING_RIGHT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f449\U0001f3fc" +BACKHAND_INDEX_POINTING_RIGHT_MEDIUM_SKIN_TONE = "\U0001f449\U0001f3fd" +BACKHAND_INDEX_POINTING_RIGHT_MEDIUM_DARK_SKIN_TONE = "\U0001f449\U0001f3fe" +BACKHAND_INDEX_POINTING_RIGHT_DARK_SKIN_TONE = "\U0001f449\U0001f3ff" +BACKHAND_INDEX_POINTING_UP = "\U0001f446" +BACKHAND_INDEX_POINTING_UP_LIGHT_SKIN_TONE = "\U0001f446\U0001f3fb" +BACKHAND_INDEX_POINTING_UP_MEDIUM_LIGHT_SKIN_TONE = "\U0001f446\U0001f3fc" +BACKHAND_INDEX_POINTING_UP_MEDIUM_SKIN_TONE = "\U0001f446\U0001f3fd" +BACKHAND_INDEX_POINTING_UP_MEDIUM_DARK_SKIN_TONE = "\U0001f446\U0001f3fe" +BACKHAND_INDEX_POINTING_UP_DARK_SKIN_TONE = "\U0001f446\U0001f3ff" +MIDDLE_FINGER = "\U0001f595" +MIDDLE_FINGER_LIGHT_SKIN_TONE = "\U0001f595\U0001f3fb" +MIDDLE_FINGER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f595\U0001f3fc" +MIDDLE_FINGER_MEDIUM_SKIN_TONE = "\U0001f595\U0001f3fd" +MIDDLE_FINGER_MEDIUM_DARK_SKIN_TONE = "\U0001f595\U0001f3fe" +MIDDLE_FINGER_DARK_SKIN_TONE = "\U0001f595\U0001f3ff" +BACKHAND_INDEX_POINTING_DOWN = "\U0001f447" +BACKHAND_INDEX_POINTING_DOWN_LIGHT_SKIN_TONE = "\U0001f447\U0001f3fb" +BACKHAND_INDEX_POINTING_DOWN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f447\U0001f3fc" +BACKHAND_INDEX_POINTING_DOWN_MEDIUM_SKIN_TONE = "\U0001f447\U0001f3fd" +BACKHAND_INDEX_POINTING_DOWN_MEDIUM_DARK_SKIN_TONE = "\U0001f447\U0001f3fe" +BACKHAND_INDEX_POINTING_DOWN_DARK_SKIN_TONE = "\U0001f447\U0001f3ff" +INDEX_POINTING_UP = "\u261d\ufe0f" +INDEX_POINTING_UP_LIGHT_SKIN_TONE = "\u261d\U0001f3fb" +INDEX_POINTING_UP_MEDIUM_LIGHT_SKIN_TONE = "\u261d\U0001f3fc" +INDEX_POINTING_UP_MEDIUM_SKIN_TONE = "\u261d\U0001f3fd" +INDEX_POINTING_UP_MEDIUM_DARK_SKIN_TONE = "\u261d\U0001f3fe" +INDEX_POINTING_UP_DARK_SKIN_TONE = "\u261d\U0001f3ff" +INDEX_POINTING_AT_THE_VIEWER = "\U0001faf5" +INDEX_POINTING_AT_THE_VIEWER_LIGHT_SKIN_TONE = "\U0001faf5\U0001f3fb" +INDEX_POINTING_AT_THE_VIEWER_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf5\U0001f3fc" +INDEX_POINTING_AT_THE_VIEWER_MEDIUM_SKIN_TONE = "\U0001faf5\U0001f3fd" +INDEX_POINTING_AT_THE_VIEWER_MEDIUM_DARK_SKIN_TONE = "\U0001faf5\U0001f3fe" +INDEX_POINTING_AT_THE_VIEWER_DARK_SKIN_TONE = "\U0001faf5\U0001f3ff" +THUMBS_UP = "\U0001f44d" +THUMBS_UP_LIGHT_SKIN_TONE = "\U0001f44d\U0001f3fb" +THUMBS_UP_MEDIUM_LIGHT_SKIN_TONE = "\U0001f44d\U0001f3fc" +THUMBS_UP_MEDIUM_SKIN_TONE = "\U0001f44d\U0001f3fd" +THUMBS_UP_MEDIUM_DARK_SKIN_TONE = "\U0001f44d\U0001f3fe" +THUMBS_UP_DARK_SKIN_TONE = "\U0001f44d\U0001f3ff" +THUMBS_DOWN = "\U0001f44e" +THUMBS_DOWN_LIGHT_SKIN_TONE = "\U0001f44e\U0001f3fb" +THUMBS_DOWN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f44e\U0001f3fc" +THUMBS_DOWN_MEDIUM_SKIN_TONE = "\U0001f44e\U0001f3fd" +THUMBS_DOWN_MEDIUM_DARK_SKIN_TONE = "\U0001f44e\U0001f3fe" +THUMBS_DOWN_DARK_SKIN_TONE = "\U0001f44e\U0001f3ff" +RAISED_FIST = "\u270a" +RAISED_FIST_LIGHT_SKIN_TONE = "\u270a\U0001f3fb" +RAISED_FIST_MEDIUM_LIGHT_SKIN_TONE = "\u270a\U0001f3fc" +RAISED_FIST_MEDIUM_SKIN_TONE = "\u270a\U0001f3fd" +RAISED_FIST_MEDIUM_DARK_SKIN_TONE = "\u270a\U0001f3fe" +RAISED_FIST_DARK_SKIN_TONE = "\u270a\U0001f3ff" +ONCOMING_FIST = "\U0001f44a" +ONCOMING_FIST_LIGHT_SKIN_TONE = "\U0001f44a\U0001f3fb" +ONCOMING_FIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f44a\U0001f3fc" +ONCOMING_FIST_MEDIUM_SKIN_TONE = "\U0001f44a\U0001f3fd" +ONCOMING_FIST_MEDIUM_DARK_SKIN_TONE = "\U0001f44a\U0001f3fe" +ONCOMING_FIST_DARK_SKIN_TONE = "\U0001f44a\U0001f3ff" +LEFT_FACING_FIST = "\U0001f91b" +LEFT_FACING_FIST_LIGHT_SKIN_TONE = "\U0001f91b\U0001f3fb" +LEFT_FACING_FIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f91b\U0001f3fc" +LEFT_FACING_FIST_MEDIUM_SKIN_TONE = "\U0001f91b\U0001f3fd" +LEFT_FACING_FIST_MEDIUM_DARK_SKIN_TONE = "\U0001f91b\U0001f3fe" +LEFT_FACING_FIST_DARK_SKIN_TONE = "\U0001f91b\U0001f3ff" +RIGHT_FACING_FIST = "\U0001f91c" +RIGHT_FACING_FIST_LIGHT_SKIN_TONE = "\U0001f91c\U0001f3fb" +RIGHT_FACING_FIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f91c\U0001f3fc" +RIGHT_FACING_FIST_MEDIUM_SKIN_TONE = "\U0001f91c\U0001f3fd" +RIGHT_FACING_FIST_MEDIUM_DARK_SKIN_TONE = "\U0001f91c\U0001f3fe" +RIGHT_FACING_FIST_DARK_SKIN_TONE = "\U0001f91c\U0001f3ff" +CLAPPING_HANDS = "\U0001f44f" +CLAPPING_HANDS_LIGHT_SKIN_TONE = "\U0001f44f\U0001f3fb" +CLAPPING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f44f\U0001f3fc" +CLAPPING_HANDS_MEDIUM_SKIN_TONE = "\U0001f44f\U0001f3fd" +CLAPPING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f44f\U0001f3fe" +CLAPPING_HANDS_DARK_SKIN_TONE = "\U0001f44f\U0001f3ff" +RAISING_HANDS = "\U0001f64c" +RAISING_HANDS_LIGHT_SKIN_TONE = "\U0001f64c\U0001f3fb" +RAISING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64c\U0001f3fc" +RAISING_HANDS_MEDIUM_SKIN_TONE = "\U0001f64c\U0001f3fd" +RAISING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f64c\U0001f3fe" +RAISING_HANDS_DARK_SKIN_TONE = "\U0001f64c\U0001f3ff" +HEART_HANDS = "\U0001faf6" +HEART_HANDS_LIGHT_SKIN_TONE = "\U0001faf6\U0001f3fb" +HEART_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf6\U0001f3fc" +HEART_HANDS_MEDIUM_SKIN_TONE = "\U0001faf6\U0001f3fd" +HEART_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001faf6\U0001f3fe" +HEART_HANDS_DARK_SKIN_TONE = "\U0001faf6\U0001f3ff" +OPEN_HANDS = "\U0001f450" +OPEN_HANDS_LIGHT_SKIN_TONE = "\U0001f450\U0001f3fb" +OPEN_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f450\U0001f3fc" +OPEN_HANDS_MEDIUM_SKIN_TONE = "\U0001f450\U0001f3fd" +OPEN_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f450\U0001f3fe" +OPEN_HANDS_DARK_SKIN_TONE = "\U0001f450\U0001f3ff" +PALMS_UP_TOGETHER = "\U0001f932" +PALMS_UP_TOGETHER_LIGHT_SKIN_TONE = "\U0001f932\U0001f3fb" +PALMS_UP_TOGETHER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f932\U0001f3fc" +PALMS_UP_TOGETHER_MEDIUM_SKIN_TONE = "\U0001f932\U0001f3fd" +PALMS_UP_TOGETHER_MEDIUM_DARK_SKIN_TONE = "\U0001f932\U0001f3fe" +PALMS_UP_TOGETHER_DARK_SKIN_TONE = "\U0001f932\U0001f3ff" +HANDSHAKE = "\U0001f91d" +HANDSHAKE_LIGHT_SKIN_TONE = "\U0001f91d\U0001f3fb" +HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f91d\U0001f3fc" +HANDSHAKE_MEDIUM_SKIN_TONE = "\U0001f91d\U0001f3fd" +HANDSHAKE_MEDIUM_DARK_SKIN_TONE = "\U0001f91d\U0001f3fe" +HANDSHAKE_DARK_SKIN_TONE = "\U0001f91d\U0001f3ff" +HANDSHAKE_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3fc" +HANDSHAKE_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3fd" +HANDSHAKE_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3fe" +HANDSHAKE_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3ff" +HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3fb" +HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3fd" +HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3fe" +HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3ff" +HANDSHAKE_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3fb" +HANDSHAKE_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3fc" +HANDSHAKE_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3fe" +HANDSHAKE_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3ff" +HANDSHAKE_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3fb" +HANDSHAKE_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3fc" +HANDSHAKE_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3fd" +HANDSHAKE_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3ff" +HANDSHAKE_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fb" +HANDSHAKE_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fc" +HANDSHAKE_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fd" +HANDSHAKE_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fe" +FOLDED_HANDS = "\U0001f64f" +FOLDED_HANDS_LIGHT_SKIN_TONE = "\U0001f64f\U0001f3fb" +FOLDED_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64f\U0001f3fc" +FOLDED_HANDS_MEDIUM_SKIN_TONE = "\U0001f64f\U0001f3fd" +FOLDED_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f64f\U0001f3fe" +FOLDED_HANDS_DARK_SKIN_TONE = "\U0001f64f\U0001f3ff" +WRITING_HAND = "\u270d\ufe0f" +WRITING_HAND_LIGHT_SKIN_TONE = "\u270d\U0001f3fb" +WRITING_HAND_MEDIUM_LIGHT_SKIN_TONE = "\u270d\U0001f3fc" +WRITING_HAND_MEDIUM_SKIN_TONE = "\u270d\U0001f3fd" +WRITING_HAND_MEDIUM_DARK_SKIN_TONE = "\u270d\U0001f3fe" +WRITING_HAND_DARK_SKIN_TONE = "\u270d\U0001f3ff" +NAIL_POLISH = "\U0001f485" +NAIL_POLISH_LIGHT_SKIN_TONE = "\U0001f485\U0001f3fb" +NAIL_POLISH_MEDIUM_LIGHT_SKIN_TONE = "\U0001f485\U0001f3fc" +NAIL_POLISH_MEDIUM_SKIN_TONE = "\U0001f485\U0001f3fd" +NAIL_POLISH_MEDIUM_DARK_SKIN_TONE = "\U0001f485\U0001f3fe" +NAIL_POLISH_DARK_SKIN_TONE = "\U0001f485\U0001f3ff" +SELFIE = "\U0001f933" +SELFIE_LIGHT_SKIN_TONE = "\U0001f933\U0001f3fb" +SELFIE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f933\U0001f3fc" +SELFIE_MEDIUM_SKIN_TONE = "\U0001f933\U0001f3fd" +SELFIE_MEDIUM_DARK_SKIN_TONE = "\U0001f933\U0001f3fe" +SELFIE_DARK_SKIN_TONE = "\U0001f933\U0001f3ff" +FLEXED_BICEPS = "\U0001f4aa" +FLEXED_BICEPS_LIGHT_SKIN_TONE = "\U0001f4aa\U0001f3fb" +FLEXED_BICEPS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f4aa\U0001f3fc" +FLEXED_BICEPS_MEDIUM_SKIN_TONE = "\U0001f4aa\U0001f3fd" +FLEXED_BICEPS_MEDIUM_DARK_SKIN_TONE = "\U0001f4aa\U0001f3fe" +FLEXED_BICEPS_DARK_SKIN_TONE = "\U0001f4aa\U0001f3ff" +MECHANICAL_ARM = "\U0001f9be" +MECHANICAL_LEG = "\U0001f9bf" +LEG = "\U0001f9b5" +LEG_LIGHT_SKIN_TONE = "\U0001f9b5\U0001f3fb" +LEG_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9b5\U0001f3fc" +LEG_MEDIUM_SKIN_TONE = "\U0001f9b5\U0001f3fd" +LEG_MEDIUM_DARK_SKIN_TONE = "\U0001f9b5\U0001f3fe" +LEG_DARK_SKIN_TONE = "\U0001f9b5\U0001f3ff" +FOOT = "\U0001f9b6" +FOOT_LIGHT_SKIN_TONE = "\U0001f9b6\U0001f3fb" +FOOT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9b6\U0001f3fc" +FOOT_MEDIUM_SKIN_TONE = "\U0001f9b6\U0001f3fd" +FOOT_MEDIUM_DARK_SKIN_TONE = "\U0001f9b6\U0001f3fe" +FOOT_DARK_SKIN_TONE = "\U0001f9b6\U0001f3ff" +EAR = "\U0001f442" +EAR_LIGHT_SKIN_TONE = "\U0001f442\U0001f3fb" +EAR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f442\U0001f3fc" +EAR_MEDIUM_SKIN_TONE = "\U0001f442\U0001f3fd" +EAR_MEDIUM_DARK_SKIN_TONE = "\U0001f442\U0001f3fe" +EAR_DARK_SKIN_TONE = "\U0001f442\U0001f3ff" +EAR_WITH_HEARING_AID = "\U0001f9bb" +EAR_WITH_HEARING_AID_LIGHT_SKIN_TONE = "\U0001f9bb\U0001f3fb" +EAR_WITH_HEARING_AID_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9bb\U0001f3fc" +EAR_WITH_HEARING_AID_MEDIUM_SKIN_TONE = "\U0001f9bb\U0001f3fd" +EAR_WITH_HEARING_AID_MEDIUM_DARK_SKIN_TONE = "\U0001f9bb\U0001f3fe" +EAR_WITH_HEARING_AID_DARK_SKIN_TONE = "\U0001f9bb\U0001f3ff" +NOSE = "\U0001f443" +NOSE_LIGHT_SKIN_TONE = "\U0001f443\U0001f3fb" +NOSE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f443\U0001f3fc" +NOSE_MEDIUM_SKIN_TONE = "\U0001f443\U0001f3fd" +NOSE_MEDIUM_DARK_SKIN_TONE = "\U0001f443\U0001f3fe" +NOSE_DARK_SKIN_TONE = "\U0001f443\U0001f3ff" +BRAIN = "\U0001f9e0" +ANATOMICAL_HEART = "\U0001fac0" +LUNGS = "\U0001fac1" +TOOTH = "\U0001f9b7" +BONE = "\U0001f9b4" +EYES = "\U0001f440" +EYE = "\U0001f441\ufe0f" +TONGUE = "\U0001f445" +MOUTH = "\U0001f444" +BITING_LIP = "\U0001fae6" +BABY = "\U0001f476" +BABY_LIGHT_SKIN_TONE = "\U0001f476\U0001f3fb" +BABY_MEDIUM_LIGHT_SKIN_TONE = "\U0001f476\U0001f3fc" +BABY_MEDIUM_SKIN_TONE = "\U0001f476\U0001f3fd" +BABY_MEDIUM_DARK_SKIN_TONE = "\U0001f476\U0001f3fe" +BABY_DARK_SKIN_TONE = "\U0001f476\U0001f3ff" +CHILD = "\U0001f9d2" +CHILD_LIGHT_SKIN_TONE = "\U0001f9d2\U0001f3fb" +CHILD_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d2\U0001f3fc" +CHILD_MEDIUM_SKIN_TONE = "\U0001f9d2\U0001f3fd" +CHILD_MEDIUM_DARK_SKIN_TONE = "\U0001f9d2\U0001f3fe" +CHILD_DARK_SKIN_TONE = "\U0001f9d2\U0001f3ff" +BOY = "\U0001f466" +BOY_LIGHT_SKIN_TONE = "\U0001f466\U0001f3fb" +BOY_MEDIUM_LIGHT_SKIN_TONE = "\U0001f466\U0001f3fc" +BOY_MEDIUM_SKIN_TONE = "\U0001f466\U0001f3fd" +BOY_MEDIUM_DARK_SKIN_TONE = "\U0001f466\U0001f3fe" +BOY_DARK_SKIN_TONE = "\U0001f466\U0001f3ff" +GIRL = "\U0001f467" +GIRL_LIGHT_SKIN_TONE = "\U0001f467\U0001f3fb" +GIRL_MEDIUM_LIGHT_SKIN_TONE = "\U0001f467\U0001f3fc" +GIRL_MEDIUM_SKIN_TONE = "\U0001f467\U0001f3fd" +GIRL_MEDIUM_DARK_SKIN_TONE = "\U0001f467\U0001f3fe" +GIRL_DARK_SKIN_TONE = "\U0001f467\U0001f3ff" +PERSON = "\U0001f9d1" +PERSON_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb" +PERSON_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc" +PERSON_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd" +PERSON_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe" +PERSON_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff" +PERSON_BLOND_HAIR = "\U0001f471" +PERSON_LIGHT_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fb" +PERSON_MEDIUM_LIGHT_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fc" +PERSON_MEDIUM_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fd" +PERSON_MEDIUM_DARK_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fe" +PERSON_DARK_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3ff" +MAN = "\U0001f468" +MAN_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb" +MAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc" +MAN_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd" +MAN_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe" +MAN_DARK_SKIN_TONE = "\U0001f468\U0001f3ff" +PERSON_BEARD = "\U0001f9d4" +PERSON_LIGHT_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fb" +PERSON_MEDIUM_LIGHT_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fc" +PERSON_MEDIUM_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fd" +PERSON_MEDIUM_DARK_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fe" +PERSON_DARK_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3ff" +MAN_BEARD = "\U0001f9d4\u200d\u2642\ufe0f" +MAN_LIGHT_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fb\u200d\u2642\ufe0f" +MAN_MEDIUM_LIGHT_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fc\u200d\u2642\ufe0f" +MAN_MEDIUM_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fd\u200d\u2642\ufe0f" +MAN_MEDIUM_DARK_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fe\u200d\u2642\ufe0f" +MAN_DARK_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_BEARD = "\U0001f9d4\u200d\u2640\ufe0f" +WOMAN_LIGHT_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_MEDIUM_LIGHT_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_MEDIUM_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_MEDIUM_DARK_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_DARK_SKIN_TONE_BEARD = "\U0001f9d4\U0001f3ff\u200d\u2640\ufe0f" +MAN_RED_HAIR = "\U0001f468\u200d\U0001f9b0" +MAN_LIGHT_SKIN_TONE_RED_HAIR = "\U0001f468\U0001f3fb\u200d\U0001f9b0" +MAN_MEDIUM_LIGHT_SKIN_TONE_RED_HAIR = "\U0001f468\U0001f3fc\u200d\U0001f9b0" +MAN_MEDIUM_SKIN_TONE_RED_HAIR = "\U0001f468\U0001f3fd\u200d\U0001f9b0" +MAN_MEDIUM_DARK_SKIN_TONE_RED_HAIR = "\U0001f468\U0001f3fe\u200d\U0001f9b0" +MAN_DARK_SKIN_TONE_RED_HAIR = "\U0001f468\U0001f3ff\u200d\U0001f9b0" +MAN_CURLY_HAIR = "\U0001f468\u200d\U0001f9b1" +MAN_LIGHT_SKIN_TONE_CURLY_HAIR = "\U0001f468\U0001f3fb\u200d\U0001f9b1" +MAN_MEDIUM_LIGHT_SKIN_TONE_CURLY_HAIR = "\U0001f468\U0001f3fc\u200d\U0001f9b1" +MAN_MEDIUM_SKIN_TONE_CURLY_HAIR = "\U0001f468\U0001f3fd\u200d\U0001f9b1" +MAN_MEDIUM_DARK_SKIN_TONE_CURLY_HAIR = "\U0001f468\U0001f3fe\u200d\U0001f9b1" +MAN_DARK_SKIN_TONE_CURLY_HAIR = "\U0001f468\U0001f3ff\u200d\U0001f9b1" +MAN_WHITE_HAIR = "\U0001f468\u200d\U0001f9b3" +MAN_LIGHT_SKIN_TONE_WHITE_HAIR = "\U0001f468\U0001f3fb\u200d\U0001f9b3" +MAN_MEDIUM_LIGHT_SKIN_TONE_WHITE_HAIR = "\U0001f468\U0001f3fc\u200d\U0001f9b3" +MAN_MEDIUM_SKIN_TONE_WHITE_HAIR = "\U0001f468\U0001f3fd\u200d\U0001f9b3" +MAN_MEDIUM_DARK_SKIN_TONE_WHITE_HAIR = "\U0001f468\U0001f3fe\u200d\U0001f9b3" +MAN_DARK_SKIN_TONE_WHITE_HAIR = "\U0001f468\U0001f3ff\u200d\U0001f9b3" +MAN_BALD = "\U0001f468\u200d\U0001f9b2" +MAN_LIGHT_SKIN_TONE_BALD = "\U0001f468\U0001f3fb\u200d\U0001f9b2" +MAN_MEDIUM_LIGHT_SKIN_TONE_BALD = "\U0001f468\U0001f3fc\u200d\U0001f9b2" +MAN_MEDIUM_SKIN_TONE_BALD = "\U0001f468\U0001f3fd\u200d\U0001f9b2" +MAN_MEDIUM_DARK_SKIN_TONE_BALD = "\U0001f468\U0001f3fe\u200d\U0001f9b2" +MAN_DARK_SKIN_TONE_BALD = "\U0001f468\U0001f3ff\u200d\U0001f9b2" +WOMAN = "\U0001f469" +WOMAN_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb" +WOMAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc" +WOMAN_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd" +WOMAN_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe" +WOMAN_DARK_SKIN_TONE = "\U0001f469\U0001f3ff" +WOMAN_RED_HAIR = "\U0001f469\u200d\U0001f9b0" +WOMAN_LIGHT_SKIN_TONE_RED_HAIR = "\U0001f469\U0001f3fb\u200d\U0001f9b0" +WOMAN_MEDIUM_LIGHT_SKIN_TONE_RED_HAIR = "\U0001f469\U0001f3fc\u200d\U0001f9b0" +WOMAN_MEDIUM_SKIN_TONE_RED_HAIR = "\U0001f469\U0001f3fd\u200d\U0001f9b0" +WOMAN_MEDIUM_DARK_SKIN_TONE_RED_HAIR = "\U0001f469\U0001f3fe\u200d\U0001f9b0" +WOMAN_DARK_SKIN_TONE_RED_HAIR = "\U0001f469\U0001f3ff\u200d\U0001f9b0" +PERSON_RED_HAIR = "\U0001f9d1\u200d\U0001f9b0" +PERSON_LIGHT_SKIN_TONE_RED_HAIR = "\U0001f9d1\U0001f3fb\u200d\U0001f9b0" +PERSON_MEDIUM_LIGHT_SKIN_TONE_RED_HAIR = "\U0001f9d1\U0001f3fc\u200d\U0001f9b0" +PERSON_MEDIUM_SKIN_TONE_RED_HAIR = "\U0001f9d1\U0001f3fd\u200d\U0001f9b0" +PERSON_MEDIUM_DARK_SKIN_TONE_RED_HAIR = "\U0001f9d1\U0001f3fe\u200d\U0001f9b0" +PERSON_DARK_SKIN_TONE_RED_HAIR = "\U0001f9d1\U0001f3ff\u200d\U0001f9b0" +WOMAN_CURLY_HAIR = "\U0001f469\u200d\U0001f9b1" +WOMAN_LIGHT_SKIN_TONE_CURLY_HAIR = "\U0001f469\U0001f3fb\u200d\U0001f9b1" +WOMAN_MEDIUM_LIGHT_SKIN_TONE_CURLY_HAIR = "\U0001f469\U0001f3fc\u200d\U0001f9b1" +WOMAN_MEDIUM_SKIN_TONE_CURLY_HAIR = "\U0001f469\U0001f3fd\u200d\U0001f9b1" +WOMAN_MEDIUM_DARK_SKIN_TONE_CURLY_HAIR = "\U0001f469\U0001f3fe\u200d\U0001f9b1" +WOMAN_DARK_SKIN_TONE_CURLY_HAIR = "\U0001f469\U0001f3ff\u200d\U0001f9b1" +PERSON_CURLY_HAIR = "\U0001f9d1\u200d\U0001f9b1" +PERSON_LIGHT_SKIN_TONE_CURLY_HAIR = "\U0001f9d1\U0001f3fb\u200d\U0001f9b1" +PERSON_MEDIUM_LIGHT_SKIN_TONE_CURLY_HAIR = "\U0001f9d1\U0001f3fc\u200d\U0001f9b1" +PERSON_MEDIUM_SKIN_TONE_CURLY_HAIR = "\U0001f9d1\U0001f3fd\u200d\U0001f9b1" +PERSON_MEDIUM_DARK_SKIN_TONE_CURLY_HAIR = "\U0001f9d1\U0001f3fe\u200d\U0001f9b1" +PERSON_DARK_SKIN_TONE_CURLY_HAIR = "\U0001f9d1\U0001f3ff\u200d\U0001f9b1" +WOMAN_WHITE_HAIR = "\U0001f469\u200d\U0001f9b3" +WOMAN_LIGHT_SKIN_TONE_WHITE_HAIR = "\U0001f469\U0001f3fb\u200d\U0001f9b3" +WOMAN_MEDIUM_LIGHT_SKIN_TONE_WHITE_HAIR = "\U0001f469\U0001f3fc\u200d\U0001f9b3" +WOMAN_MEDIUM_SKIN_TONE_WHITE_HAIR = "\U0001f469\U0001f3fd\u200d\U0001f9b3" +WOMAN_MEDIUM_DARK_SKIN_TONE_WHITE_HAIR = "\U0001f469\U0001f3fe\u200d\U0001f9b3" +WOMAN_DARK_SKIN_TONE_WHITE_HAIR = "\U0001f469\U0001f3ff\u200d\U0001f9b3" +PERSON_WHITE_HAIR = "\U0001f9d1\u200d\U0001f9b3" +PERSON_LIGHT_SKIN_TONE_WHITE_HAIR = "\U0001f9d1\U0001f3fb\u200d\U0001f9b3" +PERSON_MEDIUM_LIGHT_SKIN_TONE_WHITE_HAIR = "\U0001f9d1\U0001f3fc\u200d\U0001f9b3" +PERSON_MEDIUM_SKIN_TONE_WHITE_HAIR = "\U0001f9d1\U0001f3fd\u200d\U0001f9b3" +PERSON_MEDIUM_DARK_SKIN_TONE_WHITE_HAIR = "\U0001f9d1\U0001f3fe\u200d\U0001f9b3" +PERSON_DARK_SKIN_TONE_WHITE_HAIR = "\U0001f9d1\U0001f3ff\u200d\U0001f9b3" +WOMAN_BALD = "\U0001f469\u200d\U0001f9b2" +WOMAN_LIGHT_SKIN_TONE_BALD = "\U0001f469\U0001f3fb\u200d\U0001f9b2" +WOMAN_MEDIUM_LIGHT_SKIN_TONE_BALD = "\U0001f469\U0001f3fc\u200d\U0001f9b2" +WOMAN_MEDIUM_SKIN_TONE_BALD = "\U0001f469\U0001f3fd\u200d\U0001f9b2" +WOMAN_MEDIUM_DARK_SKIN_TONE_BALD = "\U0001f469\U0001f3fe\u200d\U0001f9b2" +WOMAN_DARK_SKIN_TONE_BALD = "\U0001f469\U0001f3ff\u200d\U0001f9b2" +PERSON_BALD = "\U0001f9d1\u200d\U0001f9b2" +PERSON_LIGHT_SKIN_TONE_BALD = "\U0001f9d1\U0001f3fb\u200d\U0001f9b2" +PERSON_MEDIUM_LIGHT_SKIN_TONE_BALD = "\U0001f9d1\U0001f3fc\u200d\U0001f9b2" +PERSON_MEDIUM_SKIN_TONE_BALD = "\U0001f9d1\U0001f3fd\u200d\U0001f9b2" +PERSON_MEDIUM_DARK_SKIN_TONE_BALD = "\U0001f9d1\U0001f3fe\u200d\U0001f9b2" +PERSON_DARK_SKIN_TONE_BALD = "\U0001f9d1\U0001f3ff\u200d\U0001f9b2" +WOMAN_BLOND_HAIR = "\U0001f471\u200d\u2640\ufe0f" +WOMAN_LIGHT_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_MEDIUM_LIGHT_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_MEDIUM_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_MEDIUM_DARK_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_DARK_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3ff\u200d\u2640\ufe0f" +MAN_BLOND_HAIR = "\U0001f471\u200d\u2642\ufe0f" +MAN_LIGHT_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fb\u200d\u2642\ufe0f" +MAN_MEDIUM_LIGHT_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fc\u200d\u2642\ufe0f" +MAN_MEDIUM_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fd\u200d\u2642\ufe0f" +MAN_MEDIUM_DARK_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3fe\u200d\u2642\ufe0f" +MAN_DARK_SKIN_TONE_BLOND_HAIR = "\U0001f471\U0001f3ff\u200d\u2642\ufe0f" +OLDER_PERSON = "\U0001f9d3" +OLDER_PERSON_LIGHT_SKIN_TONE = "\U0001f9d3\U0001f3fb" +OLDER_PERSON_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d3\U0001f3fc" +OLDER_PERSON_MEDIUM_SKIN_TONE = "\U0001f9d3\U0001f3fd" +OLDER_PERSON_MEDIUM_DARK_SKIN_TONE = "\U0001f9d3\U0001f3fe" +OLDER_PERSON_DARK_SKIN_TONE = "\U0001f9d3\U0001f3ff" +OLD_MAN = "\U0001f474" +OLD_MAN_LIGHT_SKIN_TONE = "\U0001f474\U0001f3fb" +OLD_MAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f474\U0001f3fc" +OLD_MAN_MEDIUM_SKIN_TONE = "\U0001f474\U0001f3fd" +OLD_MAN_MEDIUM_DARK_SKIN_TONE = "\U0001f474\U0001f3fe" +OLD_MAN_DARK_SKIN_TONE = "\U0001f474\U0001f3ff" +OLD_WOMAN = "\U0001f475" +OLD_WOMAN_LIGHT_SKIN_TONE = "\U0001f475\U0001f3fb" +OLD_WOMAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f475\U0001f3fc" +OLD_WOMAN_MEDIUM_SKIN_TONE = "\U0001f475\U0001f3fd" +OLD_WOMAN_MEDIUM_DARK_SKIN_TONE = "\U0001f475\U0001f3fe" +OLD_WOMAN_DARK_SKIN_TONE = "\U0001f475\U0001f3ff" +PERSON_FROWNING = "\U0001f64d" +PERSON_FROWNING_LIGHT_SKIN_TONE = "\U0001f64d\U0001f3fb" +PERSON_FROWNING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64d\U0001f3fc" +PERSON_FROWNING_MEDIUM_SKIN_TONE = "\U0001f64d\U0001f3fd" +PERSON_FROWNING_MEDIUM_DARK_SKIN_TONE = "\U0001f64d\U0001f3fe" +PERSON_FROWNING_DARK_SKIN_TONE = "\U0001f64d\U0001f3ff" +MAN_FROWNING = "\U0001f64d\u200d\u2642\ufe0f" +MAN_FROWNING_LIGHT_SKIN_TONE = "\U0001f64d\U0001f3fb\u200d\u2642\ufe0f" +MAN_FROWNING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64d\U0001f3fc\u200d\u2642\ufe0f" +MAN_FROWNING_MEDIUM_SKIN_TONE = "\U0001f64d\U0001f3fd\u200d\u2642\ufe0f" +MAN_FROWNING_MEDIUM_DARK_SKIN_TONE = "\U0001f64d\U0001f3fe\u200d\u2642\ufe0f" +MAN_FROWNING_DARK_SKIN_TONE = "\U0001f64d\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_FROWNING = "\U0001f64d\u200d\u2640\ufe0f" +WOMAN_FROWNING_LIGHT_SKIN_TONE = "\U0001f64d\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_FROWNING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64d\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_FROWNING_MEDIUM_SKIN_TONE = "\U0001f64d\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_FROWNING_MEDIUM_DARK_SKIN_TONE = "\U0001f64d\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_FROWNING_DARK_SKIN_TONE = "\U0001f64d\U0001f3ff\u200d\u2640\ufe0f" +PERSON_POUTING = "\U0001f64e" +PERSON_POUTING_LIGHT_SKIN_TONE = "\U0001f64e\U0001f3fb" +PERSON_POUTING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64e\U0001f3fc" +PERSON_POUTING_MEDIUM_SKIN_TONE = "\U0001f64e\U0001f3fd" +PERSON_POUTING_MEDIUM_DARK_SKIN_TONE = "\U0001f64e\U0001f3fe" +PERSON_POUTING_DARK_SKIN_TONE = "\U0001f64e\U0001f3ff" +MAN_POUTING = "\U0001f64e\u200d\u2642\ufe0f" +MAN_POUTING_LIGHT_SKIN_TONE = "\U0001f64e\U0001f3fb\u200d\u2642\ufe0f" +MAN_POUTING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64e\U0001f3fc\u200d\u2642\ufe0f" +MAN_POUTING_MEDIUM_SKIN_TONE = "\U0001f64e\U0001f3fd\u200d\u2642\ufe0f" +MAN_POUTING_MEDIUM_DARK_SKIN_TONE = "\U0001f64e\U0001f3fe\u200d\u2642\ufe0f" +MAN_POUTING_DARK_SKIN_TONE = "\U0001f64e\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_POUTING = "\U0001f64e\u200d\u2640\ufe0f" +WOMAN_POUTING_LIGHT_SKIN_TONE = "\U0001f64e\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_POUTING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64e\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_POUTING_MEDIUM_SKIN_TONE = "\U0001f64e\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_POUTING_MEDIUM_DARK_SKIN_TONE = "\U0001f64e\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_POUTING_DARK_SKIN_TONE = "\U0001f64e\U0001f3ff\u200d\u2640\ufe0f" +PERSON_GESTURING_NO = "\U0001f645" +PERSON_GESTURING_NO_LIGHT_SKIN_TONE = "\U0001f645\U0001f3fb" +PERSON_GESTURING_NO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f645\U0001f3fc" +PERSON_GESTURING_NO_MEDIUM_SKIN_TONE = "\U0001f645\U0001f3fd" +PERSON_GESTURING_NO_MEDIUM_DARK_SKIN_TONE = "\U0001f645\U0001f3fe" +PERSON_GESTURING_NO_DARK_SKIN_TONE = "\U0001f645\U0001f3ff" +MAN_GESTURING_NO = "\U0001f645\u200d\u2642\ufe0f" +MAN_GESTURING_NO_LIGHT_SKIN_TONE = "\U0001f645\U0001f3fb\u200d\u2642\ufe0f" +MAN_GESTURING_NO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f645\U0001f3fc\u200d\u2642\ufe0f" +MAN_GESTURING_NO_MEDIUM_SKIN_TONE = "\U0001f645\U0001f3fd\u200d\u2642\ufe0f" +MAN_GESTURING_NO_MEDIUM_DARK_SKIN_TONE = "\U0001f645\U0001f3fe\u200d\u2642\ufe0f" +MAN_GESTURING_NO_DARK_SKIN_TONE = "\U0001f645\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_GESTURING_NO = "\U0001f645\u200d\u2640\ufe0f" +WOMAN_GESTURING_NO_LIGHT_SKIN_TONE = "\U0001f645\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_GESTURING_NO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f645\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_GESTURING_NO_MEDIUM_SKIN_TONE = "\U0001f645\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_GESTURING_NO_MEDIUM_DARK_SKIN_TONE = "\U0001f645\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_GESTURING_NO_DARK_SKIN_TONE = "\U0001f645\U0001f3ff\u200d\u2640\ufe0f" +PERSON_GESTURING_OK = "\U0001f646" +PERSON_GESTURING_OK_LIGHT_SKIN_TONE = "\U0001f646\U0001f3fb" +PERSON_GESTURING_OK_MEDIUM_LIGHT_SKIN_TONE = "\U0001f646\U0001f3fc" +PERSON_GESTURING_OK_MEDIUM_SKIN_TONE = "\U0001f646\U0001f3fd" +PERSON_GESTURING_OK_MEDIUM_DARK_SKIN_TONE = "\U0001f646\U0001f3fe" +PERSON_GESTURING_OK_DARK_SKIN_TONE = "\U0001f646\U0001f3ff" +MAN_GESTURING_OK = "\U0001f646\u200d\u2642\ufe0f" +MAN_GESTURING_OK_LIGHT_SKIN_TONE = "\U0001f646\U0001f3fb\u200d\u2642\ufe0f" +MAN_GESTURING_OK_MEDIUM_LIGHT_SKIN_TONE = "\U0001f646\U0001f3fc\u200d\u2642\ufe0f" +MAN_GESTURING_OK_MEDIUM_SKIN_TONE = "\U0001f646\U0001f3fd\u200d\u2642\ufe0f" +MAN_GESTURING_OK_MEDIUM_DARK_SKIN_TONE = "\U0001f646\U0001f3fe\u200d\u2642\ufe0f" +MAN_GESTURING_OK_DARK_SKIN_TONE = "\U0001f646\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_GESTURING_OK = "\U0001f646\u200d\u2640\ufe0f" +WOMAN_GESTURING_OK_LIGHT_SKIN_TONE = "\U0001f646\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_GESTURING_OK_MEDIUM_LIGHT_SKIN_TONE = "\U0001f646\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_GESTURING_OK_MEDIUM_SKIN_TONE = "\U0001f646\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_GESTURING_OK_MEDIUM_DARK_SKIN_TONE = "\U0001f646\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_GESTURING_OK_DARK_SKIN_TONE = "\U0001f646\U0001f3ff\u200d\u2640\ufe0f" +PERSON_TIPPING_HAND = "\U0001f481" +PERSON_TIPPING_HAND_LIGHT_SKIN_TONE = "\U0001f481\U0001f3fb" +PERSON_TIPPING_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f481\U0001f3fc" +PERSON_TIPPING_HAND_MEDIUM_SKIN_TONE = "\U0001f481\U0001f3fd" +PERSON_TIPPING_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f481\U0001f3fe" +PERSON_TIPPING_HAND_DARK_SKIN_TONE = "\U0001f481\U0001f3ff" +MAN_TIPPING_HAND = "\U0001f481\u200d\u2642\ufe0f" +MAN_TIPPING_HAND_LIGHT_SKIN_TONE = "\U0001f481\U0001f3fb\u200d\u2642\ufe0f" +MAN_TIPPING_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f481\U0001f3fc\u200d\u2642\ufe0f" +MAN_TIPPING_HAND_MEDIUM_SKIN_TONE = "\U0001f481\U0001f3fd\u200d\u2642\ufe0f" +MAN_TIPPING_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f481\U0001f3fe\u200d\u2642\ufe0f" +MAN_TIPPING_HAND_DARK_SKIN_TONE = "\U0001f481\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_TIPPING_HAND = "\U0001f481\u200d\u2640\ufe0f" +WOMAN_TIPPING_HAND_LIGHT_SKIN_TONE = "\U0001f481\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_TIPPING_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f481\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_TIPPING_HAND_MEDIUM_SKIN_TONE = "\U0001f481\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_TIPPING_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f481\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_TIPPING_HAND_DARK_SKIN_TONE = "\U0001f481\U0001f3ff\u200d\u2640\ufe0f" +PERSON_RAISING_HAND = "\U0001f64b" +PERSON_RAISING_HAND_LIGHT_SKIN_TONE = "\U0001f64b\U0001f3fb" +PERSON_RAISING_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64b\U0001f3fc" +PERSON_RAISING_HAND_MEDIUM_SKIN_TONE = "\U0001f64b\U0001f3fd" +PERSON_RAISING_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f64b\U0001f3fe" +PERSON_RAISING_HAND_DARK_SKIN_TONE = "\U0001f64b\U0001f3ff" +MAN_RAISING_HAND = "\U0001f64b\u200d\u2642\ufe0f" +MAN_RAISING_HAND_LIGHT_SKIN_TONE = "\U0001f64b\U0001f3fb\u200d\u2642\ufe0f" +MAN_RAISING_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64b\U0001f3fc\u200d\u2642\ufe0f" +MAN_RAISING_HAND_MEDIUM_SKIN_TONE = "\U0001f64b\U0001f3fd\u200d\u2642\ufe0f" +MAN_RAISING_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f64b\U0001f3fe\u200d\u2642\ufe0f" +MAN_RAISING_HAND_DARK_SKIN_TONE = "\U0001f64b\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_RAISING_HAND = "\U0001f64b\u200d\u2640\ufe0f" +WOMAN_RAISING_HAND_LIGHT_SKIN_TONE = "\U0001f64b\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_RAISING_HAND_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64b\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_RAISING_HAND_MEDIUM_SKIN_TONE = "\U0001f64b\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_RAISING_HAND_MEDIUM_DARK_SKIN_TONE = "\U0001f64b\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_RAISING_HAND_DARK_SKIN_TONE = "\U0001f64b\U0001f3ff\u200d\u2640\ufe0f" +DEAF_PERSON = "\U0001f9cf" +DEAF_PERSON_LIGHT_SKIN_TONE = "\U0001f9cf\U0001f3fb" +DEAF_PERSON_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9cf\U0001f3fc" +DEAF_PERSON_MEDIUM_SKIN_TONE = "\U0001f9cf\U0001f3fd" +DEAF_PERSON_MEDIUM_DARK_SKIN_TONE = "\U0001f9cf\U0001f3fe" +DEAF_PERSON_DARK_SKIN_TONE = "\U0001f9cf\U0001f3ff" +DEAF_MAN = "\U0001f9cf\u200d\u2642\ufe0f" +DEAF_MAN_LIGHT_SKIN_TONE = "\U0001f9cf\U0001f3fb\u200d\u2642\ufe0f" +DEAF_MAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9cf\U0001f3fc\u200d\u2642\ufe0f" +DEAF_MAN_MEDIUM_SKIN_TONE = "\U0001f9cf\U0001f3fd\u200d\u2642\ufe0f" +DEAF_MAN_MEDIUM_DARK_SKIN_TONE = "\U0001f9cf\U0001f3fe\u200d\u2642\ufe0f" +DEAF_MAN_DARK_SKIN_TONE = "\U0001f9cf\U0001f3ff\u200d\u2642\ufe0f" +DEAF_WOMAN = "\U0001f9cf\u200d\u2640\ufe0f" +DEAF_WOMAN_LIGHT_SKIN_TONE = "\U0001f9cf\U0001f3fb\u200d\u2640\ufe0f" +DEAF_WOMAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9cf\U0001f3fc\u200d\u2640\ufe0f" +DEAF_WOMAN_MEDIUM_SKIN_TONE = "\U0001f9cf\U0001f3fd\u200d\u2640\ufe0f" +DEAF_WOMAN_MEDIUM_DARK_SKIN_TONE = "\U0001f9cf\U0001f3fe\u200d\u2640\ufe0f" +DEAF_WOMAN_DARK_SKIN_TONE = "\U0001f9cf\U0001f3ff\u200d\u2640\ufe0f" +PERSON_BOWING = "\U0001f647" +PERSON_BOWING_LIGHT_SKIN_TONE = "\U0001f647\U0001f3fb" +PERSON_BOWING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f647\U0001f3fc" +PERSON_BOWING_MEDIUM_SKIN_TONE = "\U0001f647\U0001f3fd" +PERSON_BOWING_MEDIUM_DARK_SKIN_TONE = "\U0001f647\U0001f3fe" +PERSON_BOWING_DARK_SKIN_TONE = "\U0001f647\U0001f3ff" +MAN_BOWING = "\U0001f647\u200d\u2642\ufe0f" +MAN_BOWING_LIGHT_SKIN_TONE = "\U0001f647\U0001f3fb\u200d\u2642\ufe0f" +MAN_BOWING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f647\U0001f3fc\u200d\u2642\ufe0f" +MAN_BOWING_MEDIUM_SKIN_TONE = "\U0001f647\U0001f3fd\u200d\u2642\ufe0f" +MAN_BOWING_MEDIUM_DARK_SKIN_TONE = "\U0001f647\U0001f3fe\u200d\u2642\ufe0f" +MAN_BOWING_DARK_SKIN_TONE = "\U0001f647\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_BOWING = "\U0001f647\u200d\u2640\ufe0f" +WOMAN_BOWING_LIGHT_SKIN_TONE = "\U0001f647\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_BOWING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f647\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_BOWING_MEDIUM_SKIN_TONE = "\U0001f647\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_BOWING_MEDIUM_DARK_SKIN_TONE = "\U0001f647\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_BOWING_DARK_SKIN_TONE = "\U0001f647\U0001f3ff\u200d\u2640\ufe0f" +PERSON_FACEPALMING = "\U0001f926" +PERSON_FACEPALMING_LIGHT_SKIN_TONE = "\U0001f926\U0001f3fb" +PERSON_FACEPALMING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f926\U0001f3fc" +PERSON_FACEPALMING_MEDIUM_SKIN_TONE = "\U0001f926\U0001f3fd" +PERSON_FACEPALMING_MEDIUM_DARK_SKIN_TONE = "\U0001f926\U0001f3fe" +PERSON_FACEPALMING_DARK_SKIN_TONE = "\U0001f926\U0001f3ff" +MAN_FACEPALMING = "\U0001f926\u200d\u2642\ufe0f" +MAN_FACEPALMING_LIGHT_SKIN_TONE = "\U0001f926\U0001f3fb\u200d\u2642\ufe0f" +MAN_FACEPALMING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f926\U0001f3fc\u200d\u2642\ufe0f" +MAN_FACEPALMING_MEDIUM_SKIN_TONE = "\U0001f926\U0001f3fd\u200d\u2642\ufe0f" +MAN_FACEPALMING_MEDIUM_DARK_SKIN_TONE = "\U0001f926\U0001f3fe\u200d\u2642\ufe0f" +MAN_FACEPALMING_DARK_SKIN_TONE = "\U0001f926\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_FACEPALMING = "\U0001f926\u200d\u2640\ufe0f" +WOMAN_FACEPALMING_LIGHT_SKIN_TONE = "\U0001f926\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_FACEPALMING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f926\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_FACEPALMING_MEDIUM_SKIN_TONE = "\U0001f926\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_FACEPALMING_MEDIUM_DARK_SKIN_TONE = "\U0001f926\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_FACEPALMING_DARK_SKIN_TONE = "\U0001f926\U0001f3ff\u200d\u2640\ufe0f" +PERSON_SHRUGGING = "\U0001f937" +PERSON_SHRUGGING_LIGHT_SKIN_TONE = "\U0001f937\U0001f3fb" +PERSON_SHRUGGING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f937\U0001f3fc" +PERSON_SHRUGGING_MEDIUM_SKIN_TONE = "\U0001f937\U0001f3fd" +PERSON_SHRUGGING_MEDIUM_DARK_SKIN_TONE = "\U0001f937\U0001f3fe" +PERSON_SHRUGGING_DARK_SKIN_TONE = "\U0001f937\U0001f3ff" +MAN_SHRUGGING = "\U0001f937\u200d\u2642\ufe0f" +MAN_SHRUGGING_LIGHT_SKIN_TONE = "\U0001f937\U0001f3fb\u200d\u2642\ufe0f" +MAN_SHRUGGING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f937\U0001f3fc\u200d\u2642\ufe0f" +MAN_SHRUGGING_MEDIUM_SKIN_TONE = "\U0001f937\U0001f3fd\u200d\u2642\ufe0f" +MAN_SHRUGGING_MEDIUM_DARK_SKIN_TONE = "\U0001f937\U0001f3fe\u200d\u2642\ufe0f" +MAN_SHRUGGING_DARK_SKIN_TONE = "\U0001f937\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_SHRUGGING = "\U0001f937\u200d\u2640\ufe0f" +WOMAN_SHRUGGING_LIGHT_SKIN_TONE = "\U0001f937\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_SHRUGGING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f937\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_SHRUGGING_MEDIUM_SKIN_TONE = "\U0001f937\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_SHRUGGING_MEDIUM_DARK_SKIN_TONE = "\U0001f937\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_SHRUGGING_DARK_SKIN_TONE = "\U0001f937\U0001f3ff\u200d\u2640\ufe0f" +HEALTH_WORKER = "\U0001f9d1\u200d\u2695\ufe0f" +HEALTH_WORKER_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\u2695\ufe0f" +HEALTH_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\u2695\ufe0f" +HEALTH_WORKER_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\u2695\ufe0f" +HEALTH_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\u2695\ufe0f" +HEALTH_WORKER_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\u2695\ufe0f" +MAN_HEALTH_WORKER = "\U0001f468\u200d\u2695\ufe0f" +MAN_HEALTH_WORKER_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\u2695\ufe0f" +MAN_HEALTH_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\u2695\ufe0f" +MAN_HEALTH_WORKER_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\u2695\ufe0f" +MAN_HEALTH_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\u2695\ufe0f" +MAN_HEALTH_WORKER_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\u2695\ufe0f" +WOMAN_HEALTH_WORKER = "\U0001f469\u200d\u2695\ufe0f" +WOMAN_HEALTH_WORKER_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2695\ufe0f" +WOMAN_HEALTH_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\u2695\ufe0f" +WOMAN_HEALTH_WORKER_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2695\ufe0f" +WOMAN_HEALTH_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\u2695\ufe0f" +WOMAN_HEALTH_WORKER_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2695\ufe0f" +STUDENT = "\U0001f9d1\u200d\U0001f393" +STUDENT_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f393" +STUDENT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f393" +STUDENT_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f393" +STUDENT_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f393" +STUDENT_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f393" +MAN_STUDENT = "\U0001f468\u200d\U0001f393" +MAN_STUDENT_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f393" +MAN_STUDENT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f393" +MAN_STUDENT_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f393" +MAN_STUDENT_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f393" +MAN_STUDENT_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f393" +WOMAN_STUDENT = "\U0001f469\u200d\U0001f393" +WOMAN_STUDENT_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f393" +WOMAN_STUDENT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f393" +WOMAN_STUDENT_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f393" +WOMAN_STUDENT_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f393" +WOMAN_STUDENT_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f393" +TEACHER = "\U0001f9d1\u200d\U0001f3eb" +TEACHER_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f3eb" +TEACHER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f3eb" +TEACHER_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f3eb" +TEACHER_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f3eb" +TEACHER_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f3eb" +MAN_TEACHER = "\U0001f468\u200d\U0001f3eb" +MAN_TEACHER_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f3eb" +MAN_TEACHER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f3eb" +MAN_TEACHER_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f3eb" +MAN_TEACHER_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f3eb" +MAN_TEACHER_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f3eb" +WOMAN_TEACHER = "\U0001f469\u200d\U0001f3eb" +WOMAN_TEACHER_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f3eb" +WOMAN_TEACHER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f3eb" +WOMAN_TEACHER_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f3eb" +WOMAN_TEACHER_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f3eb" +WOMAN_TEACHER_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f3eb" +JUDGE = "\U0001f9d1\u200d\u2696\ufe0f" +JUDGE_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\u2696\ufe0f" +JUDGE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\u2696\ufe0f" +JUDGE_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\u2696\ufe0f" +JUDGE_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\u2696\ufe0f" +JUDGE_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\u2696\ufe0f" +MAN_JUDGE = "\U0001f468\u200d\u2696\ufe0f" +MAN_JUDGE_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\u2696\ufe0f" +MAN_JUDGE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\u2696\ufe0f" +MAN_JUDGE_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\u2696\ufe0f" +MAN_JUDGE_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\u2696\ufe0f" +MAN_JUDGE_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\u2696\ufe0f" +WOMAN_JUDGE = "\U0001f469\u200d\u2696\ufe0f" +WOMAN_JUDGE_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2696\ufe0f" +WOMAN_JUDGE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\u2696\ufe0f" +WOMAN_JUDGE_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2696\ufe0f" +WOMAN_JUDGE_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\u2696\ufe0f" +WOMAN_JUDGE_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2696\ufe0f" +FARMER = "\U0001f9d1\u200d\U0001f33e" +FARMER_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f33e" +FARMER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f33e" +FARMER_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f33e" +FARMER_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f33e" +FARMER_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f33e" +MAN_FARMER = "\U0001f468\u200d\U0001f33e" +MAN_FARMER_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f33e" +MAN_FARMER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f33e" +MAN_FARMER_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f33e" +MAN_FARMER_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f33e" +MAN_FARMER_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f33e" +WOMAN_FARMER = "\U0001f469\u200d\U0001f33e" +WOMAN_FARMER_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f33e" +WOMAN_FARMER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f33e" +WOMAN_FARMER_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f33e" +WOMAN_FARMER_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f33e" +WOMAN_FARMER_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f33e" +COOK = "\U0001f9d1\u200d\U0001f373" +COOK_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f373" +COOK_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f373" +COOK_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f373" +COOK_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f373" +COOK_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f373" +MAN_COOK = "\U0001f468\u200d\U0001f373" +MAN_COOK_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f373" +MAN_COOK_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f373" +MAN_COOK_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f373" +MAN_COOK_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f373" +MAN_COOK_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f373" +WOMAN_COOK = "\U0001f469\u200d\U0001f373" +WOMAN_COOK_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f373" +WOMAN_COOK_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f373" +WOMAN_COOK_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f373" +WOMAN_COOK_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f373" +WOMAN_COOK_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f373" +MECHANIC = "\U0001f9d1\u200d\U0001f527" +MECHANIC_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f527" +MECHANIC_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f527" +MECHANIC_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f527" +MECHANIC_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f527" +MECHANIC_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f527" +MAN_MECHANIC = "\U0001f468\u200d\U0001f527" +MAN_MECHANIC_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f527" +MAN_MECHANIC_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f527" +MAN_MECHANIC_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f527" +MAN_MECHANIC_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f527" +MAN_MECHANIC_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f527" +WOMAN_MECHANIC = "\U0001f469\u200d\U0001f527" +WOMAN_MECHANIC_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f527" +WOMAN_MECHANIC_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f527" +WOMAN_MECHANIC_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f527" +WOMAN_MECHANIC_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f527" +WOMAN_MECHANIC_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f527" +FACTORY_WORKER = "\U0001f9d1\u200d\U0001f3ed" +FACTORY_WORKER_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f3ed" +FACTORY_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f3ed" +FACTORY_WORKER_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f3ed" +FACTORY_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f3ed" +FACTORY_WORKER_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f3ed" +MAN_FACTORY_WORKER = "\U0001f468\u200d\U0001f3ed" +MAN_FACTORY_WORKER_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f3ed" +MAN_FACTORY_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f3ed" +MAN_FACTORY_WORKER_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f3ed" +MAN_FACTORY_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f3ed" +MAN_FACTORY_WORKER_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f3ed" +WOMAN_FACTORY_WORKER = "\U0001f469\u200d\U0001f3ed" +WOMAN_FACTORY_WORKER_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f3ed" +WOMAN_FACTORY_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f3ed" +WOMAN_FACTORY_WORKER_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f3ed" +WOMAN_FACTORY_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f3ed" +WOMAN_FACTORY_WORKER_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f3ed" +OFFICE_WORKER = "\U0001f9d1\u200d\U0001f4bc" +OFFICE_WORKER_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f4bc" +OFFICE_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f4bc" +OFFICE_WORKER_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f4bc" +OFFICE_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f4bc" +OFFICE_WORKER_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f4bc" +MAN_OFFICE_WORKER = "\U0001f468\u200d\U0001f4bc" +MAN_OFFICE_WORKER_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f4bc" +MAN_OFFICE_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f4bc" +MAN_OFFICE_WORKER_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f4bc" +MAN_OFFICE_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f4bc" +MAN_OFFICE_WORKER_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f4bc" +WOMAN_OFFICE_WORKER = "\U0001f469\u200d\U0001f4bc" +WOMAN_OFFICE_WORKER_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f4bc" +WOMAN_OFFICE_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f4bc" +WOMAN_OFFICE_WORKER_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f4bc" +WOMAN_OFFICE_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f4bc" +WOMAN_OFFICE_WORKER_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f4bc" +SCIENTIST = "\U0001f9d1\u200d\U0001f52c" +SCIENTIST_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f52c" +SCIENTIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f52c" +SCIENTIST_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f52c" +SCIENTIST_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f52c" +SCIENTIST_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f52c" +MAN_SCIENTIST = "\U0001f468\u200d\U0001f52c" +MAN_SCIENTIST_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f52c" +MAN_SCIENTIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f52c" +MAN_SCIENTIST_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f52c" +MAN_SCIENTIST_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f52c" +MAN_SCIENTIST_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f52c" +WOMAN_SCIENTIST = "\U0001f469\u200d\U0001f52c" +WOMAN_SCIENTIST_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f52c" +WOMAN_SCIENTIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f52c" +WOMAN_SCIENTIST_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f52c" +WOMAN_SCIENTIST_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f52c" +WOMAN_SCIENTIST_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f52c" +TECHNOLOGIST = "\U0001f9d1\u200d\U0001f4bb" +TECHNOLOGIST_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f4bb" +TECHNOLOGIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f4bb" +TECHNOLOGIST_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f4bb" +TECHNOLOGIST_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f4bb" +TECHNOLOGIST_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f4bb" +MAN_TECHNOLOGIST = "\U0001f468\u200d\U0001f4bb" +MAN_TECHNOLOGIST_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f4bb" +MAN_TECHNOLOGIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f4bb" +MAN_TECHNOLOGIST_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f4bb" +MAN_TECHNOLOGIST_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f4bb" +MAN_TECHNOLOGIST_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f4bb" +WOMAN_TECHNOLOGIST = "\U0001f469\u200d\U0001f4bb" +WOMAN_TECHNOLOGIST_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f4bb" +WOMAN_TECHNOLOGIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f4bb" +WOMAN_TECHNOLOGIST_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f4bb" +WOMAN_TECHNOLOGIST_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f4bb" +WOMAN_TECHNOLOGIST_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f4bb" +SINGER = "\U0001f9d1\u200d\U0001f3a4" +SINGER_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f3a4" +SINGER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f3a4" +SINGER_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f3a4" +SINGER_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f3a4" +SINGER_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f3a4" +MAN_SINGER = "\U0001f468\u200d\U0001f3a4" +MAN_SINGER_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f3a4" +MAN_SINGER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f3a4" +MAN_SINGER_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f3a4" +MAN_SINGER_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f3a4" +MAN_SINGER_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f3a4" +WOMAN_SINGER = "\U0001f469\u200d\U0001f3a4" +WOMAN_SINGER_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f3a4" +WOMAN_SINGER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f3a4" +WOMAN_SINGER_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f3a4" +WOMAN_SINGER_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f3a4" +WOMAN_SINGER_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f3a4" +ARTIST = "\U0001f9d1\u200d\U0001f3a8" +ARTIST_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f3a8" +ARTIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f3a8" +ARTIST_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f3a8" +ARTIST_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f3a8" +ARTIST_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f3a8" +MAN_ARTIST = "\U0001f468\u200d\U0001f3a8" +MAN_ARTIST_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f3a8" +MAN_ARTIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f3a8" +MAN_ARTIST_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f3a8" +MAN_ARTIST_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f3a8" +MAN_ARTIST_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f3a8" +WOMAN_ARTIST = "\U0001f469\u200d\U0001f3a8" +WOMAN_ARTIST_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f3a8" +WOMAN_ARTIST_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f3a8" +WOMAN_ARTIST_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f3a8" +WOMAN_ARTIST_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f3a8" +WOMAN_ARTIST_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f3a8" +PILOT = "\U0001f9d1\u200d\u2708\ufe0f" +PILOT_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\u2708\ufe0f" +PILOT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\u2708\ufe0f" +PILOT_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\u2708\ufe0f" +PILOT_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\u2708\ufe0f" +PILOT_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\u2708\ufe0f" +MAN_PILOT = "\U0001f468\u200d\u2708\ufe0f" +MAN_PILOT_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\u2708\ufe0f" +MAN_PILOT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\u2708\ufe0f" +MAN_PILOT_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\u2708\ufe0f" +MAN_PILOT_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\u2708\ufe0f" +MAN_PILOT_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\u2708\ufe0f" +WOMAN_PILOT = "\U0001f469\u200d\u2708\ufe0f" +WOMAN_PILOT_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2708\ufe0f" +WOMAN_PILOT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\u2708\ufe0f" +WOMAN_PILOT_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2708\ufe0f" +WOMAN_PILOT_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\u2708\ufe0f" +WOMAN_PILOT_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2708\ufe0f" +ASTRONAUT = "\U0001f9d1\u200d\U0001f680" +ASTRONAUT_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f680" +ASTRONAUT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f680" +ASTRONAUT_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f680" +ASTRONAUT_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f680" +ASTRONAUT_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f680" +MAN_ASTRONAUT = "\U0001f468\u200d\U0001f680" +MAN_ASTRONAUT_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f680" +MAN_ASTRONAUT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f680" +MAN_ASTRONAUT_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f680" +MAN_ASTRONAUT_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f680" +MAN_ASTRONAUT_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f680" +WOMAN_ASTRONAUT = "\U0001f469\u200d\U0001f680" +WOMAN_ASTRONAUT_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f680" +WOMAN_ASTRONAUT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f680" +WOMAN_ASTRONAUT_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f680" +WOMAN_ASTRONAUT_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f680" +WOMAN_ASTRONAUT_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f680" +FIREFIGHTER = "\U0001f9d1\u200d\U0001f692" +FIREFIGHTER_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f692" +FIREFIGHTER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f692" +FIREFIGHTER_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f692" +FIREFIGHTER_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f692" +FIREFIGHTER_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f692" +MAN_FIREFIGHTER = "\U0001f468\u200d\U0001f692" +MAN_FIREFIGHTER_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f692" +MAN_FIREFIGHTER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f692" +MAN_FIREFIGHTER_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f692" +MAN_FIREFIGHTER_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f692" +MAN_FIREFIGHTER_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f692" +WOMAN_FIREFIGHTER = "\U0001f469\u200d\U0001f692" +WOMAN_FIREFIGHTER_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f692" +WOMAN_FIREFIGHTER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f692" +WOMAN_FIREFIGHTER_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f692" +WOMAN_FIREFIGHTER_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f692" +WOMAN_FIREFIGHTER_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f692" +POLICE_OFFICER = "\U0001f46e" +POLICE_OFFICER_LIGHT_SKIN_TONE = "\U0001f46e\U0001f3fb" +POLICE_OFFICER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f46e\U0001f3fc" +POLICE_OFFICER_MEDIUM_SKIN_TONE = "\U0001f46e\U0001f3fd" +POLICE_OFFICER_MEDIUM_DARK_SKIN_TONE = "\U0001f46e\U0001f3fe" +POLICE_OFFICER_DARK_SKIN_TONE = "\U0001f46e\U0001f3ff" +MAN_POLICE_OFFICER = "\U0001f46e\u200d\u2642\ufe0f" +MAN_POLICE_OFFICER_LIGHT_SKIN_TONE = "\U0001f46e\U0001f3fb\u200d\u2642\ufe0f" +MAN_POLICE_OFFICER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f46e\U0001f3fc\u200d\u2642\ufe0f" +MAN_POLICE_OFFICER_MEDIUM_SKIN_TONE = "\U0001f46e\U0001f3fd\u200d\u2642\ufe0f" +MAN_POLICE_OFFICER_MEDIUM_DARK_SKIN_TONE = "\U0001f46e\U0001f3fe\u200d\u2642\ufe0f" +MAN_POLICE_OFFICER_DARK_SKIN_TONE = "\U0001f46e\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_POLICE_OFFICER = "\U0001f46e\u200d\u2640\ufe0f" +WOMAN_POLICE_OFFICER_LIGHT_SKIN_TONE = "\U0001f46e\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_POLICE_OFFICER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f46e\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_POLICE_OFFICER_MEDIUM_SKIN_TONE = "\U0001f46e\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_POLICE_OFFICER_MEDIUM_DARK_SKIN_TONE = "\U0001f46e\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_POLICE_OFFICER_DARK_SKIN_TONE = "\U0001f46e\U0001f3ff\u200d\u2640\ufe0f" +DETECTIVE = "\U0001f575\ufe0f" +DETECTIVE_LIGHT_SKIN_TONE = "\U0001f575\U0001f3fb" +DETECTIVE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f575\U0001f3fc" +DETECTIVE_MEDIUM_SKIN_TONE = "\U0001f575\U0001f3fd" +DETECTIVE_MEDIUM_DARK_SKIN_TONE = "\U0001f575\U0001f3fe" +DETECTIVE_DARK_SKIN_TONE = "\U0001f575\U0001f3ff" +MAN_DETECTIVE = "\U0001f575\ufe0f\u200d\u2642\ufe0f" +MAN_DETECTIVE_LIGHT_SKIN_TONE = "\U0001f575\U0001f3fb\u200d\u2642\ufe0f" +MAN_DETECTIVE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f575\U0001f3fc\u200d\u2642\ufe0f" +MAN_DETECTIVE_MEDIUM_SKIN_TONE = "\U0001f575\U0001f3fd\u200d\u2642\ufe0f" +MAN_DETECTIVE_MEDIUM_DARK_SKIN_TONE = "\U0001f575\U0001f3fe\u200d\u2642\ufe0f" +MAN_DETECTIVE_DARK_SKIN_TONE = "\U0001f575\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_DETECTIVE = "\U0001f575\ufe0f\u200d\u2640\ufe0f" +WOMAN_DETECTIVE_LIGHT_SKIN_TONE = "\U0001f575\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_DETECTIVE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f575\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_DETECTIVE_MEDIUM_SKIN_TONE = "\U0001f575\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_DETECTIVE_MEDIUM_DARK_SKIN_TONE = "\U0001f575\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_DETECTIVE_DARK_SKIN_TONE = "\U0001f575\U0001f3ff\u200d\u2640\ufe0f" +GUARD = "\U0001f482" +GUARD_LIGHT_SKIN_TONE = "\U0001f482\U0001f3fb" +GUARD_MEDIUM_LIGHT_SKIN_TONE = "\U0001f482\U0001f3fc" +GUARD_MEDIUM_SKIN_TONE = "\U0001f482\U0001f3fd" +GUARD_MEDIUM_DARK_SKIN_TONE = "\U0001f482\U0001f3fe" +GUARD_DARK_SKIN_TONE = "\U0001f482\U0001f3ff" +MAN_GUARD = "\U0001f482\u200d\u2642\ufe0f" +MAN_GUARD_LIGHT_SKIN_TONE = "\U0001f482\U0001f3fb\u200d\u2642\ufe0f" +MAN_GUARD_MEDIUM_LIGHT_SKIN_TONE = "\U0001f482\U0001f3fc\u200d\u2642\ufe0f" +MAN_GUARD_MEDIUM_SKIN_TONE = "\U0001f482\U0001f3fd\u200d\u2642\ufe0f" +MAN_GUARD_MEDIUM_DARK_SKIN_TONE = "\U0001f482\U0001f3fe\u200d\u2642\ufe0f" +MAN_GUARD_DARK_SKIN_TONE = "\U0001f482\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_GUARD = "\U0001f482\u200d\u2640\ufe0f" +WOMAN_GUARD_LIGHT_SKIN_TONE = "\U0001f482\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_GUARD_MEDIUM_LIGHT_SKIN_TONE = "\U0001f482\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_GUARD_MEDIUM_SKIN_TONE = "\U0001f482\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_GUARD_MEDIUM_DARK_SKIN_TONE = "\U0001f482\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_GUARD_DARK_SKIN_TONE = "\U0001f482\U0001f3ff\u200d\u2640\ufe0f" +NINJA = "\U0001f977" +NINJA_LIGHT_SKIN_TONE = "\U0001f977\U0001f3fb" +NINJA_MEDIUM_LIGHT_SKIN_TONE = "\U0001f977\U0001f3fc" +NINJA_MEDIUM_SKIN_TONE = "\U0001f977\U0001f3fd" +NINJA_MEDIUM_DARK_SKIN_TONE = "\U0001f977\U0001f3fe" +NINJA_DARK_SKIN_TONE = "\U0001f977\U0001f3ff" +CONSTRUCTION_WORKER = "\U0001f477" +CONSTRUCTION_WORKER_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fb" +CONSTRUCTION_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fc" +CONSTRUCTION_WORKER_MEDIUM_SKIN_TONE = "\U0001f477\U0001f3fd" +CONSTRUCTION_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f477\U0001f3fe" +CONSTRUCTION_WORKER_DARK_SKIN_TONE = "\U0001f477\U0001f3ff" +MAN_CONSTRUCTION_WORKER = "\U0001f477\u200d\u2642\ufe0f" +MAN_CONSTRUCTION_WORKER_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fb\u200d\u2642\ufe0f" +MAN_CONSTRUCTION_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fc\u200d\u2642\ufe0f" +MAN_CONSTRUCTION_WORKER_MEDIUM_SKIN_TONE = "\U0001f477\U0001f3fd\u200d\u2642\ufe0f" +MAN_CONSTRUCTION_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f477\U0001f3fe\u200d\u2642\ufe0f" +MAN_CONSTRUCTION_WORKER_DARK_SKIN_TONE = "\U0001f477\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_CONSTRUCTION_WORKER = "\U0001f477\u200d\u2640\ufe0f" +WOMAN_CONSTRUCTION_WORKER_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_CONSTRUCTION_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_CONSTRUCTION_WORKER_MEDIUM_SKIN_TONE = "\U0001f477\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_CONSTRUCTION_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f477\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_CONSTRUCTION_WORKER_DARK_SKIN_TONE = "\U0001f477\U0001f3ff\u200d\u2640\ufe0f" +PERSON_WITH_CROWN = "\U0001fac5" +PERSON_WITH_CROWN_LIGHT_SKIN_TONE = "\U0001fac5\U0001f3fb" +PERSON_WITH_CROWN_MEDIUM_LIGHT_SKIN_TONE = "\U0001fac5\U0001f3fc" +PERSON_WITH_CROWN_MEDIUM_SKIN_TONE = "\U0001fac5\U0001f3fd" +PERSON_WITH_CROWN_MEDIUM_DARK_SKIN_TONE = "\U0001fac5\U0001f3fe" +PERSON_WITH_CROWN_DARK_SKIN_TONE = "\U0001fac5\U0001f3ff" +PRINCE = "\U0001f934" +PRINCE_LIGHT_SKIN_TONE = "\U0001f934\U0001f3fb" +PRINCE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f934\U0001f3fc" +PRINCE_MEDIUM_SKIN_TONE = "\U0001f934\U0001f3fd" +PRINCE_MEDIUM_DARK_SKIN_TONE = "\U0001f934\U0001f3fe" +PRINCE_DARK_SKIN_TONE = "\U0001f934\U0001f3ff" +PRINCESS = "\U0001f478" +PRINCESS_LIGHT_SKIN_TONE = "\U0001f478\U0001f3fb" +PRINCESS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f478\U0001f3fc" +PRINCESS_MEDIUM_SKIN_TONE = "\U0001f478\U0001f3fd" +PRINCESS_MEDIUM_DARK_SKIN_TONE = "\U0001f478\U0001f3fe" +PRINCESS_DARK_SKIN_TONE = "\U0001f478\U0001f3ff" +PERSON_WEARING_TURBAN = "\U0001f473" +PERSON_WEARING_TURBAN_LIGHT_SKIN_TONE = "\U0001f473\U0001f3fb" +PERSON_WEARING_TURBAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f473\U0001f3fc" +PERSON_WEARING_TURBAN_MEDIUM_SKIN_TONE = "\U0001f473\U0001f3fd" +PERSON_WEARING_TURBAN_MEDIUM_DARK_SKIN_TONE = "\U0001f473\U0001f3fe" +PERSON_WEARING_TURBAN_DARK_SKIN_TONE = "\U0001f473\U0001f3ff" +MAN_WEARING_TURBAN = "\U0001f473\u200d\u2642\ufe0f" +MAN_WEARING_TURBAN_LIGHT_SKIN_TONE = "\U0001f473\U0001f3fb\u200d\u2642\ufe0f" +MAN_WEARING_TURBAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f473\U0001f3fc\u200d\u2642\ufe0f" +MAN_WEARING_TURBAN_MEDIUM_SKIN_TONE = "\U0001f473\U0001f3fd\u200d\u2642\ufe0f" +MAN_WEARING_TURBAN_MEDIUM_DARK_SKIN_TONE = "\U0001f473\U0001f3fe\u200d\u2642\ufe0f" +MAN_WEARING_TURBAN_DARK_SKIN_TONE = "\U0001f473\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_WEARING_TURBAN = "\U0001f473\u200d\u2640\ufe0f" +WOMAN_WEARING_TURBAN_LIGHT_SKIN_TONE = "\U0001f473\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_WEARING_TURBAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f473\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_WEARING_TURBAN_MEDIUM_SKIN_TONE = "\U0001f473\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_WEARING_TURBAN_MEDIUM_DARK_SKIN_TONE = "\U0001f473\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_WEARING_TURBAN_DARK_SKIN_TONE = "\U0001f473\U0001f3ff\u200d\u2640\ufe0f" +PERSON_WITH_SKULLCAP = "\U0001f472" +PERSON_WITH_SKULLCAP_LIGHT_SKIN_TONE = "\U0001f472\U0001f3fb" +PERSON_WITH_SKULLCAP_MEDIUM_LIGHT_SKIN_TONE = "\U0001f472\U0001f3fc" +PERSON_WITH_SKULLCAP_MEDIUM_SKIN_TONE = "\U0001f472\U0001f3fd" +PERSON_WITH_SKULLCAP_MEDIUM_DARK_SKIN_TONE = "\U0001f472\U0001f3fe" +PERSON_WITH_SKULLCAP_DARK_SKIN_TONE = "\U0001f472\U0001f3ff" +WOMAN_WITH_HEADSCARF = "\U0001f9d5" +WOMAN_WITH_HEADSCARF_LIGHT_SKIN_TONE = "\U0001f9d5\U0001f3fb" +WOMAN_WITH_HEADSCARF_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d5\U0001f3fc" +WOMAN_WITH_HEADSCARF_MEDIUM_SKIN_TONE = "\U0001f9d5\U0001f3fd" +WOMAN_WITH_HEADSCARF_MEDIUM_DARK_SKIN_TONE = "\U0001f9d5\U0001f3fe" +WOMAN_WITH_HEADSCARF_DARK_SKIN_TONE = "\U0001f9d5\U0001f3ff" +PERSON_IN_TUXEDO = "\U0001f935" +PERSON_IN_TUXEDO_LIGHT_SKIN_TONE = "\U0001f935\U0001f3fb" +PERSON_IN_TUXEDO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f935\U0001f3fc" +PERSON_IN_TUXEDO_MEDIUM_SKIN_TONE = "\U0001f935\U0001f3fd" +PERSON_IN_TUXEDO_MEDIUM_DARK_SKIN_TONE = "\U0001f935\U0001f3fe" +PERSON_IN_TUXEDO_DARK_SKIN_TONE = "\U0001f935\U0001f3ff" +MAN_IN_TUXEDO = "\U0001f935\u200d\u2642\ufe0f" +MAN_IN_TUXEDO_LIGHT_SKIN_TONE = "\U0001f935\U0001f3fb\u200d\u2642\ufe0f" +MAN_IN_TUXEDO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f935\U0001f3fc\u200d\u2642\ufe0f" +MAN_IN_TUXEDO_MEDIUM_SKIN_TONE = "\U0001f935\U0001f3fd\u200d\u2642\ufe0f" +MAN_IN_TUXEDO_MEDIUM_DARK_SKIN_TONE = "\U0001f935\U0001f3fe\u200d\u2642\ufe0f" +MAN_IN_TUXEDO_DARK_SKIN_TONE = "\U0001f935\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_IN_TUXEDO = "\U0001f935\u200d\u2640\ufe0f" +WOMAN_IN_TUXEDO_LIGHT_SKIN_TONE = "\U0001f935\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_IN_TUXEDO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f935\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_IN_TUXEDO_MEDIUM_SKIN_TONE = "\U0001f935\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_IN_TUXEDO_MEDIUM_DARK_SKIN_TONE = "\U0001f935\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_IN_TUXEDO_DARK_SKIN_TONE = "\U0001f935\U0001f3ff\u200d\u2640\ufe0f" +PERSON_WITH_VEIL = "\U0001f470" +PERSON_WITH_VEIL_LIGHT_SKIN_TONE = "\U0001f470\U0001f3fb" +PERSON_WITH_VEIL_MEDIUM_LIGHT_SKIN_TONE = "\U0001f470\U0001f3fc" +PERSON_WITH_VEIL_MEDIUM_SKIN_TONE = "\U0001f470\U0001f3fd" +PERSON_WITH_VEIL_MEDIUM_DARK_SKIN_TONE = "\U0001f470\U0001f3fe" +PERSON_WITH_VEIL_DARK_SKIN_TONE = "\U0001f470\U0001f3ff" +MAN_WITH_VEIL = "\U0001f470\u200d\u2642\ufe0f" +MAN_WITH_VEIL_LIGHT_SKIN_TONE = "\U0001f470\U0001f3fb\u200d\u2642\ufe0f" +MAN_WITH_VEIL_MEDIUM_LIGHT_SKIN_TONE = "\U0001f470\U0001f3fc\u200d\u2642\ufe0f" +MAN_WITH_VEIL_MEDIUM_SKIN_TONE = "\U0001f470\U0001f3fd\u200d\u2642\ufe0f" +MAN_WITH_VEIL_MEDIUM_DARK_SKIN_TONE = "\U0001f470\U0001f3fe\u200d\u2642\ufe0f" +MAN_WITH_VEIL_DARK_SKIN_TONE = "\U0001f470\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_WITH_VEIL = "\U0001f470\u200d\u2640\ufe0f" +WOMAN_WITH_VEIL_LIGHT_SKIN_TONE = "\U0001f470\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_WITH_VEIL_MEDIUM_LIGHT_SKIN_TONE = "\U0001f470\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_WITH_VEIL_MEDIUM_SKIN_TONE = "\U0001f470\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_WITH_VEIL_MEDIUM_DARK_SKIN_TONE = "\U0001f470\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_WITH_VEIL_DARK_SKIN_TONE = "\U0001f470\U0001f3ff\u200d\u2640\ufe0f" +PREGNANT_WOMAN = "\U0001f930" +PREGNANT_WOMAN_LIGHT_SKIN_TONE = "\U0001f930\U0001f3fb" +PREGNANT_WOMAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f930\U0001f3fc" +PREGNANT_WOMAN_MEDIUM_SKIN_TONE = "\U0001f930\U0001f3fd" +PREGNANT_WOMAN_MEDIUM_DARK_SKIN_TONE = "\U0001f930\U0001f3fe" +PREGNANT_WOMAN_DARK_SKIN_TONE = "\U0001f930\U0001f3ff" +PREGNANT_MAN = "\U0001fac3" +PREGNANT_MAN_LIGHT_SKIN_TONE = "\U0001fac3\U0001f3fb" +PREGNANT_MAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001fac3\U0001f3fc" +PREGNANT_MAN_MEDIUM_SKIN_TONE = "\U0001fac3\U0001f3fd" +PREGNANT_MAN_MEDIUM_DARK_SKIN_TONE = "\U0001fac3\U0001f3fe" +PREGNANT_MAN_DARK_SKIN_TONE = "\U0001fac3\U0001f3ff" +PREGNANT_PERSON = "\U0001fac4" +PREGNANT_PERSON_LIGHT_SKIN_TONE = "\U0001fac4\U0001f3fb" +PREGNANT_PERSON_MEDIUM_LIGHT_SKIN_TONE = "\U0001fac4\U0001f3fc" +PREGNANT_PERSON_MEDIUM_SKIN_TONE = "\U0001fac4\U0001f3fd" +PREGNANT_PERSON_MEDIUM_DARK_SKIN_TONE = "\U0001fac4\U0001f3fe" +PREGNANT_PERSON_DARK_SKIN_TONE = "\U0001fac4\U0001f3ff" +BREAST_FEEDING = "\U0001f931" +BREAST_FEEDING_LIGHT_SKIN_TONE = "\U0001f931\U0001f3fb" +BREAST_FEEDING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f931\U0001f3fc" +BREAST_FEEDING_MEDIUM_SKIN_TONE = "\U0001f931\U0001f3fd" +BREAST_FEEDING_MEDIUM_DARK_SKIN_TONE = "\U0001f931\U0001f3fe" +BREAST_FEEDING_DARK_SKIN_TONE = "\U0001f931\U0001f3ff" +WOMAN_FEEDING_BABY = "\U0001f469\u200d\U0001f37c" +WOMAN_FEEDING_BABY_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f37c" +WOMAN_FEEDING_BABY_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f37c" +WOMAN_FEEDING_BABY_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f37c" +WOMAN_FEEDING_BABY_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f37c" +WOMAN_FEEDING_BABY_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f37c" +MAN_FEEDING_BABY = "\U0001f468\u200d\U0001f37c" +MAN_FEEDING_BABY_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f37c" +MAN_FEEDING_BABY_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f37c" +MAN_FEEDING_BABY_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f37c" +MAN_FEEDING_BABY_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f37c" +MAN_FEEDING_BABY_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f37c" +PERSON_FEEDING_BABY = "\U0001f9d1\u200d\U0001f37c" +PERSON_FEEDING_BABY_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f37c" +PERSON_FEEDING_BABY_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f37c" +PERSON_FEEDING_BABY_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f37c" +PERSON_FEEDING_BABY_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f37c" +PERSON_FEEDING_BABY_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f37c" +BABY_ANGEL = "\U0001f47c" +BABY_ANGEL_LIGHT_SKIN_TONE = "\U0001f47c\U0001f3fb" +BABY_ANGEL_MEDIUM_LIGHT_SKIN_TONE = "\U0001f47c\U0001f3fc" +BABY_ANGEL_MEDIUM_SKIN_TONE = "\U0001f47c\U0001f3fd" +BABY_ANGEL_MEDIUM_DARK_SKIN_TONE = "\U0001f47c\U0001f3fe" +BABY_ANGEL_DARK_SKIN_TONE = "\U0001f47c\U0001f3ff" +SANTA_CLAUS = "\U0001f385" +SANTA_CLAUS_LIGHT_SKIN_TONE = "\U0001f385\U0001f3fb" +SANTA_CLAUS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f385\U0001f3fc" +SANTA_CLAUS_MEDIUM_SKIN_TONE = "\U0001f385\U0001f3fd" +SANTA_CLAUS_MEDIUM_DARK_SKIN_TONE = "\U0001f385\U0001f3fe" +SANTA_CLAUS_DARK_SKIN_TONE = "\U0001f385\U0001f3ff" +MRS_CLAUS = "\U0001f936" +MRS_CLAUS_LIGHT_SKIN_TONE = "\U0001f936\U0001f3fb" +MRS_CLAUS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f936\U0001f3fc" +MRS_CLAUS_MEDIUM_SKIN_TONE = "\U0001f936\U0001f3fd" +MRS_CLAUS_MEDIUM_DARK_SKIN_TONE = "\U0001f936\U0001f3fe" +MRS_CLAUS_DARK_SKIN_TONE = "\U0001f936\U0001f3ff" +MX_CLAUS = "\U0001f9d1\u200d\U0001f384" +MX_CLAUS_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f384" +MX_CLAUS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f384" +MX_CLAUS_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f384" +MX_CLAUS_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f384" +MX_CLAUS_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f384" +SUPERHERO = "\U0001f9b8" +SUPERHERO_LIGHT_SKIN_TONE = "\U0001f9b8\U0001f3fb" +SUPERHERO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9b8\U0001f3fc" +SUPERHERO_MEDIUM_SKIN_TONE = "\U0001f9b8\U0001f3fd" +SUPERHERO_MEDIUM_DARK_SKIN_TONE = "\U0001f9b8\U0001f3fe" +SUPERHERO_DARK_SKIN_TONE = "\U0001f9b8\U0001f3ff" +MAN_SUPERHERO = "\U0001f9b8\u200d\u2642\ufe0f" +MAN_SUPERHERO_LIGHT_SKIN_TONE = "\U0001f9b8\U0001f3fb\u200d\u2642\ufe0f" +MAN_SUPERHERO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9b8\U0001f3fc\u200d\u2642\ufe0f" +MAN_SUPERHERO_MEDIUM_SKIN_TONE = "\U0001f9b8\U0001f3fd\u200d\u2642\ufe0f" +MAN_SUPERHERO_MEDIUM_DARK_SKIN_TONE = "\U0001f9b8\U0001f3fe\u200d\u2642\ufe0f" +MAN_SUPERHERO_DARK_SKIN_TONE = "\U0001f9b8\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_SUPERHERO = "\U0001f9b8\u200d\u2640\ufe0f" +WOMAN_SUPERHERO_LIGHT_SKIN_TONE = "\U0001f9b8\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_SUPERHERO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9b8\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_SUPERHERO_MEDIUM_SKIN_TONE = "\U0001f9b8\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_SUPERHERO_MEDIUM_DARK_SKIN_TONE = "\U0001f9b8\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_SUPERHERO_DARK_SKIN_TONE = "\U0001f9b8\U0001f3ff\u200d\u2640\ufe0f" +SUPERVILLAIN = "\U0001f9b9" +SUPERVILLAIN_LIGHT_SKIN_TONE = "\U0001f9b9\U0001f3fb" +SUPERVILLAIN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9b9\U0001f3fc" +SUPERVILLAIN_MEDIUM_SKIN_TONE = "\U0001f9b9\U0001f3fd" +SUPERVILLAIN_MEDIUM_DARK_SKIN_TONE = "\U0001f9b9\U0001f3fe" +SUPERVILLAIN_DARK_SKIN_TONE = "\U0001f9b9\U0001f3ff" +MAN_SUPERVILLAIN = "\U0001f9b9\u200d\u2642\ufe0f" +MAN_SUPERVILLAIN_LIGHT_SKIN_TONE = "\U0001f9b9\U0001f3fb\u200d\u2642\ufe0f" +MAN_SUPERVILLAIN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9b9\U0001f3fc\u200d\u2642\ufe0f" +MAN_SUPERVILLAIN_MEDIUM_SKIN_TONE = "\U0001f9b9\U0001f3fd\u200d\u2642\ufe0f" +MAN_SUPERVILLAIN_MEDIUM_DARK_SKIN_TONE = "\U0001f9b9\U0001f3fe\u200d\u2642\ufe0f" +MAN_SUPERVILLAIN_DARK_SKIN_TONE = "\U0001f9b9\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_SUPERVILLAIN = "\U0001f9b9\u200d\u2640\ufe0f" +WOMAN_SUPERVILLAIN_LIGHT_SKIN_TONE = "\U0001f9b9\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_SUPERVILLAIN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9b9\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_SUPERVILLAIN_MEDIUM_SKIN_TONE = "\U0001f9b9\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_SUPERVILLAIN_MEDIUM_DARK_SKIN_TONE = "\U0001f9b9\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_SUPERVILLAIN_DARK_SKIN_TONE = "\U0001f9b9\U0001f3ff\u200d\u2640\ufe0f" +MAGE = "\U0001f9d9" +MAGE_LIGHT_SKIN_TONE = "\U0001f9d9\U0001f3fb" +MAGE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d9\U0001f3fc" +MAGE_MEDIUM_SKIN_TONE = "\U0001f9d9\U0001f3fd" +MAGE_MEDIUM_DARK_SKIN_TONE = "\U0001f9d9\U0001f3fe" +MAGE_DARK_SKIN_TONE = "\U0001f9d9\U0001f3ff" +MAN_MAGE = "\U0001f9d9\u200d\u2642\ufe0f" +MAN_MAGE_LIGHT_SKIN_TONE = "\U0001f9d9\U0001f3fb\u200d\u2642\ufe0f" +MAN_MAGE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d9\U0001f3fc\u200d\u2642\ufe0f" +MAN_MAGE_MEDIUM_SKIN_TONE = "\U0001f9d9\U0001f3fd\u200d\u2642\ufe0f" +MAN_MAGE_MEDIUM_DARK_SKIN_TONE = "\U0001f9d9\U0001f3fe\u200d\u2642\ufe0f" +MAN_MAGE_DARK_SKIN_TONE = "\U0001f9d9\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_MAGE = "\U0001f9d9\u200d\u2640\ufe0f" +WOMAN_MAGE_LIGHT_SKIN_TONE = "\U0001f9d9\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_MAGE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d9\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_MAGE_MEDIUM_SKIN_TONE = "\U0001f9d9\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_MAGE_MEDIUM_DARK_SKIN_TONE = "\U0001f9d9\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_MAGE_DARK_SKIN_TONE = "\U0001f9d9\U0001f3ff\u200d\u2640\ufe0f" +FAIRY = "\U0001f9da" +FAIRY_LIGHT_SKIN_TONE = "\U0001f9da\U0001f3fb" +FAIRY_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9da\U0001f3fc" +FAIRY_MEDIUM_SKIN_TONE = "\U0001f9da\U0001f3fd" +FAIRY_MEDIUM_DARK_SKIN_TONE = "\U0001f9da\U0001f3fe" +FAIRY_DARK_SKIN_TONE = "\U0001f9da\U0001f3ff" +MAN_FAIRY = "\U0001f9da\u200d\u2642\ufe0f" +MAN_FAIRY_LIGHT_SKIN_TONE = "\U0001f9da\U0001f3fb\u200d\u2642\ufe0f" +MAN_FAIRY_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9da\U0001f3fc\u200d\u2642\ufe0f" +MAN_FAIRY_MEDIUM_SKIN_TONE = "\U0001f9da\U0001f3fd\u200d\u2642\ufe0f" +MAN_FAIRY_MEDIUM_DARK_SKIN_TONE = "\U0001f9da\U0001f3fe\u200d\u2642\ufe0f" +MAN_FAIRY_DARK_SKIN_TONE = "\U0001f9da\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_FAIRY = "\U0001f9da\u200d\u2640\ufe0f" +WOMAN_FAIRY_LIGHT_SKIN_TONE = "\U0001f9da\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_FAIRY_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9da\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_FAIRY_MEDIUM_SKIN_TONE = "\U0001f9da\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_FAIRY_MEDIUM_DARK_SKIN_TONE = "\U0001f9da\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_FAIRY_DARK_SKIN_TONE = "\U0001f9da\U0001f3ff\u200d\u2640\ufe0f" +VAMPIRE = "\U0001f9db" +VAMPIRE_LIGHT_SKIN_TONE = "\U0001f9db\U0001f3fb" +VAMPIRE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9db\U0001f3fc" +VAMPIRE_MEDIUM_SKIN_TONE = "\U0001f9db\U0001f3fd" +VAMPIRE_MEDIUM_DARK_SKIN_TONE = "\U0001f9db\U0001f3fe" +VAMPIRE_DARK_SKIN_TONE = "\U0001f9db\U0001f3ff" +MAN_VAMPIRE = "\U0001f9db\u200d\u2642\ufe0f" +MAN_VAMPIRE_LIGHT_SKIN_TONE = "\U0001f9db\U0001f3fb\u200d\u2642\ufe0f" +MAN_VAMPIRE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9db\U0001f3fc\u200d\u2642\ufe0f" +MAN_VAMPIRE_MEDIUM_SKIN_TONE = "\U0001f9db\U0001f3fd\u200d\u2642\ufe0f" +MAN_VAMPIRE_MEDIUM_DARK_SKIN_TONE = "\U0001f9db\U0001f3fe\u200d\u2642\ufe0f" +MAN_VAMPIRE_DARK_SKIN_TONE = "\U0001f9db\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_VAMPIRE = "\U0001f9db\u200d\u2640\ufe0f" +WOMAN_VAMPIRE_LIGHT_SKIN_TONE = "\U0001f9db\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_VAMPIRE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9db\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_VAMPIRE_MEDIUM_SKIN_TONE = "\U0001f9db\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_VAMPIRE_MEDIUM_DARK_SKIN_TONE = "\U0001f9db\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_VAMPIRE_DARK_SKIN_TONE = "\U0001f9db\U0001f3ff\u200d\u2640\ufe0f" +MERPERSON = "\U0001f9dc" +MERPERSON_LIGHT_SKIN_TONE = "\U0001f9dc\U0001f3fb" +MERPERSON_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9dc\U0001f3fc" +MERPERSON_MEDIUM_SKIN_TONE = "\U0001f9dc\U0001f3fd" +MERPERSON_MEDIUM_DARK_SKIN_TONE = "\U0001f9dc\U0001f3fe" +MERPERSON_DARK_SKIN_TONE = "\U0001f9dc\U0001f3ff" +MERMAN = "\U0001f9dc\u200d\u2642\ufe0f" +MERMAN_LIGHT_SKIN_TONE = "\U0001f9dc\U0001f3fb\u200d\u2642\ufe0f" +MERMAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9dc\U0001f3fc\u200d\u2642\ufe0f" +MERMAN_MEDIUM_SKIN_TONE = "\U0001f9dc\U0001f3fd\u200d\u2642\ufe0f" +MERMAN_MEDIUM_DARK_SKIN_TONE = "\U0001f9dc\U0001f3fe\u200d\u2642\ufe0f" +MERMAN_DARK_SKIN_TONE = "\U0001f9dc\U0001f3ff\u200d\u2642\ufe0f" +MERMAID = "\U0001f9dc\u200d\u2640\ufe0f" +MERMAID_LIGHT_SKIN_TONE = "\U0001f9dc\U0001f3fb\u200d\u2640\ufe0f" +MERMAID_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9dc\U0001f3fc\u200d\u2640\ufe0f" +MERMAID_MEDIUM_SKIN_TONE = "\U0001f9dc\U0001f3fd\u200d\u2640\ufe0f" +MERMAID_MEDIUM_DARK_SKIN_TONE = "\U0001f9dc\U0001f3fe\u200d\u2640\ufe0f" +MERMAID_DARK_SKIN_TONE = "\U0001f9dc\U0001f3ff\u200d\u2640\ufe0f" +ELF = "\U0001f9dd" +ELF_LIGHT_SKIN_TONE = "\U0001f9dd\U0001f3fb" +ELF_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9dd\U0001f3fc" +ELF_MEDIUM_SKIN_TONE = "\U0001f9dd\U0001f3fd" +ELF_MEDIUM_DARK_SKIN_TONE = "\U0001f9dd\U0001f3fe" +ELF_DARK_SKIN_TONE = "\U0001f9dd\U0001f3ff" +MAN_ELF = "\U0001f9dd\u200d\u2642\ufe0f" +MAN_ELF_LIGHT_SKIN_TONE = "\U0001f9dd\U0001f3fb\u200d\u2642\ufe0f" +MAN_ELF_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9dd\U0001f3fc\u200d\u2642\ufe0f" +MAN_ELF_MEDIUM_SKIN_TONE = "\U0001f9dd\U0001f3fd\u200d\u2642\ufe0f" +MAN_ELF_MEDIUM_DARK_SKIN_TONE = "\U0001f9dd\U0001f3fe\u200d\u2642\ufe0f" +MAN_ELF_DARK_SKIN_TONE = "\U0001f9dd\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_ELF = "\U0001f9dd\u200d\u2640\ufe0f" +WOMAN_ELF_LIGHT_SKIN_TONE = "\U0001f9dd\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_ELF_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9dd\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_ELF_MEDIUM_SKIN_TONE = "\U0001f9dd\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_ELF_MEDIUM_DARK_SKIN_TONE = "\U0001f9dd\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_ELF_DARK_SKIN_TONE = "\U0001f9dd\U0001f3ff\u200d\u2640\ufe0f" +GENIE = "\U0001f9de" +MAN_GENIE = "\U0001f9de\u200d\u2642\ufe0f" +WOMAN_GENIE = "\U0001f9de\u200d\u2640\ufe0f" +ZOMBIE = "\U0001f9df" +MAN_ZOMBIE = "\U0001f9df\u200d\u2642\ufe0f" +WOMAN_ZOMBIE = "\U0001f9df\u200d\u2640\ufe0f" +TROLL = "\U0001f9cc" +PERSON_GETTING_MASSAGE = "\U0001f486" +PERSON_GETTING_MASSAGE_LIGHT_SKIN_TONE = "\U0001f486\U0001f3fb" +PERSON_GETTING_MASSAGE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f486\U0001f3fc" +PERSON_GETTING_MASSAGE_MEDIUM_SKIN_TONE = "\U0001f486\U0001f3fd" +PERSON_GETTING_MASSAGE_MEDIUM_DARK_SKIN_TONE = "\U0001f486\U0001f3fe" +PERSON_GETTING_MASSAGE_DARK_SKIN_TONE = "\U0001f486\U0001f3ff" +MAN_GETTING_MASSAGE = "\U0001f486\u200d\u2642\ufe0f" +MAN_GETTING_MASSAGE_LIGHT_SKIN_TONE = "\U0001f486\U0001f3fb\u200d\u2642\ufe0f" +MAN_GETTING_MASSAGE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f486\U0001f3fc\u200d\u2642\ufe0f" +MAN_GETTING_MASSAGE_MEDIUM_SKIN_TONE = "\U0001f486\U0001f3fd\u200d\u2642\ufe0f" +MAN_GETTING_MASSAGE_MEDIUM_DARK_SKIN_TONE = "\U0001f486\U0001f3fe\u200d\u2642\ufe0f" +MAN_GETTING_MASSAGE_DARK_SKIN_TONE = "\U0001f486\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_GETTING_MASSAGE = "\U0001f486\u200d\u2640\ufe0f" +WOMAN_GETTING_MASSAGE_LIGHT_SKIN_TONE = "\U0001f486\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_GETTING_MASSAGE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f486\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_GETTING_MASSAGE_MEDIUM_SKIN_TONE = "\U0001f486\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_GETTING_MASSAGE_MEDIUM_DARK_SKIN_TONE = "\U0001f486\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_GETTING_MASSAGE_DARK_SKIN_TONE = "\U0001f486\U0001f3ff\u200d\u2640\ufe0f" +PERSON_GETTING_HAIRCUT = "\U0001f487" +PERSON_GETTING_HAIRCUT_LIGHT_SKIN_TONE = "\U0001f487\U0001f3fb" +PERSON_GETTING_HAIRCUT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f487\U0001f3fc" +PERSON_GETTING_HAIRCUT_MEDIUM_SKIN_TONE = "\U0001f487\U0001f3fd" +PERSON_GETTING_HAIRCUT_MEDIUM_DARK_SKIN_TONE = "\U0001f487\U0001f3fe" +PERSON_GETTING_HAIRCUT_DARK_SKIN_TONE = "\U0001f487\U0001f3ff" +MAN_GETTING_HAIRCUT = "\U0001f487\u200d\u2642\ufe0f" +MAN_GETTING_HAIRCUT_LIGHT_SKIN_TONE = "\U0001f487\U0001f3fb\u200d\u2642\ufe0f" +MAN_GETTING_HAIRCUT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f487\U0001f3fc\u200d\u2642\ufe0f" +MAN_GETTING_HAIRCUT_MEDIUM_SKIN_TONE = "\U0001f487\U0001f3fd\u200d\u2642\ufe0f" +MAN_GETTING_HAIRCUT_MEDIUM_DARK_SKIN_TONE = "\U0001f487\U0001f3fe\u200d\u2642\ufe0f" +MAN_GETTING_HAIRCUT_DARK_SKIN_TONE = "\U0001f487\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_GETTING_HAIRCUT = "\U0001f487\u200d\u2640\ufe0f" +WOMAN_GETTING_HAIRCUT_LIGHT_SKIN_TONE = "\U0001f487\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_GETTING_HAIRCUT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f487\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_GETTING_HAIRCUT_MEDIUM_SKIN_TONE = "\U0001f487\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_GETTING_HAIRCUT_MEDIUM_DARK_SKIN_TONE = "\U0001f487\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_GETTING_HAIRCUT_DARK_SKIN_TONE = "\U0001f487\U0001f3ff\u200d\u2640\ufe0f" +PERSON_WALKING = "\U0001f6b6" +PERSON_WALKING_LIGHT_SKIN_TONE = "\U0001f6b6\U0001f3fb" +PERSON_WALKING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6b6\U0001f3fc" +PERSON_WALKING_MEDIUM_SKIN_TONE = "\U0001f6b6\U0001f3fd" +PERSON_WALKING_MEDIUM_DARK_SKIN_TONE = "\U0001f6b6\U0001f3fe" +PERSON_WALKING_DARK_SKIN_TONE = "\U0001f6b6\U0001f3ff" +MAN_WALKING = "\U0001f6b6\u200d\u2642\ufe0f" +MAN_WALKING_LIGHT_SKIN_TONE = "\U0001f6b6\U0001f3fb\u200d\u2642\ufe0f" +MAN_WALKING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6b6\U0001f3fc\u200d\u2642\ufe0f" +MAN_WALKING_MEDIUM_SKIN_TONE = "\U0001f6b6\U0001f3fd\u200d\u2642\ufe0f" +MAN_WALKING_MEDIUM_DARK_SKIN_TONE = "\U0001f6b6\U0001f3fe\u200d\u2642\ufe0f" +MAN_WALKING_DARK_SKIN_TONE = "\U0001f6b6\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_WALKING = "\U0001f6b6\u200d\u2640\ufe0f" +WOMAN_WALKING_LIGHT_SKIN_TONE = "\U0001f6b6\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_WALKING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6b6\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_WALKING_MEDIUM_SKIN_TONE = "\U0001f6b6\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_WALKING_MEDIUM_DARK_SKIN_TONE = "\U0001f6b6\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_WALKING_DARK_SKIN_TONE = "\U0001f6b6\U0001f3ff\u200d\u2640\ufe0f" +PERSON_STANDING = "\U0001f9cd" +PERSON_STANDING_LIGHT_SKIN_TONE = "\U0001f9cd\U0001f3fb" +PERSON_STANDING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9cd\U0001f3fc" +PERSON_STANDING_MEDIUM_SKIN_TONE = "\U0001f9cd\U0001f3fd" +PERSON_STANDING_MEDIUM_DARK_SKIN_TONE = "\U0001f9cd\U0001f3fe" +PERSON_STANDING_DARK_SKIN_TONE = "\U0001f9cd\U0001f3ff" +MAN_STANDING = "\U0001f9cd\u200d\u2642\ufe0f" +MAN_STANDING_LIGHT_SKIN_TONE = "\U0001f9cd\U0001f3fb\u200d\u2642\ufe0f" +MAN_STANDING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9cd\U0001f3fc\u200d\u2642\ufe0f" +MAN_STANDING_MEDIUM_SKIN_TONE = "\U0001f9cd\U0001f3fd\u200d\u2642\ufe0f" +MAN_STANDING_MEDIUM_DARK_SKIN_TONE = "\U0001f9cd\U0001f3fe\u200d\u2642\ufe0f" +MAN_STANDING_DARK_SKIN_TONE = "\U0001f9cd\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_STANDING = "\U0001f9cd\u200d\u2640\ufe0f" +WOMAN_STANDING_LIGHT_SKIN_TONE = "\U0001f9cd\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_STANDING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9cd\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_STANDING_MEDIUM_SKIN_TONE = "\U0001f9cd\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_STANDING_MEDIUM_DARK_SKIN_TONE = "\U0001f9cd\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_STANDING_DARK_SKIN_TONE = "\U0001f9cd\U0001f3ff\u200d\u2640\ufe0f" +PERSON_KNEELING = "\U0001f9ce" +PERSON_KNEELING_LIGHT_SKIN_TONE = "\U0001f9ce\U0001f3fb" +PERSON_KNEELING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9ce\U0001f3fc" +PERSON_KNEELING_MEDIUM_SKIN_TONE = "\U0001f9ce\U0001f3fd" +PERSON_KNEELING_MEDIUM_DARK_SKIN_TONE = "\U0001f9ce\U0001f3fe" +PERSON_KNEELING_DARK_SKIN_TONE = "\U0001f9ce\U0001f3ff" +MAN_KNEELING = "\U0001f9ce\u200d\u2642\ufe0f" +MAN_KNEELING_LIGHT_SKIN_TONE = "\U0001f9ce\U0001f3fb\u200d\u2642\ufe0f" +MAN_KNEELING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9ce\U0001f3fc\u200d\u2642\ufe0f" +MAN_KNEELING_MEDIUM_SKIN_TONE = "\U0001f9ce\U0001f3fd\u200d\u2642\ufe0f" +MAN_KNEELING_MEDIUM_DARK_SKIN_TONE = "\U0001f9ce\U0001f3fe\u200d\u2642\ufe0f" +MAN_KNEELING_DARK_SKIN_TONE = "\U0001f9ce\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_KNEELING = "\U0001f9ce\u200d\u2640\ufe0f" +WOMAN_KNEELING_LIGHT_SKIN_TONE = "\U0001f9ce\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_KNEELING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9ce\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_KNEELING_MEDIUM_SKIN_TONE = "\U0001f9ce\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_KNEELING_MEDIUM_DARK_SKIN_TONE = "\U0001f9ce\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_KNEELING_DARK_SKIN_TONE = "\U0001f9ce\U0001f3ff\u200d\u2640\ufe0f" +PERSON_WITH_WHITE_CANE = "\U0001f9d1\u200d\U0001f9af" +PERSON_WITH_WHITE_CANE_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f9af" +PERSON_WITH_WHITE_CANE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f9af" +PERSON_WITH_WHITE_CANE_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f9af" +PERSON_WITH_WHITE_CANE_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f9af" +PERSON_WITH_WHITE_CANE_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f9af" +MAN_WITH_WHITE_CANE = "\U0001f468\u200d\U0001f9af" +MAN_WITH_WHITE_CANE_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f9af" +MAN_WITH_WHITE_CANE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f9af" +MAN_WITH_WHITE_CANE_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f9af" +MAN_WITH_WHITE_CANE_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f9af" +MAN_WITH_WHITE_CANE_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f9af" +WOMAN_WITH_WHITE_CANE = "\U0001f469\u200d\U0001f9af" +WOMAN_WITH_WHITE_CANE_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f9af" +WOMAN_WITH_WHITE_CANE_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f9af" +WOMAN_WITH_WHITE_CANE_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f9af" +WOMAN_WITH_WHITE_CANE_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f9af" +WOMAN_WITH_WHITE_CANE_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f9af" +PERSON_IN_MOTORIZED_WHEELCHAIR = "\U0001f9d1\u200d\U0001f9bc" +PERSON_IN_MOTORIZED_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f9bc" +PERSON_IN_MOTORIZED_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f9bc" +PERSON_IN_MOTORIZED_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f9bc" +PERSON_IN_MOTORIZED_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f9bc" +PERSON_IN_MOTORIZED_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f9bc" +MAN_IN_MOTORIZED_WHEELCHAIR = "\U0001f468\u200d\U0001f9bc" +MAN_IN_MOTORIZED_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f9bc" +MAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f9bc" +MAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f9bc" +MAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f9bc" +MAN_IN_MOTORIZED_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f9bc" +WOMAN_IN_MOTORIZED_WHEELCHAIR = "\U0001f469\u200d\U0001f9bc" +WOMAN_IN_MOTORIZED_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f9bc" +WOMAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f9bc" +WOMAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f9bc" +WOMAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f9bc" +WOMAN_IN_MOTORIZED_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f9bc" +PERSON_IN_MANUAL_WHEELCHAIR = "\U0001f9d1\u200d\U0001f9bd" +PERSON_IN_MANUAL_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f9bd" +PERSON_IN_MANUAL_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f9bd" +PERSON_IN_MANUAL_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f9bd" +PERSON_IN_MANUAL_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f9bd" +PERSON_IN_MANUAL_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f9bd" +MAN_IN_MANUAL_WHEELCHAIR = "\U0001f468\u200d\U0001f9bd" +MAN_IN_MANUAL_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f9bd" +MAN_IN_MANUAL_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f9bd" +MAN_IN_MANUAL_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f9bd" +MAN_IN_MANUAL_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f9bd" +MAN_IN_MANUAL_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f9bd" +WOMAN_IN_MANUAL_WHEELCHAIR = "\U0001f469\u200d\U0001f9bd" +WOMAN_IN_MANUAL_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f9bd" +WOMAN_IN_MANUAL_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f9bd" +WOMAN_IN_MANUAL_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f9bd" +WOMAN_IN_MANUAL_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f9bd" +WOMAN_IN_MANUAL_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f9bd" +PERSON_RUNNING = "\U0001f3c3" +PERSON_RUNNING_LIGHT_SKIN_TONE = "\U0001f3c3\U0001f3fb" +PERSON_RUNNING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3c3\U0001f3fc" +PERSON_RUNNING_MEDIUM_SKIN_TONE = "\U0001f3c3\U0001f3fd" +PERSON_RUNNING_MEDIUM_DARK_SKIN_TONE = "\U0001f3c3\U0001f3fe" +PERSON_RUNNING_DARK_SKIN_TONE = "\U0001f3c3\U0001f3ff" +MAN_RUNNING = "\U0001f3c3\u200d\u2642\ufe0f" +MAN_RUNNING_LIGHT_SKIN_TONE = "\U0001f3c3\U0001f3fb\u200d\u2642\ufe0f" +MAN_RUNNING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3c3\U0001f3fc\u200d\u2642\ufe0f" +MAN_RUNNING_MEDIUM_SKIN_TONE = "\U0001f3c3\U0001f3fd\u200d\u2642\ufe0f" +MAN_RUNNING_MEDIUM_DARK_SKIN_TONE = "\U0001f3c3\U0001f3fe\u200d\u2642\ufe0f" +MAN_RUNNING_DARK_SKIN_TONE = "\U0001f3c3\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_RUNNING = "\U0001f3c3\u200d\u2640\ufe0f" +WOMAN_RUNNING_LIGHT_SKIN_TONE = "\U0001f3c3\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_RUNNING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3c3\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_RUNNING_MEDIUM_SKIN_TONE = "\U0001f3c3\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_RUNNING_MEDIUM_DARK_SKIN_TONE = "\U0001f3c3\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_RUNNING_DARK_SKIN_TONE = "\U0001f3c3\U0001f3ff\u200d\u2640\ufe0f" +WOMAN_DANCING = "\U0001f483" +WOMAN_DANCING_LIGHT_SKIN_TONE = "\U0001f483\U0001f3fb" +WOMAN_DANCING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f483\U0001f3fc" +WOMAN_DANCING_MEDIUM_SKIN_TONE = "\U0001f483\U0001f3fd" +WOMAN_DANCING_MEDIUM_DARK_SKIN_TONE = "\U0001f483\U0001f3fe" +WOMAN_DANCING_DARK_SKIN_TONE = "\U0001f483\U0001f3ff" +MAN_DANCING = "\U0001f57a" +MAN_DANCING_LIGHT_SKIN_TONE = "\U0001f57a\U0001f3fb" +MAN_DANCING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f57a\U0001f3fc" +MAN_DANCING_MEDIUM_SKIN_TONE = "\U0001f57a\U0001f3fd" +MAN_DANCING_MEDIUM_DARK_SKIN_TONE = "\U0001f57a\U0001f3fe" +MAN_DANCING_DARK_SKIN_TONE = "\U0001f57a\U0001f3ff" +PERSON_IN_SUIT_LEVITATING = "\U0001f574\ufe0f" +PERSON_IN_SUIT_LEVITATING_LIGHT_SKIN_TONE = "\U0001f574\U0001f3fb" +PERSON_IN_SUIT_LEVITATING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f574\U0001f3fc" +PERSON_IN_SUIT_LEVITATING_MEDIUM_SKIN_TONE = "\U0001f574\U0001f3fd" +PERSON_IN_SUIT_LEVITATING_MEDIUM_DARK_SKIN_TONE = "\U0001f574\U0001f3fe" +PERSON_IN_SUIT_LEVITATING_DARK_SKIN_TONE = "\U0001f574\U0001f3ff" +PEOPLE_WITH_BUNNY_EARS = "\U0001f46f" +MEN_WITH_BUNNY_EARS = "\U0001f46f\u200d\u2642\ufe0f" +WOMEN_WITH_BUNNY_EARS = "\U0001f46f\u200d\u2640\ufe0f" +PERSON_IN_STEAMY_ROOM = "\U0001f9d6" +PERSON_IN_STEAMY_ROOM_LIGHT_SKIN_TONE = "\U0001f9d6\U0001f3fb" +PERSON_IN_STEAMY_ROOM_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d6\U0001f3fc" +PERSON_IN_STEAMY_ROOM_MEDIUM_SKIN_TONE = "\U0001f9d6\U0001f3fd" +PERSON_IN_STEAMY_ROOM_MEDIUM_DARK_SKIN_TONE = "\U0001f9d6\U0001f3fe" +PERSON_IN_STEAMY_ROOM_DARK_SKIN_TONE = "\U0001f9d6\U0001f3ff" +MAN_IN_STEAMY_ROOM = "\U0001f9d6\u200d\u2642\ufe0f" +MAN_IN_STEAMY_ROOM_LIGHT_SKIN_TONE = "\U0001f9d6\U0001f3fb\u200d\u2642\ufe0f" +MAN_IN_STEAMY_ROOM_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d6\U0001f3fc\u200d\u2642\ufe0f" +MAN_IN_STEAMY_ROOM_MEDIUM_SKIN_TONE = "\U0001f9d6\U0001f3fd\u200d\u2642\ufe0f" +MAN_IN_STEAMY_ROOM_MEDIUM_DARK_SKIN_TONE = "\U0001f9d6\U0001f3fe\u200d\u2642\ufe0f" +MAN_IN_STEAMY_ROOM_DARK_SKIN_TONE = "\U0001f9d6\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_IN_STEAMY_ROOM = "\U0001f9d6\u200d\u2640\ufe0f" +WOMAN_IN_STEAMY_ROOM_LIGHT_SKIN_TONE = "\U0001f9d6\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_IN_STEAMY_ROOM_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d6\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_IN_STEAMY_ROOM_MEDIUM_SKIN_TONE = "\U0001f9d6\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_IN_STEAMY_ROOM_MEDIUM_DARK_SKIN_TONE = "\U0001f9d6\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_IN_STEAMY_ROOM_DARK_SKIN_TONE = "\U0001f9d6\U0001f3ff\u200d\u2640\ufe0f" +PERSON_CLIMBING = "\U0001f9d7" +PERSON_CLIMBING_LIGHT_SKIN_TONE = "\U0001f9d7\U0001f3fb" +PERSON_CLIMBING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d7\U0001f3fc" +PERSON_CLIMBING_MEDIUM_SKIN_TONE = "\U0001f9d7\U0001f3fd" +PERSON_CLIMBING_MEDIUM_DARK_SKIN_TONE = "\U0001f9d7\U0001f3fe" +PERSON_CLIMBING_DARK_SKIN_TONE = "\U0001f9d7\U0001f3ff" +MAN_CLIMBING = "\U0001f9d7\u200d\u2642\ufe0f" +MAN_CLIMBING_LIGHT_SKIN_TONE = "\U0001f9d7\U0001f3fb\u200d\u2642\ufe0f" +MAN_CLIMBING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d7\U0001f3fc\u200d\u2642\ufe0f" +MAN_CLIMBING_MEDIUM_SKIN_TONE = "\U0001f9d7\U0001f3fd\u200d\u2642\ufe0f" +MAN_CLIMBING_MEDIUM_DARK_SKIN_TONE = "\U0001f9d7\U0001f3fe\u200d\u2642\ufe0f" +MAN_CLIMBING_DARK_SKIN_TONE = "\U0001f9d7\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_CLIMBING = "\U0001f9d7\u200d\u2640\ufe0f" +WOMAN_CLIMBING_LIGHT_SKIN_TONE = "\U0001f9d7\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_CLIMBING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d7\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_CLIMBING_MEDIUM_SKIN_TONE = "\U0001f9d7\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_CLIMBING_MEDIUM_DARK_SKIN_TONE = "\U0001f9d7\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_CLIMBING_DARK_SKIN_TONE = "\U0001f9d7\U0001f3ff\u200d\u2640\ufe0f" +PERSON_FENCING = "\U0001f93a" +HORSE_RACING = "\U0001f3c7" +HORSE_RACING_LIGHT_SKIN_TONE = "\U0001f3c7\U0001f3fb" +HORSE_RACING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3c7\U0001f3fc" +HORSE_RACING_MEDIUM_SKIN_TONE = "\U0001f3c7\U0001f3fd" +HORSE_RACING_MEDIUM_DARK_SKIN_TONE = "\U0001f3c7\U0001f3fe" +HORSE_RACING_DARK_SKIN_TONE = "\U0001f3c7\U0001f3ff" +SKIER = "\u26f7\ufe0f" +SNOWBOARDER = "\U0001f3c2" +SNOWBOARDER_LIGHT_SKIN_TONE = "\U0001f3c2\U0001f3fb" +SNOWBOARDER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3c2\U0001f3fc" +SNOWBOARDER_MEDIUM_SKIN_TONE = "\U0001f3c2\U0001f3fd" +SNOWBOARDER_MEDIUM_DARK_SKIN_TONE = "\U0001f3c2\U0001f3fe" +SNOWBOARDER_DARK_SKIN_TONE = "\U0001f3c2\U0001f3ff" +PERSON_GOLFING = "\U0001f3cc\ufe0f" +PERSON_GOLFING_LIGHT_SKIN_TONE = "\U0001f3cc\U0001f3fb" +PERSON_GOLFING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3cc\U0001f3fc" +PERSON_GOLFING_MEDIUM_SKIN_TONE = "\U0001f3cc\U0001f3fd" +PERSON_GOLFING_MEDIUM_DARK_SKIN_TONE = "\U0001f3cc\U0001f3fe" +PERSON_GOLFING_DARK_SKIN_TONE = "\U0001f3cc\U0001f3ff" +MAN_GOLFING = "\U0001f3cc\ufe0f\u200d\u2642\ufe0f" +MAN_GOLFING_LIGHT_SKIN_TONE = "\U0001f3cc\U0001f3fb\u200d\u2642\ufe0f" +MAN_GOLFING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3cc\U0001f3fc\u200d\u2642\ufe0f" +MAN_GOLFING_MEDIUM_SKIN_TONE = "\U0001f3cc\U0001f3fd\u200d\u2642\ufe0f" +MAN_GOLFING_MEDIUM_DARK_SKIN_TONE = "\U0001f3cc\U0001f3fe\u200d\u2642\ufe0f" +MAN_GOLFING_DARK_SKIN_TONE = "\U0001f3cc\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_GOLFING = "\U0001f3cc\ufe0f\u200d\u2640\ufe0f" +WOMAN_GOLFING_LIGHT_SKIN_TONE = "\U0001f3cc\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_GOLFING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3cc\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_GOLFING_MEDIUM_SKIN_TONE = "\U0001f3cc\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_GOLFING_MEDIUM_DARK_SKIN_TONE = "\U0001f3cc\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_GOLFING_DARK_SKIN_TONE = "\U0001f3cc\U0001f3ff\u200d\u2640\ufe0f" +PERSON_SURFING = "\U0001f3c4" +PERSON_SURFING_LIGHT_SKIN_TONE = "\U0001f3c4\U0001f3fb" +PERSON_SURFING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3c4\U0001f3fc" +PERSON_SURFING_MEDIUM_SKIN_TONE = "\U0001f3c4\U0001f3fd" +PERSON_SURFING_MEDIUM_DARK_SKIN_TONE = "\U0001f3c4\U0001f3fe" +PERSON_SURFING_DARK_SKIN_TONE = "\U0001f3c4\U0001f3ff" +MAN_SURFING = "\U0001f3c4\u200d\u2642\ufe0f" +MAN_SURFING_LIGHT_SKIN_TONE = "\U0001f3c4\U0001f3fb\u200d\u2642\ufe0f" +MAN_SURFING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3c4\U0001f3fc\u200d\u2642\ufe0f" +MAN_SURFING_MEDIUM_SKIN_TONE = "\U0001f3c4\U0001f3fd\u200d\u2642\ufe0f" +MAN_SURFING_MEDIUM_DARK_SKIN_TONE = "\U0001f3c4\U0001f3fe\u200d\u2642\ufe0f" +MAN_SURFING_DARK_SKIN_TONE = "\U0001f3c4\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_SURFING = "\U0001f3c4\u200d\u2640\ufe0f" +WOMAN_SURFING_LIGHT_SKIN_TONE = "\U0001f3c4\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_SURFING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3c4\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_SURFING_MEDIUM_SKIN_TONE = "\U0001f3c4\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_SURFING_MEDIUM_DARK_SKIN_TONE = "\U0001f3c4\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_SURFING_DARK_SKIN_TONE = "\U0001f3c4\U0001f3ff\u200d\u2640\ufe0f" +PERSON_ROWING_BOAT = "\U0001f6a3" +PERSON_ROWING_BOAT_LIGHT_SKIN_TONE = "\U0001f6a3\U0001f3fb" +PERSON_ROWING_BOAT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6a3\U0001f3fc" +PERSON_ROWING_BOAT_MEDIUM_SKIN_TONE = "\U0001f6a3\U0001f3fd" +PERSON_ROWING_BOAT_MEDIUM_DARK_SKIN_TONE = "\U0001f6a3\U0001f3fe" +PERSON_ROWING_BOAT_DARK_SKIN_TONE = "\U0001f6a3\U0001f3ff" +MAN_ROWING_BOAT = "\U0001f6a3\u200d\u2642\ufe0f" +MAN_ROWING_BOAT_LIGHT_SKIN_TONE = "\U0001f6a3\U0001f3fb\u200d\u2642\ufe0f" +MAN_ROWING_BOAT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6a3\U0001f3fc\u200d\u2642\ufe0f" +MAN_ROWING_BOAT_MEDIUM_SKIN_TONE = "\U0001f6a3\U0001f3fd\u200d\u2642\ufe0f" +MAN_ROWING_BOAT_MEDIUM_DARK_SKIN_TONE = "\U0001f6a3\U0001f3fe\u200d\u2642\ufe0f" +MAN_ROWING_BOAT_DARK_SKIN_TONE = "\U0001f6a3\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_ROWING_BOAT = "\U0001f6a3\u200d\u2640\ufe0f" +WOMAN_ROWING_BOAT_LIGHT_SKIN_TONE = "\U0001f6a3\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_ROWING_BOAT_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6a3\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_ROWING_BOAT_MEDIUM_SKIN_TONE = "\U0001f6a3\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_ROWING_BOAT_MEDIUM_DARK_SKIN_TONE = "\U0001f6a3\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_ROWING_BOAT_DARK_SKIN_TONE = "\U0001f6a3\U0001f3ff\u200d\u2640\ufe0f" +PERSON_SWIMMING = "\U0001f3ca" +PERSON_SWIMMING_LIGHT_SKIN_TONE = "\U0001f3ca\U0001f3fb" +PERSON_SWIMMING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3ca\U0001f3fc" +PERSON_SWIMMING_MEDIUM_SKIN_TONE = "\U0001f3ca\U0001f3fd" +PERSON_SWIMMING_MEDIUM_DARK_SKIN_TONE = "\U0001f3ca\U0001f3fe" +PERSON_SWIMMING_DARK_SKIN_TONE = "\U0001f3ca\U0001f3ff" +MAN_SWIMMING = "\U0001f3ca\u200d\u2642\ufe0f" +MAN_SWIMMING_LIGHT_SKIN_TONE = "\U0001f3ca\U0001f3fb\u200d\u2642\ufe0f" +MAN_SWIMMING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3ca\U0001f3fc\u200d\u2642\ufe0f" +MAN_SWIMMING_MEDIUM_SKIN_TONE = "\U0001f3ca\U0001f3fd\u200d\u2642\ufe0f" +MAN_SWIMMING_MEDIUM_DARK_SKIN_TONE = "\U0001f3ca\U0001f3fe\u200d\u2642\ufe0f" +MAN_SWIMMING_DARK_SKIN_TONE = "\U0001f3ca\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_SWIMMING = "\U0001f3ca\u200d\u2640\ufe0f" +WOMAN_SWIMMING_LIGHT_SKIN_TONE = "\U0001f3ca\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_SWIMMING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3ca\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_SWIMMING_MEDIUM_SKIN_TONE = "\U0001f3ca\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_SWIMMING_MEDIUM_DARK_SKIN_TONE = "\U0001f3ca\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_SWIMMING_DARK_SKIN_TONE = "\U0001f3ca\U0001f3ff\u200d\u2640\ufe0f" +PERSON_BOUNCING_BALL = "\u26f9\ufe0f" +PERSON_BOUNCING_BALL_LIGHT_SKIN_TONE = "\u26f9\U0001f3fb" +PERSON_BOUNCING_BALL_MEDIUM_LIGHT_SKIN_TONE = "\u26f9\U0001f3fc" +PERSON_BOUNCING_BALL_MEDIUM_SKIN_TONE = "\u26f9\U0001f3fd" +PERSON_BOUNCING_BALL_MEDIUM_DARK_SKIN_TONE = "\u26f9\U0001f3fe" +PERSON_BOUNCING_BALL_DARK_SKIN_TONE = "\u26f9\U0001f3ff" +MAN_BOUNCING_BALL = "\u26f9\ufe0f\u200d\u2642\ufe0f" +MAN_BOUNCING_BALL_LIGHT_SKIN_TONE = "\u26f9\U0001f3fb\u200d\u2642\ufe0f" +MAN_BOUNCING_BALL_MEDIUM_LIGHT_SKIN_TONE = "\u26f9\U0001f3fc\u200d\u2642\ufe0f" +MAN_BOUNCING_BALL_MEDIUM_SKIN_TONE = "\u26f9\U0001f3fd\u200d\u2642\ufe0f" +MAN_BOUNCING_BALL_MEDIUM_DARK_SKIN_TONE = "\u26f9\U0001f3fe\u200d\u2642\ufe0f" +MAN_BOUNCING_BALL_DARK_SKIN_TONE = "\u26f9\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_BOUNCING_BALL = "\u26f9\ufe0f\u200d\u2640\ufe0f" +WOMAN_BOUNCING_BALL_LIGHT_SKIN_TONE = "\u26f9\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_BOUNCING_BALL_MEDIUM_LIGHT_SKIN_TONE = "\u26f9\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_BOUNCING_BALL_MEDIUM_SKIN_TONE = "\u26f9\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_BOUNCING_BALL_MEDIUM_DARK_SKIN_TONE = "\u26f9\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_BOUNCING_BALL_DARK_SKIN_TONE = "\u26f9\U0001f3ff\u200d\u2640\ufe0f" +PERSON_LIFTING_WEIGHTS = "\U0001f3cb\ufe0f" +PERSON_LIFTING_WEIGHTS_LIGHT_SKIN_TONE = "\U0001f3cb\U0001f3fb" +PERSON_LIFTING_WEIGHTS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3cb\U0001f3fc" +PERSON_LIFTING_WEIGHTS_MEDIUM_SKIN_TONE = "\U0001f3cb\U0001f3fd" +PERSON_LIFTING_WEIGHTS_MEDIUM_DARK_SKIN_TONE = "\U0001f3cb\U0001f3fe" +PERSON_LIFTING_WEIGHTS_DARK_SKIN_TONE = "\U0001f3cb\U0001f3ff" +MAN_LIFTING_WEIGHTS = "\U0001f3cb\ufe0f\u200d\u2642\ufe0f" +MAN_LIFTING_WEIGHTS_LIGHT_SKIN_TONE = "\U0001f3cb\U0001f3fb\u200d\u2642\ufe0f" +MAN_LIFTING_WEIGHTS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3cb\U0001f3fc\u200d\u2642\ufe0f" +MAN_LIFTING_WEIGHTS_MEDIUM_SKIN_TONE = "\U0001f3cb\U0001f3fd\u200d\u2642\ufe0f" +MAN_LIFTING_WEIGHTS_MEDIUM_DARK_SKIN_TONE = "\U0001f3cb\U0001f3fe\u200d\u2642\ufe0f" +MAN_LIFTING_WEIGHTS_DARK_SKIN_TONE = "\U0001f3cb\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_LIFTING_WEIGHTS = "\U0001f3cb\ufe0f\u200d\u2640\ufe0f" +WOMAN_LIFTING_WEIGHTS_LIGHT_SKIN_TONE = "\U0001f3cb\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_LIFTING_WEIGHTS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f3cb\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_LIFTING_WEIGHTS_MEDIUM_SKIN_TONE = "\U0001f3cb\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_LIFTING_WEIGHTS_MEDIUM_DARK_SKIN_TONE = "\U0001f3cb\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_LIFTING_WEIGHTS_DARK_SKIN_TONE = "\U0001f3cb\U0001f3ff\u200d\u2640\ufe0f" +PERSON_BIKING = "\U0001f6b4" +PERSON_BIKING_LIGHT_SKIN_TONE = "\U0001f6b4\U0001f3fb" +PERSON_BIKING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6b4\U0001f3fc" +PERSON_BIKING_MEDIUM_SKIN_TONE = "\U0001f6b4\U0001f3fd" +PERSON_BIKING_MEDIUM_DARK_SKIN_TONE = "\U0001f6b4\U0001f3fe" +PERSON_BIKING_DARK_SKIN_TONE = "\U0001f6b4\U0001f3ff" +MAN_BIKING = "\U0001f6b4\u200d\u2642\ufe0f" +MAN_BIKING_LIGHT_SKIN_TONE = "\U0001f6b4\U0001f3fb\u200d\u2642\ufe0f" +MAN_BIKING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6b4\U0001f3fc\u200d\u2642\ufe0f" +MAN_BIKING_MEDIUM_SKIN_TONE = "\U0001f6b4\U0001f3fd\u200d\u2642\ufe0f" +MAN_BIKING_MEDIUM_DARK_SKIN_TONE = "\U0001f6b4\U0001f3fe\u200d\u2642\ufe0f" +MAN_BIKING_DARK_SKIN_TONE = "\U0001f6b4\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_BIKING = "\U0001f6b4\u200d\u2640\ufe0f" +WOMAN_BIKING_LIGHT_SKIN_TONE = "\U0001f6b4\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_BIKING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6b4\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_BIKING_MEDIUM_SKIN_TONE = "\U0001f6b4\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_BIKING_MEDIUM_DARK_SKIN_TONE = "\U0001f6b4\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_BIKING_DARK_SKIN_TONE = "\U0001f6b4\U0001f3ff\u200d\u2640\ufe0f" +PERSON_MOUNTAIN_BIKING = "\U0001f6b5" +PERSON_MOUNTAIN_BIKING_LIGHT_SKIN_TONE = "\U0001f6b5\U0001f3fb" +PERSON_MOUNTAIN_BIKING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6b5\U0001f3fc" +PERSON_MOUNTAIN_BIKING_MEDIUM_SKIN_TONE = "\U0001f6b5\U0001f3fd" +PERSON_MOUNTAIN_BIKING_MEDIUM_DARK_SKIN_TONE = "\U0001f6b5\U0001f3fe" +PERSON_MOUNTAIN_BIKING_DARK_SKIN_TONE = "\U0001f6b5\U0001f3ff" +MAN_MOUNTAIN_BIKING = "\U0001f6b5\u200d\u2642\ufe0f" +MAN_MOUNTAIN_BIKING_LIGHT_SKIN_TONE = "\U0001f6b5\U0001f3fb\u200d\u2642\ufe0f" +MAN_MOUNTAIN_BIKING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6b5\U0001f3fc\u200d\u2642\ufe0f" +MAN_MOUNTAIN_BIKING_MEDIUM_SKIN_TONE = "\U0001f6b5\U0001f3fd\u200d\u2642\ufe0f" +MAN_MOUNTAIN_BIKING_MEDIUM_DARK_SKIN_TONE = "\U0001f6b5\U0001f3fe\u200d\u2642\ufe0f" +MAN_MOUNTAIN_BIKING_DARK_SKIN_TONE = "\U0001f6b5\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_MOUNTAIN_BIKING = "\U0001f6b5\u200d\u2640\ufe0f" +WOMAN_MOUNTAIN_BIKING_LIGHT_SKIN_TONE = "\U0001f6b5\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_MOUNTAIN_BIKING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6b5\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_MOUNTAIN_BIKING_MEDIUM_SKIN_TONE = "\U0001f6b5\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_MOUNTAIN_BIKING_MEDIUM_DARK_SKIN_TONE = "\U0001f6b5\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_MOUNTAIN_BIKING_DARK_SKIN_TONE = "\U0001f6b5\U0001f3ff\u200d\u2640\ufe0f" +PERSON_CARTWHEELING = "\U0001f938" +PERSON_CARTWHEELING_LIGHT_SKIN_TONE = "\U0001f938\U0001f3fb" +PERSON_CARTWHEELING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f938\U0001f3fc" +PERSON_CARTWHEELING_MEDIUM_SKIN_TONE = "\U0001f938\U0001f3fd" +PERSON_CARTWHEELING_MEDIUM_DARK_SKIN_TONE = "\U0001f938\U0001f3fe" +PERSON_CARTWHEELING_DARK_SKIN_TONE = "\U0001f938\U0001f3ff" +MAN_CARTWHEELING = "\U0001f938\u200d\u2642\ufe0f" +MAN_CARTWHEELING_LIGHT_SKIN_TONE = "\U0001f938\U0001f3fb\u200d\u2642\ufe0f" +MAN_CARTWHEELING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f938\U0001f3fc\u200d\u2642\ufe0f" +MAN_CARTWHEELING_MEDIUM_SKIN_TONE = "\U0001f938\U0001f3fd\u200d\u2642\ufe0f" +MAN_CARTWHEELING_MEDIUM_DARK_SKIN_TONE = "\U0001f938\U0001f3fe\u200d\u2642\ufe0f" +MAN_CARTWHEELING_DARK_SKIN_TONE = "\U0001f938\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_CARTWHEELING = "\U0001f938\u200d\u2640\ufe0f" +WOMAN_CARTWHEELING_LIGHT_SKIN_TONE = "\U0001f938\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_CARTWHEELING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f938\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_CARTWHEELING_MEDIUM_SKIN_TONE = "\U0001f938\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_CARTWHEELING_MEDIUM_DARK_SKIN_TONE = "\U0001f938\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_CARTWHEELING_DARK_SKIN_TONE = "\U0001f938\U0001f3ff\u200d\u2640\ufe0f" +PEOPLE_WRESTLING = "\U0001f93c" +MEN_WRESTLING = "\U0001f93c\u200d\u2642\ufe0f" +WOMEN_WRESTLING = "\U0001f93c\u200d\u2640\ufe0f" +PERSON_PLAYING_WATER_POLO = "\U0001f93d" +PERSON_PLAYING_WATER_POLO_LIGHT_SKIN_TONE = "\U0001f93d\U0001f3fb" +PERSON_PLAYING_WATER_POLO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f93d\U0001f3fc" +PERSON_PLAYING_WATER_POLO_MEDIUM_SKIN_TONE = "\U0001f93d\U0001f3fd" +PERSON_PLAYING_WATER_POLO_MEDIUM_DARK_SKIN_TONE = "\U0001f93d\U0001f3fe" +PERSON_PLAYING_WATER_POLO_DARK_SKIN_TONE = "\U0001f93d\U0001f3ff" +MAN_PLAYING_WATER_POLO = "\U0001f93d\u200d\u2642\ufe0f" +MAN_PLAYING_WATER_POLO_LIGHT_SKIN_TONE = "\U0001f93d\U0001f3fb\u200d\u2642\ufe0f" +MAN_PLAYING_WATER_POLO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f93d\U0001f3fc\u200d\u2642\ufe0f" +MAN_PLAYING_WATER_POLO_MEDIUM_SKIN_TONE = "\U0001f93d\U0001f3fd\u200d\u2642\ufe0f" +MAN_PLAYING_WATER_POLO_MEDIUM_DARK_SKIN_TONE = "\U0001f93d\U0001f3fe\u200d\u2642\ufe0f" +MAN_PLAYING_WATER_POLO_DARK_SKIN_TONE = "\U0001f93d\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_PLAYING_WATER_POLO = "\U0001f93d\u200d\u2640\ufe0f" +WOMAN_PLAYING_WATER_POLO_LIGHT_SKIN_TONE = "\U0001f93d\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_PLAYING_WATER_POLO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f93d\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_PLAYING_WATER_POLO_MEDIUM_SKIN_TONE = "\U0001f93d\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_PLAYING_WATER_POLO_MEDIUM_DARK_SKIN_TONE = "\U0001f93d\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_PLAYING_WATER_POLO_DARK_SKIN_TONE = "\U0001f93d\U0001f3ff\u200d\u2640\ufe0f" +PERSON_PLAYING_HANDBALL = "\U0001f93e" +PERSON_PLAYING_HANDBALL_LIGHT_SKIN_TONE = "\U0001f93e\U0001f3fb" +PERSON_PLAYING_HANDBALL_MEDIUM_LIGHT_SKIN_TONE = "\U0001f93e\U0001f3fc" +PERSON_PLAYING_HANDBALL_MEDIUM_SKIN_TONE = "\U0001f93e\U0001f3fd" +PERSON_PLAYING_HANDBALL_MEDIUM_DARK_SKIN_TONE = "\U0001f93e\U0001f3fe" +PERSON_PLAYING_HANDBALL_DARK_SKIN_TONE = "\U0001f93e\U0001f3ff" +MAN_PLAYING_HANDBALL = "\U0001f93e\u200d\u2642\ufe0f" +MAN_PLAYING_HANDBALL_LIGHT_SKIN_TONE = "\U0001f93e\U0001f3fb\u200d\u2642\ufe0f" +MAN_PLAYING_HANDBALL_MEDIUM_LIGHT_SKIN_TONE = "\U0001f93e\U0001f3fc\u200d\u2642\ufe0f" +MAN_PLAYING_HANDBALL_MEDIUM_SKIN_TONE = "\U0001f93e\U0001f3fd\u200d\u2642\ufe0f" +MAN_PLAYING_HANDBALL_MEDIUM_DARK_SKIN_TONE = "\U0001f93e\U0001f3fe\u200d\u2642\ufe0f" +MAN_PLAYING_HANDBALL_DARK_SKIN_TONE = "\U0001f93e\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_PLAYING_HANDBALL = "\U0001f93e\u200d\u2640\ufe0f" +WOMAN_PLAYING_HANDBALL_LIGHT_SKIN_TONE = "\U0001f93e\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_PLAYING_HANDBALL_MEDIUM_LIGHT_SKIN_TONE = "\U0001f93e\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_PLAYING_HANDBALL_MEDIUM_SKIN_TONE = "\U0001f93e\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_PLAYING_HANDBALL_MEDIUM_DARK_SKIN_TONE = "\U0001f93e\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_PLAYING_HANDBALL_DARK_SKIN_TONE = "\U0001f93e\U0001f3ff\u200d\u2640\ufe0f" +PERSON_JUGGLING = "\U0001f939" +PERSON_JUGGLING_LIGHT_SKIN_TONE = "\U0001f939\U0001f3fb" +PERSON_JUGGLING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f939\U0001f3fc" +PERSON_JUGGLING_MEDIUM_SKIN_TONE = "\U0001f939\U0001f3fd" +PERSON_JUGGLING_MEDIUM_DARK_SKIN_TONE = "\U0001f939\U0001f3fe" +PERSON_JUGGLING_DARK_SKIN_TONE = "\U0001f939\U0001f3ff" +MAN_JUGGLING = "\U0001f939\u200d\u2642\ufe0f" +MAN_JUGGLING_LIGHT_SKIN_TONE = "\U0001f939\U0001f3fb\u200d\u2642\ufe0f" +MAN_JUGGLING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f939\U0001f3fc\u200d\u2642\ufe0f" +MAN_JUGGLING_MEDIUM_SKIN_TONE = "\U0001f939\U0001f3fd\u200d\u2642\ufe0f" +MAN_JUGGLING_MEDIUM_DARK_SKIN_TONE = "\U0001f939\U0001f3fe\u200d\u2642\ufe0f" +MAN_JUGGLING_DARK_SKIN_TONE = "\U0001f939\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_JUGGLING = "\U0001f939\u200d\u2640\ufe0f" +WOMAN_JUGGLING_LIGHT_SKIN_TONE = "\U0001f939\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_JUGGLING_MEDIUM_LIGHT_SKIN_TONE = "\U0001f939\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_JUGGLING_MEDIUM_SKIN_TONE = "\U0001f939\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_JUGGLING_MEDIUM_DARK_SKIN_TONE = "\U0001f939\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_JUGGLING_DARK_SKIN_TONE = "\U0001f939\U0001f3ff\u200d\u2640\ufe0f" +PERSON_IN_LOTUS_POSITION = "\U0001f9d8" +PERSON_IN_LOTUS_POSITION_LIGHT_SKIN_TONE = "\U0001f9d8\U0001f3fb" +PERSON_IN_LOTUS_POSITION_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d8\U0001f3fc" +PERSON_IN_LOTUS_POSITION_MEDIUM_SKIN_TONE = "\U0001f9d8\U0001f3fd" +PERSON_IN_LOTUS_POSITION_MEDIUM_DARK_SKIN_TONE = "\U0001f9d8\U0001f3fe" +PERSON_IN_LOTUS_POSITION_DARK_SKIN_TONE = "\U0001f9d8\U0001f3ff" +MAN_IN_LOTUS_POSITION = "\U0001f9d8\u200d\u2642\ufe0f" +MAN_IN_LOTUS_POSITION_LIGHT_SKIN_TONE = "\U0001f9d8\U0001f3fb\u200d\u2642\ufe0f" +MAN_IN_LOTUS_POSITION_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d8\U0001f3fc\u200d\u2642\ufe0f" +MAN_IN_LOTUS_POSITION_MEDIUM_SKIN_TONE = "\U0001f9d8\U0001f3fd\u200d\u2642\ufe0f" +MAN_IN_LOTUS_POSITION_MEDIUM_DARK_SKIN_TONE = "\U0001f9d8\U0001f3fe\u200d\u2642\ufe0f" +MAN_IN_LOTUS_POSITION_DARK_SKIN_TONE = "\U0001f9d8\U0001f3ff\u200d\u2642\ufe0f" +WOMAN_IN_LOTUS_POSITION = "\U0001f9d8\u200d\u2640\ufe0f" +WOMAN_IN_LOTUS_POSITION_LIGHT_SKIN_TONE = "\U0001f9d8\U0001f3fb\u200d\u2640\ufe0f" +WOMAN_IN_LOTUS_POSITION_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d8\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_IN_LOTUS_POSITION_MEDIUM_SKIN_TONE = "\U0001f9d8\U0001f3fd\u200d\u2640\ufe0f" +WOMAN_IN_LOTUS_POSITION_MEDIUM_DARK_SKIN_TONE = "\U0001f9d8\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_IN_LOTUS_POSITION_DARK_SKIN_TONE = "\U0001f9d8\U0001f3ff\u200d\u2640\ufe0f" +PERSON_TAKING_BATH = "\U0001f6c0" +PERSON_TAKING_BATH_LIGHT_SKIN_TONE = "\U0001f6c0\U0001f3fb" +PERSON_TAKING_BATH_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6c0\U0001f3fc" +PERSON_TAKING_BATH_MEDIUM_SKIN_TONE = "\U0001f6c0\U0001f3fd" +PERSON_TAKING_BATH_MEDIUM_DARK_SKIN_TONE = "\U0001f6c0\U0001f3fe" +PERSON_TAKING_BATH_DARK_SKIN_TONE = "\U0001f6c0\U0001f3ff" +PERSON_IN_BED = "\U0001f6cc" +PERSON_IN_BED_LIGHT_SKIN_TONE = "\U0001f6cc\U0001f3fb" +PERSON_IN_BED_MEDIUM_LIGHT_SKIN_TONE = "\U0001f6cc\U0001f3fc" +PERSON_IN_BED_MEDIUM_SKIN_TONE = "\U0001f6cc\U0001f3fd" +PERSON_IN_BED_MEDIUM_DARK_SKIN_TONE = "\U0001f6cc\U0001f3fe" +PERSON_IN_BED_DARK_SKIN_TONE = "\U0001f6cc\U0001f3ff" +PEOPLE_HOLDING_HANDS = "\U0001f9d1\u200d\U0001f91d\u200d\U0001f9d1" +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" +WOMEN_HOLDING_HANDS = "\U0001f46d" +WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE = "\U0001f46d\U0001f3fb" +WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3fc" +WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" +WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3fe" +WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" +WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" +WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f46d\U0001f3fc" +WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" +WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f469\U0001f3fe" +WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" +WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" +WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3fc" +WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE = "\U0001f46d\U0001f3fd" +WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3fe" +WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" +WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" +WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f469\U0001f3fc" +WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" +WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f46d\U0001f3fe" +WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" +WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" +WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fc" +WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" +WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fe" +WOMEN_HOLDING_HANDS_DARK_SKIN_TONE = "\U0001f46d\U0001f3ff" +WOMAN_AND_MAN_HOLDING_HANDS = "\U0001f46b" +WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE = "\U0001f46b\U0001f3fb" +WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f46b\U0001f3fc" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE = "\U0001f46b\U0001f3fd" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f46b\U0001f3fe" +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE = "\U0001f46b\U0001f3ff" +MEN_HOLDING_HANDS = "\U0001f46c" +MEN_HOLDING_HANDS_LIGHT_SKIN_TONE = "\U0001f46c\U0001f3fb" +MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f46c\U0001f3fc" +MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE = "\U0001f46c\U0001f3fd" +MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f46c\U0001f3fe" +MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +MEN_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +MEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +MEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +MEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +MEN_HOLDING_HANDS_DARK_SKIN_TONE = "\U0001f46c\U0001f3ff" +KISS = "\U0001f48f" +KISS_LIGHT_SKIN_TONE = "\U0001f48f\U0001f3fb" +KISS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f48f\U0001f3fc" +KISS_MEDIUM_SKIN_TONE = "\U0001f48f\U0001f3fd" +KISS_MEDIUM_DARK_SKIN_TONE = "\U0001f48f\U0001f3fe" +KISS_DARK_SKIN_TONE = "\U0001f48f\U0001f3ff" +KISS_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fc" +KISS_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fd" +KISS_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fe" +KISS_PERSON_PERSON_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3ff" +KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fb" +KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fd" +KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fe" +KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3ff" +KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fb" +KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fc" +KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fe" +KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3ff" +KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fb" +KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fc" +KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fd" +KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3ff" +KISS_PERSON_PERSON_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fb" +KISS_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fc" +KISS_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fd" +KISS_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fe" +KISS_WOMAN_MAN = "\U0001f469\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468" +KISS_WOMAN_MAN_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_WOMAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_WOMAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_WOMAN_MAN_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_MAN_MAN = "\U0001f468\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468" +KISS_MAN_MAN_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_MAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_MAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_MAN_MAN_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_MAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_MAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +KISS_MAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" +KISS_MAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +KISS_MAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +KISS_MAN_MAN_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +KISS_WOMAN_WOMAN = "\U0001f469\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469" +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" +KISS_WOMAN_WOMAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" +KISS_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" +KISS_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" +KISS_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" +KISS_WOMAN_WOMAN_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" +COUPLE_WITH_HEART = "\U0001f491" +COUPLE_WITH_HEART_LIGHT_SKIN_TONE = "\U0001f491\U0001f3fb" +COUPLE_WITH_HEART_MEDIUM_LIGHT_SKIN_TONE = "\U0001f491\U0001f3fc" +COUPLE_WITH_HEART_MEDIUM_SKIN_TONE = "\U0001f491\U0001f3fd" +COUPLE_WITH_HEART_MEDIUM_DARK_SKIN_TONE = "\U0001f491\U0001f3fe" +COUPLE_WITH_HEART_DARK_SKIN_TONE = "\U0001f491\U0001f3ff" +COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fc" +COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fd" +COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fe" +COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3ff" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fb" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fd" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fe" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3ff" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fb" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fc" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fe" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3ff" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fb" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fc" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fd" +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3ff" +COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fb" +COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fc" +COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fd" +COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_MAN = "\U0001f469\u200d\u2764\ufe0f\u200d\U0001f468" +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_MAN_MAN = "\U0001f468\u200d\u2764\ufe0f\u200d\U0001f468" +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +COUPLE_WITH_HEART_WOMAN_WOMAN = "\U0001f469\u200d\u2764\ufe0f\u200d\U0001f469" +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" +FAMILY = "\U0001f46a" +FAMILY_MAN_WOMAN_BOY = "\U0001f468\u200d\U0001f469\u200d\U0001f466" +FAMILY_MAN_WOMAN_GIRL = "\U0001f468\u200d\U0001f469\u200d\U0001f467" +FAMILY_MAN_WOMAN_GIRL_BOY = "\U0001f468\u200d\U0001f469\u200d\U0001f467\u200d\U0001f466" +FAMILY_MAN_WOMAN_BOY_BOY = "\U0001f468\u200d\U0001f469\u200d\U0001f466\u200d\U0001f466" +FAMILY_MAN_WOMAN_GIRL_GIRL = "\U0001f468\u200d\U0001f469\u200d\U0001f467\u200d\U0001f467" +FAMILY_MAN_MAN_BOY = "\U0001f468\u200d\U0001f468\u200d\U0001f466" +FAMILY_MAN_MAN_GIRL = "\U0001f468\u200d\U0001f468\u200d\U0001f467" +FAMILY_MAN_MAN_GIRL_BOY = "\U0001f468\u200d\U0001f468\u200d\U0001f467\u200d\U0001f466" +FAMILY_MAN_MAN_BOY_BOY = "\U0001f468\u200d\U0001f468\u200d\U0001f466\u200d\U0001f466" +FAMILY_MAN_MAN_GIRL_GIRL = "\U0001f468\u200d\U0001f468\u200d\U0001f467\u200d\U0001f467" +FAMILY_WOMAN_WOMAN_BOY = "\U0001f469\u200d\U0001f469\u200d\U0001f466" +FAMILY_WOMAN_WOMAN_GIRL = "\U0001f469\u200d\U0001f469\u200d\U0001f467" +FAMILY_WOMAN_WOMAN_GIRL_BOY = "\U0001f469\u200d\U0001f469\u200d\U0001f467\u200d\U0001f466" +FAMILY_WOMAN_WOMAN_BOY_BOY = "\U0001f469\u200d\U0001f469\u200d\U0001f466\u200d\U0001f466" +FAMILY_WOMAN_WOMAN_GIRL_GIRL = "\U0001f469\u200d\U0001f469\u200d\U0001f467\u200d\U0001f467" +FAMILY_MAN_BOY = "\U0001f468\u200d\U0001f466" +FAMILY_MAN_BOY_BOY = "\U0001f468\u200d\U0001f466\u200d\U0001f466" +FAMILY_MAN_GIRL = "\U0001f468\u200d\U0001f467" +FAMILY_MAN_GIRL_BOY = "\U0001f468\u200d\U0001f467\u200d\U0001f466" +FAMILY_MAN_GIRL_GIRL = "\U0001f468\u200d\U0001f467\u200d\U0001f467" +FAMILY_WOMAN_BOY = "\U0001f469\u200d\U0001f466" +FAMILY_WOMAN_BOY_BOY = "\U0001f469\u200d\U0001f466\u200d\U0001f466" +FAMILY_WOMAN_GIRL = "\U0001f469\u200d\U0001f467" +FAMILY_WOMAN_GIRL_BOY = "\U0001f469\u200d\U0001f467\u200d\U0001f466" +FAMILY_WOMAN_GIRL_GIRL = "\U0001f469\u200d\U0001f467\u200d\U0001f467" +SPEAKING_HEAD = "\U0001f5e3\ufe0f" +BUST_IN_SILHOUETTE = "\U0001f464" +BUSTS_IN_SILHOUETTE = "\U0001f465" +PEOPLE_HUGGING = "\U0001fac2" +FOOTPRINTS = "\U0001f463" +LIGHT_SKIN_TONE = "\U0001f3fb" +MEDIUM_LIGHT_SKIN_TONE = "\U0001f3fc" +MEDIUM_SKIN_TONE = "\U0001f3fd" +MEDIUM_DARK_SKIN_TONE = "\U0001f3fe" +DARK_SKIN_TONE = "\U0001f3ff" +RED_HAIR = "\U0001f9b0" +CURLY_HAIR = "\U0001f9b1" +WHITE_HAIR = "\U0001f9b3" +BALD = "\U0001f9b2" +MONKEY_FACE = "\U0001f435" +MONKEY = "\U0001f412" +GORILLA = "\U0001f98d" +ORANGUTAN = "\U0001f9a7" +DOG_FACE = "\U0001f436" +DOG = "\U0001f415" +GUIDE_DOG = "\U0001f9ae" +SERVICE_DOG = "\U0001f415\u200d\U0001f9ba" +POODLE = "\U0001f429" +WOLF = "\U0001f43a" +FOX = "\U0001f98a" +RACCOON = "\U0001f99d" +CAT_FACE = "\U0001f431" +CAT = "\U0001f408" +BLACK_CAT = "\U0001f408\u200d\u2b1b" +LION = "\U0001f981" +TIGER_FACE = "\U0001f42f" +TIGER = "\U0001f405" +LEOPARD = "\U0001f406" +HORSE_FACE = "\U0001f434" +HORSE = "\U0001f40e" +UNICORN = "\U0001f984" +ZEBRA = "\U0001f993" +DEER = "\U0001f98c" +BISON = "\U0001f9ac" +COW_FACE = "\U0001f42e" +OX = "\U0001f402" +WATER_BUFFALO = "\U0001f403" +COW = "\U0001f404" +PIG_FACE = "\U0001f437" +PIG = "\U0001f416" +BOAR = "\U0001f417" +PIG_NOSE = "\U0001f43d" +RAM = "\U0001f40f" +EWE = "\U0001f411" +GOAT = "\U0001f410" +CAMEL = "\U0001f42a" +TWO_HUMP_CAMEL = "\U0001f42b" +LLAMA = "\U0001f999" +GIRAFFE = "\U0001f992" +ELEPHANT = "\U0001f418" +MAMMOTH = "\U0001f9a3" +RHINOCEROS = "\U0001f98f" +HIPPOPOTAMUS = "\U0001f99b" +MOUSE_FACE = "\U0001f42d" +MOUSE = "\U0001f401" +RAT = "\U0001f400" +HAMSTER = "\U0001f439" +RABBIT_FACE = "\U0001f430" +RABBIT = "\U0001f407" +CHIPMUNK = "\U0001f43f\ufe0f" +BEAVER = "\U0001f9ab" +HEDGEHOG = "\U0001f994" +BAT = "\U0001f987" +BEAR = "\U0001f43b" +POLAR_BEAR = "\U0001f43b\u200d\u2744\ufe0f" +KOALA = "\U0001f428" +PANDA = "\U0001f43c" +SLOTH = "\U0001f9a5" +OTTER = "\U0001f9a6" +SKUNK = "\U0001f9a8" +KANGAROO = "\U0001f998" +BADGER = "\U0001f9a1" +PAW_PRINTS = "\U0001f43e" +TURKEY = "\U0001f983" +CHICKEN = "\U0001f414" +ROOSTER = "\U0001f413" +HATCHING_CHICK = "\U0001f423" +BABY_CHICK = "\U0001f424" +FRONT_FACING_BABY_CHICK = "\U0001f425" +BIRD = "\U0001f426" +PENGUIN = "\U0001f427" +DOVE = "\U0001f54a\ufe0f" +EAGLE = "\U0001f985" +DUCK = "\U0001f986" +SWAN = "\U0001f9a2" +OWL = "\U0001f989" +DODO = "\U0001f9a4" +FEATHER = "\U0001fab6" +FLAMINGO = "\U0001f9a9" +PEACOCK = "\U0001f99a" +PARROT = "\U0001f99c" +FROG = "\U0001f438" +CROCODILE = "\U0001f40a" +TURTLE = "\U0001f422" +LIZARD = "\U0001f98e" +SNAKE = "\U0001f40d" +DRAGON_FACE = "\U0001f432" +DRAGON = "\U0001f409" +SAUROPOD = "\U0001f995" +T_REX = "\U0001f996" +SPOUTING_WHALE = "\U0001f433" +WHALE = "\U0001f40b" +DOLPHIN = "\U0001f42c" +SEAL = "\U0001f9ad" +FISH = "\U0001f41f" +TROPICAL_FISH = "\U0001f420" +BLOWFISH = "\U0001f421" +SHARK = "\U0001f988" +OCTOPUS = "\U0001f419" +SPIRAL_SHELL = "\U0001f41a" +CORAL = "\U0001fab8" +SNAIL = "\U0001f40c" +BUTTERFLY = "\U0001f98b" +BUG = "\U0001f41b" +ANT = "\U0001f41c" +HONEYBEE = "\U0001f41d" +BEETLE = "\U0001fab2" +LADY_BEETLE = "\U0001f41e" +CRICKET = "\U0001f997" +COCKROACH = "\U0001fab3" +SPIDER = "\U0001f577\ufe0f" +SPIDER_WEB = "\U0001f578\ufe0f" +SCORPION = "\U0001f982" +MOSQUITO = "\U0001f99f" +FLY = "\U0001fab0" +WORM = "\U0001fab1" +MICROBE = "\U0001f9a0" +BOUQUET = "\U0001f490" +CHERRY_BLOSSOM = "\U0001f338" +WHITE_FLOWER = "\U0001f4ae" +LOTUS = "\U0001fab7" +ROSETTE = "\U0001f3f5\ufe0f" +ROSE = "\U0001f339" +WILTED_FLOWER = "\U0001f940" +HIBISCUS = "\U0001f33a" +SUNFLOWER = "\U0001f33b" +BLOSSOM = "\U0001f33c" +TULIP = "\U0001f337" +SEEDLING = "\U0001f331" +POTTED_PLANT = "\U0001fab4" +EVERGREEN_TREE = "\U0001f332" +DECIDUOUS_TREE = "\U0001f333" +PALM_TREE = "\U0001f334" +CACTUS = "\U0001f335" +SHEAF_OF_RICE = "\U0001f33e" +HERB = "\U0001f33f" +SHAMROCK = "\u2618\ufe0f" +FOUR_LEAF_CLOVER = "\U0001f340" +MAPLE_LEAF = "\U0001f341" +FALLEN_LEAF = "\U0001f342" +LEAF_FLUTTERING_IN_WIND = "\U0001f343" +EMPTY_NEST = "\U0001fab9" +NEST_WITH_EGGS = "\U0001faba" +GRAPES = "\U0001f347" +MELON = "\U0001f348" +WATERMELON = "\U0001f349" +TANGERINE = "\U0001f34a" +LEMON = "\U0001f34b" +BANANA = "\U0001f34c" +PINEAPPLE = "\U0001f34d" +MANGO = "\U0001f96d" +RED_APPLE = "\U0001f34e" +GREEN_APPLE = "\U0001f34f" +PEAR = "\U0001f350" +PEACH = "\U0001f351" +CHERRIES = "\U0001f352" +STRAWBERRY = "\U0001f353" +BLUEBERRIES = "\U0001fad0" +KIWI_FRUIT = "\U0001f95d" +TOMATO = "\U0001f345" +OLIVE = "\U0001fad2" +COCONUT = "\U0001f965" +AVOCADO = "\U0001f951" +EGGPLANT = "\U0001f346" +POTATO = "\U0001f954" +CARROT = "\U0001f955" +EAR_OF_CORN = "\U0001f33d" +HOT_PEPPER = "\U0001f336\ufe0f" +BELL_PEPPER = "\U0001fad1" +CUCUMBER = "\U0001f952" +LEAFY_GREEN = "\U0001f96c" +BROCCOLI = "\U0001f966" +GARLIC = "\U0001f9c4" +ONION = "\U0001f9c5" +MUSHROOM = "\U0001f344" +PEANUTS = "\U0001f95c" +BEANS = "\U0001fad8" +CHESTNUT = "\U0001f330" +BREAD = "\U0001f35e" +CROISSANT = "\U0001f950" +BAGUETTE_BREAD = "\U0001f956" +FLATBREAD = "\U0001fad3" +PRETZEL = "\U0001f968" +BAGEL = "\U0001f96f" +PANCAKES = "\U0001f95e" +WAFFLE = "\U0001f9c7" +CHEESE_WEDGE = "\U0001f9c0" +MEAT_ON_BONE = "\U0001f356" +POULTRY_LEG = "\U0001f357" +CUT_OF_MEAT = "\U0001f969" +BACON = "\U0001f953" +HAMBURGER = "\U0001f354" +FRENCH_FRIES = "\U0001f35f" +PIZZA = "\U0001f355" +HOT_DOG = "\U0001f32d" +SANDWICH = "\U0001f96a" +TACO = "\U0001f32e" +BURRITO = "\U0001f32f" +TAMALE = "\U0001fad4" +STUFFED_FLATBREAD = "\U0001f959" +FALAFEL = "\U0001f9c6" +EGG = "\U0001f95a" +COOKING = "\U0001f373" +SHALLOW_PAN_OF_FOOD = "\U0001f958" +POT_OF_FOOD = "\U0001f372" +FONDUE = "\U0001fad5" +BOWL_WITH_SPOON = "\U0001f963" +GREEN_SALAD = "\U0001f957" +POPCORN = "\U0001f37f" +BUTTER = "\U0001f9c8" +SALT = "\U0001f9c2" +CANNED_FOOD = "\U0001f96b" +BENTO_BOX = "\U0001f371" +RICE_CRACKER = "\U0001f358" +RICE_BALL = "\U0001f359" +COOKED_RICE = "\U0001f35a" +CURRY_RICE = "\U0001f35b" +STEAMING_BOWL = "\U0001f35c" +SPAGHETTI = "\U0001f35d" +ROASTED_SWEET_POTATO = "\U0001f360" +ODEN = "\U0001f362" +SUSHI = "\U0001f363" +FRIED_SHRIMP = "\U0001f364" +FISH_CAKE_WITH_SWIRL = "\U0001f365" +MOON_CAKE = "\U0001f96e" +DANGO = "\U0001f361" +DUMPLING = "\U0001f95f" +FORTUNE_COOKIE = "\U0001f960" +TAKEOUT_BOX = "\U0001f961" +CRAB = "\U0001f980" +LOBSTER = "\U0001f99e" +SHRIMP = "\U0001f990" +SQUID = "\U0001f991" +OYSTER = "\U0001f9aa" +SOFT_ICE_CREAM = "\U0001f366" +SHAVED_ICE = "\U0001f367" +ICE_CREAM = "\U0001f368" +DOUGHNUT = "\U0001f369" +COOKIE = "\U0001f36a" +BIRTHDAY_CAKE = "\U0001f382" +SHORTCAKE = "\U0001f370" +CUPCAKE = "\U0001f9c1" +PIE = "\U0001f967" +CHOCOLATE_BAR = "\U0001f36b" +CANDY = "\U0001f36c" +LOLLIPOP = "\U0001f36d" +CUSTARD = "\U0001f36e" +HONEY_POT = "\U0001f36f" +BABY_BOTTLE = "\U0001f37c" +GLASS_OF_MILK = "\U0001f95b" +HOT_BEVERAGE = "\u2615" +TEAPOT = "\U0001fad6" +TEACUP_WITHOUT_HANDLE = "\U0001f375" +SAKE = "\U0001f376" +BOTTLE_WITH_POPPING_CORK = "\U0001f37e" +WINE_GLASS = "\U0001f377" +COCKTAIL_GLASS = "\U0001f378" +TROPICAL_DRINK = "\U0001f379" +BEER_MUG = "\U0001f37a" +CLINKING_BEER_MUGS = "\U0001f37b" +CLINKING_GLASSES = "\U0001f942" +TUMBLER_GLASS = "\U0001f943" +POURING_LIQUID = "\U0001fad7" +CUP_WITH_STRAW = "\U0001f964" +BUBBLE_TEA = "\U0001f9cb" +BEVERAGE_BOX = "\U0001f9c3" +MATE = "\U0001f9c9" +ICE = "\U0001f9ca" +CHOPSTICKS = "\U0001f962" +FORK_AND_KNIFE_WITH_PLATE = "\U0001f37d\ufe0f" +FORK_AND_KNIFE = "\U0001f374" +SPOON = "\U0001f944" +KITCHEN_KNIFE = "\U0001f52a" +JAR = "\U0001fad9" +AMPHORA = "\U0001f3fa" +GLOBE_SHOWING_EUROPE_AFRICA = "\U0001f30d" +GLOBE_SHOWING_AMERICAS = "\U0001f30e" +GLOBE_SHOWING_ASIA_AUSTRALIA = "\U0001f30f" +GLOBE_WITH_MERIDIANS = "\U0001f310" +WORLD_MAP = "\U0001f5fa\ufe0f" +MAP_OF_JAPAN = "\U0001f5fe" +COMPASS = "\U0001f9ed" +SNOW_CAPPED_MOUNTAIN = "\U0001f3d4\ufe0f" +MOUNTAIN = "\u26f0\ufe0f" +VOLCANO = "\U0001f30b" +MOUNT_FUJI = "\U0001f5fb" +CAMPING = "\U0001f3d5\ufe0f" +BEACH_WITH_UMBRELLA = "\U0001f3d6\ufe0f" +DESERT = "\U0001f3dc\ufe0f" +DESERT_ISLAND = "\U0001f3dd\ufe0f" +NATIONAL_PARK = "\U0001f3de\ufe0f" +STADIUM = "\U0001f3df\ufe0f" +CLASSICAL_BUILDING = "\U0001f3db\ufe0f" +BUILDING_CONSTRUCTION = "\U0001f3d7\ufe0f" +BRICK = "\U0001f9f1" +ROCK = "\U0001faa8" +WOOD = "\U0001fab5" +HUT = "\U0001f6d6" +HOUSES = "\U0001f3d8\ufe0f" +DERELICT_HOUSE = "\U0001f3da\ufe0f" +HOUSE = "\U0001f3e0" +HOUSE_WITH_GARDEN = "\U0001f3e1" +OFFICE_BUILDING = "\U0001f3e2" +JAPANESE_POST_OFFICE = "\U0001f3e3" +POST_OFFICE = "\U0001f3e4" +HOSPITAL = "\U0001f3e5" +BANK = "\U0001f3e6" +HOTEL = "\U0001f3e8" +LOVE_HOTEL = "\U0001f3e9" +CONVENIENCE_STORE = "\U0001f3ea" +SCHOOL = "\U0001f3eb" +DEPARTMENT_STORE = "\U0001f3ec" +FACTORY = "\U0001f3ed" +JAPANESE_CASTLE = "\U0001f3ef" +CASTLE = "\U0001f3f0" +WEDDING = "\U0001f492" +TOKYO_TOWER = "\U0001f5fc" +STATUE_OF_LIBERTY = "\U0001f5fd" +CHURCH = "\u26ea" +MOSQUE = "\U0001f54c" +HINDU_TEMPLE = "\U0001f6d5" +SYNAGOGUE = "\U0001f54d" +SHINTO_SHRINE = "\u26e9\ufe0f" +KAABA = "\U0001f54b" +FOUNTAIN = "\u26f2" +TENT = "\u26fa" +FOGGY = "\U0001f301" +NIGHT_WITH_STARS = "\U0001f303" +CITYSCAPE = "\U0001f3d9\ufe0f" +SUNRISE_OVER_MOUNTAINS = "\U0001f304" +SUNRISE = "\U0001f305" +CITYSCAPE_AT_DUSK = "\U0001f306" +SUNSET = "\U0001f307" +BRIDGE_AT_NIGHT = "\U0001f309" +HOT_SPRINGS = "\u2668\ufe0f" +CAROUSEL_HORSE = "\U0001f3a0" +PLAYGROUND_SLIDE = "\U0001f6dd" +FERRIS_WHEEL = "\U0001f3a1" +ROLLER_COASTER = "\U0001f3a2" +BARBER_POLE = "\U0001f488" +CIRCUS_TENT = "\U0001f3aa" +LOCOMOTIVE = "\U0001f682" +RAILWAY_CAR = "\U0001f683" +HIGH_SPEED_TRAIN = "\U0001f684" +BULLET_TRAIN = "\U0001f685" +TRAIN = "\U0001f686" +METRO = "\U0001f687" +LIGHT_RAIL = "\U0001f688" +STATION = "\U0001f689" +TRAM = "\U0001f68a" +MONORAIL = "\U0001f69d" +MOUNTAIN_RAILWAY = "\U0001f69e" +TRAM_CAR = "\U0001f68b" +BUS = "\U0001f68c" +ONCOMING_BUS = "\U0001f68d" +TROLLEYBUS = "\U0001f68e" +MINIBUS = "\U0001f690" +AMBULANCE = "\U0001f691" +FIRE_ENGINE = "\U0001f692" +POLICE_CAR = "\U0001f693" +ONCOMING_POLICE_CAR = "\U0001f694" +TAXI = "\U0001f695" +ONCOMING_TAXI = "\U0001f696" +AUTOMOBILE = "\U0001f697" +ONCOMING_AUTOMOBILE = "\U0001f698" +SPORT_UTILITY_VEHICLE = "\U0001f699" +PICKUP_TRUCK = "\U0001f6fb" +DELIVERY_TRUCK = "\U0001f69a" +ARTICULATED_LORRY = "\U0001f69b" +TRACTOR = "\U0001f69c" +RACING_CAR = "\U0001f3ce\ufe0f" +MOTORCYCLE = "\U0001f3cd\ufe0f" +MOTOR_SCOOTER = "\U0001f6f5" +MANUAL_WHEELCHAIR = "\U0001f9bd" +MOTORIZED_WHEELCHAIR = "\U0001f9bc" +AUTO_RICKSHAW = "\U0001f6fa" +BICYCLE = "\U0001f6b2" +KICK_SCOOTER = "\U0001f6f4" +SKATEBOARD = "\U0001f6f9" +ROLLER_SKATE = "\U0001f6fc" +BUS_STOP = "\U0001f68f" +MOTORWAY = "\U0001f6e3\ufe0f" +RAILWAY_TRACK = "\U0001f6e4\ufe0f" +OIL_DRUM = "\U0001f6e2\ufe0f" +FUEL_PUMP = "\u26fd" +WHEEL = "\U0001f6de" +POLICE_CAR_LIGHT = "\U0001f6a8" +HORIZONTAL_TRAFFIC_LIGHT = "\U0001f6a5" +VERTICAL_TRAFFIC_LIGHT = "\U0001f6a6" +STOP_SIGN = "\U0001f6d1" +CONSTRUCTION = "\U0001f6a7" +ANCHOR = "\u2693" +RING_BUOY = "\U0001f6df" +SAILBOAT = "\u26f5" +CANOE = "\U0001f6f6" +SPEEDBOAT = "\U0001f6a4" +PASSENGER_SHIP = "\U0001f6f3\ufe0f" +FERRY = "\u26f4\ufe0f" +MOTOR_BOAT = "\U0001f6e5\ufe0f" +SHIP = "\U0001f6a2" +AIRPLANE = "\u2708\ufe0f" +SMALL_AIRPLANE = "\U0001f6e9\ufe0f" +AIRPLANE_DEPARTURE = "\U0001f6eb" +AIRPLANE_ARRIVAL = "\U0001f6ec" +PARACHUTE = "\U0001fa82" +SEAT = "\U0001f4ba" +HELICOPTER = "\U0001f681" +SUSPENSION_RAILWAY = "\U0001f69f" +MOUNTAIN_CABLEWAY = "\U0001f6a0" +AERIAL_TRAMWAY = "\U0001f6a1" +SATELLITE = "\U0001f6f0\ufe0f" +ROCKET = "\U0001f680" +FLYING_SAUCER = "\U0001f6f8" +BELLHOP_BELL = "\U0001f6ce\ufe0f" +LUGGAGE = "\U0001f9f3" +HOURGLASS_DONE = "\u231b" +HOURGLASS_NOT_DONE = "\u23f3" +WATCH = "\u231a" +ALARM_CLOCK = "\u23f0" +STOPWATCH = "\u23f1\ufe0f" +TIMER_CLOCK = "\u23f2\ufe0f" +MANTELPIECE_CLOCK = "\U0001f570\ufe0f" +TWELVE_O_CLOCK = "\U0001f55b" +TWELVE_THIRTY = "\U0001f567" +ONE_O_CLOCK = "\U0001f550" +ONE_THIRTY = "\U0001f55c" +TWO_O_CLOCK = "\U0001f551" +TWO_THIRTY = "\U0001f55d" +THREE_O_CLOCK = "\U0001f552" +THREE_THIRTY = "\U0001f55e" +FOUR_O_CLOCK = "\U0001f553" +FOUR_THIRTY = "\U0001f55f" +FIVE_O_CLOCK = "\U0001f554" +FIVE_THIRTY = "\U0001f560" +SIX_O_CLOCK = "\U0001f555" +SIX_THIRTY = "\U0001f561" +SEVEN_O_CLOCK = "\U0001f556" +SEVEN_THIRTY = "\U0001f562" +EIGHT_O_CLOCK = "\U0001f557" +EIGHT_THIRTY = "\U0001f563" +NINE_O_CLOCK = "\U0001f558" +NINE_THIRTY = "\U0001f564" +TEN_O_CLOCK = "\U0001f559" +TEN_THIRTY = "\U0001f565" +ELEVEN_O_CLOCK = "\U0001f55a" +ELEVEN_THIRTY = "\U0001f566" +NEW_MOON = "\U0001f311" +WAXING_CRESCENT_MOON = "\U0001f312" +FIRST_QUARTER_MOON = "\U0001f313" +WAXING_GIBBOUS_MOON = "\U0001f314" +FULL_MOON = "\U0001f315" +WANING_GIBBOUS_MOON = "\U0001f316" +LAST_QUARTER_MOON = "\U0001f317" +WANING_CRESCENT_MOON = "\U0001f318" +CRESCENT_MOON = "\U0001f319" +NEW_MOON_FACE = "\U0001f31a" +FIRST_QUARTER_MOON_FACE = "\U0001f31b" +LAST_QUARTER_MOON_FACE = "\U0001f31c" +THERMOMETER = "\U0001f321\ufe0f" +SUN = "\u2600\ufe0f" +FULL_MOON_FACE = "\U0001f31d" +SUN_WITH_FACE = "\U0001f31e" +RINGED_PLANET = "\U0001fa90" +STAR = "\u2b50" +GLOWING_STAR = "\U0001f31f" +SHOOTING_STAR = "\U0001f320" +MILKY_WAY = "\U0001f30c" +CLOUD = "\u2601\ufe0f" +SUN_BEHIND_CLOUD = "\u26c5" +CLOUD_WITH_LIGHTNING_AND_RAIN = "\u26c8\ufe0f" +SUN_BEHIND_SMALL_CLOUD = "\U0001f324\ufe0f" +SUN_BEHIND_LARGE_CLOUD = "\U0001f325\ufe0f" +SUN_BEHIND_RAIN_CLOUD = "\U0001f326\ufe0f" +CLOUD_WITH_RAIN = "\U0001f327\ufe0f" +CLOUD_WITH_SNOW = "\U0001f328\ufe0f" +CLOUD_WITH_LIGHTNING = "\U0001f329\ufe0f" +TORNADO = "\U0001f32a\ufe0f" +FOG = "\U0001f32b\ufe0f" +WIND_FACE = "\U0001f32c\ufe0f" +CYCLONE = "\U0001f300" +RAINBOW = "\U0001f308" +CLOSED_UMBRELLA = "\U0001f302" +UMBRELLA = "\u2602\ufe0f" +UMBRELLA_WITH_RAIN_DROPS = "\u2614" +UMBRELLA_ON_GROUND = "\u26f1\ufe0f" +HIGH_VOLTAGE = "\u26a1" +SNOWFLAKE = "\u2744\ufe0f" +SNOWMAN = "\u2603\ufe0f" +SNOWMAN_WITHOUT_SNOW = "\u26c4" +COMET = "\u2604\ufe0f" +FIRE = "\U0001f525" +DROPLET = "\U0001f4a7" +WATER_WAVE = "\U0001f30a" +JACK_O_LANTERN = "\U0001f383" +CHRISTMAS_TREE = "\U0001f384" +FIREWORKS = "\U0001f386" +SPARKLER = "\U0001f387" +FIRECRACKER = "\U0001f9e8" +SPARKLES = "\u2728" +BALLOON = "\U0001f388" +PARTY_POPPER = "\U0001f389" +CONFETTI_BALL = "\U0001f38a" +TANABATA_TREE = "\U0001f38b" +PINE_DECORATION = "\U0001f38d" +JAPANESE_DOLLS = "\U0001f38e" +CARP_STREAMER = "\U0001f38f" +WIND_CHIME = "\U0001f390" +MOON_VIEWING_CEREMONY = "\U0001f391" +RED_ENVELOPE = "\U0001f9e7" +RIBBON = "\U0001f380" +WRAPPED_GIFT = "\U0001f381" +REMINDER_RIBBON = "\U0001f397\ufe0f" +ADMISSION_TICKETS = "\U0001f39f\ufe0f" +TICKET = "\U0001f3ab" +MILITARY_MEDAL = "\U0001f396\ufe0f" +TROPHY = "\U0001f3c6" +SPORTS_MEDAL = "\U0001f3c5" +FIRST_PLACE_MEDAL = "\U0001f947" +SECOND_PLACE_MEDAL = "\U0001f948" +THIRD_PLACE_MEDAL = "\U0001f949" +SOCCER_BALL = "\u26bd" +BASEBALL = "\u26be" +SOFTBALL = "\U0001f94e" +BASKETBALL = "\U0001f3c0" +VOLLEYBALL = "\U0001f3d0" +AMERICAN_FOOTBALL = "\U0001f3c8" +RUGBY_FOOTBALL = "\U0001f3c9" +TENNIS = "\U0001f3be" +FLYING_DISC = "\U0001f94f" +BOWLING = "\U0001f3b3" +CRICKET_GAME = "\U0001f3cf" +FIELD_HOCKEY = "\U0001f3d1" +ICE_HOCKEY = "\U0001f3d2" +LACROSSE = "\U0001f94d" +PING_PONG = "\U0001f3d3" +BADMINTON = "\U0001f3f8" +BOXING_GLOVE = "\U0001f94a" +MARTIAL_ARTS_UNIFORM = "\U0001f94b" +GOAL_NET = "\U0001f945" +FLAG_IN_HOLE = "\u26f3" +ICE_SKATE = "\u26f8\ufe0f" +FISHING_POLE = "\U0001f3a3" +DIVING_MASK = "\U0001f93f" +RUNNING_SHIRT = "\U0001f3bd" +SKIS = "\U0001f3bf" +SLED = "\U0001f6f7" +CURLING_STONE = "\U0001f94c" +BULLSEYE = "\U0001f3af" +YO_YO = "\U0001fa80" +KITE = "\U0001fa81" +POOL_8_BALL = "\U0001f3b1" +CRYSTAL_BALL = "\U0001f52e" +MAGIC_WAND = "\U0001fa84" +NAZAR_AMULET = "\U0001f9ff" +HAMSA = "\U0001faac" +VIDEO_GAME = "\U0001f3ae" +JOYSTICK = "\U0001f579\ufe0f" +SLOT_MACHINE = "\U0001f3b0" +GAME_DIE = "\U0001f3b2" +PUZZLE_PIECE = "\U0001f9e9" +TEDDY_BEAR = "\U0001f9f8" +PINATA = "\U0001fa85" +MIRROR_BALL = "\U0001faa9" +NESTING_DOLLS = "\U0001fa86" +SPADE_SUIT = "\u2660\ufe0f" +HEART_SUIT = "\u2665\ufe0f" +DIAMOND_SUIT = "\u2666\ufe0f" +CLUB_SUIT = "\u2663\ufe0f" +CHESS_PAWN = "\u265f\ufe0f" +JOKER = "\U0001f0cf" +MAHJONG_RED_DRAGON = "\U0001f004" +FLOWER_PLAYING_CARDS = "\U0001f3b4" +PERFORMING_ARTS = "\U0001f3ad" +FRAMED_PICTURE = "\U0001f5bc\ufe0f" +ARTIST_PALETTE = "\U0001f3a8" +THREAD = "\U0001f9f5" +SEWING_NEEDLE = "\U0001faa1" +YARN = "\U0001f9f6" +KNOT = "\U0001faa2" +GLASSES = "\U0001f453" +SUNGLASSES = "\U0001f576\ufe0f" +GOGGLES = "\U0001f97d" +LAB_COAT = "\U0001f97c" +SAFETY_VEST = "\U0001f9ba" +NECKTIE = "\U0001f454" +T_SHIRT = "\U0001f455" +JEANS = "\U0001f456" +SCARF = "\U0001f9e3" +GLOVES = "\U0001f9e4" +COAT = "\U0001f9e5" +SOCKS = "\U0001f9e6" +DRESS = "\U0001f457" +KIMONO = "\U0001f458" +SARI = "\U0001f97b" +ONE_PIECE_SWIMSUIT = "\U0001fa71" +BRIEFS = "\U0001fa72" +SHORTS = "\U0001fa73" +BIKINI = "\U0001f459" +WOMAN_S_CLOTHES = "\U0001f45a" +PURSE = "\U0001f45b" +HANDBAG = "\U0001f45c" +CLUTCH_BAG = "\U0001f45d" +SHOPPING_BAGS = "\U0001f6cd\ufe0f" +BACKPACK = "\U0001f392" +THONG_SANDAL = "\U0001fa74" +MAN_S_SHOE = "\U0001f45e" +RUNNING_SHOE = "\U0001f45f" +HIKING_BOOT = "\U0001f97e" +FLAT_SHOE = "\U0001f97f" +HIGH_HEELED_SHOE = "\U0001f460" +WOMAN_S_SANDAL = "\U0001f461" +BALLET_SHOES = "\U0001fa70" +WOMAN_S_BOOT = "\U0001f462" +CROWN = "\U0001f451" +WOMAN_S_HAT = "\U0001f452" +TOP_HAT = "\U0001f3a9" +GRADUATION_CAP = "\U0001f393" +BILLED_CAP = "\U0001f9e2" +MILITARY_HELMET = "\U0001fa96" +RESCUE_WORKER_S_HELMET = "\u26d1\ufe0f" +PRAYER_BEADS = "\U0001f4ff" +LIPSTICK = "\U0001f484" +RING = "\U0001f48d" +GEM_STONE = "\U0001f48e" +MUTED_SPEAKER = "\U0001f507" +SPEAKER_LOW_VOLUME = "\U0001f508" +SPEAKER_MEDIUM_VOLUME = "\U0001f509" +SPEAKER_HIGH_VOLUME = "\U0001f50a" +LOUDSPEAKER = "\U0001f4e2" +MEGAPHONE = "\U0001f4e3" +POSTAL_HORN = "\U0001f4ef" +BELL = "\U0001f514" +BELL_WITH_SLASH = "\U0001f515" +MUSICAL_SCORE = "\U0001f3bc" +MUSICAL_NOTE = "\U0001f3b5" +MUSICAL_NOTES = "\U0001f3b6" +STUDIO_MICROPHONE = "\U0001f399\ufe0f" +LEVEL_SLIDER = "\U0001f39a\ufe0f" +CONTROL_KNOBS = "\U0001f39b\ufe0f" +MICROPHONE = "\U0001f3a4" +HEADPHONE = "\U0001f3a7" +RADIO = "\U0001f4fb" +SAXOPHONE = "\U0001f3b7" +ACCORDION = "\U0001fa97" +GUITAR = "\U0001f3b8" +MUSICAL_KEYBOARD = "\U0001f3b9" +TRUMPET = "\U0001f3ba" +VIOLIN = "\U0001f3bb" +BANJO = "\U0001fa95" +DRUM = "\U0001f941" +LONG_DRUM = "\U0001fa98" +MOBILE_PHONE = "\U0001f4f1" +MOBILE_PHONE_WITH_ARROW = "\U0001f4f2" +TELEPHONE = "\u260e\ufe0f" +TELEPHONE_RECEIVER = "\U0001f4de" +PAGER = "\U0001f4df" +FAX_MACHINE = "\U0001f4e0" +BATTERY = "\U0001f50b" +LOW_BATTERY = "\U0001faab" +ELECTRIC_PLUG = "\U0001f50c" +LAPTOP = "\U0001f4bb" +DESKTOP_COMPUTER = "\U0001f5a5\ufe0f" +PRINTER = "\U0001f5a8\ufe0f" +KEYBOARD = "\u2328\ufe0f" +COMPUTER_MOUSE = "\U0001f5b1\ufe0f" +TRACKBALL = "\U0001f5b2\ufe0f" +COMPUTER_DISK = "\U0001f4bd" +FLOPPY_DISK = "\U0001f4be" +OPTICAL_DISK = "\U0001f4bf" +DVD = "\U0001f4c0" +ABACUS = "\U0001f9ee" +MOVIE_CAMERA = "\U0001f3a5" +FILM_FRAMES = "\U0001f39e\ufe0f" +FILM_PROJECTOR = "\U0001f4fd\ufe0f" +CLAPPER_BOARD = "\U0001f3ac" +TELEVISION = "\U0001f4fa" +CAMERA = "\U0001f4f7" +CAMERA_WITH_FLASH = "\U0001f4f8" +VIDEO_CAMERA = "\U0001f4f9" +VIDEOCASSETTE = "\U0001f4fc" +MAGNIFYING_GLASS_TILTED_LEFT = "\U0001f50d" +MAGNIFYING_GLASS_TILTED_RIGHT = "\U0001f50e" +CANDLE = "\U0001f56f\ufe0f" +LIGHT_BULB = "\U0001f4a1" +FLASHLIGHT = "\U0001f526" +RED_PAPER_LANTERN = "\U0001f3ee" +DIYA_LAMP = "\U0001fa94" +NOTEBOOK_WITH_DECORATIVE_COVER = "\U0001f4d4" +CLOSED_BOOK = "\U0001f4d5" +OPEN_BOOK = "\U0001f4d6" +GREEN_BOOK = "\U0001f4d7" +BLUE_BOOK = "\U0001f4d8" +ORANGE_BOOK = "\U0001f4d9" +BOOKS = "\U0001f4da" +NOTEBOOK = "\U0001f4d3" +LEDGER = "\U0001f4d2" +PAGE_WITH_CURL = "\U0001f4c3" +SCROLL = "\U0001f4dc" +PAGE_FACING_UP = "\U0001f4c4" +NEWSPAPER = "\U0001f4f0" +ROLLED_UP_NEWSPAPER = "\U0001f5de\ufe0f" +BOOKMARK_TABS = "\U0001f4d1" +BOOKMARK = "\U0001f516" +LABEL = "\U0001f3f7\ufe0f" +MONEY_BAG = "\U0001f4b0" +COIN = "\U0001fa99" +YEN_BANKNOTE = "\U0001f4b4" +DOLLAR_BANKNOTE = "\U0001f4b5" +EURO_BANKNOTE = "\U0001f4b6" +POUND_BANKNOTE = "\U0001f4b7" +MONEY_WITH_WINGS = "\U0001f4b8" +CREDIT_CARD = "\U0001f4b3" +RECEIPT = "\U0001f9fe" +CHART_INCREASING_WITH_YEN = "\U0001f4b9" +ENVELOPE = "\u2709\ufe0f" +E_MAIL = "\U0001f4e7" +INCOMING_ENVELOPE = "\U0001f4e8" +ENVELOPE_WITH_ARROW = "\U0001f4e9" +OUTBOX_TRAY = "\U0001f4e4" +INBOX_TRAY = "\U0001f4e5" +PACKAGE = "\U0001f4e6" +CLOSED_MAILBOX_WITH_RAISED_FLAG = "\U0001f4eb" +CLOSED_MAILBOX_WITH_LOWERED_FLAG = "\U0001f4ea" +OPEN_MAILBOX_WITH_RAISED_FLAG = "\U0001f4ec" +OPEN_MAILBOX_WITH_LOWERED_FLAG = "\U0001f4ed" +POSTBOX = "\U0001f4ee" +BALLOT_BOX_WITH_BALLOT = "\U0001f5f3\ufe0f" +PENCIL = "\u270f\ufe0f" +BLACK_NIB = "\u2712\ufe0f" +FOUNTAIN_PEN = "\U0001f58b\ufe0f" +PEN = "\U0001f58a\ufe0f" +PAINTBRUSH = "\U0001f58c\ufe0f" +CRAYON = "\U0001f58d\ufe0f" +MEMO = "\U0001f4dd" +BRIEFCASE = "\U0001f4bc" +FILE_FOLDER = "\U0001f4c1" +OPEN_FILE_FOLDER = "\U0001f4c2" +CARD_INDEX_DIVIDERS = "\U0001f5c2\ufe0f" +CALENDAR = "\U0001f4c5" +TEAR_OFF_CALENDAR = "\U0001f4c6" +SPIRAL_NOTEPAD = "\U0001f5d2\ufe0f" +SPIRAL_CALENDAR = "\U0001f5d3\ufe0f" +CARD_INDEX = "\U0001f4c7" +CHART_INCREASING = "\U0001f4c8" +CHART_DECREASING = "\U0001f4c9" +BAR_CHART = "\U0001f4ca" +CLIPBOARD = "\U0001f4cb" +PUSHPIN = "\U0001f4cc" +ROUND_PUSHPIN = "\U0001f4cd" +PAPERCLIP = "\U0001f4ce" +LINKED_PAPERCLIPS = "\U0001f587\ufe0f" +STRAIGHT_RULER = "\U0001f4cf" +TRIANGULAR_RULER = "\U0001f4d0" +SCISSORS = "\u2702\ufe0f" +CARD_FILE_BOX = "\U0001f5c3\ufe0f" +FILE_CABINET = "\U0001f5c4\ufe0f" +WASTEBASKET = "\U0001f5d1\ufe0f" +LOCKED = "\U0001f512" +UNLOCKED = "\U0001f513" +LOCKED_WITH_PEN = "\U0001f50f" +LOCKED_WITH_KEY = "\U0001f510" +KEY = "\U0001f511" +OLD_KEY = "\U0001f5dd\ufe0f" +HAMMER = "\U0001f528" +AXE = "\U0001fa93" +PICK = "\u26cf\ufe0f" +HAMMER_AND_PICK = "\u2692\ufe0f" +HAMMER_AND_WRENCH = "\U0001f6e0\ufe0f" +DAGGER = "\U0001f5e1\ufe0f" +CROSSED_SWORDS = "\u2694\ufe0f" +WATER_PISTOL = "\U0001f52b" +BOOMERANG = "\U0001fa83" +BOW_AND_ARROW = "\U0001f3f9" +SHIELD = "\U0001f6e1\ufe0f" +CARPENTRY_SAW = "\U0001fa9a" +WRENCH = "\U0001f527" +SCREWDRIVER = "\U0001fa9b" +NUT_AND_BOLT = "\U0001f529" +GEAR = "\u2699\ufe0f" +CLAMP = "\U0001f5dc\ufe0f" +BALANCE_SCALE = "\u2696\ufe0f" +WHITE_CANE = "\U0001f9af" +LINK = "\U0001f517" +CHAINS = "\u26d3\ufe0f" +HOOK = "\U0001fa9d" +TOOLBOX = "\U0001f9f0" +MAGNET = "\U0001f9f2" +LADDER = "\U0001fa9c" +ALEMBIC = "\u2697\ufe0f" +TEST_TUBE = "\U0001f9ea" +PETRI_DISH = "\U0001f9eb" +DNA = "\U0001f9ec" +MICROSCOPE = "\U0001f52c" +TELESCOPE = "\U0001f52d" +SATELLITE_ANTENNA = "\U0001f4e1" +SYRINGE = "\U0001f489" +DROP_OF_BLOOD = "\U0001fa78" +PILL = "\U0001f48a" +ADHESIVE_BANDAGE = "\U0001fa79" +CRUTCH = "\U0001fa7c" +STETHOSCOPE = "\U0001fa7a" +X_RAY = "\U0001fa7b" +DOOR = "\U0001f6aa" +ELEVATOR = "\U0001f6d7" +MIRROR = "\U0001fa9e" +WINDOW = "\U0001fa9f" +BED = "\U0001f6cf\ufe0f" +COUCH_AND_LAMP = "\U0001f6cb\ufe0f" +CHAIR = "\U0001fa91" +TOILET = "\U0001f6bd" +PLUNGER = "\U0001faa0" +SHOWER = "\U0001f6bf" +BATHTUB = "\U0001f6c1" +MOUSE_TRAP = "\U0001faa4" +RAZOR = "\U0001fa92" +LOTION_BOTTLE = "\U0001f9f4" +SAFETY_PIN = "\U0001f9f7" +BROOM = "\U0001f9f9" +BASKET = "\U0001f9fa" +ROLL_OF_PAPER = "\U0001f9fb" +BUCKET = "\U0001faa3" +SOAP = "\U0001f9fc" +BUBBLES = "\U0001fae7" +TOOTHBRUSH = "\U0001faa5" +SPONGE = "\U0001f9fd" +FIRE_EXTINGUISHER = "\U0001f9ef" +SHOPPING_CART = "\U0001f6d2" +CIGARETTE = "\U0001f6ac" +COFFIN = "\u26b0\ufe0f" +HEADSTONE = "\U0001faa6" +FUNERAL_URN = "\u26b1\ufe0f" +MOAI = "\U0001f5ff" +PLACARD = "\U0001faa7" +IDENTIFICATION_CARD = "\U0001faaa" +ATM_SIGN = "\U0001f3e7" +LITTER_IN_BIN_SIGN = "\U0001f6ae" +POTABLE_WATER = "\U0001f6b0" +WHEELCHAIR_SYMBOL = "\u267f" +MEN_S_ROOM = "\U0001f6b9" +WOMEN_S_ROOM = "\U0001f6ba" +RESTROOM = "\U0001f6bb" +BABY_SYMBOL = "\U0001f6bc" +WATER_CLOSET = "\U0001f6be" +PASSPORT_CONTROL = "\U0001f6c2" +CUSTOMS = "\U0001f6c3" +BAGGAGE_CLAIM = "\U0001f6c4" +LEFT_LUGGAGE = "\U0001f6c5" +WARNING = "\u26a0\ufe0f" +CHILDREN_CROSSING = "\U0001f6b8" +NO_ENTRY = "\u26d4" +PROHIBITED = "\U0001f6ab" +NO_BICYCLES = "\U0001f6b3" +NO_SMOKING = "\U0001f6ad" +NO_LITTERING = "\U0001f6af" +NON_POTABLE_WATER = "\U0001f6b1" +NO_PEDESTRIANS = "\U0001f6b7" +NO_MOBILE_PHONES = "\U0001f4f5" +NO_ONE_UNDER_EIGHTEEN = "\U0001f51e" +RADIOACTIVE = "\u2622\ufe0f" +BIOHAZARD = "\u2623\ufe0f" +UP_ARROW = "\u2b06\ufe0f" +UP_RIGHT_ARROW = "\u2197\ufe0f" +RIGHT_ARROW = "\u27a1\ufe0f" +DOWN_RIGHT_ARROW = "\u2198\ufe0f" +DOWN_ARROW = "\u2b07\ufe0f" +DOWN_LEFT_ARROW = "\u2199\ufe0f" +LEFT_ARROW = "\u2b05\ufe0f" +UP_LEFT_ARROW = "\u2196\ufe0f" +UP_DOWN_ARROW = "\u2195\ufe0f" +LEFT_RIGHT_ARROW = "\u2194\ufe0f" +RIGHT_ARROW_CURVING_LEFT = "\u21a9\ufe0f" +LEFT_ARROW_CURVING_RIGHT = "\u21aa\ufe0f" +RIGHT_ARROW_CURVING_UP = "\u2934\ufe0f" +RIGHT_ARROW_CURVING_DOWN = "\u2935\ufe0f" +CLOCKWISE_VERTICAL_ARROWS = "\U0001f503" +COUNTERCLOCKWISE_ARROWS_BUTTON = "\U0001f504" +BACK_ARROW = "\U0001f519" +END_ARROW = "\U0001f51a" +ON_ARROW = "\U0001f51b" +SOON_ARROW = "\U0001f51c" +TOP_ARROW = "\U0001f51d" +PLACE_OF_WORSHIP = "\U0001f6d0" +ATOM_SYMBOL = "\u269b\ufe0f" +OM = "\U0001f549\ufe0f" +STAR_OF_DAVID = "\u2721\ufe0f" +WHEEL_OF_DHARMA = "\u2638\ufe0f" +YIN_YANG = "\u262f\ufe0f" +LATIN_CROSS = "\u271d\ufe0f" +ORTHODOX_CROSS = "\u2626\ufe0f" +STAR_AND_CRESCENT = "\u262a\ufe0f" +PEACE_SYMBOL = "\u262e\ufe0f" +MENORAH = "\U0001f54e" +DOTTED_SIX_POINTED_STAR = "\U0001f52f" +ARIES = "\u2648" +TAURUS = "\u2649" +GEMINI = "\u264a" +CANCER = "\u264b" +LEO = "\u264c" +VIRGO = "\u264d" +LIBRA = "\u264e" +SCORPIO = "\u264f" +SAGITTARIUS = "\u2650" +CAPRICORN = "\u2651" +AQUARIUS = "\u2652" +PISCES = "\u2653" +OPHIUCHUS = "\u26ce" +SHUFFLE_TRACKS_BUTTON = "\U0001f500" +REPEAT_BUTTON = "\U0001f501" +REPEAT_SINGLE_BUTTON = "\U0001f502" +PLAY_BUTTON = "\u25b6\ufe0f" +FAST_FORWARD_BUTTON = "\u23e9" +NEXT_TRACK_BUTTON = "\u23ed\ufe0f" +PLAY_OR_PAUSE_BUTTON = "\u23ef\ufe0f" +REVERSE_BUTTON = "\u25c0\ufe0f" +FAST_REVERSE_BUTTON = "\u23ea" +LAST_TRACK_BUTTON = "\u23ee\ufe0f" +UPWARDS_BUTTON = "\U0001f53c" +FAST_UP_BUTTON = "\u23eb" +DOWNWARDS_BUTTON = "\U0001f53d" +FAST_DOWN_BUTTON = "\u23ec" +PAUSE_BUTTON = "\u23f8\ufe0f" +STOP_BUTTON = "\u23f9\ufe0f" +RECORD_BUTTON = "\u23fa\ufe0f" +EJECT_BUTTON = "\u23cf\ufe0f" +CINEMA = "\U0001f3a6" +DIM_BUTTON = "\U0001f505" +BRIGHT_BUTTON = "\U0001f506" +ANTENNA_BARS = "\U0001f4f6" +VIBRATION_MODE = "\U0001f4f3" +MOBILE_PHONE_OFF = "\U0001f4f4" +FEMALE_SIGN = "\u2640\ufe0f" +MALE_SIGN = "\u2642\ufe0f" +TRANSGENDER_SYMBOL = "\u26a7\ufe0f" +MULTIPLY = "\u2716\ufe0f" +PLUS = "\u2795" +MINUS = "\u2796" +DIVIDE = "\u2797" +HEAVY_EQUALS_SIGN = "\U0001f7f0" +INFINITY = "\u267e\ufe0f" +DOUBLE_EXCLAMATION_MARK = "\u203c\ufe0f" +EXCLAMATION_QUESTION_MARK = "\u2049\ufe0f" +RED_QUESTION_MARK = "\u2753" +WHITE_QUESTION_MARK = "\u2754" +WHITE_EXCLAMATION_MARK = "\u2755" +RED_EXCLAMATION_MARK = "\u2757" +WAVY_DASH = "\u3030\ufe0f" +CURRENCY_EXCHANGE = "\U0001f4b1" +HEAVY_DOLLAR_SIGN = "\U0001f4b2" +MEDICAL_SYMBOL = "\u2695\ufe0f" +RECYCLING_SYMBOL = "\u267b\ufe0f" +FLEUR_DE_LIS = "\u269c\ufe0f" +TRIDENT_EMBLEM = "\U0001f531" +NAME_BADGE = "\U0001f4db" +JAPANESE_SYMBOL_FOR_BEGINNER = "\U0001f530" +HOLLOW_RED_CIRCLE = "\u2b55" +CHECK_MARK_BUTTON = "\u2705" +CHECK_BOX_WITH_CHECK = "\u2611\ufe0f" +CHECK_MARK = "\u2714\ufe0f" +CROSS_MARK = "\u274c" +CROSS_MARK_BUTTON = "\u274e" +CURLY_LOOP = "\u27b0" +DOUBLE_CURLY_LOOP = "\u27bf" +PART_ALTERNATION_MARK = "\u303d\ufe0f" +EIGHT_SPOKED_ASTERISK = "\u2733\ufe0f" +EIGHT_POINTED_STAR = "\u2734\ufe0f" +SPARKLE = "\u2747\ufe0f" +COPYRIGHT = "\xa9\ufe0f" +REGISTERED = "\xae\ufe0f" +TRADE_MARK = "\u2122\ufe0f" +KEYCAP_NUMBER_SIGN = "#\ufe0f\u20e3" +KEYCAP_ASTERISK = "*\ufe0f\u20e3" +KEYCAP_DIGIT_ZERO = "0\ufe0f\u20e3" +KEYCAP_DIGIT_ONE = "1\ufe0f\u20e3" +KEYCAP_DIGIT_TWO = "2\ufe0f\u20e3" +KEYCAP_DIGIT_THREE = "3\ufe0f\u20e3" +KEYCAP_DIGIT_FOUR = "4\ufe0f\u20e3" +KEYCAP_DIGIT_FIVE = "5\ufe0f\u20e3" +KEYCAP_DIGIT_SIX = "6\ufe0f\u20e3" +KEYCAP_DIGIT_SEVEN = "7\ufe0f\u20e3" +KEYCAP_DIGIT_EIGHT = "8\ufe0f\u20e3" +KEYCAP_DIGIT_NINE = "9\ufe0f\u20e3" +KEYCAP_10 = "\U0001f51f" +INPUT_LATIN_UPPERCASE = "\U0001f520" +INPUT_LATIN_LOWERCASE = "\U0001f521" +INPUT_NUMBERS = "\U0001f522" +INPUT_SYMBOLS = "\U0001f523" +INPUT_LATIN_LETTERS = "\U0001f524" +A_BUTTON_BLOOD_TYPE = "\U0001f170\ufe0f" +AB_BUTTON_BLOOD_TYPE = "\U0001f18e" +B_BUTTON_BLOOD_TYPE = "\U0001f171\ufe0f" +CL_BUTTON = "\U0001f191" +COOL_BUTTON = "\U0001f192" +FREE_BUTTON = "\U0001f193" +INFORMATION = "\u2139\ufe0f" +ID_BUTTON = "\U0001f194" +CIRCLED_M = "\u24c2\ufe0f" +NEW_BUTTON = "\U0001f195" +NG_BUTTON = "\U0001f196" +O_BUTTON_BLOOD_TYPE = "\U0001f17e\ufe0f" +OK_BUTTON = "\U0001f197" +P_BUTTON = "\U0001f17f\ufe0f" +SOS_BUTTON = "\U0001f198" +UP_BUTTON = "\U0001f199" +VS_BUTTON = "\U0001f19a" +JAPANESE_HERE_BUTTON = "\U0001f201" +JAPANESE_SERVICE_CHARGE_BUTTON = "\U0001f202\ufe0f" +JAPANESE_MONTHLY_AMOUNT_BUTTON = "\U0001f237\ufe0f" +JAPANESE_NOT_FREE_OF_CHARGE_BUTTON = "\U0001f236" +JAPANESE_RESERVED_BUTTON = "\U0001f22f" +JAPANESE_BARGAIN_BUTTON = "\U0001f250" +JAPANESE_DISCOUNT_BUTTON = "\U0001f239" +JAPANESE_FREE_OF_CHARGE_BUTTON = "\U0001f21a" +JAPANESE_PROHIBITED_BUTTON = "\U0001f232" +JAPANESE_ACCEPTABLE_BUTTON = "\U0001f251" +JAPANESE_APPLICATION_BUTTON = "\U0001f238" +JAPANESE_PASSING_GRADE_BUTTON = "\U0001f234" +JAPANESE_VACANCY_BUTTON = "\U0001f233" +JAPANESE_CONGRATULATIONS_BUTTON = "\u3297\ufe0f" +JAPANESE_SECRET_BUTTON = "\u3299\ufe0f" +JAPANESE_OPEN_FOR_BUSINESS_BUTTON = "\U0001f23a" +JAPANESE_NO_VACANCY_BUTTON = "\U0001f235" +RED_CIRCLE = "\U0001f534" +ORANGE_CIRCLE = "\U0001f7e0" +YELLOW_CIRCLE = "\U0001f7e1" +GREEN_CIRCLE = "\U0001f7e2" +BLUE_CIRCLE = "\U0001f535" +PURPLE_CIRCLE = "\U0001f7e3" +BROWN_CIRCLE = "\U0001f7e4" +BLACK_CIRCLE = "\u26ab" +WHITE_CIRCLE = "\u26aa" +RED_SQUARE = "\U0001f7e5" +ORANGE_SQUARE = "\U0001f7e7" +YELLOW_SQUARE = "\U0001f7e8" +GREEN_SQUARE = "\U0001f7e9" +BLUE_SQUARE = "\U0001f7e6" +PURPLE_SQUARE = "\U0001f7ea" +BROWN_SQUARE = "\U0001f7eb" +BLACK_LARGE_SQUARE = "\u2b1b" +WHITE_LARGE_SQUARE = "\u2b1c" +BLACK_MEDIUM_SQUARE = "\u25fc\ufe0f" +WHITE_MEDIUM_SQUARE = "\u25fb\ufe0f" +BLACK_MEDIUM_SMALL_SQUARE = "\u25fe" +WHITE_MEDIUM_SMALL_SQUARE = "\u25fd" +BLACK_SMALL_SQUARE = "\u25aa\ufe0f" +WHITE_SMALL_SQUARE = "\u25ab\ufe0f" +LARGE_ORANGE_DIAMOND = "\U0001f536" +LARGE_BLUE_DIAMOND = "\U0001f537" +SMALL_ORANGE_DIAMOND = "\U0001f538" +SMALL_BLUE_DIAMOND = "\U0001f539" +RED_TRIANGLE_POINTED_UP = "\U0001f53a" +RED_TRIANGLE_POINTED_DOWN = "\U0001f53b" +DIAMOND_WITH_A_DOT = "\U0001f4a0" +RADIO_BUTTON = "\U0001f518" +WHITE_SQUARE_BUTTON = "\U0001f533" +BLACK_SQUARE_BUTTON = "\U0001f532" +CHEQUERED_FLAG = "\U0001f3c1" +TRIANGULAR_FLAG = "\U0001f6a9" +CROSSED_FLAGS = "\U0001f38c" +BLACK_FLAG = "\U0001f3f4" +WHITE_FLAG = "\U0001f3f3\ufe0f" +RAINBOW_FLAG = "\U0001f3f3\ufe0f\u200d\U0001f308" +TRANSGENDER_FLAG = "\U0001f3f3\ufe0f\u200d\u26a7\ufe0f" +PIRATE_FLAG = "\U0001f3f4\u200d\u2620\ufe0f" +FLAG_ASCENSION_ISLAND = "\U0001f1e6\U0001f1e8" +FLAG_ANDORRA = "\U0001f1e6\U0001f1e9" +FLAG_UNITED_ARAB_EMIRATES = "\U0001f1e6\U0001f1ea" +FLAG_AFGHANISTAN = "\U0001f1e6\U0001f1eb" +FLAG_ANTIGUA_ANDAMP_BARBUDA = "\U0001f1e6\U0001f1ec" +FLAG_ANGUILLA = "\U0001f1e6\U0001f1ee" +FLAG_ALBANIA = "\U0001f1e6\U0001f1f1" +FLAG_ARMENIA = "\U0001f1e6\U0001f1f2" +FLAG_ANGOLA = "\U0001f1e6\U0001f1f4" +FLAG_ANTARCTICA = "\U0001f1e6\U0001f1f6" +FLAG_ARGENTINA = "\U0001f1e6\U0001f1f7" +FLAG_AMERICAN_SAMOA = "\U0001f1e6\U0001f1f8" +FLAG_AUSTRIA = "\U0001f1e6\U0001f1f9" +FLAG_AUSTRALIA = "\U0001f1e6\U0001f1fa" +FLAG_ARUBA = "\U0001f1e6\U0001f1fc" +FLAG_ALAND_ISLANDS = "\U0001f1e6\U0001f1fd" +FLAG_AZERBAIJAN = "\U0001f1e6\U0001f1ff" +FLAG_BOSNIA_ANDAMP_HERZEGOVINA = "\U0001f1e7\U0001f1e6" +FLAG_BARBADOS = "\U0001f1e7\U0001f1e7" +FLAG_BANGLADESH = "\U0001f1e7\U0001f1e9" +FLAG_BELGIUM = "\U0001f1e7\U0001f1ea" +FLAG_BURKINA_FASO = "\U0001f1e7\U0001f1eb" +FLAG_BULGARIA = "\U0001f1e7\U0001f1ec" +FLAG_BAHRAIN = "\U0001f1e7\U0001f1ed" +FLAG_BURUNDI = "\U0001f1e7\U0001f1ee" +FLAG_BENIN = "\U0001f1e7\U0001f1ef" +FLAG_ST_BARTHELEMY = "\U0001f1e7\U0001f1f1" +FLAG_BERMUDA = "\U0001f1e7\U0001f1f2" +FLAG_BRUNEI = "\U0001f1e7\U0001f1f3" +FLAG_BOLIVIA = "\U0001f1e7\U0001f1f4" +FLAG_CARIBBEAN_NETHERLANDS = "\U0001f1e7\U0001f1f6" +FLAG_BRAZIL = "\U0001f1e7\U0001f1f7" +FLAG_BAHAMAS = "\U0001f1e7\U0001f1f8" +FLAG_BHUTAN = "\U0001f1e7\U0001f1f9" +FLAG_BOUVET_ISLAND = "\U0001f1e7\U0001f1fb" +FLAG_BOTSWANA = "\U0001f1e7\U0001f1fc" +FLAG_BELARUS = "\U0001f1e7\U0001f1fe" +FLAG_BELIZE = "\U0001f1e7\U0001f1ff" +FLAG_CANADA = "\U0001f1e8\U0001f1e6" +FLAG_COCOS_KEELING_ISLANDS = "\U0001f1e8\U0001f1e8" +FLAG_CONGO_KINSHASA = "\U0001f1e8\U0001f1e9" +FLAG_CENTRAL_AFRICAN_REPUBLIC = "\U0001f1e8\U0001f1eb" +FLAG_CONGO_BRAZZAVILLE = "\U0001f1e8\U0001f1ec" +FLAG_SWITZERLAND = "\U0001f1e8\U0001f1ed" +FLAG_COTE_D_IVOIRE = "\U0001f1e8\U0001f1ee" +FLAG_COOK_ISLANDS = "\U0001f1e8\U0001f1f0" +FLAG_CHILE = "\U0001f1e8\U0001f1f1" +FLAG_CAMEROON = "\U0001f1e8\U0001f1f2" +FLAG_CHINA = "\U0001f1e8\U0001f1f3" +FLAG_COLOMBIA = "\U0001f1e8\U0001f1f4" +FLAG_CLIPPERTON_ISLAND = "\U0001f1e8\U0001f1f5" +FLAG_COSTA_RICA = "\U0001f1e8\U0001f1f7" +FLAG_CUBA = "\U0001f1e8\U0001f1fa" +FLAG_CAPE_VERDE = "\U0001f1e8\U0001f1fb" +FLAG_CURACAO = "\U0001f1e8\U0001f1fc" +FLAG_CHRISTMAS_ISLAND = "\U0001f1e8\U0001f1fd" +FLAG_CYPRUS = "\U0001f1e8\U0001f1fe" +FLAG_CZECHIA = "\U0001f1e8\U0001f1ff" +FLAG_GERMANY = "\U0001f1e9\U0001f1ea" +FLAG_DIEGO_GARCIA = "\U0001f1e9\U0001f1ec" +FLAG_DJIBOUTI = "\U0001f1e9\U0001f1ef" +FLAG_DENMARK = "\U0001f1e9\U0001f1f0" +FLAG_DOMINICA = "\U0001f1e9\U0001f1f2" +FLAG_DOMINICAN_REPUBLIC = "\U0001f1e9\U0001f1f4" +FLAG_ALGERIA = "\U0001f1e9\U0001f1ff" +FLAG_CEUTA_ANDAMP_MELILLA = "\U0001f1ea\U0001f1e6" +FLAG_ECUADOR = "\U0001f1ea\U0001f1e8" +FLAG_ESTONIA = "\U0001f1ea\U0001f1ea" +FLAG_EGYPT = "\U0001f1ea\U0001f1ec" +FLAG_WESTERN_SAHARA = "\U0001f1ea\U0001f1ed" +FLAG_ERITREA = "\U0001f1ea\U0001f1f7" +FLAG_SPAIN = "\U0001f1ea\U0001f1f8" +FLAG_ETHIOPIA = "\U0001f1ea\U0001f1f9" +FLAG_EUROPEAN_UNION = "\U0001f1ea\U0001f1fa" +FLAG_FINLAND = "\U0001f1eb\U0001f1ee" +FLAG_FIJI = "\U0001f1eb\U0001f1ef" +FLAG_FALKLAND_ISLANDS = "\U0001f1eb\U0001f1f0" +FLAG_MICRONESIA = "\U0001f1eb\U0001f1f2" +FLAG_FAROE_ISLANDS = "\U0001f1eb\U0001f1f4" +FLAG_FRANCE = "\U0001f1eb\U0001f1f7" +FLAG_GABON = "\U0001f1ec\U0001f1e6" +FLAG_UNITED_KINGDOM = "\U0001f1ec\U0001f1e7" +FLAG_GRENADA = "\U0001f1ec\U0001f1e9" +FLAG_GEORGIA = "\U0001f1ec\U0001f1ea" +FLAG_FRENCH_GUIANA = "\U0001f1ec\U0001f1eb" +FLAG_GUERNSEY = "\U0001f1ec\U0001f1ec" +FLAG_GHANA = "\U0001f1ec\U0001f1ed" +FLAG_GIBRALTAR = "\U0001f1ec\U0001f1ee" +FLAG_GREENLAND = "\U0001f1ec\U0001f1f1" +FLAG_GAMBIA = "\U0001f1ec\U0001f1f2" +FLAG_GUINEA = "\U0001f1ec\U0001f1f3" +FLAG_GUADELOUPE = "\U0001f1ec\U0001f1f5" +FLAG_EQUATORIAL_GUINEA = "\U0001f1ec\U0001f1f6" +FLAG_GREECE = "\U0001f1ec\U0001f1f7" +FLAG_SOUTH_GEORGIA_ANDAMP_SOUTH_SANDWICH_ISLANDS = "\U0001f1ec\U0001f1f8" +FLAG_GUATEMALA = "\U0001f1ec\U0001f1f9" +FLAG_GUAM = "\U0001f1ec\U0001f1fa" +FLAG_GUINEA_BISSAU = "\U0001f1ec\U0001f1fc" +FLAG_GUYANA = "\U0001f1ec\U0001f1fe" +FLAG_HONG_KONG_SAR_CHINA = "\U0001f1ed\U0001f1f0" +FLAG_HEARD_ANDAMP_MCDONALD_ISLANDS = "\U0001f1ed\U0001f1f2" +FLAG_HONDURAS = "\U0001f1ed\U0001f1f3" +FLAG_CROATIA = "\U0001f1ed\U0001f1f7" +FLAG_HAITI = "\U0001f1ed\U0001f1f9" +FLAG_HUNGARY = "\U0001f1ed\U0001f1fa" +FLAG_CANARY_ISLANDS = "\U0001f1ee\U0001f1e8" +FLAG_INDONESIA = "\U0001f1ee\U0001f1e9" +FLAG_IRELAND = "\U0001f1ee\U0001f1ea" +FLAG_ISRAEL = "\U0001f1ee\U0001f1f1" +FLAG_ISLE_OF_MAN = "\U0001f1ee\U0001f1f2" +FLAG_INDIA = "\U0001f1ee\U0001f1f3" +FLAG_BRITISH_INDIAN_OCEAN_TERRITORY = "\U0001f1ee\U0001f1f4" +FLAG_IRAQ = "\U0001f1ee\U0001f1f6" +FLAG_IRAN = "\U0001f1ee\U0001f1f7" +FLAG_ICELAND = "\U0001f1ee\U0001f1f8" +FLAG_ITALY = "\U0001f1ee\U0001f1f9" +FLAG_JERSEY = "\U0001f1ef\U0001f1ea" +FLAG_JAMAICA = "\U0001f1ef\U0001f1f2" +FLAG_JORDAN = "\U0001f1ef\U0001f1f4" +FLAG_JAPAN = "\U0001f1ef\U0001f1f5" +FLAG_KENYA = "\U0001f1f0\U0001f1ea" +FLAG_KYRGYZSTAN = "\U0001f1f0\U0001f1ec" +FLAG_CAMBODIA = "\U0001f1f0\U0001f1ed" +FLAG_KIRIBATI = "\U0001f1f0\U0001f1ee" +FLAG_COMOROS = "\U0001f1f0\U0001f1f2" +FLAG_ST_KITTS_ANDAMP_NEVIS = "\U0001f1f0\U0001f1f3" +FLAG_NORTH_KOREA = "\U0001f1f0\U0001f1f5" +FLAG_SOUTH_KOREA = "\U0001f1f0\U0001f1f7" +FLAG_KUWAIT = "\U0001f1f0\U0001f1fc" +FLAG_CAYMAN_ISLANDS = "\U0001f1f0\U0001f1fe" +FLAG_KAZAKHSTAN = "\U0001f1f0\U0001f1ff" +FLAG_LAOS = "\U0001f1f1\U0001f1e6" +FLAG_LEBANON = "\U0001f1f1\U0001f1e7" +FLAG_ST_LUCIA = "\U0001f1f1\U0001f1e8" +FLAG_LIECHTENSTEIN = "\U0001f1f1\U0001f1ee" +FLAG_SRI_LANKA = "\U0001f1f1\U0001f1f0" +FLAG_LIBERIA = "\U0001f1f1\U0001f1f7" +FLAG_LESOTHO = "\U0001f1f1\U0001f1f8" +FLAG_LITHUANIA = "\U0001f1f1\U0001f1f9" +FLAG_LUXEMBOURG = "\U0001f1f1\U0001f1fa" +FLAG_LATVIA = "\U0001f1f1\U0001f1fb" +FLAG_LIBYA = "\U0001f1f1\U0001f1fe" +FLAG_MOROCCO = "\U0001f1f2\U0001f1e6" +FLAG_MONACO = "\U0001f1f2\U0001f1e8" +FLAG_MOLDOVA = "\U0001f1f2\U0001f1e9" +FLAG_MONTENEGRO = "\U0001f1f2\U0001f1ea" +FLAG_ST_MARTIN = "\U0001f1f2\U0001f1eb" +FLAG_MADAGASCAR = "\U0001f1f2\U0001f1ec" +FLAG_MARSHALL_ISLANDS = "\U0001f1f2\U0001f1ed" +FLAG_NORTH_MACEDONIA = "\U0001f1f2\U0001f1f0" +FLAG_MALI = "\U0001f1f2\U0001f1f1" +FLAG_MYANMAR_BURMA = "\U0001f1f2\U0001f1f2" +FLAG_MONGOLIA = "\U0001f1f2\U0001f1f3" +FLAG_MACAO_SAR_CHINA = "\U0001f1f2\U0001f1f4" +FLAG_NORTHERN_MARIANA_ISLANDS = "\U0001f1f2\U0001f1f5" +FLAG_MARTINIQUE = "\U0001f1f2\U0001f1f6" +FLAG_MAURITANIA = "\U0001f1f2\U0001f1f7" +FLAG_MONTSERRAT = "\U0001f1f2\U0001f1f8" +FLAG_MALTA = "\U0001f1f2\U0001f1f9" +FLAG_MAURITIUS = "\U0001f1f2\U0001f1fa" +FLAG_MALDIVES = "\U0001f1f2\U0001f1fb" +FLAG_MALAWI = "\U0001f1f2\U0001f1fc" +FLAG_MEXICO = "\U0001f1f2\U0001f1fd" +FLAG_MALAYSIA = "\U0001f1f2\U0001f1fe" +FLAG_MOZAMBIQUE = "\U0001f1f2\U0001f1ff" +FLAG_NAMIBIA = "\U0001f1f3\U0001f1e6" +FLAG_NEW_CALEDONIA = "\U0001f1f3\U0001f1e8" +FLAG_NIGER = "\U0001f1f3\U0001f1ea" +FLAG_NORFOLK_ISLAND = "\U0001f1f3\U0001f1eb" +FLAG_NIGERIA = "\U0001f1f3\U0001f1ec" +FLAG_NICARAGUA = "\U0001f1f3\U0001f1ee" +FLAG_NETHERLANDS = "\U0001f1f3\U0001f1f1" +FLAG_NORWAY = "\U0001f1f3\U0001f1f4" +FLAG_NEPAL = "\U0001f1f3\U0001f1f5" +FLAG_NAURU = "\U0001f1f3\U0001f1f7" +FLAG_NIUE = "\U0001f1f3\U0001f1fa" +FLAG_NEW_ZEALAND = "\U0001f1f3\U0001f1ff" +FLAG_OMAN = "\U0001f1f4\U0001f1f2" +FLAG_PANAMA = "\U0001f1f5\U0001f1e6" +FLAG_PERU = "\U0001f1f5\U0001f1ea" +FLAG_FRENCH_POLYNESIA = "\U0001f1f5\U0001f1eb" +FLAG_PAPUA_NEW_GUINEA = "\U0001f1f5\U0001f1ec" +FLAG_PHILIPPINES = "\U0001f1f5\U0001f1ed" +FLAG_PAKISTAN = "\U0001f1f5\U0001f1f0" +FLAG_POLAND = "\U0001f1f5\U0001f1f1" +FLAG_ST_PIERRE_ANDAMP_MIQUELON = "\U0001f1f5\U0001f1f2" +FLAG_PITCAIRN_ISLANDS = "\U0001f1f5\U0001f1f3" +FLAG_PUERTO_RICO = "\U0001f1f5\U0001f1f7" +FLAG_PALESTINIAN_TERRITORIES = "\U0001f1f5\U0001f1f8" +FLAG_PORTUGAL = "\U0001f1f5\U0001f1f9" +FLAG_PALAU = "\U0001f1f5\U0001f1fc" +FLAG_PARAGUAY = "\U0001f1f5\U0001f1fe" +FLAG_QATAR = "\U0001f1f6\U0001f1e6" +FLAG_REUNION = "\U0001f1f7\U0001f1ea" +FLAG_ROMANIA = "\U0001f1f7\U0001f1f4" +FLAG_SERBIA = "\U0001f1f7\U0001f1f8" +FLAG_RUSSIA = "\U0001f1f7\U0001f1fa" +FLAG_RWANDA = "\U0001f1f7\U0001f1fc" +FLAG_SAUDI_ARABIA = "\U0001f1f8\U0001f1e6" +FLAG_SOLOMON_ISLANDS = "\U0001f1f8\U0001f1e7" +FLAG_SEYCHELLES = "\U0001f1f8\U0001f1e8" +FLAG_SUDAN = "\U0001f1f8\U0001f1e9" +FLAG_SWEDEN = "\U0001f1f8\U0001f1ea" +FLAG_SINGAPORE = "\U0001f1f8\U0001f1ec" +FLAG_ST_HELENA = "\U0001f1f8\U0001f1ed" +FLAG_SLOVENIA = "\U0001f1f8\U0001f1ee" +FLAG_SVALBARD_ANDAMP_JAN_MAYEN = "\U0001f1f8\U0001f1ef" +FLAG_SLOVAKIA = "\U0001f1f8\U0001f1f0" +FLAG_SIERRA_LEONE = "\U0001f1f8\U0001f1f1" +FLAG_SAN_MARINO = "\U0001f1f8\U0001f1f2" +FLAG_SENEGAL = "\U0001f1f8\U0001f1f3" +FLAG_SOMALIA = "\U0001f1f8\U0001f1f4" +FLAG_SURINAME = "\U0001f1f8\U0001f1f7" +FLAG_SOUTH_SUDAN = "\U0001f1f8\U0001f1f8" +FLAG_SAO_TOME_ANDAMP_PRINCIPE = "\U0001f1f8\U0001f1f9" +FLAG_EL_SALVADOR = "\U0001f1f8\U0001f1fb" +FLAG_SINT_MAARTEN = "\U0001f1f8\U0001f1fd" +FLAG_SYRIA = "\U0001f1f8\U0001f1fe" +FLAG_ESWATINI = "\U0001f1f8\U0001f1ff" +FLAG_TRISTAN_DA_CUNHA = "\U0001f1f9\U0001f1e6" +FLAG_TURKS_ANDAMP_CAICOS_ISLANDS = "\U0001f1f9\U0001f1e8" +FLAG_CHAD = "\U0001f1f9\U0001f1e9" +FLAG_FRENCH_SOUTHERN_TERRITORIES = "\U0001f1f9\U0001f1eb" +FLAG_TOGO = "\U0001f1f9\U0001f1ec" +FLAG_THAILAND = "\U0001f1f9\U0001f1ed" +FLAG_TAJIKISTAN = "\U0001f1f9\U0001f1ef" +FLAG_TOKELAU = "\U0001f1f9\U0001f1f0" +FLAG_TIMOR_LESTE = "\U0001f1f9\U0001f1f1" +FLAG_TURKMENISTAN = "\U0001f1f9\U0001f1f2" +FLAG_TUNISIA = "\U0001f1f9\U0001f1f3" +FLAG_TONGA = "\U0001f1f9\U0001f1f4" +FLAG_TURKEY = "\U0001f1f9\U0001f1f7" +FLAG_TRINIDAD_ANDAMP_TOBAGO = "\U0001f1f9\U0001f1f9" +FLAG_TUVALU = "\U0001f1f9\U0001f1fb" +FLAG_TAIWAN = "\U0001f1f9\U0001f1fc" +FLAG_TANZANIA = "\U0001f1f9\U0001f1ff" +FLAG_UKRAINE = "\U0001f1fa\U0001f1e6" +FLAG_UGANDA = "\U0001f1fa\U0001f1ec" +FLAG_U_S_OUTLYING_ISLANDS = "\U0001f1fa\U0001f1f2" +FLAG_UNITED_NATIONS = "\U0001f1fa\U0001f1f3" +FLAG_UNITED_STATES = "\U0001f1fa\U0001f1f8" +FLAG_URUGUAY = "\U0001f1fa\U0001f1fe" +FLAG_UZBEKISTAN = "\U0001f1fa\U0001f1ff" +FLAG_VATICAN_CITY = "\U0001f1fb\U0001f1e6" +FLAG_ST_VINCENT_ANDAMP_GRENADINES = "\U0001f1fb\U0001f1e8" +FLAG_VENEZUELA = "\U0001f1fb\U0001f1ea" +FLAG_BRITISH_VIRGIN_ISLANDS = "\U0001f1fb\U0001f1ec" +FLAG_U_S_VIRGIN_ISLANDS = "\U0001f1fb\U0001f1ee" +FLAG_VIETNAM = "\U0001f1fb\U0001f1f3" +FLAG_VANUATU = "\U0001f1fb\U0001f1fa" +FLAG_WALLIS_ANDAMP_FUTUNA = "\U0001f1fc\U0001f1eb" +FLAG_SAMOA = "\U0001f1fc\U0001f1f8" +FLAG_KOSOVO = "\U0001f1fd\U0001f1f0" +FLAG_YEMEN = "\U0001f1fe\U0001f1ea" +FLAG_MAYOTTE = "\U0001f1fe\U0001f1f9" +FLAG_SOUTH_AFRICA = "\U0001f1ff\U0001f1e6" +FLAG_ZAMBIA = "\U0001f1ff\U0001f1f2" +FLAG_ZIMBABWE = "\U0001f1ff\U0001f1fc" +FLAG_ENGLAND = "\U0001f3f4\U000e0067\U000e0062\U000e0065\U000e006e\U000e0067\U000e007f" +FLAG_SCOTLAND = "\U0001f3f4\U000e0067\U000e0062\U000e0073\U000e0063\U000e0074\U000e007f" +FLAG_WALES = "\U0001f3f4\U000e0067\U000e0062\U000e0077\U000e006c\U000e0073\U000e007f" +REGIONAL_INDICATOR_SYMBOL_LETTER_A = "\U0001f1e6" +REGIONAL_INDICATOR_SYMBOL_LETTER_B = "\U0001f1e7" +REGIONAL_INDICATOR_SYMBOL_LETTER_C = "\U0001f1e8" +REGIONAL_INDICATOR_SYMBOL_LETTER_D = "\U0001f1e9" +REGIONAL_INDICATOR_SYMBOL_LETTER_E = "\U0001f1ea" +REGIONAL_INDICATOR_SYMBOL_LETTER_F = "\U0001f1eb" +REGIONAL_INDICATOR_SYMBOL_LETTER_G = "\U0001f1ec" +REGIONAL_INDICATOR_SYMBOL_LETTER_H = "\U0001f1ed" +REGIONAL_INDICATOR_SYMBOL_LETTER_I = "\U0001f1ee" +REGIONAL_INDICATOR_SYMBOL_LETTER_J = "\U0001f1ef" +REGIONAL_INDICATOR_SYMBOL_LETTER_K = "\U0001f1f0" +REGIONAL_INDICATOR_SYMBOL_LETTER_L = "\U0001f1f1" +REGIONAL_INDICATOR_SYMBOL_LETTER_M = "\U0001f1f2" +REGIONAL_INDICATOR_SYMBOL_LETTER_N = "\U0001f1f3" +REGIONAL_INDICATOR_SYMBOL_LETTER_O = "\U0001f1f4" +REGIONAL_INDICATOR_SYMBOL_LETTER_P = "\U0001f1f5" +REGIONAL_INDICATOR_SYMBOL_LETTER_Q = "\U0001f1f6" +REGIONAL_INDICATOR_SYMBOL_LETTER_R = "\U0001f1f7" +REGIONAL_INDICATOR_SYMBOL_LETTER_S = "\U0001f1f8" +REGIONAL_INDICATOR_SYMBOL_LETTER_T = "\U0001f1f9" +REGIONAL_INDICATOR_SYMBOL_LETTER_U = "\U0001f1fa" +REGIONAL_INDICATOR_SYMBOL_LETTER_V = "\U0001f1fb" +REGIONAL_INDICATOR_SYMBOL_LETTER_W = "\U0001f1fc" +REGIONAL_INDICATOR_SYMBOL_LETTER_X = "\U0001f1fd" +REGIONAL_INDICATOR_SYMBOL_LETTER_Y = "\U0001f1fe" +REGIONAL_INDICATOR_SYMBOL_LETTER_Z = "\U0001f1ff" +TAG_RIGHT_CURLY_BRACKET = "\U000e007d" +DIGIT_FIVE = "5\ufe0f" +TAG_LATIN_CAPITAL_LETTER_U = "\U000e0055" +TAG_LATIN_CAPITAL_LETTER_Q = "\U000e0051" +TAG_LATIN_CAPITAL_LETTER_K = "\U000e004b" +COMBINING_ENCLOSING_KEYCAP = "\u20e3" +TAG_LATIN_CAPITAL_LETTER_C = "\U000e0043" +TAG_ASTERISK = "\U000e002a" +TAG_FULL_STOP = "\U000e002e" +TAG_CIRCUMFLEX_ACCENT = "\U000e005e" +DIGIT_ONE = "1\ufe0f" +TAG_COMMA = "\U000e002c" +DIGIT_ZERO = "0\ufe0f" +TAG_EQUALS_SIGN = "\U000e003d" +TAG_LATIN_CAPITAL_LETTER_O = "\U000e004f" +TAG_COMMERCIAL_AT = "\U000e0040" +DIGIT_EIGHT = "8\ufe0f" +TAG_NUMBER_SIGN = "\U000e0023" +TAG_LATIN_CAPITAL_LETTER_T = "\U000e0054" +TAG_LATIN_CAPITAL_LETTER_N = "\U000e004e" +DIGIT_SIX = "6\ufe0f" +TAG_PERCENT_SIGN = "\U000e0025" +VARIATION_SELECTOR_16 = "\ufe0f" +TAG_LATIN_CAPITAL_LETTER_W = "\U000e0057" +TAG_DOLLAR_SIGN = "\U000e0024" +TAG_LOW_LINE = "\U000e005f" +TAG_DIGIT_EIGHT = "\U000e0038" +TAG_LATIN_CAPITAL_LETTER_M = "\U000e004d" +TAG_LATIN_CAPITAL_LETTER_A = "\U000e0041" +TAG_REVERSE_SOLIDUS = "\U000e005c" +TAG_SOLIDUS = "\U000e002f" +TAG_LATIN_CAPITAL_LETTER_H = "\U000e0048" +TAG_DIGIT_NINE = "\U000e0039" +TAG_LEFT_CURLY_BRACKET = "\U000e007b" +TAG_LATIN_CAPITAL_LETTER_E = "\U000e0045" +TAG_LATIN_SMALL_LETTER_W = "\U000e0077" +TAG_DIGIT_ZERO = "\U000e0030" +TAG_LATIN_CAPITAL_LETTER_B = "\U000e0042" +TAG_LATIN_CAPITAL_LETTER_F = "\U000e0046" +TAG_LATIN_CAPITAL_LETTER_Y = "\U000e0059" +TAG_TILDE = "\U000e007e" +TAG_LATIN_SMALL_LETTER_P = "\U000e0070" +TAG_LATIN_CAPITAL_LETTER_Z = "\U000e005a" +TAG_GREATER_THAN_SIGN = "\U000e003e" +TAG_LATIN_SMALL_LETTER_S = "\U000e0073" +TAG_LATIN_SMALL_LETTER_G = "\U000e0067" +TAG_APOSTROPHE = "\U000e0027" +TAG_RIGHT_PARENTHESIS = "\U000e0029" +TAG_DIGIT_THREE = "\U000e0033" +TAG_LEFT_PARENTHESIS = "\U000e0028" +TAG_DIGIT_SEVEN = "\U000e0037" +TAG_LATIN_SMALL_LETTER_O = "\U000e006f" +TAG_DIGIT_SIX = "\U000e0036" +TAG_DIGIT_TWO = "\U000e0032" +TAG_LATIN_SMALL_LETTER_F = "\U000e0066" +TAG_LATIN_SMALL_LETTER_K = "\U000e006b" +TAG_LATIN_SMALL_LETTER_Y = "\U000e0079" +TAG_SPACE = "\U000e0020" +TAG_LATIN_SMALL_LETTER_I = "\U000e0069" +DIGIT_TWO = "2\ufe0f" +TAG_DIGIT_ONE = "\U000e0031" +TAG_RIGHT_SQUARE_BRACKET = "\U000e005d" +TAG_LATIN_SMALL_LETTER_R = "\U000e0072" +HASH_SIGN = "#\ufe0f" +TAG_SEMICOLON = "\U000e003b" +TAG_LATIN_CAPITAL_LETTER_L = "\U000e004c" +TAG_HYPHEN_MINUS = "\U000e002d" +ASTERISK = "*\ufe0f" +TAG_LATIN_SMALL_LETTER_A = "\U000e0061" +TAG_EXCLAMATION_MARK = "\U000e0021" +TAG_LATIN_CAPITAL_LETTER_V = "\U000e0056" +TAG_LATIN_SMALL_LETTER_C = "\U000e0063" +TAG_GRAVE_ACCENT = "\U000e0060" +ZERO_WIDTH_JOINER = "\u200d" +TAG_LATIN_CAPITAL_LETTER_G = "\U000e0047" +DIGIT_NINE = "9\ufe0f" +TAG_VERTICAL_LINE = "\U000e007c" +TAG_LATIN_SMALL_LETTER_Z = "\U000e007a" +TAG_LATIN_CAPITAL_LETTER_X = "\U000e0058" +TAG_LATIN_SMALL_LETTER_J = "\U000e006a" +TAG_LATIN_CAPITAL_LETTER_P = "\U000e0050" +TAG_AMPERSAND = "\U000e0026" +TAG_LATIN_SMALL_LETTER_L = "\U000e006c" +TAG_LATIN_SMALL_LETTER_X = "\U000e0078" +DIGIT_SEVEN = "7\ufe0f" +TAG_LATIN_CAPITAL_LETTER_J = "\U000e004a" +TAG_LATIN_SMALL_LETTER_T = "\U000e0074" +TAG_QUESTION_MARK = "\U000e003f" +TAG_LATIN_SMALL_LETTER_B = "\U000e0062" +TAG_LEFT_SQUARE_BRACKET = "\U000e005b" +TAG_LATIN_SMALL_LETTER_D = "\U000e0064" +TAG_LATIN_SMALL_LETTER_E = "\U000e0065" +TAG_LATIN_SMALL_LETTER_M = "\U000e006d" +TAG_LESS_THAN_SIGN = "\U000e003c" +TAG_DIGIT_FIVE = "\U000e0035" +TAG_LATIN_CAPITAL_LETTER_D = "\U000e0044" +TAG_LATIN_SMALL_LETTER_N = "\U000e006e" +TAG_PLUS_SIGN = "\U000e002b" +TAG_COLON = "\U000e003a" +DIGIT_THREE = "3\ufe0f" +TAG_LATIN_SMALL_LETTER_Q = "\U000e0071" +TAG_LATIN_CAPITAL_LETTER_R = "\U000e0052" +TAG_LATIN_CAPITAL_LETTER_S = "\U000e0053" +DIGIT_FOUR = "4\ufe0f" +TAG_LATIN_CAPITAL_LETTER_I = "\U000e0049" +TAG_QUOTATION_MARK = "\U000e0022" +CANCEL_TAG = "\U000e007f" +TAG_LATIN_SMALL_LETTER_V = "\U000e0076" +TAG_LATIN_SMALL_LETTER_H = "\U000e0068" +TAG_LATIN_SMALL_LETTER_U = "\U000e0075" +TAG_DIGIT_FOUR = "\U000e0034" diff --git a/pyrogram/enums/__init__.py b/pyrogram/enums/__init__.py new file mode 100644 index 0000000000..f0a5ad4dce --- /dev/null +++ b/pyrogram/enums/__init__.py @@ -0,0 +1,55 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 .chat_action import ChatAction +from .chat_event_action import ChatEventAction +from .chat_member_status import ChatMemberStatus +from .chat_members_filter import ChatMembersFilter +from .chat_type import ChatType +from .message_entity_type import MessageEntityType +from .message_media_type import MessageMediaType +from .message_service_type import MessageServiceType +from .messages_filter import MessagesFilter +from .next_code_type import NextCodeType +from .parse_mode import ParseMode +from .poll_type import PollType +from .sent_code_type import SentCodeType +from .user_status import UserStatus +from .client_platform import ClientPlatform +from .accent_color import AccentColor +from .profile_color import ProfileColor + +__all__ = [ + 'ChatAction', + 'ChatEventAction', + 'ChatMemberStatus', + 'ChatMembersFilter', + 'ChatType', + 'MessageEntityType', + 'MessageMediaType', + 'MessageServiceType', + 'MessagesFilter', + 'NextCodeType', + 'ParseMode', + 'PollType', + 'SentCodeType', + 'UserStatus', + 'ClientPlatform', + 'AccentColor', + 'ProfileColor', +] diff --git a/pyrogram/enums/accent_color.py b/pyrogram/enums/accent_color.py new file mode 100644 index 0000000000..a33dd48db9 --- /dev/null +++ b/pyrogram/enums/accent_color.py @@ -0,0 +1,97 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 .auto_name import AutoName + + +class AccentColor(AutoName): + """Accent color enumeration used in :obj:`~pyrogram.types.ChatColor`. + + `More about accent colors. `_ + """ + + RED = 0 + "Red color." + + ORANGE = 1 + "Orange color." + + VIOLET = 2 + "Violet color." + + GREEN = 3 + "Green color." + + CYAN = 4 + "Cyan color." + + BLUE = 5 + "Blue color." + + PINK = 6 + "Pink color." + + RED_DARK_RED = 7 + "Red color with dark red stripes." + + ORANGE_DARK_ORANGE = 8 + "Orange color with dark orange stripes." + + VIOLET_DARK_VIOLET = 9 + "Violet color with dark violet stripes." + + GREEN_DARK_GREEN = 10 + "Green color with dark green stripes." + + CYAN_DARK_CYAN = 11 + "Cyan color with dark cyan stripes." + + BLUE_DARK_BLUE = 12 + "Blue color with dark blue stripes." + + PINK_DARK_PINK = 13 + "Pink color with dark pink stripes." + + BLUE_WHITE_RED = 14 + "Blue color with white and red stripes." + + ORANGE_WHITE_GREEN = 15 + "Orange color with white and green stripes." + + GREEN_WHITE_RED = 16 + "Green color with white and red stripes." + + CYAN_WHITE_GREEN = 17 + "Cyan color with white and red green." + + CYAN_YELLOW_PINK = 18 + "Cyan color with yellow and pink stripes." + + VIOLET_YELLOW_ORANGE = 19 + "Violet color with yellow and orange stripes." + + BLUE_WHITE_ORANGE = 20 + "Blue color with white and orange stripes." + + UNKNOWN_DYNAMIC = 21 + """Secret color that cannot be set. + + For now: + Red - If you use Telegram desktop. + Blue - If you are using Telegram android/ios. + """ diff --git a/pyrogram/enums/auto_name.py b/pyrogram/enums/auto_name.py new file mode 100644 index 0000000000..b43fa74180 --- /dev/null +++ b/pyrogram/enums/auto_name.py @@ -0,0 +1,27 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 + + +class AutoName(Enum): + def _generate_next_value_(self, *args): + return self.lower() + + def __repr__(self): + return f"pyrogram.enums.{self}" diff --git a/pyrogram/enums/chat_action.py b/pyrogram/enums/chat_action.py new file mode 100644 index 0000000000..68c60a3056 --- /dev/null +++ b/pyrogram/enums/chat_action.py @@ -0,0 +1,78 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 import raw +from .auto_name import AutoName + + +class ChatAction(AutoName): + """Chat action enumeration used in :obj:`~pyrogram.types.ChatEvent`.""" + + CANCEL = raw.types.SendMessageCancelAction + "Cancel ongoing chat action" + + TYPING = raw.types.SendMessageTypingAction + "Typing text message" + + UPLOAD_PHOTO = raw.types.SendMessageUploadPhotoAction + "Uploading photo" + + RECORD_VIDEO = raw.types.SendMessageRecordVideoAction + "Recording video" + + UPLOAD_VIDEO = raw.types.SendMessageUploadVideoAction + "Uploading video" + + RECORD_AUDIO = raw.types.SendMessageRecordAudioAction + "Recording voice" + + UPLOAD_AUDIO = raw.types.SendMessageUploadAudioAction + "Uploading voice" + + UPLOAD_DOCUMENT = raw.types.SendMessageUploadDocumentAction + "Uploading document" + + CHOOSE_STICKER = raw.types.SendMessageChooseStickerAction + "Choosing sticker" + + FIND_LOCATION = raw.types.SendMessageGeoLocationAction + "Finding location" + + RECORD_VIDEO_NOTE = raw.types.SendMessageRecordRoundAction + "Recording video note" + + UPLOAD_VIDEO_NOTE = raw.types.SendMessageUploadRoundAction + "Uploading video note" + + PLAYING = raw.types.SendMessageGamePlayAction + "Playing game" + + CHOOSE_CONTACT = raw.types.SendMessageChooseContactAction + "Choosing contact" + + SPEAKING = raw.types.SpeakingInGroupCallAction + "Speaking in group call" + + IMPORT_HISTORY = raw.types.SendMessageHistoryImportAction + "Importing history" + + TRIGGER_EMOJI_ANIMATION = raw.types.SendMessageEmojiInteraction + "User has clicked on an animated emoji triggering a `reaction `_" + + WATCH_EMOJI_ANIMATION = raw.types.SendMessageEmojiInteractionSeen + "The user is watching animations sent by the other party by clicking on an animated emoji" diff --git a/pyrogram/enums/chat_event_action.py b/pyrogram/enums/chat_event_action.py new file mode 100644 index 0000000000..7a5954720f --- /dev/null +++ b/pyrogram/enums/chat_event_action.py @@ -0,0 +1,127 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from .auto_name import AutoName + + +class ChatEventAction(AutoName): + """Chat event action enumeration used in :meth:`~pyrogram.Client.get_chat_event_log`.""" + + DESCRIPTION_CHANGED = auto() + "The chat description has been changed (see ``old_description`` and ``new_description``)" + + HISTORY_TTL_CHANGED = auto() + "The history time-to-live has been changed (see ``old_history_ttl`` and ``new_history_ttl``)" + + LINKED_CHAT_CHANGED = auto() + "The linked chat has been changed (see ``old_linked_chat`` and ``new_linked_chat``)" + + # LOCATION_CHANGED = auto() + "" + + PHOTO_CHANGED = auto() + "The chat photo has been changed (see ``old_photo`` and ``new_photo``)" + + # STICKER_SET_CHANGED = auto() + "" + + TITLE_CHANGED = auto() + "the chat title has been changed (see ``old_title`` and ``new_title``)" + + USERNAME_CHANGED = auto() + "the chat username has been changed (see ``old_username`` and ``new_username``)" + + CHAT_PERMISSIONS_CHANGED = auto() + "the default chat permissions has been changed (see ``old_chat_permissions`` and ``new_chat_permissions``)" + + MESSAGE_DELETED = auto() + "a message has been deleted (see ``deleted_message``)" + + # VOICE_CHAT_DISCARDED = auto() + "" + + MESSAGE_EDITED = auto() + "a message has been edited (see ``old_message`` and ``new_message``)" + + INVITE_LINK_EDITED = auto() + "An invite link has been edited (see ``old_invite_link`` and ``new_invite`` link)" + + INVITE_LINK_REVOKED = auto() + "An invite link has been revoked (see ``revoked_invite_link``)" + + INVITE_LINK_DELETED = auto() + "An invite link has been deleted (see ``deleted_invite_link``)" + + MEMBER_INVITED = auto() + "a member has been invited by someone (see ``invited_member``)" + + MEMBER_JOINED = auto() + "a member joined by themselves. (see ``user``)" + + # MEMBER_JOINED_BY_LINK = auto() + "" + + MEMBER_LEFT = auto() + "a member left by themselves. (see ``user``)" + + # MEMBER_MUTED = auto() + "" + + ADMINISTRATOR_PRIVILEGES_CHANGED = auto() + "a chat member has been promoted/demoted or their administrator privileges has changed (see ``old_administrator_privileges`` and ``new_administrator_privileges``)" + + MEMBER_PERMISSIONS_CHANGED = auto() + "a chat member has been restricted/unrestricted or banned/unbanned, or their permissions has changed (see ``old_member_permissions`` and ``new_member_permissions``)" + + # MEMBER_UNMUTED = auto() + "" + + # MEMBER_VOLUME_CHANGED = auto() + "" + + # VIDEO_CHAT_STARTED = auto() + "" + + POLL_STOPPED = auto() + "a poll has been stopped (see ``stopped_poll``)" + + # VOICE_CHAT_SETTINGS_CHANGED = auto() + "" + + INVITES_ENABLED = auto() + "the chat invitation has been enabled or disabled (see ``invites_enabled``)" + + HISTORY_HIDDEN = auto() + "the chat history has been hidden or unhidden (see ``history_hidden``)" + + SIGNATURES_ENABLED = auto() + "the message signatures have been enabled or disabled (see ``signatures_enabled``)" + + SLOW_MODE_CHANGED = auto() + "the slow mode has been changes (see ``old_slow_mode`` and ``new_slow_mode``)" + + MESSAGE_PINNED = auto() + "a message has been pinned (see ``pinned_message``)" + + MESSAGE_UNPINNED = auto() + "a message has been unpinned (see ``unpinned_message``)" + + UNKNOWN = auto() + "Unknown chat event action" diff --git a/pyrogram/enums/chat_member_status.py b/pyrogram/enums/chat_member_status.py new file mode 100644 index 0000000000..7eedff8b84 --- /dev/null +++ b/pyrogram/enums/chat_member_status.py @@ -0,0 +1,43 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from .auto_name import AutoName + + +class ChatMemberStatus(AutoName): + """Chat member status enumeration used in :obj:`~pyrogram.types.ChatMember`.""" + + OWNER = auto() # TODO: rename to 'creator' + "Chat owner" + + ADMINISTRATOR = auto() + "Chat administrator" + + MEMBER = auto() + "Chat member" + + RESTRICTED = auto() + "Restricted chat member" + + LEFT = auto() + "Left chat member" + + BANNED = auto() # TODO: rename to 'kicked' + "Banned chat member" diff --git a/pyrogram/enums/chat_members_filter.py b/pyrogram/enums/chat_members_filter.py new file mode 100644 index 0000000000..bf0e7ef358 --- /dev/null +++ b/pyrogram/enums/chat_members_filter.py @@ -0,0 +1,42 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 import raw +from .auto_name import AutoName + + +class ChatMembersFilter(AutoName): + """Chat members filter enumeration used in :meth:`~pyrogram.Client.get_chat_members`""" + + SEARCH = raw.types.ChannelParticipantsSearch + "Search for members" + + BANNED = raw.types.ChannelParticipantsKicked + "Banned members" + + RESTRICTED = raw.types.ChannelParticipantsBanned + "Restricted members" + + BOTS = raw.types.ChannelParticipantsBots + "Bots" + + RECENT = raw.types.ChannelParticipantsRecent + "Recently active members" + + ADMINISTRATORS = raw.types.ChannelParticipantsAdmins + "Administrators" diff --git a/pyrogram/enums/chat_type.py b/pyrogram/enums/chat_type.py new file mode 100644 index 0000000000..5750e16d7c --- /dev/null +++ b/pyrogram/enums/chat_type.py @@ -0,0 +1,40 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from .auto_name import AutoName + + +class ChatType(AutoName): + """Chat type enumeration used in :obj:`~pyrogram.types.Chat`.""" + + PRIVATE = auto() + "Chat is a private chat with a user" + + BOT = auto() + "Chat is a private chat with a bot" + + GROUP = auto() + "Chat is a basic group" + + SUPERGROUP = auto() + "Chat is a supergroup" + + CHANNEL = auto() + "Chat is a channel" diff --git a/pyrogram/enums/client_platform.py b/pyrogram/enums/client_platform.py new file mode 100644 index 0000000000..3d392e0ee0 --- /dev/null +++ b/pyrogram/enums/client_platform.py @@ -0,0 +1,49 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from .auto_name import AutoName + + +class ClientPlatform(AutoName): + """Valid platforms for a :obj:`~pyrogram.Client`.""" + + ANDROID = auto() + "Android" + + IOS = auto() + "iOS" + + WP = auto() + "Windows Phone" + + BB = auto() + "Blackberry" + + DESKTOP = auto() + "Desktop" + + WEB = auto() + "Web" + + UBP = auto() + "Ubuntu Phone" + + OTHER = auto() + "Other" diff --git a/pyrogram/enums/message_entity_type.py b/pyrogram/enums/message_entity_type.py new file mode 100644 index 0000000000..13398a4908 --- /dev/null +++ b/pyrogram/enums/message_entity_type.py @@ -0,0 +1,90 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from pyrogram import raw + +from .auto_name import AutoName + + +class MessageEntityType(AutoName): + """Message entity type enumeration used in :obj:`~pyrogram.types.MessageEntity`.""" + + MENTION = raw.types.MessageEntityMention + "``@username``" + + HASHTAG = raw.types.MessageEntityHashtag + "``#hashtag``" + + CASHTAG = raw.types.MessageEntityCashtag + "``$USD``" + + BOT_COMMAND = raw.types.MessageEntityBotCommand + "``/start@pyrogrambot``" + + URL = raw.types.MessageEntityUrl + "``https://pyrogram.org`` (see ``url``)" + + EMAIL = raw.types.MessageEntityEmail + "``do-not-reply@pyrogram.org``" + + PHONE_NUMBER = raw.types.MessageEntityPhone + "``+1-123-456-7890``" + + BOLD = raw.types.MessageEntityBold + "Bold text" + + ITALIC = raw.types.MessageEntityItalic + "Italic text" + + UNDERLINE = raw.types.MessageEntityUnderline + "Underlined text" + + STRIKETHROUGH = raw.types.MessageEntityStrike + "Strikethrough text" + + SPOILER = raw.types.MessageEntitySpoiler + "Spoiler text" + + BLOCKQUOTE = auto() + "Block quotation" + + EXPANDABLE_BLOCKQUOTE = auto() + "collapsed-by-default block quotation" + + CODE = raw.types.MessageEntityCode + "Monowidth string" + + PRE = raw.types.MessageEntityPre + "Monowidth block (see ``language``)" + + TEXT_LINK = raw.types.MessageEntityTextUrl + "For clickable text URLs" + + TEXT_MENTION = raw.types.MessageEntityMentionName + "for users without usernames (see ``user``)" + + BANK_CARD = raw.types.MessageEntityBankCard + "Bank card text" + + CUSTOM_EMOJI = raw.types.MessageEntityCustomEmoji + "Custom emoji" + + UNKNOWN = raw.types.MessageEntityUnknown + "Unknown message entity type" diff --git a/pyrogram/enums/message_media_type.py b/pyrogram/enums/message_media_type.py new file mode 100644 index 0000000000..e6073707c1 --- /dev/null +++ b/pyrogram/enums/message_media_type.py @@ -0,0 +1,85 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from .auto_name import AutoName + + +class MessageMediaType(AutoName): + """Message media type enumeration used in :obj:`~pyrogram.types.Message`.""" + + AUDIO = auto() + "Audio media" + + DOCUMENT = auto() + "Document media" + + PHOTO = auto() + "Photo media" + + STICKER = auto() + "Sticker media" + + VIDEO = auto() + "Video media" + + ANIMATION = auto() + "Animation media" + + VOICE = auto() + "Voice media" + + VIDEO_NOTE = auto() + "Video note media" + + CONTACT = auto() + "Contact media" + + LOCATION = auto() + "Location media" + + VENUE = auto() + "Venue media" + + POLL = auto() + "Poll media" + + WEB_PAGE = auto() + "Web page media" + + DICE = auto() + "Dice media" + + GAME = auto() + "Game media" + + STORY = auto() + "Story" + + GIVEAWAY = auto() + "Giveaway" + + GIVEAWAY_WINNERS = auto() + "Giveaway Winners" + + INVOICE = auto() + "Invoice" + + PAID_MEDIA = auto() + "Paid Media" diff --git a/pyrogram/enums/message_service_type.py b/pyrogram/enums/message_service_type.py new file mode 100644 index 0000000000..17e85678f3 --- /dev/null +++ b/pyrogram/enums/message_service_type.py @@ -0,0 +1,130 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from .auto_name import AutoName + + +class MessageServiceType(AutoName): + """Message service type enumeration used in :obj:`~pyrogram.types.Message`.""" + + NEW_CHAT_MEMBERS = auto() + "New members join" + + LEFT_CHAT_MEMBERS = auto() + "Left chat members" + + NEW_CHAT_TITLE = auto() + "New chat title" + + NEW_CHAT_PHOTO = auto() + "New chat photo" + + DELETE_CHAT_PHOTO = auto() + "Deleted chat photo" + + GROUP_CHAT_CREATED = auto() + "Group chat created" + + SUPERGROUP_CHAT_CREATED = auto() + "Supergroup chat created" + + CHANNEL_CHAT_CREATED = auto() + "Channel chat created" + + MIGRATE_TO_CHAT_ID = auto() + "Migrated to chat id" + + MIGRATE_FROM_CHAT_ID = auto() + "Migrated from chat id" + + PINNED_MESSAGE = auto() + "Pinned message" + + GAME_HIGH_SCORE = auto() + "Game high score" + + GIVEAWAY_CREATED = auto() + "Giveaway Created" + + GIVEAWAY_COMPLETED = auto() + "Giveaway Completed" + + GIFT_CODE = auto() + "Gift code" + + GIFTED_PREMIUM = auto() + "Gifted Premium" + + GIFTED_STARS = auto() + "Gifted Stars" + + VIDEO_CHAT_STARTED = auto() + "Video chat started" + + VIDEO_CHAT_ENDED = auto() + "Video chat ended" + + VIDEO_CHAT_SCHEDULED = auto() + "Video chat scheduled" + + VIDEO_CHAT_PARTICIPANTS_INVITED = auto() + "Video chat participants invited" + + WEB_APP_DATA = auto() + "Web app data" + + USERS_SHARED = auto() + "Users Shared" + + CHAT_SHARED = auto() + "Chat Shared" + + MESSAGE_AUTO_DELETE_TIMER_CHANGED = auto() + "Message Auto Delete Timer changed" + + CHAT_BOOST_ADDED = auto() + "Chat Boost Added" + + CUSTOM_ACTION = auto() + "Custom action" + + FORUM_TOPIC_CREATED = auto() + "a new forum topic created in the chat" + + FORUM_TOPIC_CLOSED = auto() + "a new forum topic closed in the chat" + + FORUM_TOPIC_REOPENED = auto() + "a new forum topic reopened in the chat" + + FORUM_TOPIC_EDITED = auto() + "a new forum topic renamed in the chat" + + GENERAL_FORUM_TOPIC_HIDDEN = auto() + "a forum general topic hidden in the chat" + + GENERAL_FORUM_TOPIC_UNHIDDEN = auto() + "a forum general topic unhidden in the chat" + + SUCCESSFUL_PAYMENT = auto() + "Successful payment" + + REFUNDED_PAYMENT = auto() + "Refunded payment" diff --git a/pyrogram/enums/messages_filter.py b/pyrogram/enums/messages_filter.py new file mode 100644 index 0000000000..608ca159d4 --- /dev/null +++ b/pyrogram/enums/messages_filter.py @@ -0,0 +1,75 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 import raw +from .auto_name import AutoName + + +class MessagesFilter(AutoName): + """Messages filter enumeration used in :meth:`~pyrogram.Client.search_messages` and :meth:`~pyrogram.Client.search_global`""" + + EMPTY = raw.types.InputMessagesFilterEmpty + "Empty filter (Filter is absent.)" + + PHOTO = raw.types.InputMessagesFilterPhotos + "Photo messages" + + VIDEO = raw.types.InputMessagesFilterVideo + "Video messages" + + PHOTO_VIDEO = raw.types.InputMessagesFilterPhotoVideo + "Photo and video messages" + + DOCUMENT = raw.types.InputMessagesFilterDocument + "Document messages" + + URL = raw.types.InputMessagesFilterUrl + "Messages containing URLs" + + ANIMATION = raw.types.InputMessagesFilterGif + "Animation messages" + + VOICE_NOTE = raw.types.InputMessagesFilterVoice + "Voice note messages" + + VIDEO_NOTE = raw.types.InputMessagesFilterRoundVideo + "Video note messages" + + VOICE_VIDEO_NOTE = raw.types.InputMessagesFilterRoundVoice + "Voice and video note messages" + + AUDIO = raw.types.InputMessagesFilterMusic + "Audio messages (music)" + + CHAT_PHOTO = raw.types.InputMessagesFilterChatPhotos + "Chat photo messages" + + PHONE_CALL = raw.types.InputMessagesFilterPhoneCalls # TODO + "Phone call messages" + + MENTION = raw.types.InputMessagesFilterMyMentions + "Messages containing mentions" + + LOCATION = raw.types.InputMessagesFilterGeo + "Location messages" + + CONTACT = raw.types.InputMessagesFilterContacts + "Contact messages" + + PINNED = raw.types.InputMessagesFilterPinned + "Pinned messages" diff --git a/pyrogram/enums/next_code_type.py b/pyrogram/enums/next_code_type.py new file mode 100644 index 0000000000..7b3137a7ad --- /dev/null +++ b/pyrogram/enums/next_code_type.py @@ -0,0 +1,39 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 import raw +from .auto_name import AutoName + + +class NextCodeType(AutoName): + """Next code type enumeration used in :obj:`~pyrogram.types.SentCode`.""" + + CALL = raw.types.auth.CodeTypeCall + "The code will be sent via a phone call. A synthesized voice will tell the user which verification code to input." + + FLASH_CALL = raw.types.auth.CodeTypeFlashCall + "The code will be sent via a flash phone call, that will be closed immediately." + + MISSED_CALL = raw.types.auth.CodeTypeMissedCall + "Missed call." + + SMS = raw.types.auth.CodeTypeSms + "The code was sent via SMS." + + FRAGMENT_SMS = raw.types.auth.CodeTypeFragmentSms + "The code was sent via Fragment SMS." diff --git a/pyrogram/enums/parse_mode.py b/pyrogram/enums/parse_mode.py new file mode 100644 index 0000000000..26dc165a25 --- /dev/null +++ b/pyrogram/enums/parse_mode.py @@ -0,0 +1,37 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from .auto_name import AutoName + + +class ParseMode(AutoName): + """Parse mode enumeration used in various places to set a specific parse mode""" + + DEFAULT = auto() + "Default mode. Markdown and HTML combined" + + MARKDOWN = auto() + "Markdown only mode" + + HTML = auto() + "HTML only mode" + + DISABLED = auto() + "Disabled mode" diff --git a/pyrogram/enums/poll_type.py b/pyrogram/enums/poll_type.py new file mode 100644 index 0000000000..384592dee3 --- /dev/null +++ b/pyrogram/enums/poll_type.py @@ -0,0 +1,31 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from .auto_name import AutoName + + +class PollType(AutoName): + """Poll type enumeration used in :obj:`~pyrogram.types.Poll`.""" + + QUIZ = auto() + "Quiz poll" + + REGULAR = auto() + "Regular poll" diff --git a/pyrogram/enums/profile_color.py b/pyrogram/enums/profile_color.py new file mode 100644 index 0000000000..093417137c --- /dev/null +++ b/pyrogram/enums/profile_color.py @@ -0,0 +1,74 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 .auto_name import AutoName + + +class ProfileColor(AutoName): + """Profile color enumeration used in :obj:`~pyrogram.types.ChatColor`. + + `More about profile colors. `_ + """ + + RED = 0 + "Red color." + + ORANGE = 1 + "Orange color." + + VIOLET = 2 + "Violet color." + + GREEN = 3 + "Green color." + + CYAN = 4 + "Cyan color." + + BLUE = 5 + "Blue color." + + PINK = 6 + "Pink color." + + GRAY = 7 + "Gray color." + + RED_LIGHT_RED = 8 + "Red color with light red gradient." + + ORANGE_LIGHT_ORANGE = 9 + "Orange color with light red gradient." + + VIOLET_LIGHT_VIOLET = 10 + "Violet color with light violet gradient." + + GREEN_LIGHT_GREEN = 11 + "Green color with light green gradien." + + CYAN_LIGHT_CYAN = 12 + "Cyan color with light cyan gradient." + + BLUE_LIGHT_BLUE = 13 + "Blue color with light blue gradient." + + PINK_LIGHT_PINK = 14 + "Pink color with light pink gradient." + + GRAY_LIGHT_GRAY = 15 + "Gray color with light gray gradient." diff --git a/pyrogram/enums/sent_code_type.py b/pyrogram/enums/sent_code_type.py new file mode 100644 index 0000000000..56e44b4939 --- /dev/null +++ b/pyrogram/enums/sent_code_type.py @@ -0,0 +1,51 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 import raw +from .auto_name import AutoName + + +class SentCodeType(AutoName): + """Sent code type enumeration used in :obj:`~pyrogram.types.SentCode`.""" + + APP = raw.types.auth.SentCodeTypeApp + "The code was sent through the telegram app." + + CALL = raw.types.auth.SentCodeTypeCall + "The code will be sent via a phone call. A synthesized voice will tell the user which verification code to input." + + FLASH_CALL = raw.types.auth.SentCodeTypeFlashCall + "The code will be sent via a flash phone call, that will be closed immediately." + + MISSED_CALL = raw.types.auth.SentCodeTypeMissedCall + "The code will be sent via a Missed call. User manually enters last digits of the calling phone number." + + SMS = raw.types.auth.SentCodeTypeSms + "The code was sent via SMS." + + FRAGMENT_SMS = raw.types.auth.SentCodeTypeFragmentSms + "The code was sent via Fragment SMS." + + FIREBASE_SMS = raw.types.auth.SentCodeTypeFirebaseSms + "The code should be delivered via SMS after Firebase attestation." + + EMAIL_CODE = raw.types.auth.SentCodeTypeEmailCode + "The code was sent via email." + + SETUP_EMAIL_REQUIRED = raw.types.auth.SentCodeTypeSetUpEmailRequired + "The user should add and verify an email address in order to login." diff --git a/pyrogram/enums/user_status.py b/pyrogram/enums/user_status.py new file mode 100644 index 0000000000..c7c25234cb --- /dev/null +++ b/pyrogram/enums/user_status.py @@ -0,0 +1,43 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 auto + +from .auto_name import AutoName + + +class UserStatus(AutoName): + """User status enumeration used in :obj:`~pyrogram.types.User`.""" + + ONLINE = auto() + """User is online""" + + OFFLINE = auto() + """User is offline""" + + RECENTLY = auto() + """User was seen recently""" + + LAST_WEEK = auto() + """User was seen last week""" + + LAST_MONTH = auto() + """User was seen last month""" + + LONG_AGO = auto() + """User was seen long ago""" diff --git a/pyrogram/errors/__init__.py b/pyrogram/errors/__init__.py new file mode 100644 index 0000000000..aa3a042c54 --- /dev/null +++ b/pyrogram/errors/__init__.py @@ -0,0 +1,65 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 .exceptions import * +from .rpc_error import UnknownError + + +class BadMsgNotification(Exception): + descriptions = { + 16: "The msg_id is too low, the client time has to be synchronized.", + 17: "The msg_id is too high, the client time has to be synchronized.", + 18: "Incorrect two lower order of the msg_id bits, the server expects the client message " + "msg_id to be divisible by 4.", + 19: "The container msg_id is the same as the msg_id of a previously received message.", + 20: "The message is too old, it cannot be verified by the server.", + 32: "The msg_seqno is too low.", + 33: "The msg_seqno is too high.", + 34: "An even msg_seqno was expected, but an odd one was received.", + 35: "An odd msg_seqno was expected, but an even one was received.", + 48: "Incorrect server salt.", + 64: "Invalid container." + } + + def __init__(self, code): + description = self.descriptions.get(code, "Unknown error code") + super().__init__(f"[{code}] {description}") + + +class SecurityError(Exception): + """Generic security error.""" + + @classmethod + def check(cls, cond: bool, msg: str): + """Raises this exception if the condition is false""" + if not cond: + raise cls(f"Check failed: {msg}") + + +class SecurityCheckMismatch(SecurityError): + """Raised when a security check mismatch occurs.""" + + def __init__(self, msg: str = None): + super().__init__("A security check mismatch has occurred." if msg is None else msg) + + +class CDNFileHashMismatch(SecurityError): + """Raised when a CDN file hash mismatch occurs.""" + + def __init__(self, msg: str = None): + super().__init__("A CDN file hash mismatch has occurred." if msg is None else msg) diff --git a/pyrogram/errors/rpc_error.py b/pyrogram/errors/rpc_error.py new file mode 100644 index 0000000000..1ca3631627 --- /dev/null +++ b/pyrogram/errors/rpc_error.py @@ -0,0 +1,120 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 os import environ +import re +from datetime import datetime +from importlib import import_module +from typing import Type, Union + +from pyrogram import __version__, raw +from pyrogram.raw.core import TLObject +from .exceptions.all import exceptions + + +UEFN = environ.get( + "PYROGRAM_LOG_UNKNOWN_ERRORS_FILENAME", + "unknown_errors.txt" +) +SCUK = bool(environ.get( + "PYROGRAM_DONOT_LOG_UNKNOWN_ERRORS" +)) + + +class RPCError(Exception): + ID = None + CODE = None + NAME = None + MESSAGE = "{value}" + + def __init__( + self, + value: Union[int, str, raw.types.RpcError] = None, + rpc_name: str = None, + is_unknown: bool = False, + is_signed: bool = False, + _raw = None + ): + super().__init__("Telegram says: [{}{} {}] {} Pyrogram {} thinks: {}".format( + "-" if is_signed else "", + self.CODE, + self.ID or self.NAME, + f'(caused by "{rpc_name}")' if rpc_name else "", + __version__, + self.MESSAGE.format(value=value), + )) + + self._raw = _raw + + try: + self.value = int(value) + except (ValueError, TypeError): + self.value = value + + if not SCUK and is_unknown: + with open(UEFN, "a", encoding="utf-8") as f: + f.write(f"{datetime.now()}\t{value}\t{rpc_name}\n") + + @staticmethod + def raise_it(rpc_error: "raw.types.RpcError", rpc_type: Type[TLObject]): + error_code = rpc_error.error_code + is_signed = error_code < 0 + error_message = rpc_error.error_message + rpc_name = ".".join(rpc_type.QUALNAME.split(".")[1:]) + + if is_signed: + error_code = -error_code + + if error_code not in exceptions: + raise UnknownError( + value=f"[{error_code} {error_message}]", + rpc_name=rpc_name, + is_unknown=True, + is_signed=is_signed, + _raw=rpc_error + ) + + error_id = re.sub(r"_\d+", "_X", error_message) + + if error_id not in exceptions[error_code]: + raise getattr( + import_module("pyrogram.errors"), + exceptions[error_code]["_"] + )(value=f"[{error_code} {error_message}]", + rpc_name=rpc_name, + is_unknown=True, + is_signed=is_signed, + _raw=rpc_error) + + value = re.search(r"_(\d+)", error_message) + value = value.group(1) if value is not None else value + + raise getattr( + import_module("pyrogram.errors"), + exceptions[error_code][error_id] + )(value=value, + rpc_name=rpc_name, + is_unknown=False, + is_signed=is_signed, + _raw=rpc_error) + + +class UnknownError(RPCError): + CODE = 520 + """:obj:`int`: Error code""" + NAME = "Unknown error" diff --git a/pyrogram/extensions/__init__.py b/pyrogram/extensions/__init__.py deleted file mode 100644 index a8741ddf2a..0000000000 --- a/pyrogram/extensions/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 .markdown import Markdown diff --git a/pyrogram/extensions/markdown.py b/pyrogram/extensions/markdown.py deleted file mode 100644 index 2e1c757f17..0000000000 --- a/pyrogram/extensions/markdown.py +++ /dev/null @@ -1,123 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017 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 re -from struct import unpack - -from pyrogram.api.types import ( - MessageEntityBold as Bold, - MessageEntityItalic as Italic, - MessageEntityCode as Code, - MessageEntityTextUrl as Url, - MessageEntityPre as Pre, -) - - -class Markdown: - INLINE_DELIMITERS = { - "**": Bold, - "__": Italic, - "`": Code - } - - # SMP = Supplementary Multilingual Plane: https://en.wikipedia.org/wiki/Plane_(Unicode)#Overview - SMP_RE = re.compile(r"[\U00010000-\U0010FFFF]") - - # ``` python - # for i in range(10): - # print(i) - # ``` - PRE_RE = r"(?P
```(?P.*)\n(?P(.|\n)*)\n```)"
-
-    # [url](github.com)
-    URL_RE = r"(?P(\[(?P.+?)\]\((?P.+?)\)))"
-
-    # **bold**
-    # __italic__
-    # `code`
-    INLINE_RE = r"(?P(?P{d})(?P.+?)(?P{d}))".format(
-        d="|".join(
-            ["".join(i) for i in [
-                ["\{}".format(j) for j in i]
-                for i in sorted(  # Sort delimiters by length
-                    INLINE_DELIMITERS.keys(),
-                    key=lambda k: len(k),  # Or: key=len
-                    reverse=True
-                )
-            ]]
-        )
-    )
-
-    MARKDOWN_RE = re.compile("|".join([PRE_RE, URL_RE, INLINE_RE]))
-
-    @classmethod
-    def add_surrogates(cls, text):
-        # Replace each SMP code point with a surrogate pair
-        return cls.SMP_RE.sub(
-            lambda match:  # Split SMP in two surrogates
-            "".join(chr(i) for i in 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 base64
+import functools
+import logging
+import struct
+import typing
+from enum import IntEnum
+from io import BytesIO
+from typing import List
+
+from pyrogram.raw.core import Bytes, String
+
+log = logging.getLogger(__name__)
+
+
+def b64_encode(s: bytes) -> str:
+    """Encode bytes into a URL-safe Base64 string without padding
+
+    Parameters:
+        s (``bytes``):
+            Bytes to encode
+
+    Returns:
+        ``str``: The encoded bytes
+    """
+    return base64.urlsafe_b64encode(s).decode().strip("=")
+
+
+def b64_decode(s: str) -> bytes:
+    """Decode a URL-safe Base64 string without padding to bytes
+
+    Parameters:
+        s (``str``):
+            String to decode
+
+    Returns:
+        ``bytes``: The decoded string
+    """
+    return base64.urlsafe_b64decode(s + "=" * (-len(s) % 4))
+
+
+def rle_encode(s: bytes) -> bytes:
+    """Zero-value RLE encoder
+    Parameters:
+        s (``bytes``):
+            Bytes to encode
+    Returns:
+        ``bytes``: The encoded bytes
+    """
+    r: List[int] = []
+    n: int = 0
+
+    for b in s:
+        if not b:
+            n += 1
+        else:
+            if n:
+                r.extend((0, n))
+                n = 0
+
+            r.append(b)
+
+    if n:
+        r.extend((0, n))
+
+    return bytes(r)
+
+def rle_decode(s: bytes) -> bytes:
+    """Zero-value RLE decoder
+
+    Parameters:
+        s (``bytes``):
+            Bytes to decode
+
+    Returns:
+        ``bytes``: The decoded bytes
+    """
+    r: List[int] = []
+    z: bool = False
+
+    for b in s:
+        if not b:
+            z = True
+            continue
+
+        if z:
+            r.extend((0,) * b)
+            z = False
+        else:
+            r.append(b)
+
+    return bytes(r)
+
+
+class FileType(IntEnum):
+    """Known file types"""
+    THUMBNAIL = 0
+    CHAT_PHOTO = 1  # ProfilePhoto
+    PHOTO = 2
+    VOICE = 3  # VoiceNote
+    VIDEO = 4
+    DOCUMENT = 5
+    ENCRYPTED = 6
+    TEMP = 7
+    STICKER = 8
+    AUDIO = 9
+    ANIMATION = 10
+    ENCRYPTED_THUMBNAIL = 11
+    WALLPAPER = 12
+    VIDEO_NOTE = 13
+    SECURE_RAW = 14
+    SECURE = 15
+    BACKGROUND = 16
+    DOCUMENT_AS_FILE = 17
+
+
+class ThumbnailSource(IntEnum):
+    """Known thumbnail sources"""
+    LEGACY = 0
+    THUMBNAIL = 1
+    CHAT_PHOTO_SMALL = 2  # DialogPhotoSmall
+    CHAT_PHOTO_BIG = 3  # DialogPhotoBig
+    STICKER_SET_THUMBNAIL = 4
+
+
+# Photo-like file ids are longer and contain extra info, the rest are all documents
+PHOTO_TYPES = {FileType.THUMBNAIL, FileType.CHAT_PHOTO, FileType.PHOTO, FileType.WALLPAPER,
+               FileType.ENCRYPTED_THUMBNAIL}
+DOCUMENT_TYPES = set(FileType) - PHOTO_TYPES
+
+# Since the file type values are small enough to fit them in few bits, Telegram thought it would be a good idea to
+# encode extra information about web url and file reference existence as flag inside the 4 bytes allocated for the field
+WEB_LOCATION_FLAG = 1 << 24
+FILE_REFERENCE_FLAG = 1 << 25
+
+
+class FileId:
+    MAJOR = 4
+    MINOR = 30
+
+    @functools.lru_cache(maxsize=8128)
+    def __new__(cls, **kwargs) -> "FileIdCached":
+        return FileIdCached(**kwargs)
+
+    @staticmethod
+    def decode(file_id: str):
+        decoded = rle_decode(b64_decode(file_id))
+
+        # region read version
+        # File id versioning. Major versions lower than 4 don't have a minor version
+        major = decoded[-1]
+
+        if major < 4:
+            minor = 0
+            buffer = BytesIO(decoded[:-1])
+        else:
+            minor = decoded[-2]
+            buffer = BytesIO(decoded[:-2])
+        # endregion
+
+        file_type, dc_id = struct.unpack("= 4:
+                buffer.write(struct.pack(" "FileUniqueIdCached":
+        return FileUniqueIdCached(**kwargs)
+
+    @staticmethod
+    def decode(file_unique_id: str):
+        buffer = BytesIO(rle_decode(b64_decode(file_unique_id)))
+        file_unique_type, = 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 inspect
+import re
+from typing import Any, Callable, List, Literal, Optional, Pattern, Union
+
+import pyrogram
+from pyrogram import enums
+from pyrogram.types import (
+    Message,
+    CallbackQuery,
+    InlineQuery,
+    InlineKeyboardMarkup,
+    PreCheckoutQuery,
+    ReplyKeyboardMarkup,
+    Update,
+)
+from pyrogram.types.messages_and_media.message import Str
+
+
+class Filter:
+    async def __call__(self, client: "pyrogram.Client", update: Update) -> None:
+        raise NotImplementedError
+
+    def __invert__(self) -> "InvertFilter":
+        return InvertFilter(self)
+
+    def __and__(self, other) -> "AndFilter":
+        return AndFilter(self, other)
+
+    def __or__(self, other) -> "OrFilter":
+        return OrFilter(self, other)
+
+
+class InvertFilter(Filter):
+    def __init__(self, base) -> None:
+        self.base: Any = base
+
+    async def __call__(self, client: "pyrogram.Client", update: Update) -> bool:
+        if inspect.iscoroutinefunction(self.base.__call__):
+            x = await self.base(client, update)
+        else:
+            x = await client.loop.run_in_executor(
+                client.executor, self.base, client, update
+            )
+
+        return not x
+
+
+class AndFilter(Filter):
+    def __init__(self, base, other) -> None:
+        self.base = base
+        self.other = other
+
+    async def __call__(
+        self, client: "pyrogram.Client", update: Update
+    ) -> Union[Any, Literal[False]]:
+        if inspect.iscoroutinefunction(self.base.__call__):
+            x = await self.base(client, update)
+        else:
+            x = await client.loop.run_in_executor(
+                client.executor, self.base, client, update
+            )
+
+        # short circuit
+        if not x:
+            return False
+
+        if inspect.iscoroutinefunction(self.other.__call__):
+            y = await self.other(client, update)
+        else:
+            y = await client.loop.run_in_executor(
+                client.executor, self.other, client, update
+            )
+
+        return x and y
+
+
+class OrFilter(Filter):
+    def __init__(self, base, other) -> None:
+        self.base = base
+        self.other = other
+
+    async def __call__(
+        self, client: "pyrogram.Client", update: Update
+    ) -> Union[Any, Literal[True]]:
+        if inspect.iscoroutinefunction(self.base.__call__):
+            x = await self.base(client, update)
+        else:
+            x = await client.loop.run_in_executor(
+                client.executor, self.base, client, update
+            )
+
+        # short circuit
+        if x:
+            return True
+
+        if inspect.iscoroutinefunction(self.other.__call__):
+            y = await self.other(client, update)
+        else:
+            y = await client.loop.run_in_executor(
+                client.executor, self.other, client, update
+            )
+
+        return x or y
+
+
+CUSTOM_FILTER_NAME = "CustomFilter"
+
+
+def create(func: Callable, name: str = None, **kwargs) -> Filter:
+    """Easily create a custom filter.
+
+    Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.
+
+    Parameters:
+        func (``Callable``):
+            A function that accepts three positional arguments *(filter, client, update)* and returns a boolean: True if the
+            update should be handled, False otherwise.
+            The *filter* argument refers to the filter itself and can be used to access keyword arguments (read below).
+            The *client* argument refers to the :obj:`~pyrogram.Client` that received the update.
+            The *update* argument type will vary depending on which `Handler `_ is coming from.
+            For example, in a :obj:`~pyrogram.handlers.MessageHandler` the *update* argument will be a :obj:`~pyrogram.types.Message`; in a :obj:`~pyrogram.handlers.CallbackQueryHandler` the *update* will be a :obj:`~pyrogram.types.CallbackQuery`.
+            Your function body can then access the incoming update attributes and decide whether to allow it or not.
+
+        name (``str``, *optional*):
+            Your filter's name. Can be anything you like.
+            Defaults to "CustomFilter".
+
+        **kwargs (``any``, *optional*):
+            Any keyword argument you would like to pass. Useful when creating parameterized custom filters, such as
+            :meth:`~pyrogram.filters.command` or :meth:`~pyrogram.filters.regex`.
+    """
+    return type(
+        name or func.__name__ or CUSTOM_FILTER_NAME,
+        (Filter,),
+        {"__call__": func, **kwargs},
+    )()
+
+
+# region all_filter
+async def all_filter(_, __, ___) -> Literal[True]:
+    return True
+
+
+all = create(all_filter)
+"""Filter all messages."""
+
+
+# endregion
+
+
+# region me_filter
+async def me_filter(_, __, m: Message) -> bool:
+    return bool(m.from_user and m.from_user.is_self or getattr(m, "outgoing", False))
+
+
+me: Filter = create(me_filter)
+"""Filter messages generated by you yourself."""
+
+
+# endregion
+
+
+# region bot_filter
+async def bot_filter(_, __, m: Message) -> bool:
+    return bool(m.from_user and m.from_user.is_bot)
+
+
+bot = create(bot_filter)
+"""Filter messages coming from bots."""
+
+
+# endregion
+
+
+# region incoming_filter
+async def incoming_filter(_, __, m: Message) -> bool:
+    return not m.outgoing
+
+
+incoming: Filter = create(incoming_filter)
+"""Filter incoming messages. Messages sent to your own chat (Saved Messages) are also recognised as incoming."""
+
+
+# endregion
+
+
+# region outgoing_filter
+async def outgoing_filter(_, __, m: Message) -> bool:
+    return m.outgoing
+
+
+outgoing = create(outgoing_filter)
+"""Filter outgoing messages. Messages sent to your own chat (Saved Messages) are not recognized as outgoing."""
+
+
+# endregion
+
+
+# region text_filter
+async def text_filter(_, __, m: Message) -> bool:
+    return bool(m.text)
+
+
+text: Filter = create(text_filter)
+"""Filter text messages."""
+
+
+# endregion
+
+
+# region reply_filter
+async def reply_filter(_, __, m: Message) -> bool:
+    return bool(m.reply_to_message_id)
+
+
+reply = create(reply_filter)
+"""Filter messages that are replies to other messages."""
+
+
+# endregion
+
+
+# region forwarded_filter
+async def forwarded_filter(_, __, m: Message) -> bool:
+    return bool(m.forward_origin)
+
+
+forwarded = create(forwarded_filter)
+"""Filter messages that are forwarded."""
+
+
+# endregion
+
+
+# region caption_filter
+async def caption_filter(_, __, m: Message) -> bool:
+    return bool(m.caption)
+
+
+caption: Filter = create(caption_filter)
+"""Filter media messages that contain captions."""
+
+
+# endregion
+
+
+# region audio_filter
+async def audio_filter(_, __, m: Message) -> bool:
+    return bool(m.audio)
+
+
+audio: Filter = create(audio_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Audio` objects."""
+
+
+# endregion
+
+
+# region document_filter
+async def document_filter(_, __, m: Message) -> bool:
+    return bool(m.document)
+
+
+document = create(document_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Document` objects."""
+
+
+# endregion
+
+
+# region photo_filter
+async def photo_filter(_, __, m: Message) -> bool:
+    return bool(m.photo)
+
+
+photo: Filter = create(photo_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Photo` objects."""
+
+
+# endregion
+
+
+# region sticker_filter
+async def sticker_filter(_, __, m: Message) -> bool:
+    return bool(m.sticker)
+
+
+sticker: Filter = create(sticker_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Sticker` objects."""
+
+
+# endregion
+
+
+# region animation_filter
+async def animation_filter(_, __, m: Message) -> bool:
+    return bool(m.animation)
+
+
+animation: Filter = create(animation_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Animation` objects."""
+
+
+# endregion
+
+
+# region game_filter
+async def game_filter(_, __, m: Message) -> bool:
+    return bool(m.game)
+
+
+game: Filter = create(game_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Game` objects."""
+
+
+# endregion
+
+
+# region video_filter
+async def video_filter(_, __, m: Message) -> bool:
+    return bool(m.video)
+
+
+video: Filter = create(video_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Video` objects."""
+
+
+# endregion
+
+
+# region media_group_filter
+async def media_group_filter(_, __, m: Message) -> bool:
+    return bool(m.media_group_id)
+
+
+media_group: Filter = create(media_group_filter)
+"""Filter messages containing photos or videos being part of an album."""
+
+
+# endregion
+
+
+# region voice_filter
+async def voice_filter(_, __, m: Message) -> bool:
+    return bool(m.voice)
+
+
+voice: Filter = create(voice_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Voice` note objects."""
+
+
+# endregion
+
+
+# region video_note_filter
+async def video_note_filter(_, __, m: Message) -> bool:
+    return bool(m.video_note)
+
+
+video_note: Filter = create(video_note_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.VideoNote` objects."""
+
+
+# endregion
+
+
+# region contact_filter
+async def contact_filter(_, __, m: Message) -> bool:
+    return bool(m.contact)
+
+
+contact: Filter = create(contact_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Contact` objects."""
+
+
+# endregion
+
+
+# region location_filter
+async def location_filter(_, __, m: Message) -> bool:
+    return bool(m.location)
+
+
+location: Filter = create(location_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Location` objects."""
+
+
+# endregion
+
+
+# region venue_filter
+async def venue_filter(_, __, m: Message) -> bool:
+    return bool(m.venue)
+
+
+venue: Filter = create(venue_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Venue` objects."""
+
+
+# endregion
+
+
+# region web_page_filter
+async def web_page_filter(_, __, m: Message) -> bool:
+    return bool(m.web_page)
+
+
+web_page: Filter = create(web_page_filter)
+"""Filter messages sent with a webpage preview."""
+
+
+# endregion
+
+
+# region poll_filter
+async def poll_filter(_, __, m: Message) -> bool:
+    return bool(m.poll)
+
+
+poll: Filter = create(poll_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Poll` objects."""
+
+
+# endregion
+
+
+# region dice_filter
+async def dice_filter(_, __, m: Message) -> bool:
+    return bool(m.dice)
+
+
+dice: Filter = create(dice_filter)
+"""Filter messages that contain :obj:`~pyrogram.types.Dice` objects."""
+
+
+# endregion
+
+
+# region media_spoiler
+async def media_spoiler_filter(_, __, m: Message) -> bool:
+    return bool(m.has_media_spoiler)
+
+
+media_spoiler: Filter = create(media_spoiler_filter)
+"""Filter media messages that contain a spoiler."""
+
+
+# endregion
+
+
+# region private_filter
+async def private_filter(_, __, m: Message) -> bool:
+    return bool(m.chat and m.chat.type in {enums.ChatType.PRIVATE, enums.ChatType.BOT})
+
+
+private: Filter = create(private_filter)
+"""Filter messages sent in private chats."""
+
+
+# endregion
+
+
+# region group_filter
+async def group_filter(_, __, m: Union[Message, CallbackQuery]) -> bool:
+    m = getattr(m, "message", None) if isinstance(m, CallbackQuery) else m
+    if not m:
+        raise ValueError(
+            "filters.group is not supported here "
+        )
+    return bool(
+        m.chat and m.chat.type in {enums.ChatType.GROUP, enums.ChatType.SUPERGROUP}
+    )
+
+
+group: Filter = create(group_filter)
+"""Filter messages sent in group or supergroup chats."""
+
+
+# endregion
+
+
+# region channel_filter
+async def channel_filter(_, __, m: Union[Message, CallbackQuery]) -> bool:
+    m = getattr(m, "message", None) if isinstance(m, CallbackQuery) else m
+    if not m:
+        raise ValueError(
+            "filters.channel is not supported here "
+        )
+    return bool(m.chat and m.chat.type == enums.ChatType.CHANNEL)
+
+
+channel: Filter = create(channel_filter)
+"""Filter messages sent in channels."""
+
+
+# endregion
+
+
+# region new_chat_members_filter
+async def new_chat_members_filter(_, __, m: Message) -> bool:
+    return bool(m.new_chat_members)
+
+
+new_chat_members: Filter = create(new_chat_members_filter)
+"""Filter service messages for new chat members."""
+
+
+# endregion
+
+
+# region left_chat_member_filter
+async def left_chat_member_filter(_, __, m: Message) -> bool:
+    return bool(m.left_chat_member)
+
+
+left_chat_member: Filter = create(left_chat_member_filter)
+"""Filter service messages for members that left the chat."""
+
+
+# endregion
+
+
+# region new_chat_title_filter
+async def new_chat_title_filter(_, __, m: Message) -> bool:
+    return bool(m.new_chat_title)
+
+
+new_chat_title: Filter = create(new_chat_title_filter)
+"""Filter service messages for new chat titles."""
+
+
+# endregion
+
+
+# region new_chat_photo_filter
+async def new_chat_photo_filter(_, __, m: Message) -> bool:
+    return bool(m.new_chat_photo)
+
+
+new_chat_photo: Filter = create(new_chat_photo_filter)
+"""Filter service messages for new chat photos."""
+
+
+# endregion
+
+
+# region delete_chat_photo_filter
+async def delete_chat_photo_filter(_, __, m: Message) -> bool:
+    return bool(m.delete_chat_photo)
+
+
+delete_chat_photo: Filter = create(delete_chat_photo_filter)
+"""Filter service messages for deleted photos."""
+
+
+# endregion
+
+
+# region group_chat_created_filter
+async def group_chat_created_filter(_, __, m: Message) -> bool:
+    return bool(m.group_chat_created)
+
+
+group_chat_created: Filter = create(group_chat_created_filter)
+"""Filter service messages for group chat creations."""
+
+
+# endregion
+
+
+# region supergroup_chat_created_filter
+async def supergroup_chat_created_filter(_, __, m: Message) -> bool:
+    return bool(m.supergroup_chat_created)
+
+
+supergroup_chat_created: Filter = create(supergroup_chat_created_filter)
+"""Filter service messages for supergroup chat creations."""
+
+
+# endregion
+
+
+# region channel_chat_created_filter
+async def channel_chat_created_filter(_, __, m: Message) -> bool:
+    return bool(m.channel_chat_created)
+
+
+channel_chat_created: Filter = create(channel_chat_created_filter)
+"""Filter service messages for channel chat creations."""
+
+
+# endregion
+
+
+# region migrate_to_chat_id_filter
+async def migrate_to_chat_id_filter(_, __, m: Message) -> bool:
+    return bool(m.migrate_to_chat_id)
+
+
+migrate_to_chat_id: Filter = create(migrate_to_chat_id_filter)
+"""Filter service messages that contain migrate_to_chat_id."""
+
+
+# endregion
+
+
+# region migrate_from_chat_id_filter
+async def migrate_from_chat_id_filter(_, __, m: Message) -> bool:
+    return bool(m.migrate_from_chat_id)
+
+
+migrate_from_chat_id: Filter = create(migrate_from_chat_id_filter)
+"""Filter service messages that contain migrate_from_chat_id."""
+
+
+# endregion
+
+
+# region pinned_message_filter
+async def pinned_message_filter(_, __, m: Message) -> bool:
+    return bool(m.pinned_message)
+
+
+pinned_message: Filter = create(pinned_message_filter)
+"""Filter service messages for pinned messages."""
+
+
+# endregion
+
+
+# region game_high_score_filter
+async def game_high_score_filter(_, __, m: Message) -> bool:
+    return bool(m.game_high_score)
+
+
+game_high_score: Filter = create(game_high_score_filter)
+"""Filter service messages for game high scores."""
+
+
+# endregion
+
+
+# region reply_keyboard_filter
+async def reply_keyboard_filter(_, __, m: Message) -> bool:
+    return isinstance(m.reply_markup, ReplyKeyboardMarkup)
+
+
+reply_keyboard: Filter = create(reply_keyboard_filter)
+"""Filter messages containing reply keyboard markups"""
+
+
+# endregion
+
+
+# region inline_keyboard_filter
+async def inline_keyboard_filter(_, __, m: Message) -> bool:
+    return isinstance(m.reply_markup, InlineKeyboardMarkup)
+
+
+inline_keyboard: Filter = create(inline_keyboard_filter)
+"""Filter messages containing inline keyboard markups"""
+
+
+# endregion
+
+
+# region mentioned_filter
+async def mentioned_filter(_, __, m: Message) -> bool:
+    return bool(m.mentioned)
+
+
+mentioned: Filter = create(mentioned_filter)
+"""Filter messages containing mentions"""
+
+
+# endregion
+
+
+# region via_bot_filter
+def via_bot_filter(flt, *args):
+    # https://t.me/c/1220993104/1379819
+    if isinstance(args[0], pyrogram.Client):
+        _, m, *__ = args
+        return bool(m.via_bot) and (
+            len(flt) == 0
+            or (
+                m.via_bot.id in flt or (
+                    m.via_bot.username and m.via_bot.username.lower() in flt
+                )
+            )
+        )
+    bots = args[0] if isinstance(args[0], list) else [args[0]]
+    flt = type(flt)(u.lower().lstrip("@") if isinstance(u, str) else u for u in bots)
+    return flt
+
+via_bot: Filter = type(
+    via_bot_filter.__name__,
+    (Filter, set),
+    dict(__call__=via_bot_filter),
+)()
+"""Filter messages sent via inline bots
+
+    Parameters:
+        user_ids (``int`` | ``str`` | Iterable of ``int`` | Iterable of ``str``, *optional*):
+            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).
+            Defaults to None (all bots).
+"""
+
+
+# endregion
+
+
+# region video_chat_started_filter
+async def video_chat_started_filter(_, __, m: Message) -> bool:
+    return bool(m.video_chat_started)
+
+
+video_chat_started: Filter = create(video_chat_started_filter)
+"""Filter messages for started video chats"""
+
+
+# endregion
+
+
+# region video_chat_ended_filter
+async def video_chat_ended_filter(_, __, m: Message) -> bool:
+    return bool(m.video_chat_ended)
+
+
+video_chat_ended: Filter = create(video_chat_ended_filter)
+"""Filter messages for ended video chats"""
+
+
+# endregion
+
+
+# region business message
+async def tg_business_filter(_, __, m: Union[Message, List[Message]]):
+    if (
+        isinstance(m, list) and
+        len(m) > 0
+    ):
+        return bool(m[0].business_connection_id)
+    elif isinstance(m, Message):
+        return bool(m.business_connection_id)
+
+
+tg_business = create(tg_business_filter)
+"""Filter non-service messages from a connected business account"""
+
+
+# endregion
+
+# region video_chat_participants_invited_filter
+async def video_chat_participants_invited_filter(_, __, m: Message) -> bool:
+    return bool(m.video_chat_participants_invited)
+
+
+video_chat_participants_invited = create(video_chat_participants_invited_filter)
+"""Filter messages for voice chat invited members"""
+
+
+# endregion
+
+# region successful_payment_filter
+async def successful_payment_filter(_, __, m: Message):
+    return bool(m.successful_payment)
+
+
+successful_payment = create(successful_payment_filter)
+"""Filter messages for successful payments"""
+
+
+# endregion
+
+# region service_filter
+async def service_filter(_, __, m: Message) -> bool:
+    return bool(m.service)
+
+
+service: Filter = create(service_filter)
+"""Filter service messages.
+
+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*,
+*video_chat_started*, *video_chat_ended*, *video_chat_participants_invited*, *successful_payment*.
+"""
+
+
+# endregion
+
+
+# region media_filter
+async def media_filter(_, __, m: Message) -> bool:
+    return bool(m.media)
+
+
+media: Filter = create(media_filter)
+"""Filter media messages.
+
+A media message contains any of the following fields set: *animation*, *audio*, *contact*, *dice*, *document*, *game*, *giveaway*, *giveaway_winners*, *location*, *photo*, *poll*, *sticker*, *story*, *venue*, *video*, *video_note*, *voice*, *web_page*.
+"""
+
+
+# endregion
+
+
+# region scheduled_filter
+async def scheduled_filter(_, __, m: Message) -> bool:
+    return bool(m.scheduled)
+
+
+scheduled: Filter = create(scheduled_filter)
+"""Filter messages that have been scheduled (not yet sent)."""
+
+
+# endregion
+
+
+# region from_scheduled_filter
+async def from_scheduled_filter(_, __, m: Message) -> bool:
+    return bool(m.from_scheduled)
+
+
+from_scheduled: Filter = create(from_scheduled_filter)
+"""Filter new automatically sent messages that were previously scheduled."""
+
+
+# endregion
+
+
+# region linked_channel_filter
+async def linked_channel_filter(_, __, m: Message) -> bool:
+    return bool(
+        m.forward_origin and
+        m.forward_origin.type == "channel" and
+        m.forward_origin.chat == m.sender_chat
+    )
+
+linked_channel: Filter = create(linked_channel_filter)
+"""Filter messages that are automatically forwarded from the linked channel to the group chat."""
+
+
+# endregion
+
+
+# region command_filter
+def command(
+    commands: Union[str, List[str]],
+    prefixes: Union[str, List[str]] = "/",
+    case_sensitive: bool = False,
+) -> Filter:
+    """Filter commands, i.e.: text messages starting with "/" or any other custom prefix.
+
+    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 :obj:`~pyrogram.types.Message`.
+
+        prefixes (``str`` | ``list``, *optional*):
+            A prefix or a list of prefixes as string the filter should look for.
+            Defaults to "/" (slash). Examples: ".", "!", ["/", "!", "."], list(".:!").
+            Pass None or "" (empty string) to allow commands with no prefix at all.
+
+        case_sensitive (``bool``, *optional*):
+            Pass True if you want your command(s) to be case sensitive. Defaults to False.
+            Examples: when True, command="Start" would trigger /Start but not /start.
+    """
+    command_re: Pattern[str] = re.compile(pattern=r"([\"'])(.*?)(? bool:
+        username: str = client.me.username or ""
+        text: Str = message.text or message.caption
+        message.command = None
+
+        if not text:
+            return False
+
+        for prefix in flt.prefixes:
+            if not text.startswith(prefix):
+                continue
+
+            without_prefix = text[len(prefix) :]
+
+            for cmd in flt.commands:
+                if not re.match(
+                    pattern=rf"^(?:{cmd}(?:@?{username})?)(?:\s|$)",
+                    string=without_prefix,
+                    flags=re.IGNORECASE if not flt.case_sensitive else 0,
+                ):
+                    continue
+
+                without_command: str = re.sub(
+                    pattern=rf"{cmd}(?:@?{username})?\s?",
+                    repl="",
+                    string=without_prefix,
+                    count=1,
+                    flags=re.IGNORECASE if not flt.case_sensitive else 0,
+                )
+
+                # match.groups are 1-indexed, group(1) is the quote, group(2) is the text
+                # between the quotes, group(3) is unquoted, whitespace-split text
+
+                # Remove the escape character from the arguments
+                message.command = [cmd] + [
+                    re.sub(
+                        pattern=r"\\([\"'])",
+                        repl=r"\1",
+                        string=m.group(2) or m.group(3) or "",
+                    )
+                    for m in command_re.finditer(string=without_command)
+                ]
+
+                return True
+
+        return False
+
+    commands = commands if isinstance(commands, list) else [commands]
+    commands = {c if case_sensitive else c.lower() for c in commands}
+
+    prefixes = [] if prefixes is None else prefixes
+    prefixes = prefixes if isinstance(prefixes, list) else [prefixes]
+    prefixes = set(prefixes) if prefixes else {""}
+
+    return create(
+        func=func,
+        name="CommandFilter",
+        commands=commands,
+        prefixes=prefixes,
+        case_sensitive=case_sensitive,
+    )
+
+
+# endregion
+
+
+# region cq_data_filter
+def cq_data(data: Union[str, List[str]]):
+    """Filter callback query updates that match a given string or list of strings.
+
+    Can be applied to handlers that receive :obj:`~pyrogram.types.CallbackQuery` updates.
+
+    Parameters:
+        data (``str`` | ``List[str]``):
+            The data or list of data strings to match against the callback query.
+
+    Returns:
+        :obj:`callable`: A filter function that matches callback query updates based on the provided data.
+    """
+
+    async def func(_, __, callback_query: CallbackQuery):
+        if isinstance(data, str):
+            return callback_query.data == data
+        elif isinstance(data, list):
+            return callback_query.data in data
+        else:
+            return False
+    return filters.create(func)
+
+
+# endregion
+
+
+# region regex_filter
+def regex(pattern: Union[str, Pattern], flags: int = 0) -> Filter:
+    """Filter updates that match a given regular expression pattern.
+
+    Can be applied to handlers that receive one of the following updates:
+
+    - :obj:`~pyrogram.types.Message`: The filter will match ``text`` or ``caption``.
+    - :obj:`~pyrogram.types.CallbackQuery`: The filter will match ``data``.
+    - :obj:`~pyrogram.types.InlineQuery`: The filter will match ``query``.
+    - :obj:`~pyrogram.types.PreCheckoutQuery`: The filter will match ``payload``.
+
+    When a pattern matches, all the `Match Objects `_ are
+    stored in the ``matches`` field of the update object itself.
+
+    Parameters:
+        pattern (``str`` | ``Pattern``):
+            The regex pattern as string or as pre-compiled pattern.
+
+        flags (``int``, *optional*):
+            Regex flags.
+    """
+
+    async def func(flt, _, update: Update) -> bool:
+        if isinstance(update, Message):
+            value: Str = update.text or update.caption
+        elif isinstance(update, CallbackQuery):
+            value: str | bytes = update.data
+        elif isinstance(update, InlineQuery):
+            value: str = update.query
+        elif isinstance(update, PreCheckoutQuery):
+            value: str = update.invoice_payload
+        else:
+            raise ValueError(f"Regex filter doesn't work with {type(update)}")
+
+        if value:
+            update.matches = list(flt.p.finditer(value)) or None
+
+        return bool(update.matches)
+
+    return create(
+        func=func,
+        name="RegexFilter",
+        p=pattern if isinstance(pattern, Pattern) else re.compile(pattern, flags),
+    )
+
+
+# endregion
+
+
+# noinspection PyPep8Naming
+class user(Filter, set):
+    """Filter messages coming from one or more users.
+
+    You can use `set bound methods `_ to manipulate the
+    users container.
+
+    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.
+            Defaults to None (no users).
+    """
+
+    def __init__(self, users: Optional[Union[int, str, List[Union[int, str]]]] = None) -> None:
+        users = [] if users is None else users if isinstance(users, list) else [users]
+
+        super().__init__(
+            (
+                "me"
+                if u in ["me", "self"]
+                else u.lower().strip("@") if isinstance(u, str) else u
+            )
+            for u in users
+        )
+
+    async def __call__(self, _, message: Message) -> bool:
+        return message.from_user and (
+            message.from_user.id in self
+            or (
+                message.from_user.username
+                and message.from_user.username.lower() in self
+            )
+            or ("me" in self and message.from_user.is_self)
+        )
+
+
+# noinspection PyPep8Naming
+class chat(Filter, set):
+    """Filter messages coming from one or more chats.
+
+    You can use `set bound methods `_ to manipulate the
+    chats container.
+
+    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".
+            Defaults to None (no chats).
+    """
+
+    def __init__(self, chats: Optional[Union[int, str, List[Union[int, str]]]] = None) -> None:
+        chats = [] if chats is None else chats if isinstance(chats, list) else [chats]
+
+        super().__init__(
+            (
+                "me"
+                if c in ["me", "self"]
+                else c.lower().strip("@") if isinstance(c, str) else c
+            )
+            for c in chats
+        )
+
+    async def __call__(self, _, message: Message) -> bool:
+        return message.chat and (
+            message.chat.id in self
+            or (message.chat.username and message.chat.username.lower() in self)
+            or (
+                "me" in self
+                and message.from_user
+                and message.from_user.is_self
+                and not message.outgoing
+            )
+        )
+
+
+# region chat_shared filter
+
+chat_shared: Filter = create(
+    lambda _, __, m: (
+        bool(m.chat_shared)
+    )
+)
+"""Filter service messages for chat shared."""
+
+# endregion
+
+
+# region users_shared filter
+
+users_shared: Filter = create(
+    lambda _, __, m: (
+        bool(m.users_shared)
+    )
+)
+"""Filter service messages for chat shared."""
+
+# endregion
+
+# noinspection PyPep8Naming
+class thread(Filter, set):
+    """Filter messages coming from one or more threads.
+
+    You can use `set bound methods `_ to manipulate the
+    message_thread_ids container.
+
+    Parameters:
+        message_thread_ids (``int`` | ``list``):
+            Pass one or more message thread ids to filter messages in specific threads.
+            Defaults to None (no threads).
+    """
+
+    def __init__(self, message_thread_ids: Optional[Union[int, List[int]]] = None):
+        message_thread_ids = [] if message_thread_ids is None else message_thread_ids if isinstance(message_thread_ids, list) else [message_thread_ids]
+
+        super().__init__(
+            t for t in message_thread_ids
+        )
+
+    async def __call__(self, _, message: Message):
+        return message.message_thread_id and message.message_thread_id in self
+
+
+# region self_destruct_filter
+
+async def self_destruct_filter(_, __, m: Message):
+    return bool(
+        m.media and
+        getattr(
+            getattr(
+                m,
+                m.media.value,
+                None
+            ),
+            "ttl_seconds",
+            None
+        )
+    )
+
+
+self_destruct = create(self_destruct_filter)
+"""Filter self destruct media messages."""
+
+
+# endregion
diff --git a/pyrogram/handlers/__init__.py b/pyrogram/handlers/__init__.py
new file mode 100644
index 0000000000..5ef7d3d6f8
--- /dev/null
+++ b/pyrogram/handlers/__init__.py
@@ -0,0 +1,35 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .callback_query_handler import CallbackQueryHandler
+from .chat_join_request_handler import ChatJoinRequestHandler
+from .chat_member_updated_handler import ChatMemberUpdatedHandler
+from .chosen_inline_result_handler import ChosenInlineResultHandler
+from .deleted_messages_handler import DeletedMessagesHandler
+from .disconnect_handler import DisconnectHandler
+from .edited_message_handler import EditedMessageHandler
+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
+from .message_reaction_updated_handler import MessageReactionUpdatedHandler
+from .message_reaction_count_updated_handler import MessageReactionCountUpdatedHandler
+from .pre_checkout_query_handler import PreCheckoutQueryHandler
+from .shipping_query_handler import ShippingQueryHandler
+from .story_handler import StoryHandler
diff --git a/pyrogram/handlers/callback_query_handler.py b/pyrogram/handlers/callback_query_handler.py
new file mode 100644
index 0000000000..b924fffa26
--- /dev/null
+++ b/pyrogram/handlers/callback_query_handler.py
@@ -0,0 +1,49 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+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:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_callback_query` decorator.
+
+    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`):
+            Pass one or more filters to allow only a subset of callback queries to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the message handler.
+
+        callback_query (:obj:`~pyrogram.types.CallbackQuery`):
+            The received callback query.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/chat_join_request_handler.py b/pyrogram/handlers/chat_join_request_handler.py
new file mode 100644
index 0000000000..54b8b86abb
--- /dev/null
+++ b/pyrogram/handlers/chat_join_request_handler.py
@@ -0,0 +1,49 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class ChatJoinRequestHandler(Handler):
+    """The ChatJoinRequest handler class. Used to handle join chat requests.
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`.
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_chat_join_request` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new ChatJoinRequest event arrives. It takes
+            *(client, chat_join_request)* 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 updates to be passed in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the handler.
+
+        chat_join_request (:obj:`~pyrogram.types.ChatJoinRequest`):
+            The received chat join request.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/chat_member_updated_handler.py b/pyrogram/handlers/chat_member_updated_handler.py
new file mode 100644
index 0000000000..a89e7e2b57
--- /dev/null
+++ b/pyrogram/handlers/chat_member_updated_handler.py
@@ -0,0 +1,49 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class ChatMemberUpdatedHandler(Handler):
+    """The ChatMemberUpdated handler class. Used to handle changes in the status of a chat member.
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`.
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_chat_member_updated` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new ChatMemberUpdated event arrives. It takes
+            *(client, chat_member_updated)* 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 updates to be passed in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the handler.
+
+        chat_member_updated (:obj:`~pyrogram.types.ChatMemberUpdated`):
+            The received chat member update.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/chosen_inline_result_handler.py b/pyrogram/handlers/chosen_inline_result_handler.py
new file mode 100644
index 0000000000..774593868b
--- /dev/null
+++ b/pyrogram/handlers/chosen_inline_result_handler.py
@@ -0,0 +1,54 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class ChosenInlineResultHandler(Handler):
+    """The ChosenInlineResultHandler handler class. Used to handle chosen inline results coming from inline queries.
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`
+
+    Please see the official documentation on the `feedback collecting `_ for details on how to enable these updates for your bot.
+
+    `This should only be used for statistical purposes, rather than functional `_.
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_chosen_inline_result` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new chosen inline result arrives.
+            It takes *(client, chosen_inline_result)* 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 chosen inline results to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the message handler.
+
+        chosen_inline_result (:obj:`~pyrogram.types.ChosenInlineResult`):
+            The received chosen inline result.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/deleted_messages_handler.py b/pyrogram/handlers/deleted_messages_handler.py
new file mode 100644
index 0000000000..ab9f834705
--- /dev/null
+++ b/pyrogram/handlers/deleted_messages_handler.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+from pyrogram.types import Message
+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:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_deleted_messages` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            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`):
+            Pass one or more filters to allow only a subset of messages to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the message handler.
+
+        messages (List of :obj:`~pyrogram.types.Message`):
+            The deleted messages, as list.
+    """
+
+    def __init__(self, callback: Callable, filters: Filter = None):
+        super().__init__(callback, filters)
+
+    async def check(self, client: "pyrogram.Client", messages: List[Message]):
+        # Every message should be checked, if at least one matches the filter True is returned
+        # otherwise, or if the list is empty, False is returned
+        for message in messages:
+            if await super().check(client, message):
+                return True
+        else:
+            return False
diff --git a/pyrogram/handlers/disconnect_handler.py b/pyrogram/handlers/disconnect_handler.py
new file mode 100644
index 0000000000..7420afd67a
--- /dev/null
+++ b/pyrogram/handlers/disconnect_handler.py
@@ -0,0 +1,43 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class DisconnectHandler(Handler):
+    """The Disconnect handler class. Used to handle disconnections. It is intended to be used with
+    :meth:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_disconnect` decorator.
+
+    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:`~pyrogram.Client`):
+            The Client itself. Useful, for example, when you want to change the proxy before a new connection
+            is established.
+    """
+
+    def __init__(self, callback: Callable):
+        super().__init__(callback)
diff --git a/pyrogram/handlers/edited_message_handler.py b/pyrogram/handlers/edited_message_handler.py
new file mode 100644
index 0000000000..78deaf0fa9
--- /dev/null
+++ b/pyrogram/handlers/edited_message_handler.py
@@ -0,0 +1,49 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class EditedMessageHandler(Handler):
+    """The EditedMessage handler class. Used to handle edited messages.
+     It is intended to be used with :meth:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_edited_message` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new edited message arrives. It takes *(client, message)*
+            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 messages to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the message handler.
+
+        edited_message (:obj:`~pyrogram.types.Message`):
+            The received edited message.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/handler.py b/pyrogram/handlers/handler.py
new file mode 100644
index 0000000000..c666d042e2
--- /dev/null
+++ b/pyrogram/handlers/handler.py
@@ -0,0 +1,43 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 inspect
+from typing import Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+from pyrogram.types import Update
+
+
+class Handler:
+    def __init__(self, callback: Callable, filters: Filter = None):
+        self.callback = callback
+        self.filters = filters
+
+    async def check(self, client: "pyrogram.Client", update: Update):
+        if callable(self.filters):
+            if inspect.iscoroutinefunction(self.filters.__call__):
+                return await self.filters(client, update)
+            else:
+                return await client.loop.run_in_executor(
+                    client.executor,
+                    self.filters,
+                    client, update
+                )
+
+        return True
diff --git a/pyrogram/handlers/inline_query_handler.py b/pyrogram/handlers/inline_query_handler.py
new file mode 100644
index 0000000000..f5ea23bc57
--- /dev/null
+++ b/pyrogram/handlers/inline_query_handler.py
@@ -0,0 +1,49 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class InlineQueryHandler(Handler):
+    """The InlineQuery handler class. Used to handle inline queries.
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_inline_query` decorator.
+
+    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`):
+            Pass one or more filters to allow only a subset of inline queries to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the inline query handler.
+
+        inline_query (:obj:`~pyrogram.types.InlineQuery`):
+            The received inline query.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/message_handler.py b/pyrogram/handlers/message_handler.py
new file mode 100644
index 0000000000..f5a35b5531
--- /dev/null
+++ b/pyrogram/handlers/message_handler.py
@@ -0,0 +1,49 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class MessageHandler(Handler):
+    """The Message handler class. Used to handle new messages.
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_message` decorator.
+
+    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`):
+            Pass one or more filters to allow only a subset of messages to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the message handler.
+
+        message (:obj:`~pyrogram.types.Message`):
+            The received message.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/message_reaction_count_updated_handler.py b/pyrogram/handlers/message_reaction_count_updated_handler.py
new file mode 100644
index 0000000000..cf9fed92a1
--- /dev/null
+++ b/pyrogram/handlers/message_reaction_count_updated_handler.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class MessageReactionCountUpdatedHandler(Handler):
+    """The MessageReactionCountUpdated handler class.
+    Used to handle changes in the anonymous reaction of a message.
+
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`.
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_message_reaction_count_updated` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new MessageReactionCountUpdated event arrives. It takes
+            *(client, message_reaction_count_updated)* 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 updates to be passed in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the handler.
+
+        message_reaction_count_updated (:obj:`~pyrogram.types.MessageReactionCountUpdated`):
+            The received message reaction count update.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/message_reaction_updated_handler.py b/pyrogram/handlers/message_reaction_updated_handler.py
new file mode 100644
index 0000000000..245a03709d
--- /dev/null
+++ b/pyrogram/handlers/message_reaction_updated_handler.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class MessageReactionUpdatedHandler(Handler):
+    """The MessageReactionUpdated handler class.
+    Used to handle changes in the reaction of a message.
+
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`.
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_message_reaction_updated` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new MessageReactionUpdated event arrives. It takes
+            *(client, message_reaction_updated)* 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 updates to be passed in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the handler.
+
+        message_reaction_updated (:obj:`~pyrogram.types.MessageReactionUpdated`):
+            The received message reaction update.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/poll_handler.py b/pyrogram/handlers/poll_handler.py
new file mode 100644
index 0000000000..332ca7ea28
--- /dev/null
+++ b/pyrogram/handlers/poll_handler.py
@@ -0,0 +1,50 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class PollHandler(Handler):
+    """The Poll handler class. Used to handle polls updates.
+
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.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:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the poll handler.
+
+        poll (:obj:`~pyrogram.types.Poll`):
+            The received poll.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/pre_checkout_query_handler.py b/pyrogram/handlers/pre_checkout_query_handler.py
new file mode 100644
index 0000000000..c68b9aa478
--- /dev/null
+++ b/pyrogram/handlers/pre_checkout_query_handler.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class PreCheckoutQueryHandler(Handler):
+    """The PreCheckoutQueryHandler handler class. Used to handle pre-checkout queries coming from invoice buttons.
+
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_pre_checkout_query` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new PreCheckoutQuery arrives. It takes *(client, pre_checkout_query)*
+            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 callback queries to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the message handler.
+
+        pre_checkout_query (:obj:`~pyrogram.types.PreCheckoutQuery`):
+            New incoming pre-checkout query. Contains full information about checkout.
+
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/raw_update_handler.py b/pyrogram/handlers/raw_update_handler.py
new file mode 100644
index 0000000000..d957083b57
--- /dev/null
+++ b/pyrogram/handlers/raw_update_handler.py
@@ -0,0 +1,67 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+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:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_raw_update` decorator.
+
+    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 (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the update handler.
+
+        update (``Update``):
+            The received update, which can be one of the many single Updates listed in the
+            :obj:`~pyrogram.raw.base.Update` base type.
+
+        users (``dict``):
+            Dictionary of all :obj:`~pyrogram.types.User` mentioned in the update.
+            You can access extra info about the user (such as *first_name*, *last_name*, etc...) by using
+            the IDs you find in the *update* argument (e.g.: *users[1768841572]*).
+
+        chats (``dict``):
+            Dictionary of all :obj:`~pyrogram.types.Chat` and
+            :obj:`~pyrogram.raw.types.Channel` mentioned in the update.
+            You can access extra info about the chat (such as *title*, *participants_count*, etc...)
+            by using the IDs you find in the *update* argument (e.g.: *chats[1701277281]*).
+
+    Note:
+        The following Empty or Forbidden types may exist inside the *users* and *chats* dictionaries.
+        They mean you have been blocked by the user or banned from the group/channel.
+
+        - :obj:`~pyrogram.raw.types.UserEmpty`
+        - :obj:`~pyrogram.raw.types.ChatEmpty`
+        - :obj:`~pyrogram.raw.types.ChatForbidden`
+        - :obj:`~pyrogram.raw.types.ChannelForbidden`
+    """
+
+    def __init__(self, callback: Callable):
+        super().__init__(callback)
diff --git a/pyrogram/handlers/shipping_query_handler.py b/pyrogram/handlers/shipping_query_handler.py
new file mode 100644
index 0000000000..478a3745fa
--- /dev/null
+++ b/pyrogram/handlers/shipping_query_handler.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class ShippingQueryHandler(Handler):
+    """The ShippingQueryHandler handler class. Used to handle shipping queries coming only from invoice buttons with flexible price.
+
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_shipping_query` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new PreCheckoutQuery arrives. It takes *(client, shipping_query)*
+            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 callback queries to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the message handler.
+
+        shipping_query (:obj:`~pyrogram.types.ShippingQuery`):
+            New incoming shipping query. Only for invoices with flexible price.
+
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/story_handler.py b/pyrogram/handlers/story_handler.py
new file mode 100644
index 0000000000..b6a07d1cd0
--- /dev/null
+++ b/pyrogram/handlers/story_handler.py
@@ -0,0 +1,49 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+from .handler import Handler
+
+
+class StoryHandler(Handler):
+    """The Story handler class. Used to handle new stories.
+    It is intended to be used with :meth:`~pyrogram.Client.add_handler`
+
+    For a nicer way to register this handler, have a look at the
+    :meth:`~pyrogram.Client.on_story` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new Stories arrives. It takes *(client, story)*
+            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 stories to be passed
+            in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the story handler.
+
+        story (:obj:`~pyrogram.types.Story`):
+            The received story.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/handlers/user_status_handler.py b/pyrogram/handlers/user_status_handler.py
new file mode 100644
index 0000000000..f10871e874
--- /dev/null
+++ b/pyrogram/handlers/user_status_handler.py
@@ -0,0 +1,47 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+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:`~pyrogram.Client.add_handler`.
+
+    For a nicer way to register this handler, have a look at the :meth:`~pyrogram.Client.on_user_status` decorator.
+
+    Parameters:
+        callback (``Callable``):
+            Pass a function that will be called when a new user status update arrives. It takes *(client, user)*
+            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 users to be passed in your callback function.
+
+    Other parameters:
+        client (:obj:`~pyrogram.Client`):
+            The Client itself, useful when you want to call other API methods inside the user status handler.
+
+        user (:obj:`~pyrogram.types.User`):
+            The user containing the updated status.
+    """
+
+    def __init__(self, callback: Callable, filters=None):
+        super().__init__(callback, filters)
diff --git a/pyrogram/methods/__init__.py b/pyrogram/methods/__init__.py
new file mode 100644
index 0000000000..9f0f11b1f0
--- /dev/null
+++ b/pyrogram/methods/__init__.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .advanced import Advanced
+from .auth import Auth
+from .bots import Bots
+from .chats import Chats
+from .chat_topics import ChatTopics
+from .contacts import Contacts
+from .decorators import Decorators
+from .invite_links import InviteLinks
+from .messages import Messages
+from .password import Password
+from .phone import Phone
+from .stickers import Stickers
+from .stories import Stories
+from .users import Users
+from .utilities import Utilities
+from .business import TelegramBusiness
+
+
+class Methods(
+    Decorators,
+    Advanced,
+    Auth,
+    Bots,
+    Chats,
+    ChatTopics,
+    Contacts,
+    InviteLinks,
+    Messages,
+    Password,
+    Phone,
+    Stickers,
+    Stories,
+    TelegramBusiness,
+    Users,
+    Utilities,
+):
+    pass
diff --git a/pyrogram/methods/advanced/__init__.py b/pyrogram/methods/advanced/__init__.py
new file mode 100644
index 0000000000..bf19658a3c
--- /dev/null
+++ b/pyrogram/methods/advanced/__init__.py
@@ -0,0 +1,29 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .invoke import Invoke
+from .resolve_peer import ResolvePeer
+from .save_file import SaveFile
+
+
+class Advanced(
+    Invoke,
+    ResolvePeer,
+    SaveFile
+):
+    pass
diff --git a/pyrogram/methods/advanced/invoke.py b/pyrogram/methods/advanced/invoke.py
new file mode 100644
index 0000000000..0af771adc8
--- /dev/null
+++ b/pyrogram/methods/advanced/invoke.py
@@ -0,0 +1,89 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram.raw.core import TLObject
+from pyrogram.session import Session
+
+log = logging.getLogger(__name__)
+
+
+class Invoke:
+    async def invoke(
+        self: "pyrogram.Client",
+        query: TLObject,
+        retries: int = Session.MAX_RETRIES,
+        timeout: float = Session.WAIT_TIMEOUT,
+        sleep_threshold: float = None
+    ):
+        """Invoke raw Telegram functions.
+
+        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...
+
+        .. 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).
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            query (``RawFunction``):
+                The API Schema function filled with proper arguments.
+
+            retries (``int``):
+                Number of retries.
+
+            timeout (``float``):
+                Timeout in seconds.
+
+            sleep_threshold (``float``):
+                Sleep threshold in seconds.
+
+        Returns:
+            ``RawType``: The raw type response generated by the query.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if not self.is_connected:
+            raise ConnectionError("Client has not been started yet")
+
+        if self.no_updates:
+            query = raw.functions.InvokeWithoutUpdates(query=query)
+
+        if self.takeout_id:
+            query = raw.functions.InvokeWithTakeout(takeout_id=self.takeout_id, query=query)
+
+        r = await self.session.invoke(
+            query, retries, timeout,
+            (sleep_threshold
+             if sleep_threshold is not None
+             else self.sleep_threshold)
+        )
+
+        await self.fetch_peers(getattr(r, "users", []))
+        await self.fetch_peers(getattr(r, "chats", []))
+
+        return r
diff --git a/pyrogram/methods/advanced/resolve_peer.py b/pyrogram/methods/advanced/resolve_peer.py
new file mode 100644
index 0000000000..ebb8ff4475
--- /dev/null
+++ b/pyrogram/methods/advanced/resolve_peer.py
@@ -0,0 +1,125 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import re
+from typing import Union
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import utils
+from pyrogram.errors import PeerIdInvalid
+
+log = logging.getLogger(__name__)
+
+
+class ResolvePeer:
+    async def resolve_peer(
+        self: "pyrogram.Client",
+        peer_id: Union[int, str]
+    ) -> Union[raw.base.InputPeer, raw.base.InputUser, raw.base.InputChannel]:
+        """Get the InputPeer of a known peer id.
+        Useful whenever an InputPeer type is required.
+
+        .. 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).
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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:
+            ``InputPeer``: On success, the resolved peer id is returned in form of an InputPeer object.
+
+        Raises:
+            KeyError: In case the peer doesn't exist in the internal database.
+        """
+        if not self.is_connected:
+            raise ConnectionError("Client has not been started yet")
+
+        try:
+            return await self.storage.get_peer_by_id(peer_id)
+        except KeyError:
+            if isinstance(peer_id, str):
+                if peer_id in ("self", "me"):
+                    return raw.types.InputPeerSelf()
+
+                peer_id = re.sub(r"[@+\s]", "", peer_id.lower())
+
+                try:
+                    int(peer_id)
+                except ValueError:
+                    try:
+                        return await self.storage.get_peer_by_username(peer_id)
+                    except KeyError:
+                        await self.invoke(
+                            raw.functions.contacts.ResolveUsername(
+                                username=peer_id
+                            )
+                        )
+
+                        return await self.storage.get_peer_by_username(peer_id)
+                else:
+                    try:
+                        return await self.storage.get_peer_by_phone_number(peer_id)
+                    except KeyError:
+                        raise PeerIdInvalid
+
+            peer_type = utils.get_peer_type(peer_id)
+
+            if peer_type == "user":
+                await self.fetch_peers(
+                    await self.invoke(
+                        raw.functions.users.GetUsers(
+                            id=[
+                                raw.types.InputUser(
+                                    user_id=peer_id,
+                                    access_hash=0
+                                )
+                            ]
+                        )
+                    )
+                )
+            elif peer_type == "chat":
+                await self.invoke(
+                    raw.functions.messages.GetChats(
+                        id=[-peer_id]
+                    )
+                )
+            else:
+                await self.invoke(
+                    raw.functions.channels.GetChannels(
+                        id=[
+                            raw.types.InputChannel(
+                                channel_id=utils.get_channel_id(peer_id),
+                                access_hash=0
+                            )
+                        ]
+                    )
+                )
+
+            try:
+                return await self.storage.get_peer_by_id(peer_id)
+            except KeyError:
+                raise PeerIdInvalid
diff --git a/pyrogram/methods/advanced/save_file.py b/pyrogram/methods/advanced/save_file.py
new file mode 100644
index 0000000000..42ca36c9e9
--- /dev/null
+++ b/pyrogram/methods/advanced/save_file.py
@@ -0,0 +1,228 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+import functools
+import inspect
+import io
+import logging
+import math
+import os
+from hashlib import md5
+from pathlib import PurePath
+from typing import Union, BinaryIO, Callable
+
+import pyrogram
+from pyrogram import StopTransmission
+from pyrogram import raw
+from pyrogram.session import Session
+
+log = logging.getLogger(__name__)
+
+
+class SaveFile:
+    async def save_file(
+        self: "pyrogram.Client",
+        path: Union[str, BinaryIO],
+        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.
+
+        .. 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:
+            path (``str`` | ``BinaryIO``):
+                The path of the file you want to upload that exists on your local machine or a binary file-like object
+                with its attribute ".name" set for in-memory uploads.
+
+            file_id (``int``, *optional*):
+                In case a file part expired, pass the file_id and the file_part to retry uploading that specific chunk.
+
+            file_part (``int``, *optional*):
+                In case a file part expired, pass the file_id and the file_part to retry uploading that specific chunk.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            ``InputFile``: On success, the uploaded file is returned in form of an InputFile object.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if path is None:
+            return None
+
+        async def worker(session):
+            while True:
+                data = await queue.get()
+
+                if data is None:
+                    return
+
+                try:
+                    await session.invoke(data)
+                except Exception as e:
+                    log.error(e)
+
+        part_size = 512 * 1024
+
+        if isinstance(path, (str, PurePath)):
+            fp = open(path, "rb")
+        elif isinstance(path, io.IOBase):
+            fp = path
+        else:
+            raise ValueError("Invalid file. Expected a file path as string or a binary (not text) file pointer")
+
+        file_name = getattr(fp, "name", "file.jpg")
+
+        fp.seek(0, os.SEEK_END)
+        file_size = fp.tell()
+        fp.seek(0)
+
+        if file_size == 0:
+            raise ValueError("File size equals to 0 B")
+
+        # TODO
+        file_size_limit_mib = 4000 if self.me.is_premium else 2000
+
+        if file_size > file_size_limit_mib * 1024 * 1024:
+            raise ValueError(f"Can't upload files bigger than {file_size_limit_mib} MiB")
+
+        file_total_parts = int(math.ceil(file_size / part_size))
+        is_big = file_size > 10 * 1024 * 1024
+        pool_size = 3 if is_big else 1
+        workers_count = 4 if is_big else 1
+        is_missing_part = file_id is not None
+        file_id = file_id or self.rnd_id()
+        md5_sum = md5() if not is_big and not is_missing_part else None
+        pool = [
+            Session(
+                self, await self.storage.dc_id(), await self.storage.auth_key(),
+                await self.storage.test_mode(), is_media=True
+            ) for _ in range(pool_size)
+        ]
+        workers = [self.loop.create_task(worker(session)) for session in pool for _ in range(workers_count)]
+        queue = asyncio.Queue(16)
+
+        try:
+            for session in pool:
+                await session.start()
+
+            fp.seek(part_size * file_part)
+
+            while True:
+                chunk = fp.read(part_size)
+
+                if not chunk:
+                    if not is_big and not is_missing_part:
+                        md5_sum = "".join([hex(i)[2:].zfill(2) for i in md5_sum.digest()])
+                    break
+
+                if is_big:
+                    rpc = raw.functions.upload.SaveBigFilePart(
+                        file_id=file_id,
+                        file_part=file_part,
+                        file_total_parts=file_total_parts,
+                        bytes=chunk
+                    )
+                else:
+                    rpc = raw.functions.upload.SaveFilePart(
+                        file_id=file_id,
+                        file_part=file_part,
+                        bytes=chunk
+                    )
+
+                await queue.put(rpc)
+
+                if is_missing_part:
+                    return
+
+                if not is_big and not is_missing_part:
+                    md5_sum.update(chunk)
+
+                file_part += 1
+
+                if progress:
+                    func = functools.partial(
+                        progress,
+                        min(file_part * part_size, file_size),
+                        file_size,
+                        *progress_args
+                    )
+
+                    if inspect.iscoroutinefunction(progress):
+                        await func()
+                    else:
+                        await self.loop.run_in_executor(self.executor, func)
+        except StopTransmission:
+            raise
+        except Exception as e:
+            log.error(e, exc_info=True)
+        else:
+            if is_big:
+                return raw.types.InputFileBig(
+                    id=file_id,
+                    parts=file_total_parts,
+                    name=file_name,
+
+                )
+            else:
+                return raw.types.InputFile(
+                    id=file_id,
+                    parts=file_total_parts,
+                    name=file_name,
+                    md5_checksum=md5_sum
+                )
+        finally:
+            for _ in workers:
+                await queue.put(None)
+
+            await asyncio.gather(*workers)
+
+            for session in pool:
+                await session.stop()
+            if isinstance(path, (str, PurePath)):
+                fp.close()
diff --git a/pyrogram/methods/auth/__init__.py b/pyrogram/methods/auth/__init__.py
new file mode 100644
index 0000000000..91a5009d1c
--- /dev/null
+++ b/pyrogram/methods/auth/__init__.py
@@ -0,0 +1,59 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .accept_terms_of_service import AcceptTermsOfService
+from .check_password import CheckPassword
+from .connect import Connect
+from .disconnect import Disconnect
+from .get_active_sessions import GetActiveSessions
+from .get_password_hint import GetPasswordHint
+from .initialize import Initialize
+from .log_out import LogOut
+from .recover_password import RecoverPassword
+from .resend_code import ResendCode
+from .send_code import SendCode
+from .send_recovery_code import SendRecoveryCode
+from .sign_in import SignIn
+from .sign_in_bot import SignInBot
+from .sign_up import SignUp
+from .terminate import Terminate
+from .terminate_all_other_sessions import TerminateAllOtherSessions
+from .terminate_session import TerminateSession
+
+
+class Auth(
+    AcceptTermsOfService,
+    CheckPassword,
+    Connect,
+    Disconnect,
+    GetActiveSessions,
+    GetPasswordHint,
+    Initialize,
+    LogOut,
+    RecoverPassword,
+    ResendCode,
+    SendCode,
+    SendRecoveryCode,
+    SignIn,
+    SignInBot,
+    SignUp,
+    Terminate,
+    TerminateAllOtherSessions,
+    TerminateSession,
+):
+    pass
diff --git a/pyrogram/methods/auth/accept_terms_of_service.py b/pyrogram/methods/auth/accept_terms_of_service.py
new file mode 100644
index 0000000000..cc1fcf5453
--- /dev/null
+++ b/pyrogram/methods/auth/accept_terms_of_service.py
@@ -0,0 +1,44 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class AcceptTermsOfService:
+    async def accept_terms_of_service(
+        self: "pyrogram.Client",
+        terms_of_service_id: str
+    ) -> bool:
+        """Accept the given terms of service.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            terms_of_service_id (``str``):
+                The terms of service identifier.
+        """
+        r = await self.invoke(
+            raw.functions.help.AcceptTermsOfService(
+                id=raw.types.DataJSON(
+                    data=terms_of_service_id
+                )
+            )
+        )
+
+        return bool(r)
diff --git a/pyrogram/methods/auth/check_password.py b/pyrogram/methods/auth/check_password.py
new file mode 100644
index 0000000000..39aa82fcc0
--- /dev/null
+++ b/pyrogram/methods/auth/check_password.py
@@ -0,0 +1,60 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+from pyrogram.utils import compute_password_check
+
+log = logging.getLogger(__name__)
+
+
+class CheckPassword:
+    async def check_password(
+        self: "pyrogram.Client",
+        password: str
+    ) -> "types.User":
+        """Check your Two-Step Verification password and log in.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            password (``str``):
+                Your Two-Step Verification password.
+
+        Returns:
+            :obj:`~pyrogram.types.User`: On success, the authorized user is returned.
+
+        Raises:
+            BadRequest: In case the password is invalid.
+        """
+        r = await self.invoke(
+            raw.functions.auth.CheckPassword(
+                password=compute_password_check(
+                    await self.invoke(raw.functions.account.GetPassword()),
+                    password
+                )
+            )
+        )
+
+        await self.storage.user_id(r.user.id)
+        await self.storage.is_bot(False)
+
+        return types.User._parse(self, r.user)
diff --git a/pyrogram/methods/auth/connect.py b/pyrogram/methods/auth/connect.py
new file mode 100644
index 0000000000..612e064bb4
--- /dev/null
+++ b/pyrogram/methods/auth/connect.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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.session import Session
+
+
+class Connect:
+    async def connect(
+        self: "pyrogram.Client",
+    ) -> bool:
+        """
+        Connect the client to Telegram servers.
+
+        Returns:
+            ``bool``: On success, in case the passed-in session is authorized, True is returned. Otherwise, in case
+            the session needs to be authorized, False is returned.
+
+        Raises:
+            ConnectionError: In case you try to connect an already connected client.
+        """
+        if self.is_connected:
+            raise ConnectionError("Client is already connected")
+
+        await self.load_session()
+
+        self.session = Session(
+            self, await self.storage.dc_id(),
+            await self.storage.auth_key(), await self.storage.test_mode()
+        )
+
+        await self.session.start()
+
+        self.is_connected = True
+
+        return bool(await self.storage.user_id())
diff --git a/pyrogram/methods/auth/disconnect.py b/pyrogram/methods/auth/disconnect.py
new file mode 100644
index 0000000000..daa07b8353
--- /dev/null
+++ b/pyrogram/methods/auth/disconnect.py
@@ -0,0 +1,40 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+
+class Disconnect:
+    async def disconnect(
+        self: "pyrogram.Client",
+    ):
+        """Disconnect the client from Telegram servers.
+
+        Raises:
+            ConnectionError: In case you try to disconnect an already disconnected client or in case you try to
+                disconnect a client that needs to be terminated first.
+        """
+        if not self.is_connected:
+            raise ConnectionError("Client is already disconnected")
+
+        if self.is_initialized:
+            raise ConnectionError("Can't disconnect an initialized client")
+
+        await self.session.stop()
+        await self.storage.close()
+        self.is_connected = False
diff --git a/pyrogram/methods/auth/get_active_sessions.py b/pyrogram/methods/auth/get_active_sessions.py
new file mode 100644
index 0000000000..d8c906b860
--- /dev/null
+++ b/pyrogram/methods/auth/get_active_sessions.py
@@ -0,0 +1,40 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+
+class GetActiveSessions:
+    async def get_active_sessions(
+        self: "pyrogram.Client"
+    ) -> "types.ActiveSessions":
+        """Returns all active sessions of the current user.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Returns:
+            :obj:`~pyrogram.types.ActiveSessions`: On success, all the active sessions of the current user is returned.
+
+        """
+        r = await self.invoke(
+            raw.functions.account.GetAuthorizations()
+        )
+        return types.ActiveSessions._parse(r)
diff --git a/pyrogram/methods/auth/get_password_hint.py b/pyrogram/methods/auth/get_password_hint.py
new file mode 100644
index 0000000000..a57f7c8075
--- /dev/null
+++ b/pyrogram/methods/auth/get_password_hint.py
@@ -0,0 +1,38 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+log = logging.getLogger(__name__)
+
+
+class GetPasswordHint:
+    async def get_password_hint(
+        self: "pyrogram.Client",
+    ) -> str:
+        """Get your Two-Step Verification password hint.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Returns:
+            ``str``: On success, the password hint as string is returned.
+        """
+        return (await self.invoke(raw.functions.account.GetPassword())).hint
diff --git a/pyrogram/methods/auth/initialize.py b/pyrogram/methods/auth/initialize.py
new file mode 100644
index 0000000000..7188b66817
--- /dev/null
+++ b/pyrogram/methods/auth/initialize.py
@@ -0,0 +1,52 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+import logging
+
+import pyrogram
+
+log = logging.getLogger(__name__)
+
+
+class Initialize:
+    async def initialize(
+        self: "pyrogram.Client",
+    ):
+        """Initialize the client by starting up workers.
+
+        This method will start updates and download workers.
+        It will also load plugins and start the internal dispatcher.
+
+        Raises:
+            ConnectionError: In case you try to initialize a disconnected client or in case you try to initialize an
+                already initialized client.
+        """
+        if not self.is_connected:
+            raise ConnectionError("Can't initialize a disconnected client")
+
+        if self.is_initialized:
+            raise ConnectionError("Client is already initialized")
+
+        self.load_plugins()
+
+        await self.dispatcher.start()
+
+        self.updates_watchdog_task = asyncio.create_task(self.updates_watchdog())
+
+        self.is_initialized = True
diff --git a/pyrogram/methods/auth/log_out.py b/pyrogram/methods/auth/log_out.py
new file mode 100644
index 0000000000..84b7db64cd
--- /dev/null
+++ b/pyrogram/methods/auth/log_out.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+log = logging.getLogger(__name__)
+
+
+class LogOut:
+    async def log_out(
+        self: "pyrogram.Client",
+    ):
+        """Log out from Telegram and delete the *\\*.session* file.
+
+        When you log out, the current client is stopped and the storage session deleted.
+        No more API calls can be made until you start the client and re-authorize again.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Log out.
+                app.log_out()
+        """
+        await self.invoke(raw.functions.auth.LogOut())
+        await self.stop()
+        await self.storage.delete()
+
+        return True
diff --git a/pyrogram/methods/auth/recover_password.py b/pyrogram/methods/auth/recover_password.py
new file mode 100644
index 0000000000..0a34750752
--- /dev/null
+++ b/pyrogram/methods/auth/recover_password.py
@@ -0,0 +1,57 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class RecoverPassword:
+    async def recover_password(
+        self: "pyrogram.Client",
+        recovery_code: str
+    ) -> "types.User":
+        """Recover your password with a recovery code and log in.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            recovery_code (``str``):
+                The recovery code sent via email.
+
+        Returns:
+            :obj:`~pyrogram.types.User`: On success, the authorized user is returned and the Two-Step Verification
+            password reset.
+
+        Raises:
+            BadRequest: In case the recovery code is invalid.
+        """
+        r = await self.invoke(
+            raw.functions.auth.RecoverPassword(
+                code=recovery_code
+            )
+        )
+
+        await self.storage.user_id(r.user.id)
+        await self.storage.is_bot(False)
+
+        return types.User._parse(self, r.user)
diff --git a/pyrogram/methods/auth/resend_code.py b/pyrogram/methods/auth/resend_code.py
new file mode 100644
index 0000000000..9644ac4f54
--- /dev/null
+++ b/pyrogram/methods/auth/resend_code.py
@@ -0,0 +1,64 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class ResendCode:
+    async def resend_code(
+        self: "pyrogram.Client",
+        phone_number: str,
+        phone_code_hash: str
+    ) -> "types.SentCode":
+        """Re-send the confirmation code using a different type.
+
+        The type of the code to be re-sent is specified in the *next_type* attribute of the
+        :obj:`~pyrogram.types.SentCode` object returned by :meth:`send_code`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            phone_number (``str``):
+                Phone number in international format (includes the country prefix).
+
+            phone_code_hash (``str``):
+                Confirmation code identifier.
+
+        Returns:
+            :obj:`~pyrogram.types.SentCode`: On success, an object containing information on the re-sent confirmation
+            code is returned.
+
+        Raises:
+            BadRequest: In case the arguments are invalid.
+        """
+        phone_number = phone_number.strip(" +")
+
+        r = await self.invoke(
+            raw.functions.auth.ResendCode(
+                phone_number=phone_number,
+                phone_code_hash=phone_code_hash
+            )
+        )
+
+        return types.SentCode._parse(r)
diff --git a/pyrogram/methods/auth/send_code.py b/pyrogram/methods/auth/send_code.py
new file mode 100644
index 0000000000..92ffc99996
--- /dev/null
+++ b/pyrogram/methods/auth/send_code.py
@@ -0,0 +1,79 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+from pyrogram.errors import PhoneMigrate, NetworkMigrate
+from pyrogram.session import Session, Auth
+
+log = logging.getLogger(__name__)
+
+
+class SendCode:
+    async def send_code(
+        self: "pyrogram.Client",
+        phone_number: str
+    ) -> "types.SentCode":
+        """Send the confirmation code to the given phone number.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            phone_number (``str``):
+                Phone number in international format (includes the country prefix).
+
+        Returns:
+            :obj:`~pyrogram.types.SentCode`: On success, an object containing information on the sent confirmation code
+            is returned.
+
+        Raises:
+            BadRequest: In case the phone number is invalid.
+        """
+        phone_number = phone_number.strip(" +")
+
+        while True:
+            try:
+                r = await self.invoke(
+                    raw.functions.auth.SendCode(
+                        phone_number=phone_number,
+                        api_id=self.api_id,
+                        api_hash=self.api_hash,
+                        settings=raw.types.CodeSettings()
+                    )
+                )
+            except (PhoneMigrate, NetworkMigrate) as e:
+                await self.session.stop()
+
+                await self.storage.dc_id(e.value)
+                await self.storage.auth_key(
+                    await Auth(
+                        self, await self.storage.dc_id(),
+                        await self.storage.test_mode()
+                    ).create()
+                )
+                self.session = Session(
+                    self, await self.storage.dc_id(),
+                    await self.storage.auth_key(), await self.storage.test_mode()
+                )
+
+                await self.session.start()
+            else:
+                return types.SentCode._parse(r)
diff --git a/pyrogram/methods/auth/send_recovery_code.py b/pyrogram/methods/auth/send_recovery_code.py
new file mode 100644
index 0000000000..9a25f3c68f
--- /dev/null
+++ b/pyrogram/methods/auth/send_recovery_code.py
@@ -0,0 +1,43 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+log = logging.getLogger(__name__)
+
+
+class SendRecoveryCode:
+    async def send_recovery_code(
+        self: "pyrogram.Client",
+    ) -> str:
+        """Send a code to your email to recover your password.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Returns:
+            ``str``: On success, the hidden email pattern is returned and a recovery code is sent to that email.
+
+        Raises:
+            BadRequest: In case no recovery email was set up.
+        """
+        return (await self.invoke(
+            raw.functions.auth.RequestPasswordRecovery()
+        )).email_pattern
diff --git a/pyrogram/methods/auth/sign_in.py b/pyrogram/methods/auth/sign_in.py
new file mode 100644
index 0000000000..9d77f1cd37
--- /dev/null
+++ b/pyrogram/methods/auth/sign_in.py
@@ -0,0 +1,80 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class SignIn:
+    async def sign_in(
+        self: "pyrogram.Client",
+        phone_number: str,
+        phone_code_hash: str,
+        phone_code: str
+    ) -> Union["types.User", "types.TermsOfService", bool]:
+        """Authorize a user in Telegram with a valid confirmation code.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            phone_number (``str``):
+                Phone number in international format (includes the country prefix).
+
+            phone_code_hash (``str``):
+                Code identifier taken from the result of :meth:`~pyrogram.Client.send_code`.
+
+            phone_code (``str``):
+                The valid confirmation code you received (either as Telegram message or as SMS in your phone number).
+
+        Returns:
+            :obj:`~pyrogram.types.User` | :obj:`~pyrogram.types.TermsOfService` | bool: On success, in case the
+            authorization completed, the user is returned. In case the phone number needs to be registered first AND the
+            terms of services accepted (with :meth:`~pyrogram.Client.accept_terms_of_service`), an object containing
+            them is returned. In case the phone number needs to be registered, but the terms of services don't need to
+            be accepted, False is returned instead.
+
+        Raises:
+            BadRequest: In case the arguments are invalid.
+            SessionPasswordNeeded: In case a password is needed to sign in.
+        """
+        phone_number = phone_number.strip(" +")
+
+        r = await self.invoke(
+            raw.functions.auth.SignIn(
+                phone_number=phone_number,
+                phone_code_hash=phone_code_hash,
+                phone_code=phone_code
+            )
+        )
+
+        if isinstance(r, raw.types.auth.AuthorizationSignUpRequired):
+            if r.terms_of_service:
+                return types.TermsOfService._parse(terms_of_service=r.terms_of_service)
+
+            return False
+        else:
+            await self.storage.user_id(r.user.id)
+            await self.storage.is_bot(False)
+
+            return types.User._parse(self, r.user)
diff --git a/pyrogram/methods/auth/sign_in_bot.py b/pyrogram/methods/auth/sign_in_bot.py
new file mode 100644
index 0000000000..09a2f28379
--- /dev/null
+++ b/pyrogram/methods/auth/sign_in_bot.py
@@ -0,0 +1,79 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+from pyrogram.errors import UserMigrate
+from pyrogram.session import Session, Auth
+
+log = logging.getLogger(__name__)
+
+
+class SignInBot:
+    async def sign_in_bot(
+        self: "pyrogram.Client",
+        bot_token: str
+    ) -> "types.User":
+        """Authorize a bot using its bot token generated by BotFather.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            bot_token (``str``):
+                The bot token generated by BotFather
+
+        Returns:
+            :obj:`~pyrogram.types.User`: On success, the bot identity is return in form of a user object.
+
+        Raises:
+            BadRequest: In case the bot token is invalid.
+        """
+        while True:
+            try:
+                r = await self.invoke(
+                    raw.functions.auth.ImportBotAuthorization(
+                        flags=0,
+                        api_id=self.api_id,
+                        api_hash=self.api_hash,
+                        bot_auth_token=bot_token
+                    )
+                )
+            except UserMigrate as e:
+                await self.session.stop()
+
+                await self.storage.dc_id(e.value)
+                await self.storage.auth_key(
+                    await Auth(
+                        self, await self.storage.dc_id(),
+                        await self.storage.test_mode()
+                    ).create()
+                )
+                self.session = Session(
+                    self, await self.storage.dc_id(),
+                    await self.storage.auth_key(), await self.storage.test_mode()
+                )
+
+                await self.session.start()
+            else:
+                await self.storage.user_id(r.user.id)
+                await self.storage.is_bot(True)
+
+                return types.User._parse(self, r.user)
diff --git a/pyrogram/methods/auth/sign_up.py b/pyrogram/methods/auth/sign_up.py
new file mode 100644
index 0000000000..eee64fdd3f
--- /dev/null
+++ b/pyrogram/methods/auth/sign_up.py
@@ -0,0 +1,74 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class SignUp:
+    async def sign_up(
+        self: "pyrogram.Client",
+        phone_number: str,
+        phone_code_hash: str,
+        first_name: str,
+        last_name: str = ""
+    ) -> "types.User":
+        """Register a new user in Telegram.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            phone_number (``str``):
+                Phone number in international format (includes the country prefix).
+
+            phone_code_hash (``str``):
+                Code identifier taken from the result of :meth:`~pyrogram.Client.send_code`.
+
+            first_name (``str``):
+                New user first name.
+
+            last_name (``str``, *optional*):
+                New user last name. Defaults to "" (empty string, no last name).
+
+        Returns:
+            :obj:`~pyrogram.types.User`: On success, the new registered user is returned.
+
+        Raises:
+            BadRequest: In case the arguments are invalid.
+        """
+        phone_number = phone_number.strip(" +")
+
+        r = await self.invoke(
+            raw.functions.auth.SignUp(
+                phone_number=phone_number,
+                first_name=first_name,
+                last_name=last_name,
+                phone_code_hash=phone_code_hash,
+                no_joined_notifications=self.no_joined_notifications
+            )
+        )
+
+        await self.storage.user_id(r.user.id)
+        await self.storage.is_bot(False)
+
+        return types.User._parse(self, r.user)
diff --git a/pyrogram/methods/auth/terminate.py b/pyrogram/methods/auth/terminate.py
new file mode 100644
index 0000000000..d5fd949cba
--- /dev/null
+++ b/pyrogram/methods/auth/terminate.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+log = logging.getLogger(__name__)
+
+
+class Terminate:
+    async def terminate(
+        self: "pyrogram.Client",
+    ):
+        """Terminate the client by shutting down workers.
+
+        This method does the opposite of :meth:`~pyrogram.Client.initialize`.
+        It will stop the dispatcher and shut down updates and download workers.
+
+        Raises:
+            ConnectionError: In case you try to terminate a client that is already terminated.
+        """
+        if not self.is_initialized:
+            raise ConnectionError("Client is already terminated")
+
+        if self.takeout_id:
+            await self.invoke(raw.functions.account.FinishTakeoutSession())
+            log.info("Takeout session %s finished", self.takeout_id)
+
+        await self.storage.save()
+        await self.dispatcher.stop()
+
+        for media_session in self.media_sessions.values():
+            await media_session.stop()
+
+        self.media_sessions.clear()
+
+        self.updates_watchdog_event.set()
+
+        if self.updates_watchdog_task is not None:
+            await self.updates_watchdog_task
+
+        self.updates_watchdog_event.clear()
+
+        self.is_initialized = False
diff --git a/pyrogram/methods/auth/terminate_all_other_sessions.py b/pyrogram/methods/auth/terminate_all_other_sessions.py
new file mode 100644
index 0000000000..027ea3cc3b
--- /dev/null
+++ b/pyrogram/methods/auth/terminate_all_other_sessions.py
@@ -0,0 +1,40 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class TerminateAllOtherSessions:
+    async def terminate_all_other_sessions(
+        self: "pyrogram.Client"
+    ) -> bool:
+        """Terminates all other sessions of the current user.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Returns:
+            ``bool``: On success, in case the session is destroyed, True is returned. Otherwise, False is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+
+        """
+        return await self.invoke(
+            raw.functions.auth.ResetAuthorizations()
+        )
diff --git a/pyrogram/methods/auth/terminate_session.py b/pyrogram/methods/auth/terminate_session.py
new file mode 100644
index 0000000000..90ddaf7a70
--- /dev/null
+++ b/pyrogram/methods/auth/terminate_session.py
@@ -0,0 +1,45 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class TerminateSession:
+    async def terminate_session(
+        self: "pyrogram.Client",
+        session_id: int
+    ) -> bool:
+        """Terminates a session of the current user.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            session_id (``int``):
+                Session identifier.
+
+        Returns:
+            ``bool``: On success, in case the session is destroyed, True is returned. Otherwise, False is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+
+        """
+        return await self.invoke(
+            raw.functions.account.ResetAuthorization(hash=session_id)
+        )
diff --git a/pyrogram/methods/bots/__init__.py b/pyrogram/methods/bots/__init__.py
new file mode 100644
index 0000000000..33a602914c
--- /dev/null
+++ b/pyrogram/methods/bots/__init__.py
@@ -0,0 +1,69 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .answer_callback_query import AnswerCallbackQuery
+from .answer_inline_query import AnswerInlineQuery
+from .answer_web_app_query import AnswerWebAppQuery
+from .delete_bot_commands import DeleteBotCommands
+from .get_bot_commands import GetBotCommands
+from .get_bot_default_privileges import GetBotDefaultPrivileges
+from .get_bot_info_description import GetBotInfoDescription
+from .get_bot_info_short_description import GetBotInfoShortDescription
+from .get_bot_name import GetBotName
+from .get_chat_menu_button import GetChatMenuButton
+from .get_game_high_scores import GetGameHighScores
+from .get_inline_bot_results import GetInlineBotResults
+from .request_callback_answer import RequestCallbackAnswer
+from .send_game import SendGame
+from .send_inline_bot_result import SendInlineBotResult
+from .send_web_app_custom_request import SendWebAppCustomRequest
+from .set_bot_commands import SetBotCommands
+from .set_bot_default_privileges import SetBotDefaultPrivileges
+from .set_bot_info_description import SetBotInfoDescription
+from .set_bot_info_short_description import SetBotInfoShortDescription
+from .set_bot_name import SetBotName
+from .set_chat_menu_button import SetChatMenuButton
+from .set_game_score import SetGameScore
+
+
+class Bots(
+    AnswerCallbackQuery,
+    AnswerInlineQuery,
+    AnswerWebAppQuery,
+    SendWebAppCustomRequest,
+    GetInlineBotResults,
+    RequestCallbackAnswer,
+    SendInlineBotResult,
+    SendGame,
+    SetGameScore,
+    GetGameHighScores,
+    SetBotCommands,
+    GetBotCommands,
+    DeleteBotCommands,
+    SetBotDefaultPrivileges,
+    GetBotDefaultPrivileges,
+    SetChatMenuButton,
+    GetChatMenuButton,
+    SetBotInfoDescription,
+    GetBotInfoDescription,
+    SetBotInfoShortDescription,
+    GetBotInfoShortDescription,
+    SetBotName,
+    GetBotName,
+):
+    pass
diff --git a/pyrogram/methods/bots/answer_callback_query.py b/pyrogram/methods/bots/answer_callback_query.py
new file mode 100644
index 0000000000..a6d8747cd5
--- /dev/null
+++ b/pyrogram/methods/bots/answer_callback_query.py
@@ -0,0 +1,81 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class AnswerCallbackQuery:
+    async def answer_callback_query(
+        self: "pyrogram.Client",
+        callback_query_id: str,
+        text: str = None,
+        show_alert: bool = None,
+        url: str = None,
+        cache_time: int = 0
+    ):
+        """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.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            callback_query_id (``str``):
+                Unique identifier for the query to be answered.
+
+            text (``str`` *optional*):
+                Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters.
+
+            show_alert (``bool``, *optional*):
+                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``, *optional*):
+                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``, *optional*):
+                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.
+
+        Returns:
+            ``bool``: True, on success.
+
+        Example:
+            .. code-block:: python
+
+                # Answer only (remove the spinning circles)
+                await app.answer_callback_query(query_id)
+
+                # Answer without alert
+                await app.answer_callback_query(query_id, text=text)
+
+                # Answer with alert
+                await app.answer_callback_query(query_id, text=text, show_alert=True)
+        """
+        return await self.invoke(
+            raw.functions.messages.SetBotCallbackAnswer(
+                query_id=int(callback_query_id),
+                cache_time=cache_time,
+                alert=show_alert or None,
+                message=text or None,
+                url=url or None
+            )
+        )
diff --git a/pyrogram/methods/bots/answer_inline_query.py b/pyrogram/methods/bots/answer_inline_query.py
new file mode 100644
index 0000000000..c3a450a015
--- /dev/null
+++ b/pyrogram/methods/bots/answer_inline_query.py
@@ -0,0 +1,112 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Iterable
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class AnswerInlineQuery:
+    async def answer_inline_query(
+        self: "pyrogram.Client",
+        inline_query_id: str,
+        results: Iterable["types.InlineQueryResult"],
+        cache_time: int = 300,
+        is_gallery: bool = False,
+        is_personal: bool = False,
+        next_offset: str = "",
+        switch_pm_text: str = "",
+        switch_pm_parameter: str = ""
+    ):
+        """Send answers to an inline query.
+
+        A maximum of 50 results per query is allowed.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            inline_query_id (``str``):
+                Unique identifier for the answered query.
+
+            results (List of :obj:`~pyrogram.types.InlineQueryResult`):
+                A list of results for the inline query.
+
+            cache_time (``int``, *optional*):
+                The maximum amount of time in seconds that the result of the inline query may be cached on the server.
+                Defaults to 300.
+
+            is_gallery (``bool``, *optional*):
+                Pass True, if results should be displayed in gallery mode instead of list mode.
+                Defaults to False.
+
+            is_personal (``bool``, *optional*):
+                Pass True, if results may be cached on the server side only for the user that sent the query.
+                By default (False), results may be returned to any user who sends the same query.
+
+            next_offset (``str``, *optional*):
+                Pass the offset that a client should send in the next query with the same text to receive more results.
+                Pass an empty string if there are no more results or if you don‘t support pagination.
+                Offset length can’t exceed 64 bytes.
+
+            switch_pm_text (``str``, *optional*):
+                If passed, clients will display a button with specified text that switches the user to a private chat
+                with the bot and sends the bot a start message with the parameter switch_pm_parameter
+
+            switch_pm_parameter (``str``, *optional*):
+                `Deep-linking `_ parameter for the /start message sent to
+                the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
+
+                Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube
+                account to adapt search results accordingly. To do this, it displays a "Connect your YouTube account"
+                button above the results, or even before showing any. The user presses the button, switches to a private
+                chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth
+                link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat
+                where they wanted to use the bot's inline capabilities.
+
+        Returns:
+            ``bool``: True, on success.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import InlineQueryResultArticle, InputTextMessageContent
+
+                await app.answer_inline_query(
+                    inline_query_id,
+                    results=[
+                        InlineQueryResultArticle(
+                            "Title",
+                            InputTextMessageContent("Message content"))])
+        """
+
+        return await self.invoke(
+            raw.functions.messages.SetInlineBotResults(
+                query_id=int(inline_query_id),
+                results=[await r.write(self) for r in results],
+                cache_time=cache_time,
+                gallery=is_gallery or None,
+                private=is_personal or None,
+                next_offset=next_offset or None,
+                switch_pm=raw.types.InlineBotSwitchPM(
+                    text=switch_pm_text,
+                    start_param=switch_pm_parameter
+                ) if switch_pm_text else None
+            )
+        )
diff --git a/pyrogram/methods/bots/answer_web_app_query.py b/pyrogram/methods/bots/answer_web_app_query.py
new file mode 100644
index 0000000000..74f56079bb
--- /dev/null
+++ b/pyrogram/methods/bots/answer_web_app_query.py
@@ -0,0 +1,53 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class AnswerWebAppQuery:
+    async def answer_web_app_query(
+        self: "pyrogram.Client",
+        web_app_query_id: str,
+        result: "types.InlineQueryResult"
+    ) -> "types.SentWebAppMessage":
+        """Set the result of an interaction with a `Web App `_ and send a
+        corresponding message on behalf of the user to the chat from which the query originated.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            web_app_query_id (``str``):
+                Unique identifier for the answered query.
+
+            result (:obj:`~pyrogram.types.InlineQueryResult`):
+                A list of results for the inline query.
+
+        Returns:
+            :obj:`~pyrogram.types.SentWebAppMessage`: On success the sent web app message is returned.
+        """
+
+        r = await self.invoke(
+            raw.functions.messages.SendWebViewResultMessage(
+                bot_query_id=web_app_query_id,
+                result=await result.write(self)
+            )
+        )
+
+        return types.SentWebAppMessage._parse(r)
diff --git a/pyrogram/methods/bots/delete_bot_commands.py b/pyrogram/methods/bots/delete_bot_commands.py
new file mode 100644
index 0000000000..e8173d32d9
--- /dev/null
+++ b/pyrogram/methods/bots/delete_bot_commands.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+
+class DeleteBotCommands:
+    async def delete_bot_commands(
+        self: "pyrogram.Client",
+        scope: "types.BotCommandScope" = types.BotCommandScopeDefault(),
+        language_code: str = "",
+    ) -> bool:
+        """Delete the list of the bot's commands for the given scope and user language.
+        After deletion, higher level commands will be shown to affected users.
+
+        The commands passed will overwrite any command set previously.
+        This method can be used by the own bot only.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            scope (:obj:`~pyrogram.types.BotCommandScope`, *optional*):
+                An object describing the scope of users for which the commands are relevant.
+                Defaults to :obj:`~pyrogram.types.BotCommandScopeDefault`.
+
+            language_code (``str``, *optional*):
+                A two-letter ISO 639-1 language code.
+                If empty, commands will be applied to all users from the given scope, for whose language there are no
+                dedicated commands.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Delete commands
+                await app.delete_bot_commands()
+        """
+
+        return await self.invoke(
+            raw.functions.bots.ResetBotCommands(
+                scope=await scope.write(self),
+                lang_code=language_code,
+            )
+        )
diff --git a/pyrogram/methods/bots/get_bot_commands.py b/pyrogram/methods/bots/get_bot_commands.py
new file mode 100644
index 0000000000..78deff30fd
--- /dev/null
+++ b/pyrogram/methods/bots/get_bot_commands.py
@@ -0,0 +1,67 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+
+class GetBotCommands:
+    async def get_bot_commands(
+        self: "pyrogram.Client",
+        scope: "types.BotCommandScope" = types.BotCommandScopeDefault(),
+        language_code: str = "",
+    ) -> List["types.BotCommand"]:
+        """Get the current list of the bot's commands for the given scope and user language.
+        Returns Array of BotCommand on success. If commands aren't set, an empty list is returned.
+
+        The commands passed will overwrite any command set previously.
+        This method can be used by the own bot only.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            scope (:obj:`~pyrogram.types.BotCommandScope`, *optional*):
+                An object describing the scope of users for which the commands are relevant.
+                Defaults to :obj:`~pyrogram.types.BotCommandScopeDefault`.
+
+            language_code (``str``, *optional*):
+                A two-letter ISO 639-1 language code.
+                If empty, commands will be applied to all users from the given scope, for whose language there are no
+                dedicated commands.
+
+        Returns:
+            List of :obj:`~pyrogram.types.BotCommand`: On success, the list of bot commands is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Get commands
+                commands = await app.get_bot_commands()
+                print(commands)
+        """
+
+        r = await self.invoke(
+            raw.functions.bots.GetBotCommands(
+                scope=await scope.write(self),
+                lang_code=language_code,
+            )
+        )
+
+        return types.List(types.BotCommand.read(c) for c in r)
diff --git a/pyrogram/methods/bots/get_bot_default_privileges.py b/pyrogram/methods/bots/get_bot_default_privileges.py
new file mode 100644
index 0000000000..217d9b4384
--- /dev/null
+++ b/pyrogram/methods/bots/get_bot_default_privileges.py
@@ -0,0 +1,59 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetBotDefaultPrivileges:
+    async def get_bot_default_privileges(
+        self: "pyrogram.Client",
+        for_channels: bool = None
+    ) -> Optional["types.ChatPrivileges"]:
+        """Get the current default privileges of the bot.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            for_channels (``bool``, *optional*):
+                Pass True to get default privileges of the bot in channels. Otherwise, default privileges of the bot
+                for groups and supergroups will be returned.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                privileges = await app.get_bot_default_privileges()
+        """
+
+        bot_info = await self.invoke(
+            raw.functions.users.GetFullUser(
+                id=raw.types.InputUserSelf()
+            )
+        )
+
+        field = "bot_broadcast_admin_rights" if for_channels else "bot_group_admin_rights"
+
+        admin_rights = getattr(bot_info.full_user, field)
+
+        return types.ChatPrivileges._parse(admin_rights) if admin_rights else None
diff --git a/pyrogram/methods/bots/get_bot_info_description.py b/pyrogram/methods/bots/get_bot_info_description.py
new file mode 100644
index 0000000000..739e6d60dc
--- /dev/null
+++ b/pyrogram/methods/bots/get_bot_info_description.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class GetBotInfoDescription:
+    async def get_bot_info_description(
+        self: "pyrogram.Client",
+        language_code: str = "",
+        for_my_bot: Union[int, str] = None,
+    ) -> str:
+        """Use this method to get the current / owned bot description for the given user language.
+        
+        .. note::
+
+            If the current account is an User, can be called only if the ``for_my_bot`` has ``can_be_edited`` property set to True.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            language_code (``str``, *optional*):
+                A two-letter ISO 639-1 language code or an empty string
+
+            for_my_bot (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the bot for which profile photo has to be updated instead of the current user.
+                The bot should have ``can_be_edited`` property set to True.
+
+        Returns:
+            ``str``: On success, returns the text shown in the chat with a bot if the chat is empty in the given language.
+
+        Example:
+            .. code-block:: python
+
+                bot_description = await app.get_bot_info_description()
+        """
+
+        bot_info = await self.invoke(
+            raw.functions.bots.GetBotInfo(
+                bot=await self.resolve_peer(for_my_bot) if for_my_bot else None,
+                lang_code=language_code
+            )
+        )
+        return bot_info.description
diff --git a/pyrogram/methods/bots/get_bot_info_short_description.py b/pyrogram/methods/bots/get_bot_info_short_description.py
new file mode 100644
index 0000000000..c78eb186c5
--- /dev/null
+++ b/pyrogram/methods/bots/get_bot_info_short_description.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class GetBotInfoShortDescription:
+    async def get_bot_info_short_description(
+        self: "pyrogram.Client",
+        language_code: str = "",
+        for_my_bot: Union[int, str] = None,
+    ) -> str:
+        """Use this method to get the current / owned bot short description for the given user language.
+        
+        .. note::
+
+            If the current account is an User, can be called only if the ``for_my_bot`` has ``can_be_edited`` property set to True.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            language_code (``str``, *optional*):
+                A two-letter ISO 639-1 language code or an empty string
+
+            for_my_bot (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the bot for which profile photo has to be updated instead of the current user.
+                The bot should have ``can_be_edited`` property set to True.
+
+        Returns:
+            ``str``: On success, returns the text shown on a bot's profile page and sent together with the link when users share the bot in the given language.
+
+        Example:
+            .. code-block:: python
+
+                bot_short_description = await app.get_bot_info_short_description()
+        """
+
+        bot_info = await self.invoke(
+            raw.functions.bots.GetBotInfo(
+                bot=await self.resolve_peer(for_my_bot) if for_my_bot else None,
+                lang_code=language_code
+            )
+        )
+        return bot_info.about
diff --git a/pyrogram/methods/bots/get_bot_name.py b/pyrogram/methods/bots/get_bot_name.py
new file mode 100644
index 0000000000..e2775b89fc
--- /dev/null
+++ b/pyrogram/methods/bots/get_bot_name.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class GetBotName:
+    async def get_bot_name(
+        self: "pyrogram.Client",
+        language_code: str = "",
+        for_my_bot: Union[int, str] = None,
+    ) -> str:
+        """Use this method to get the current / owned bot name for the given user language.
+        
+        .. note::
+
+            If the current account is an User, can be called only if the ``for_my_bot`` has ``can_be_edited`` property set to True.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            language_code (``str``, *optional*):
+                A two-letter ISO 639-1 language code or an empty string
+
+            for_my_bot (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the bot for which profile photo has to be updated instead of the current user.
+                The bot should have ``can_be_edited`` property set to True.
+
+        Returns:
+            ``str``: On success, returns the name of a bot in the given language.
+
+        Example:
+            .. code-block:: python
+
+                bot_name = await app.get_bot_name()
+        """
+
+        bot_info = await self.invoke(
+            raw.functions.bots.GetBotInfo(
+                bot=await self.resolve_peer(for_my_bot) if for_my_bot else None,
+                lang_code=language_code
+            )
+        )
+        return bot_info.name
diff --git a/pyrogram/methods/bots/get_chat_menu_button.py b/pyrogram/methods/bots/get_chat_menu_button.py
new file mode 100644
index 0000000000..9d143d5819
--- /dev/null
+++ b/pyrogram/methods/bots/get_chat_menu_button.py
@@ -0,0 +1,66 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetChatMenuButton:
+    async def get_chat_menu_button(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str] = None,
+    ) -> "types.MenuButton":
+        """Get the current value of the bot's menu button in a private chat, or the default menu button.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+                If not specified, default bot's menu button will be returned.
+        """
+
+        if chat_id:
+            r = await self.invoke(
+                raw.functions.bots.GetBotMenuButton(
+                    user_id=await self.resolve_peer(chat_id),
+                )
+            )
+        else:
+            r = (await self.invoke(
+                raw.functions.users.GetFullUser(
+                    id=raw.types.InputUserSelf()
+                )
+            )).full_user.bot_info.menu_button
+
+        if isinstance(r, raw.types.BotMenuButtonCommands):
+            return types.MenuButtonCommands()
+
+        if isinstance(r, raw.types.BotMenuButtonDefault):
+            return types.MenuButtonDefault()
+
+        if isinstance(r, raw.types.BotMenuButton):
+            return types.MenuButtonWebApp(
+                text=r.text,
+                web_app=types.WebAppInfo(
+                    url=r.url
+                )
+            )
diff --git a/pyrogram/methods/bots/get_game_high_scores.py b/pyrogram/methods/bots/get_game_high_scores.py
new file mode 100644
index 0000000000..068ecab889
--- /dev/null
+++ b/pyrogram/methods/bots/get_game_high_scores.py
@@ -0,0 +1,72 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetGameHighScores:
+    async def get_game_high_scores(
+        self: "pyrogram.Client",
+        user_id: Union[int, str],
+        chat_id: Union[int, str],
+        message_id: int = None
+    ) -> List["types.GameHighScore"]:
+        """Get data for high score tables.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        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).
+
+            chat_id (``int`` | ``str``, *optional*):
+                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).
+                Required if inline_message_id is not specified.
+
+            message_id (``int``, *optional*):
+                Identifier of the sent message.
+                Required if inline_message_id is not specified.
+
+        Returns:
+            List of :obj:`~pyrogram.types.GameHighScore`: On success.
+
+        Example:
+            .. code-block:: python
+
+                scores = await app.get_game_high_scores(user_id, chat_id, message_id)
+                print(scores)
+        """
+        # TODO: inline_message_id
+
+        r = await self.invoke(
+            raw.functions.messages.GetGameHighScores(
+                peer=await self.resolve_peer(chat_id),
+                id=message_id,
+                user_id=await self.resolve_peer(user_id)
+            )
+        )
+
+        return types.List(types.GameHighScore._parse(self, score, r.users) for score in r.scores)
diff --git a/pyrogram/methods/bots/get_inline_bot_results.py b/pyrogram/methods/bots/get_inline_bot_results.py
new file mode 100644
index 0000000000..7cb0aa127d
--- /dev/null
+++ b/pyrogram/methods/bots/get_inline_bot_results.py
@@ -0,0 +1,92 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram.errors import UnknownError
+
+
+class GetInlineBotResults:
+    async def get_inline_bot_results(
+        self: "pyrogram.Client",
+        bot: Union[int, str],
+        query: str = "",
+        offset: str = "",
+        latitude: float = None,
+        longitude: float = None
+    ):
+        """Get bot results via inline queries.
+        You can then send a result using :meth:`~pyrogram.Client.send_inline_bot_result`
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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).
+
+            query (``str``, *optional*):
+                Text of the query (up to 512 characters).
+                Defaults to "" (empty string).
+
+            offset (``str``, *optional*):
+                Offset of the results to be returned.
+
+            latitude (``float``, *optional*):
+                Latitude of the location.
+                Useful for location-based results only.
+
+            longitude (``float``, *optional*):
+                Longitude of the location.
+                Useful for location-based results only.
+
+        Returns:
+            :obj:`BotResults `: On Success.
+
+        Raises:
+            TimeoutError: In case the bot fails to answer within 10 seconds.
+
+        Example:
+            .. code-block:: python
+
+                results = await app.get_inline_bot_results("pyrogrambot")
+                print(results)
+        """
+        # TODO: Don't return the raw type
+
+        try:
+            return await self.invoke(
+                raw.functions.messages.GetInlineBotResults(
+                    bot=await self.resolve_peer(bot),
+                    peer=raw.types.InputPeerSelf(),
+                    query=query,
+                    offset=offset,
+                    geo_point=raw.types.InputGeoPoint(
+                        lat=latitude,
+                        long=longitude
+                    ) if (latitude is not None and longitude is not None) else None
+                )
+            )
+        except UnknownError as e:
+            # TODO: Add this -503 Timeout error into the Error DB
+            if e.value.error_code == -503 and e.value.error_message == "Timeout":
+                raise TimeoutError("The inline bot didn't answer in time") from None
+            else:
+                raise e
diff --git a/pyrogram/methods/bots/request_callback_answer.py b/pyrogram/methods/bots/request_callback_answer.py
new file mode 100644
index 0000000000..8dd3b8905c
--- /dev/null
+++ b/pyrogram/methods/bots/request_callback_answer.py
@@ -0,0 +1,92 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, utils
+
+
+class RequestCallbackAnswer:
+    async def request_callback_answer(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        callback_data: Union[str, bytes],
+        password: str = None,
+        timeout: int = 10
+    ):
+        """Request a callback answer from bots.
+        This is the equivalent of clicking an inline button containing callback data.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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``):
+                The message id the inline keyboard is attached on.
+
+            callback_data (``str`` | ``bytes``):
+                Callback data associated with the inline button you want to get the answer from.
+
+            password (``str``, *optional*):
+                When clicking certain buttons (such as BotFather's confirmation button to transfer ownership), if your account has 2FA enabled, you need to provide your account's password. 
+                The 2-step verification password for the current user. Only applicable, if the :obj:`~pyrogram.types.InlineKeyboardButton` contains ``callback_data_with_password``.
+
+            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:
+            TimeoutError: In case the bot fails to answer within 10 seconds.
+            ValueError: In case of invalid arguments.
+            RPCError: In case of Telegram RPC error.
+
+        Example:
+            .. code-block:: python
+
+                await app.request_callback_answer(chat_id, message_id, "callback_data")
+        """
+
+        # 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
+        
+        if password:
+            pwd = await self.invoke(
+                raw.functions.account.GetPassword()
+            )
+            password = utils.compute_password_check(pwd, password)
+
+        return await self.invoke(
+            raw.functions.messages.GetBotCallbackAnswer(
+                peer=await self.resolve_peer(chat_id),
+                msg_id=message_id,
+                data=data,
+                password=password,
+                # TODO: add ``game`` parameter too
+            ),
+            retries=0,
+            timeout=timeout
+        )
diff --git a/pyrogram/methods/bots/send_game.py b/pyrogram/methods/bots/send_game.py
new file mode 100644
index 0000000000..34f5d739d2
--- /dev/null
+++ b/pyrogram/methods/bots/send_game.py
@@ -0,0 +1,158 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, utils, types
+
+log = logging.getLogger(__name__)
+
+
+class SendGame:
+    async def send_game(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        game_short_name: str,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,        
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "types.Message":
+        """Send a game.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        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).
+
+            game_short_name (``str``):
+                Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown automatically.
+                If not empty, the first button must launch the game.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent game message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.send_game(chat_id, "gamename")
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+        rpc = raw.functions.messages.SendMedia(
+            peer=await self.resolve_peer(chat_id),
+            media=raw.types.InputMediaGame(
+                id=raw.types.InputGameShortName(
+                    bot_id=raw.types.InputUserSelf(),
+                    short_name=game_short_name
+                ),
+            ),
+            message="",
+            silent=disable_notification or None,
+            reply_to=reply_to,
+            random_id=self.rnd_id(),
+            noforwards=protect_content,
+            effect=message_effect_id,
+            reply_markup=await reply_markup.write(self) if reply_markup else None
+        )
+        if business_connection_id:
+            r = await self.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(i, (raw.types.UpdateNewMessage, raw.types.UpdateNewChannelMessage)):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotNewBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=i.connection_id,
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/bots/send_inline_bot_result.py b/pyrogram/methods/bots/send_inline_bot_result.py
new file mode 100644
index 0000000000..404354d9aa
--- /dev/null
+++ b/pyrogram/methods/bots/send_inline_bot_result.py
@@ -0,0 +1,103 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, utils, types
+
+log = logging.getLogger(__name__)
+
+
+class SendInlineBotResult:
+    async def send_inline_bot_result(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        query_id: int,
+        result_id: str,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        reply_to_message_id: int = None
+    ) -> "raw.base.Updates":
+        """Send an inline bot result.
+        Bot results can be retrieved using :meth:`~pyrogram.Client.get_inline_bot_results`
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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).
+
+            query_id (``int``):
+                Unique identifier for the answered query.
+
+            result_id (``str``):
+                Unique identifier for the result that was chosen.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+        Returns:
+            :obj:`~pyrogram.raw.base.Updates`: Currently, on success, a raw result is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.send_inline_bot_result(chat_id, query_id, result_id)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+
+        return await self.invoke(
+            raw.functions.messages.SendInlineBotResult(
+                peer=await self.resolve_peer(chat_id),
+                query_id=query_id,
+                id=result_id,
+                random_id=self.rnd_id(),
+                silent=disable_notification or None,
+                reply_to=reply_to
+            )
+        )
diff --git a/pyrogram/methods/bots/send_web_app_custom_request.py b/pyrogram/methods/bots/send_web_app_custom_request.py
new file mode 100644
index 0000000000..8bf1a950b5
--- /dev/null
+++ b/pyrogram/methods/bots/send_web_app_custom_request.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+
+class SendWebAppCustomRequest:
+    async def send_web_app_custom_request(
+        self: "pyrogram.Client",
+        bot_user_id: Union[int, str],
+        method: str,
+        parameters: str
+    ) -> str:
+        """Sends a custom request from a Web App.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            bot_user_id (``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).
+
+            method (``str``):
+                The method name.
+            
+            parameters (``str``):
+                JSON-serialized method parameters.
+
+        Returns:
+            ``str``: On success, a JSON-serialized result is returned.
+        """
+
+        r = await self.invoke(
+            raw.functions.bots.InvokeWebViewCustomMethod(
+                bot=await self.resolve_peer(bot_user_id),
+                custom_method=method,
+                params=raw.types.DataJSON(
+                    data=parameters
+                )
+            )
+        )
+
+        return r.data
diff --git a/pyrogram/methods/bots/set_bot_commands.py b/pyrogram/methods/bots/set_bot_commands.py
new file mode 100644
index 0000000000..f6f7e6c992
--- /dev/null
+++ b/pyrogram/methods/bots/set_bot_commands.py
@@ -0,0 +1,73 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class SetBotCommands:
+    async def set_bot_commands(
+        self: "pyrogram.Client",
+        commands: List["types.BotCommand"],
+        scope: "types.BotCommandScope" = types.BotCommandScopeDefault(),
+        language_code: str = "",
+    ) -> bool:
+        """Set the list of the bot's commands.
+        The commands passed will overwrite any command set previously.
+        This method can be used by the own bot only.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            commands (List of :obj:`~pyrogram.types.BotCommand`):
+                A list of bot commands.
+                At most 100 commands can be specified.
+
+            scope (:obj:`~pyrogram.types.BotCommandScope`, *optional*):
+                An object describing the scope of users for which the commands are relevant.
+                Defaults to :obj:`~pyrogram.types.BotCommandScopeDefault`.
+
+            language_code (``str``, *optional*):
+                A two-letter ISO 639-1 language code.
+                If empty, commands will be applied to all users from the given scope, for whose language there are no
+                dedicated commands.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import BotCommand
+
+                # Set new commands
+                await app.set_bot_commands([
+                    BotCommand("start", "Start the bot"),
+                    BotCommand("settings", "Bot settings")])
+        """
+
+        return await self.invoke(
+            raw.functions.bots.SetBotCommands(
+                commands=[c.write() for c in commands],
+                scope=await scope.write(self),
+                lang_code=language_code,
+            )
+        )
diff --git a/pyrogram/methods/bots/set_bot_default_privileges.py b/pyrogram/methods/bots/set_bot_default_privileges.py
new file mode 100644
index 0000000000..2890ee1ae1
--- /dev/null
+++ b/pyrogram/methods/bots/set_bot_default_privileges.py
@@ -0,0 +1,81 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class SetBotDefaultPrivileges:
+    async def set_bot_default_privileges(
+        self: "pyrogram.Client",
+        privileges: "types.ChatPrivileges" = None,
+        for_channels: bool = None
+    ) -> bool:
+        """Change the default privileges requested by the bot when it's added as an administrator to groups or channels.
+
+        These privileges will be suggested to users, but they are are free to modify the list before adding the bot.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            privileges (:obj:`~pyrogram.types.ChatPrivileges`):
+                New default privileges. None to clear.
+                Defaults to None.
+
+            for_channels (``bool``, *optional*):
+                Pass True to change the default privileges of the bot in channels. Otherwise, the default privileges of
+                the bot for groups and supergroups will be changed.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import ChatPrivileges
+
+                await app.set_bot_default_privileges(
+                    ChatPrivileges(
+                        can_delete_messages=True,
+                        can_restrict_members=True
+                    )
+                )
+        """
+
+        function = (
+            raw.functions.bots.SetBotBroadcastDefaultAdminRights
+            if for_channels
+            else raw.functions.bots.SetBotGroupDefaultAdminRights
+        )
+
+        admin_rights = raw.types.ChatAdminRights(
+            change_info=privileges.can_change_info,
+            post_messages=privileges.can_post_messages,
+            edit_messages=privileges.can_edit_messages,
+            delete_messages=privileges.can_delete_messages,
+            ban_users=privileges.can_restrict_members,
+            invite_users=privileges.can_invite_users,
+            pin_messages=privileges.can_pin_messages,
+            add_admins=privileges.can_promote_members,
+            anonymous=privileges.is_anonymous,
+            manage_call=privileges.can_manage_video_chats,
+            other=privileges.can_manage_chat
+        ) if privileges else raw.types.ChatAdminRights()
+
+        return await self.invoke(function(admin_rights=admin_rights))
diff --git a/pyrogram/methods/bots/set_bot_info_description.py b/pyrogram/methods/bots/set_bot_info_description.py
new file mode 100644
index 0000000000..6be130aca4
--- /dev/null
+++ b/pyrogram/methods/bots/set_bot_info_description.py
@@ -0,0 +1,66 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetBotInfoDescription:
+    async def set_bot_info_description(
+        self: "pyrogram.Client",
+        description: str,
+        language_code: str = "",
+        for_my_bot: Union[int, str] = None,
+    ) -> bool:
+        """Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
+
+        .. note::
+
+            If the current account is an User, can be called only if the ``for_my_bot`` has ``can_be_edited`` property set to True.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            description (``str``):
+                New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
+
+            language_code (``str``, *optional*):
+                A two-letter ISO 639-1 language code or an empty string
+
+            for_my_bot (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the bot for which profile photo has to be updated instead of the current user.
+                The bot should have ``can_be_edited`` property set to True.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                await app.set_bot_info_description("")
+        """
+
+        return await self.invoke(
+            raw.functions.bots.SetBotInfo(
+                bot=await self.resolve_peer(for_my_bot) if for_my_bot else None,
+                lang_code=language_code,
+                description=description
+            )
+        )
diff --git a/pyrogram/methods/bots/set_bot_info_short_description.py b/pyrogram/methods/bots/set_bot_info_short_description.py
new file mode 100644
index 0000000000..5a3903d55a
--- /dev/null
+++ b/pyrogram/methods/bots/set_bot_info_short_description.py
@@ -0,0 +1,66 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetBotInfoShortDescription:
+    async def set_bot_info_short_description(
+        self: "pyrogram.Client",
+        short_description: str,
+        language_code: str = "",
+        for_my_bot: Union[int, str] = None,
+    ) -> bool:
+        """Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot.
+        
+        .. note::
+
+            If the current account is an User, can be called only if the ``for_my_bot`` has ``can_be_edited`` property set to True.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            short_description (``str``):
+                New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
+
+            language_code (``str``, *optional*):
+                A two-letter ISO 639-1 language code or an empty string
+
+            for_my_bot (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the bot for which profile photo has to be updated instead of the current user.
+                The bot should have ``can_be_edited`` property set to True.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                await app.set_bot_info_short_description("")
+        """
+
+        return await self.invoke(
+            raw.functions.bots.SetBotInfo(
+                bot=await self.resolve_peer(for_my_bot) if for_my_bot else None,
+                lang_code=language_code,
+                about=short_description
+            )
+        )
diff --git a/pyrogram/methods/bots/set_bot_name.py b/pyrogram/methods/bots/set_bot_name.py
new file mode 100644
index 0000000000..34fd2fffeb
--- /dev/null
+++ b/pyrogram/methods/bots/set_bot_name.py
@@ -0,0 +1,66 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetBotName:
+    async def set_bot_name(
+        self: "pyrogram.Client",
+        name: str,
+        language_code: str = "",
+        for_my_bot: Union[int, str] = None,
+    ) -> str:
+        """Use this method to get the current / owned bot name for the given user language.
+        
+        .. note::
+
+            If the current account is an User, can be called only if the ``for_my_bot`` has ``can_be_edited`` property set to True.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            name (``str``):
+                New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
+
+            language_code (``str``, *optional*):
+                A two-letter ISO 639-1 language code or an empty string
+
+            for_my_bot (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the bot for which profile photo has to be updated instead of the current user.
+                The bot should have ``can_be_edited`` property set to True.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                await app.set_bot_name("Pyrogram Assistant")
+        """
+
+        return await self.invoke(
+            raw.functions.bots.SetBotInfo(
+                bot=await self.resolve_peer(for_my_bot) if for_my_bot else None,
+                lang_code=language_code,
+                name=name
+            )
+        )
diff --git a/pyrogram/methods/bots/set_chat_menu_button.py b/pyrogram/methods/bots/set_chat_menu_button.py
new file mode 100644
index 0000000000..fa5af85ceb
--- /dev/null
+++ b/pyrogram/methods/bots/set_chat_menu_button.py
@@ -0,0 +1,56 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class SetChatMenuButton:
+    async def set_chat_menu_button(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str] = None,
+        menu_button: "types.MenuButton" = None
+    ) -> bool:
+        """Change the bot's menu button in a private chat, or the default menu button.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the target chat.
+                If not specified, default bot's menu button will be changed.
+
+            menu_button (:obj:`~pyrogram.types.MenuButton`, *optional*):
+                The new bot's menu button.
+                Defaults to :obj:`~pyrogram.types.MenuButtonDefault`.
+        """
+
+        await self.invoke(
+            raw.functions.bots.SetBotMenuButton(
+                user_id=await self.resolve_peer(chat_id or "me"),
+                button=(
+                    (await menu_button.write(self)) if menu_button
+                    else (await types.MenuButtonDefault().write(self))
+                )
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/bots/set_game_score.py b/pyrogram/methods/bots/set_game_score.py
new file mode 100644
index 0000000000..020e17293d
--- /dev/null
+++ b/pyrogram/methods/bots/set_game_score.py
@@ -0,0 +1,101 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class SetGameScore:
+    async def set_game_score(
+        self: "pyrogram.Client",
+        user_id: Union[int, str],
+        score: int,
+        force: bool = None,
+        disable_edit_message: bool = None,
+        chat_id: Union[int, str] = None,
+        message_id: int = None
+    ) -> Union["types.Message", bool]:
+        # inline_message_id: str = None):  TODO Add inline_message_id
+        """Set the score of the specified user in a game.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        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).
+
+            score (``int``):
+                New score, must be non-negative.
+
+            force (``bool``, *optional*):
+                Pass True, if the high score is allowed to decrease.
+                This can be useful when fixing mistakes or banning cheaters.
+
+            disable_edit_message (``bool``, *optional*):
+                Pass True, if the game message should not be automatically edited to include the current scoreboard.
+
+            chat_id (``int`` | ``str``, *optional*):
+                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).
+                Required if inline_message_id is not specified.
+
+            message_id (``int``, *optional*):
+                Identifier of the sent message.
+                Required if inline_message_id is not specified.
+
+        Returns:
+            :obj:`~pyrogram.types.Message` | ``bool``: On success, if the message was sent by the bot, the edited
+            message is returned, True otherwise.
+
+        Example:
+            .. code-block:: python
+
+                # Set new score
+                await app.set_game_score(user_id, 1000)
+
+                # Force set new score
+                await app.set_game_score(user_id, 25, force=True)
+        """
+        r = await self.invoke(
+            raw.functions.messages.SetGameScore(
+                peer=await self.resolve_peer(chat_id),
+                score=score,
+                id=message_id,
+                user_id=await self.resolve_peer(user_id),
+                force=force or None,
+                edit_message=not disable_edit_message or None
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(i, (raw.types.UpdateEditMessage,
+                              raw.types.UpdateEditChannelMessage)):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    replies=self.fetch_replies
+                )
+
+        return True
diff --git a/pyrogram/methods/business/__init__.py b/pyrogram/methods/business/__init__.py
new file mode 100644
index 0000000000..287b8588e4
--- /dev/null
+++ b/pyrogram/methods/business/__init__.py
@@ -0,0 +1,37 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .answer_pre_checkout_query import AnswerPreCheckoutQuery
+from .answer_shipping_query import AnswerShippingQuery
+from .create_invoice_link import CreateInvoiceLink
+from .get_business_connection import GetBusinessConnection
+from .get_collectible_item_info import GetCollectibleItemInfo
+from .refund_star_payment import RefundStarPayment
+from .send_invoice import SendInvoice
+
+
+class TelegramBusiness(
+    AnswerPreCheckoutQuery,
+    AnswerShippingQuery,
+    CreateInvoiceLink,
+    GetBusinessConnection,
+    GetCollectibleItemInfo,
+    RefundStarPayment,
+    SendInvoice,
+):
+    pass
diff --git a/pyrogram/methods/business/answer_pre_checkout_query.py b/pyrogram/methods/business/answer_pre_checkout_query.py
new file mode 100644
index 0000000000..88a524895e
--- /dev/null
+++ b/pyrogram/methods/business/answer_pre_checkout_query.py
@@ -0,0 +1,67 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class AnswerPreCheckoutQuery:
+    async def answer_pre_checkout_query(
+        self: "pyrogram.Client",
+        pre_checkout_query_id: str,
+        ok: bool,
+        error_message: str = None
+    ):
+        """Once the user has confirmed their payment and shipping details, the API sends the final confirmation in the form of an :obj:`~pyrogram.handlers.PreCheckoutQueryHandler`.
+        
+        Use this method to respond to such pre-checkout queries.
+
+        **Note**: The API must receive an answer within 10 seconds after the pre-checkout query was sent.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            pre_checkout_query_id (``str``):
+                Unique identifier for the query to be answered.
+
+            ok (``bool``):
+                Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.
+
+            error_message (``str``, *optional*):
+                Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
+
+        Returns:
+            ``bool``: True, on success.
+
+        Example:
+            .. code-block:: python
+
+                # Proceed with the order
+                await app.answer_pre_checkout_query(query_id, ok=True)
+
+                # Answer with error message
+                await app.answer_pre_checkout_query(query_id, ok=False, error_message="Error Message displayed to the user")
+
+        """
+        return await self.invoke(
+            raw.functions.messages.SetBotPrecheckoutResults(
+                query_id=int(pre_checkout_query_id),
+                success=ok or None,
+                error=error_message or None
+            )
+        )
diff --git a/pyrogram/methods/business/answer_shipping_query.py b/pyrogram/methods/business/answer_shipping_query.py
new file mode 100644
index 0000000000..a5a5161587
--- /dev/null
+++ b/pyrogram/methods/business/answer_shipping_query.py
@@ -0,0 +1,83 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+
+class AnswerShippingQuery:
+    async def answer_shipping_query(
+        self: "pyrogram.Client",
+        shipping_query_id: str,
+        ok: bool,
+        shipping_options: List["types.ShippingOptions"] = None,
+        error_message: str = None
+    ):
+        """If you sent an invoice requesting a shipping address and the parameter ``is_flexible`` was specified, the API sends the confirmation in the form of an :obj:`~pyrogram.handlers.ShippingQueryHandler`.
+        
+        Use this method to reply to shipping queries.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            shipping_query_id (``str``):
+                Unique identifier for the query to be answered.
+
+            ok (``bool``):
+                Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.
+
+            shipping_options (List of :obj:`~pyrogram.types.ShippingOptions`, *optional*):
+                Required if ok is True. A array of available shipping options.
+
+            error_message (``str``, *optional*):
+                Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
+
+        Returns:
+            ``bool``: True, on success.
+
+        Example:
+            .. code-block:: python
+
+                # Proceed with the order
+                await app.answer_shipping_query(query_id, ok=True, shipping_options=shipping_options)
+
+                # Answer with error message
+                await app.answer_shipping_query(query_id, ok=False, error_message="Error Message displayed to the user")
+
+        """
+        r = None
+        if ok:
+            r = await self.invoke(
+                raw.functions.messages.SetBotShippingResults(
+                    query_id=int(pre_checkout_query_id),
+                    shipping_options=[
+                        so.write()
+                        for so in shipping_options
+                    ]
+                )
+            )
+        else:
+            r = await self.invoke(
+                raw.functions.messages.SetBotShippingResults(
+                    query_id=int(pre_checkout_query_id),
+                    error=error_message or None
+                )
+            )
+        return r
diff --git a/pyrogram/methods/business/create_invoice_link.py b/pyrogram/methods/business/create_invoice_link.py
new file mode 100644
index 0000000000..6298836445
--- /dev/null
+++ b/pyrogram/methods/business/create_invoice_link.py
@@ -0,0 +1,162 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 List, Optional, Union
+
+import pyrogram
+from pyrogram import enums, raw, utils, types
+
+log = logging.getLogger(__name__)
+
+
+class CreateInvoiceLink:
+    async def create_invoice_link(
+        self: "pyrogram.Client",
+        title: str,
+        description: str,
+        payload: Union[str, bytes],
+        currency: str,
+        prices: List["types.LabeledPrice"],
+        provider_token: str = None,
+        max_tip_amount: int = None,
+        suggested_tip_amounts: List[int] = None,
+        start_parameter: str = None,
+        provider_data: str = None,
+        photo_url: str = None,
+        photo_size: int = None,
+        photo_width: int = None,
+        photo_height: int = None,
+        need_name: bool = None,
+        need_phone_number: bool = None,
+        need_email: bool = None,
+        need_shipping_address: bool = None,
+        send_phone_number_to_provider: bool = None,
+        send_email_to_provider: bool = None,
+        is_flexible: bool = None
+    ) -> str:
+        """Use this method to create a link for an invoice.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            title (``str``):
+                Product name, 1-32 characters.
+
+            description (``str``):
+                Product description, 1-255 characters
+
+            payload (``str`` | ``bytes``):
+                Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
+
+            currency (``str``):
+                Three-letter ISO 4217 currency code, see `more on currencies `_. Pass ``XTR`` for payments in `Telegram Stars `_.
+
+            prices (List of :obj:`~pyrogram.types.LabeledPrice`):
+                Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars `_.
+
+            provider_token (``str``, *optional*):
+                Payment provider token, obtained via `@BotFather `_. Pass an empty string for payments in `Telegram Stars `_.
+
+            max_tip_amount (``int``, *optional*):
+                The maximum accepted amount for tips in the smallest units of the currency (integer, **not** float/double). For example, for a maximum tip of ``US$ 1.45`` pass ``max_tip_amount = 145``. See the exp parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars `_.
+
+            suggested_tip_amounts (List of ``int``, *optional*):
+                An array of suggested amounts of tips in the smallest units of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed ``max_tip_amount``.
+
+            start_parameter (``str``, *optional*):
+                Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter.
+
+            provider_data (``str``, *optional*):
+                JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
+
+            photo_url (``str``, *optional*):
+                URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
+
+            photo_size (``int``, *optional*):
+                Photo size in bytes
+
+            photo_width (``int``, *optional*):
+                Photo width
+
+            photo_height (``int``, *optional*):
+                Photo height
+
+            need_name (``bool``, *optional*):
+                Pass True if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            need_phone_number (``bool``, *optional*):
+                Pass True if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            need_email (``bool``, *optional*):
+                Pass True if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            need_shipping_address (``bool``, *optional*):
+                Pass True if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            send_phone_number_to_provider (``bool``, *optional*):
+                Pass True if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars `_.
+
+            send_email_to_provider (``bool``, *optional*):
+                Pass True if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars `_.
+
+            is_flexible (``bool``, *optional*):
+                Pass True if the final price depends on the shipping method. Ignored for payments in `Telegram Stars `_.
+
+        Returns:
+            ``str``: On success, the created invoice link is returned.
+
+        """
+
+        rpc = raw.functions.payments.ExportInvoice(
+            invoice_media=raw.types.InputMediaInvoice(
+                title=title,
+                description=description,
+                photo=raw.types.InputWebDocument(
+                    url=photo_url,
+                    mime_type="image/jpg",
+                    size=photo_size,
+                    attributes=[
+                        raw.types.DocumentAttributeImageSize(
+                            w=photo_width,
+                            h=photo_height
+                        )
+                    ]
+                ) if photo_url else None,
+                invoice=raw.types.Invoice(
+                    currency=currency,
+                    prices=[i.write() for i in prices],
+                    test=self.test_mode,
+                    name_requested=need_name,
+                    phone_requested=need_phone_number,
+                    email_requested=need_email,
+                    shipping_address_requested=need_shipping_address,
+                    flexible=is_flexible,
+                    phone_to_provider=send_phone_number_to_provider,
+                    email_to_provider=send_email_to_provider
+                ),
+                payload=payload.encode() if isinstance(payload, str) else payload,
+                provider=provider_token,
+                provider_data=raw.types.DataJSON(
+                    data=provider_data if provider_data else "{}"
+                ),
+                start_param=start_parameter
+            )
+        )
+        r = await self.invoke(rpc)
+        return r.url
diff --git a/pyrogram/methods/business/get_business_connection.py b/pyrogram/methods/business/get_business_connection.py
new file mode 100644
index 0000000000..b85b1aadc1
--- /dev/null
+++ b/pyrogram/methods/business/get_business_connection.py
@@ -0,0 +1,66 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import types, utils, raw
+
+
+class GetBusinessConnection:
+    async def get_business_connection(
+        self: "pyrogram.Client",
+        business_connection_id: str
+    ) -> "types.Message":
+        """Use this method to get information about the connection of the bot with a business account.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            business_connection_id (``str``):
+                Unique identifier of the business connection
+
+        Returns:
+            :obj:`~pyrogram.types.BusinessConnection`: On success, the the connection of the bot with a business account is returned.
+        """
+
+        r = await self.invoke(
+            raw.functions.account.GetBotBusinessConnection(
+                connection_id=business_connection_id
+            )
+        )
+        users = {i.id: i for i in r.users}
+        chats = {i.id: i for i in r.chats}
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateBotBusinessConnect
+                )
+            ):
+                business_connection = types.BusinessConnection._parse(
+                    self,
+                    i,
+                    users,
+                    chats
+                )
+                self.business_user_connection_cache[
+                    business_connection_id
+                ] = business_connection
+                return business_connection
diff --git a/pyrogram/methods/business/get_collectible_item_info.py b/pyrogram/methods/business/get_collectible_item_info.py
new file mode 100644
index 0000000000..8fb93065a3
--- /dev/null
+++ b/pyrogram/methods/business/get_collectible_item_info.py
@@ -0,0 +1,69 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+
+class GetCollectibleItemInfo:
+    async def get_collectible_item_info(
+        self: "pyrogram.Client",
+        username: str = None,
+        phone_number: str = None
+    ) -> "types.CollectibleInfo":
+        """Returns information about a given collectible item that was purchased at https://fragment.com
+
+        .. include:: /_includes/usable-by/users.rst
+
+        You must use exactly one of ``username`` OR ``phone_number``.
+
+        Parameters:
+            username (``str``, *optional*):
+                Describes a collectible username that can be purchased at https://fragment.com
+
+            phone_number (``str``, *optional*):
+                Describes a collectible phone number that can be purchased at https://fragment.com
+
+        Returns:
+            :obj:`~pyrogram.types.CollectibleInfo`: On success, a collectible info is returned.
+
+        Example:
+            .. code-block:: python
+
+                username = await app.get_collectible_item_info(username="nerd")
+                print(username)
+        """
+
+        input_collectible = None
+
+        if username:
+            input_collectible = raw.types.InputCollectibleUsername(username=username)
+        elif phone_number:
+            input_collectible = raw.types.InputCollectiblePhone(phone=phone_number)
+        else:
+            raise ValueError(
+                "No argument supplied. Either pass username OR phone_number"
+            )
+
+        r = await self.invoke(
+            raw.functions.fragment.GetCollectibleInfo(
+                collectible=input_collectible
+            )
+        )
+
+        return types.CollectibleItemInfo._parse(r)
diff --git a/pyrogram/methods/business/refund_star_payment.py b/pyrogram/methods/business/refund_star_payment.py
new file mode 100644
index 0000000000..12c4967731
--- /dev/null
+++ b/pyrogram/methods/business/refund_star_payment.py
@@ -0,0 +1,53 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class RefundStarPayment:
+    async def refund_star_payment(
+        self: "pyrogram.Client",
+        user_id: Union[int, str],
+        telegram_payment_charge_id: str
+    ) -> bool:
+        """Refunds a successful payment in `Telegram Stars `_.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            user_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target user, whose payment will be refunded.
+            
+            telegram_payment_charge_id (``str``):
+                Telegram payment identifier.
+
+        Returns:
+            ``bool``: True on success
+
+        """
+
+        r = await self.invoke(
+            raw.functions.payments.RefundStarsCharge(
+                user_id=await self.resolve_peer(user_id),
+                charge_id=telegram_payment_charge_id
+            )
+        )
+        return bool(r)
diff --git a/pyrogram/methods/business/send_invoice.py b/pyrogram/methods/business/send_invoice.py
new file mode 100644
index 0000000000..f7b4b8ec49
--- /dev/null
+++ b/pyrogram/methods/business/send_invoice.py
@@ -0,0 +1,239 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 List, Optional, Union
+
+import pyrogram
+from pyrogram import enums, raw, utils, types
+
+log = logging.getLogger(__name__)
+
+
+class SendInvoice:
+    async def send_invoice(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        title: str,
+        description: str,
+        payload: Union[str, bytes],
+        currency: str,
+        prices: List["types.LabeledPrice"],
+        message_thread_id: int = None,
+        provider_token: str = None,
+        max_tip_amount: int = None,
+        suggested_tip_amounts: List[int] = None,
+        start_parameter: str = None,
+        provider_data: str = None,
+        photo_url: str = None,
+        photo_size: int = None,
+        photo_width: int = None,
+        photo_height: int = None,
+        need_name: bool = None,
+        need_phone_number: bool = None,
+        need_email: bool = None,
+        need_shipping_address: bool = None,
+        send_phone_number_to_provider: bool = None,
+        send_email_to_provider: bool = None,
+        is_flexible: bool = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None
+    ) -> "types.Message":
+        """Use this method to send invoices.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            title (``str``):
+                Product name, 1-32 characters.
+
+            description (``str``):
+                Product description, 1-255 characters
+
+            payload (``str`` | ``bytes``):
+                Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
+
+            currency (``str``):
+                Three-letter ISO 4217 currency code, see `more on currencies `_. Pass ``XTR`` for payments in `Telegram Stars `_.
+
+            prices (List of :obj:`~pyrogram.types.LabeledPrice`):
+                Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars `_.
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            provider_token (``str``, *optional*):
+                Payment provider token, obtained via `@BotFather `_. Pass an empty string for payments in `Telegram Stars `_.
+
+            max_tip_amount (``int``, *optional*):
+                The maximum accepted amount for tips in the smallest units of the currency (integer, **not** float/double). For example, for a maximum tip of ``US$ 1.45`` pass ``max_tip_amount = 145``. See the exp parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars `_.
+
+            suggested_tip_amounts (List of ``int``, *optional*):
+                An array of suggested amounts of tips in the smallest units of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed ``max_tip_amount``.
+
+            start_parameter (``str``, *optional*):
+                Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter.
+
+            provider_data (``str``, *optional*):
+                JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
+
+            photo_url (``str``, *optional*):
+                URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
+
+            photo_size (``int``, *optional*):
+                Photo size in bytes
+
+            photo_width (``int``, *optional*):
+                Photo width
+
+            photo_height (``int``, *optional*):
+                Photo height
+
+            need_name (``bool``, *optional*):
+                Pass True if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            need_phone_number (``bool``, *optional*):
+                Pass True if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            need_email (``bool``, *optional*):
+                Pass True if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            need_shipping_address (``bool``, *optional*):
+                Pass True if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            send_phone_number_to_provider (``bool``, *optional*):
+                Pass True if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars `_.
+
+            send_email_to_provider (``bool``, *optional*):
+                Pass True if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars `_.
+
+            is_flexible (``bool``, *optional*):
+                Pass True if the final price depends on the shipping method. Ignored for payments in `Telegram Stars `_.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            caption (``str``, *optional*):
+                Document caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent invoice message is returned.
+
+        """
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+
+        rpc = raw.functions.messages.SendMedia(
+            peer=await self.resolve_peer(chat_id),
+            media=raw.types.InputMediaInvoice(
+                title=title,
+                description=description,
+                photo=raw.types.InputWebDocument(
+                    url=photo_url,
+                    mime_type="image/jpg",
+                    size=photo_size,
+                    attributes=[
+                        raw.types.DocumentAttributeImageSize(
+                            w=photo_width,
+                            h=photo_height
+                        )
+                    ]
+                ) if photo_url else None,
+                invoice=raw.types.Invoice(
+                    currency=currency,
+                    prices=[i.write() for i in prices],
+                    test=self.test_mode,
+                    name_requested=need_name,
+                    phone_requested=need_phone_number,
+                    email_requested=need_email,
+                    shipping_address_requested=need_shipping_address,
+                    flexible=is_flexible,
+                    phone_to_provider=send_phone_number_to_provider,
+                    email_to_provider=send_email_to_provider
+                ),
+                payload=payload.encode() if isinstance(payload, str) else payload,
+                provider=provider_token,
+                provider_data=raw.types.DataJSON(
+                    data=provider_data if provider_data else "{}"
+                ),
+                start_param=start_parameter
+            ),
+            silent=disable_notification or None,
+            reply_to=reply_to,
+            random_id=self.rnd_id(),
+            noforwards=protect_content,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            effect=message_effect_id,
+            **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+        )
+        r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
diff --git a/pyrogram/methods/chat_topics/__init__.py b/pyrogram/methods/chat_topics/__init__.py
new file mode 100644
index 0000000000..4fbc67e294
--- /dev/null
+++ b/pyrogram/methods/chat_topics/__init__.py
@@ -0,0 +1,43 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .get_forum_topic_icon_stickers import GetForumTopicIconStickers
+from .create_forum_topic import CreateForumTopic
+from .edit_forum_topic import EditForumTopic
+from .close_forum_topic import CloseForumTopic
+from .reopen_forum_topic import ReopenForumTopic
+from .hide_forum_topic import HideForumTopic
+from .unhide_forum_topic import UnhideForumTopic
+from .delete_forum_topic import DeleteForumTopic
+from .get_forum_topics import GetForumTopics
+from .get_forum_topic import GetForumTopic
+
+
+class ChatTopics(
+    CloseForumTopic,
+    CreateForumTopic,
+    DeleteForumTopic,
+    EditForumTopic,
+    GetForumTopic,
+    GetForumTopicIconStickers,
+    GetForumTopics,
+    HideForumTopic,
+    ReopenForumTopic,
+    UnhideForumTopic,
+):
+    pass
diff --git a/pyrogram/methods/chat_topics/close_forum_topic.py b/pyrogram/methods/chat_topics/close_forum_topic.py
new file mode 100644
index 0000000000..754faead6e
--- /dev/null
+++ b/pyrogram/methods/chat_topics/close_forum_topic.py
@@ -0,0 +1,84 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import types, utils, raw
+
+
+class CloseForumTopic:
+    async def close_forum_topic(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_thread_id: int
+    ) -> "types.Message":
+        """Use this method to close an open topic in a forum supergroup chat.
+        The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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_thread_id (``int``):
+                Unique identifier for the target message thread of the forum topic
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Create a new Topic
+                message = await app.create_forum_topic(chat, "Topic Title")
+                # Close the Topic
+                await app.close_forum_topic(chat, message.id)
+        """
+
+        r = await self.invoke(
+            raw.functions.channels.EditForumTopic(
+                channel=await self.resolve_peer(chat_id),
+                topic_id=message_thread_id,
+                closed=True
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateEditMessage,
+                    raw.types.UpdateEditChannelMessage,
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
diff --git a/pyrogram/methods/chat_topics/create_forum_topic.py b/pyrogram/methods/chat_topics/create_forum_topic.py
new file mode 100644
index 0000000000..4f8113558a
--- /dev/null
+++ b/pyrogram/methods/chat_topics/create_forum_topic.py
@@ -0,0 +1,98 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import types, utils, raw
+
+
+class CreateForumTopic:
+    async def create_forum_topic(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        name: str,
+        icon_color: int = None,
+        icon_custom_emoji_id: str = None,
+        send_as: Union[int, str] = None,
+    ) -> "types.Message":
+        """Use this method to create a topic in a forum supergroup chat.
+        The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            name (``str``):
+                Topic name, 1-128 characters
+
+            icon_color (``int``, *optional*):
+                Color of the topic icon in RGB format.
+                Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)
+
+            icon_custom_emoji_id (``str``, *optional*):
+                Unique identifier of the custom emoji shown as the topic icon. Use :meth:`~pyrogram.Client.get_forum_topic_icon_stickers` to get all allowed custom emoji identifiers.
+
+            send_as (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the as chat.
+                For your personal cloud (Saved Messages) you can simply use "me".
+                Use :meth:`~pyrogram.Client.get_send_as_chats` to get allowed values.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent text message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Create a new Topic
+                await app.create_forum_topic(chat, "Topic Title")
+        """
+
+        r = await self.invoke(
+            raw.functions.channels.CreateForumTopic(
+                channel=await self.resolve_peer(chat_id),
+                title=name,
+                icon_color=icon_color,
+                icon_emoji_id=icon_custom_emoji_id,
+                send_as=await self.resolve_peer(send_as) if send_as else None,
+                random_id=self.rnd_id()
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
diff --git a/pyrogram/methods/chat_topics/delete_forum_topic.py b/pyrogram/methods/chat_topics/delete_forum_topic.py
new file mode 100644
index 0000000000..10e06dc24a
--- /dev/null
+++ b/pyrogram/methods/chat_topics/delete_forum_topic.py
@@ -0,0 +1,65 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import types, utils, raw
+
+
+class DeleteForumTopic:
+    async def delete_forum_topic(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_thread_id: int
+    ) -> int:
+        """Use this method to delete a forum topic along with all its messages in a forum supergroup chat.
+        The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights
+        unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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_thread_id (``int``):
+                Unique identifier for the target message thread of the forum topic
+
+        Returns:
+            ``int``: Amount of affected messages
+
+        Example:
+            .. code-block:: python
+
+                # Create a new Topic
+                message = await app.create_forum_topic(chat, "Topic Title")
+                # Delete the Topic
+                await app.delete_forum_topic(chat, message.id)
+        """
+
+        r = await self.invoke(
+            raw.functions.channels.DeleteTopicHistory(
+                channel=await self.resolve_peer(chat_id),
+                top_msg_id=message_thread_id
+            )
+        )
+        return r.pts_count
diff --git a/pyrogram/methods/chat_topics/edit_forum_topic.py b/pyrogram/methods/chat_topics/edit_forum_topic.py
new file mode 100644
index 0000000000..82e229d9b1
--- /dev/null
+++ b/pyrogram/methods/chat_topics/edit_forum_topic.py
@@ -0,0 +1,94 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import types, utils, raw
+
+
+class EditForumTopic:
+    async def edit_forum_topic(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_thread_id: int,
+        name: str = None,
+        icon_custom_emoji_id: str = None
+    ) -> "types.Message":
+        """Use this method to edit name and icon of a topic in a forum supergroup chat.
+        The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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_thread_id (``int``):
+                Unique identifier for the target message thread of the forum topic
+
+            name (``str``, *optional*):
+                New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept
+
+            icon_custom_emoji_id (``str``, *optional*):
+                New unique identifier of the custom emoji shown as the topic icon. Use :meth:`~pyrogram.Client.get_forum_topic_icon_stickers` to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Create a new Topic
+                message = await app.create_forum_topic(chat, "Topic Title")
+                # Edit the Topic
+                await app.edit_forum_topic(chat, message.id, "New Topic Title")
+                # TODO: there is `a bug `_ here!
+        """
+
+        r = await self.invoke(
+            raw.functions.channels.EditForumTopic(
+                channel=await self.resolve_peer(chat_id),
+                topic_id=message_thread_id,
+                title=name,
+                icon_emoji_id=icon_custom_emoji_id
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateEditMessage,
+                    raw.types.UpdateEditChannelMessage,
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
diff --git a/pyrogram/methods/chat_topics/get_forum_topic.py b/pyrogram/methods/chat_topics/get_forum_topic.py
new file mode 100644
index 0000000000..a965491023
--- /dev/null
+++ b/pyrogram/methods/chat_topics/get_forum_topic.py
@@ -0,0 +1,94 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, List, Iterable
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class GetForumTopic:
+    async def get_forum_topic(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_thread_ids: Union[int, Iterable[int]]
+    ) -> Union["types.ForumTopic", List["types.ForumTopic"]]:
+        """Get one or more topic from a chat by using topic identifiers.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_thread_ids (``int`` | Iterable of ``int``, *optional*):
+                Pass a single message thread identifier or an iterable of message thread identifiers (as integers) to get the information of the topic themselves.
+
+        Returns:
+            :obj:`~pyrogram.types.ForumTopic` | List of :obj:`~pyrogram.types.ForumTopic`: In case *message_thread_ids* was not
+            a list, a single topic is returned, otherwise a list of topics is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Get one topic
+                await app.get_forum_topic(chat_id, 12345)
+
+                # Get more than one topic (list of topics)
+                await app.get_forum_topic(chat_id, [12345, 12346])
+
+        Raises:
+            ValueError: In case of invalid arguments.
+        """
+        is_iterable = not isinstance(message_thread_ids, int)
+        ids = list(message_thread_ids) if is_iterable else [message_thread_ids]
+
+        r = await self.invoke(
+            raw.functions.channels.GetForumTopicsByID(
+                channel=await self.resolve_peer(chat_id),
+                topics=ids
+            )
+        )
+        # TODO order_by_create_date:flags.0?true count:int pts:int
+
+        users = {i.id: i for i in r.users}
+        chats = {i.id: i for i in r.chats}
+
+        messages = {}
+        for message in getattr(r, "messages", []):
+            messages[message.id] = await types.Message._parse(
+                self,
+                message,
+                users,
+                chats,
+                replies=self.fetch_replies
+            )
+
+        topics = types.List()
+        for i in getattr(r, "topics"):
+            topics.append(
+                types.ForumTopic._parse(
+                    self, i, messages, users, chats
+                )
+            )
+
+        return topics if is_iterable else topics[0] if topics else None
diff --git a/pyrogram/methods/chat_topics/get_forum_topic_icon_stickers.py b/pyrogram/methods/chat_topics/get_forum_topic_icon_stickers.py
new file mode 100644
index 0000000000..d4d88ee229
--- /dev/null
+++ b/pyrogram/methods/chat_topics/get_forum_topic_icon_stickers.py
@@ -0,0 +1,39 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+
+class GetForumTopicIconStickers:
+    async def get_forum_topic_icon_stickers(
+        self: "pyrogram.Client"
+    ) -> List["types.Sticker"]:
+        """Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Returns:
+            List of :obj:`~pyrogram.types.Sticker`: On success, a list of sticker objects is returned.
+        """
+        r, _ = await self._get_raw_stickers(
+            raw.types.InputStickerSetEmojiDefaultTopicIcons()
+        )
+        return r
diff --git a/pyrogram/methods/chat_topics/get_forum_topics.py b/pyrogram/methods/chat_topics/get_forum_topics.py
new file mode 100644
index 0000000000..f64d0d2e85
--- /dev/null
+++ b/pyrogram/methods/chat_topics/get_forum_topics.py
@@ -0,0 +1,130 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, AsyncGenerator
+
+import pyrogram
+from pyrogram import types, raw, utils
+
+
+class GetForumTopics:
+    async def get_forum_topics(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        query: str = "",
+        offset_date: datetime = utils.zero_datetime(),
+        offset_message_id: int = 0,
+        offset_message_thread_id: int = 0,
+        limit: int = 0
+    ) -> AsyncGenerator["types.ForumTopic", None]:
+        """Get one or more topic from a chat.
+        Returns found forum topics in a forum chat.
+        This is a temporary method for getting information about topic list from the server
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            query (``str``, *optional*):
+                Query to search for in the forum topic's name
+
+            offset_date (:py:obj:`~datetime.datetime`, *optional*):
+                The date starting from which the results need to be fetched. Use 0 or any date in the future to get results from the last topic
+
+            offset_message_id (``int``, *optional*):
+                The message identifier of the last message in the last found topic, or 0 for the first request
+
+            offset_message_thread_id (``int``, *optional*):
+                The message thread identifier of the last found topic, or 0 for the first request
+
+            limit (``int``, *optional*):
+                The maximum number of forum topics to be returned; up to 100.
+                For optimal performance, the number of returned forum topics is chosen by Telegram Server and can be smaller than the specified limit
+                By default, no limit is applied and all topics are returned.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.ForumTopic` objects.
+
+        Example:
+            .. code-block:: python
+
+                # Iterate through all topics
+                async for topic in app.get_forum_topics(chat_id):
+                    print(topic)
+        """
+        current = 0
+        total = limit or (1 << 31) - 1
+        limit = min(100, total)
+
+        offset_date = utils.datetime_to_timestamp(offset_date)
+
+        while True:
+            r = await self.invoke(
+                raw.functions.channels.GetForumTopics(
+                    channel=await self.resolve_peer(chat_id),
+                    offset_date=offset_date,
+                    offset_id=offset_message_id,
+                    offset_topic=offset_message_thread_id,
+                    limit=limit
+                )
+            )
+
+            users = {i.id: i for i in r.users}
+            chats = {i.id: i for i in r.chats}
+            messages = {}
+
+            for message in getattr(r, "messages", []):
+                messages[message.id] = await types.Message._parse(
+                    self,
+                    message,
+                    users,
+                    chats,
+                    replies=self.fetch_replies
+                )
+
+            topics = []
+
+            for topic in getattr(r, "topics", []):
+                topics.append(
+                    types.ForumTopic._parse(
+                        self, topic, messages, users, chats
+                    )
+                )
+
+            if not topics:
+                return
+
+            last = topics[-1]
+
+            offset_message_id = last.last_message.id
+            # TODO: fix inconsistency
+            offset_date = utils.datetime_to_timestamp(
+                last.last_message.date
+            )
+            offset_message_thread_id = last.message_thread_id
+
+            for topic in topics:
+                yield topic
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/chat_topics/hide_forum_topic.py b/pyrogram/methods/chat_topics/hide_forum_topic.py
new file mode 100644
index 0000000000..2ff59fe676
--- /dev/null
+++ b/pyrogram/methods/chat_topics/hide_forum_topic.py
@@ -0,0 +1,82 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import types, utils, raw
+
+
+class HideForumTopic:
+    async def hide_forum_topic(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_thread_id: int
+    ) -> "types.Message":
+        """Use this method to hide a topic in a forum supergroup chat.
+        The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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_thread_id (``int``):
+                Unique identifier for the target message thread of the forum topic
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Hide the General Forum Topic
+                await app.hide_forum_topic(chat, 1)
+        """
+
+        r = await self.invoke(
+            raw.functions.channels.EditForumTopic(
+                channel=await self.resolve_peer(chat_id),
+                topic_id=message_thread_id,
+                hidden=True
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateEditMessage,
+                    raw.types.UpdateEditChannelMessage,
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
diff --git a/pyrogram/methods/chat_topics/reopen_forum_topic.py b/pyrogram/methods/chat_topics/reopen_forum_topic.py
new file mode 100644
index 0000000000..93f1b0307e
--- /dev/null
+++ b/pyrogram/methods/chat_topics/reopen_forum_topic.py
@@ -0,0 +1,86 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import types, utils, raw
+
+
+class ReopenForumTopic:
+    async def reopen_forum_topic(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_thread_id: int
+    ) -> "types.Message":
+        """Use this method to reopen a closed topic in a forum supergroup chat.
+        The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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_thread_id (``int``):
+                Unique identifier for the target message thread of the forum topic
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Create a new Topic
+                message = await app.create_forum_topic(chat, "Topic Title")
+                # Close the Topic
+                await app.close_forum_topic(chat, message.id)
+                # Reopen the closed Topic
+                await app.reopen_forum_topic(chat, message.id)
+        """
+
+        r = await self.invoke(
+            raw.functions.channels.EditForumTopic(
+                channel=await self.resolve_peer(chat_id),
+                topic_id=message_thread_id,
+                closed=False
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateEditMessage,
+                    raw.types.UpdateEditChannelMessage,
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
diff --git a/pyrogram/methods/chat_topics/unhide_forum_topic.py b/pyrogram/methods/chat_topics/unhide_forum_topic.py
new file mode 100644
index 0000000000..40324669b2
--- /dev/null
+++ b/pyrogram/methods/chat_topics/unhide_forum_topic.py
@@ -0,0 +1,82 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import types, utils, raw
+
+
+class UnhideForumTopic:
+    async def unhide_forum_topic(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_thread_id: int
+    ) -> "types.Message":
+        """Use this method to unhide a topic in a forum supergroup chat.
+        The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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_thread_id (``int``):
+                Unique identifier for the target message thread of the forum topic
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Unhide the General Forum Topic
+                await app.unhide_forum_topic(chat, 1)
+        """
+
+        r = await self.invoke(
+            raw.functions.channels.EditForumTopic(
+                channel=await self.resolve_peer(chat_id),
+                topic_id=message_thread_id,
+                hidden=False
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateEditMessage,
+                    raw.types.UpdateEditChannelMessage,
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
diff --git a/pyrogram/methods/chats/__init__.py b/pyrogram/methods/chats/__init__.py
new file mode 100644
index 0000000000..39750d2a26
--- /dev/null
+++ b/pyrogram/methods/chats/__init__.py
@@ -0,0 +1,109 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .add_chat_members import AddChatMembers
+from .archive_chats import ArchiveChats
+from .ban_chat_member import BanChatMember
+from .create_channel import CreateChannel
+from .create_group import CreateGroup
+from .create_supergroup import CreateSupergroup
+from .delete_channel import DeleteChannel
+from .delete_chat_photo import DeleteChatPhoto
+from .delete_supergroup import DeleteSupergroup
+from .delete_user_history import DeleteUserHistory
+from .get_chat import GetChat
+from .get_chat_event_log import GetChatEventLog
+from .get_chat_member import GetChatMember
+from .get_chat_members import GetChatMembers
+from .get_chat_members_count import GetChatMembersCount
+from .get_chat_online_count import GetChatOnlineCount
+from .get_dialogs import GetDialogs
+from .get_dialogs_count import GetDialogsCount
+from .get_nearby_chats import GetNearbyChats
+from .get_send_as_chats import GetSendAsChats
+from .join_chat import JoinChat
+from .leave_chat import LeaveChat
+from .mark_chat_unread import MarkChatUnread
+from .pin_chat_message import PinChatMessage
+from .promote_chat_member import PromoteChatMember
+from .restrict_chat_member import RestrictChatMember
+from .search_chats import SearchChats
+from .set_administrator_title import SetAdministratorTitle
+from .set_chat_description import SetChatDescription
+from .set_chat_permissions import SetChatPermissions
+from .set_chat_photo import SetChatPhoto
+from .set_chat_protected_content import SetChatProtectedContent
+from .set_chat_title import SetChatTitle
+from .set_chat_message_auto_delete_time import SetChatMessageAutoDeleteTime
+from .set_chat_username import SetChatUsername
+from .set_send_as_chat import SetSendAsChat
+from .set_slow_mode import SetSlowMode
+from .unarchive_chats import UnarchiveChats
+from .unban_chat_member import UnbanChatMember
+from .unpin_all_chat_messages import UnpinAllChatMessages
+from .unpin_chat_message import UnpinChatMessage
+from .get_created_chats import GetCreatedChats
+from .transfer_chat_ownership import TransferChatOwnership
+
+
+class Chats(
+    GetChat,
+    LeaveChat,
+    JoinChat,
+    BanChatMember,
+    UnbanChatMember,
+    RestrictChatMember,
+    SearchChats,
+    PromoteChatMember,
+    GetChatMembers,
+    GetChatMember,
+    SetChatPhoto,
+    DeleteChatPhoto,
+    SetChatTitle,
+    SetChatDescription,
+    SetChatMessageAutoDeleteTime,
+    PinChatMessage,
+    UnpinChatMessage,
+    GetDialogs,
+    GetChatMembersCount,
+    SetChatUsername,
+    SetChatPermissions,
+    GetDialogsCount,
+    ArchiveChats,
+    UnarchiveChats,
+    CreateGroup,
+    CreateSupergroup,
+    CreateChannel,
+    AddChatMembers,
+    DeleteChannel,
+    DeleteSupergroup,
+    GetNearbyChats,
+    SetAdministratorTitle,
+    SetSlowMode,
+    DeleteUserHistory,
+    UnpinAllChatMessages,
+    MarkChatUnread,
+    GetChatEventLog,
+    GetChatOnlineCount,
+    GetSendAsChats,
+    SetSendAsChat,
+    SetChatProtectedContent,
+    GetCreatedChats,
+    TransferChatOwnership,
+):
+    pass
diff --git a/pyrogram/methods/chats/add_chat_members.py b/pyrogram/methods/chats/add_chat_members.py
new file mode 100644
index 0000000000..85ae8fe8b7
--- /dev/null
+++ b/pyrogram/methods/chats/add_chat_members.py
@@ -0,0 +1,124 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+
+class AddChatMembers:
+    async def add_chat_members(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_ids: Union[Union[int, str], List[Union[int, str]]],
+        forward_limit: int = 100
+    ) -> Union[List["types.Message"], "types.Message", bool]:
+        """Add new chat members to a group, supergroup or channel
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                The group, supergroup or channel id
+
+            user_ids (``int`` | ``str`` | List of ``int`` or ``str``):
+                Users to add in the chat
+                You can pass an ID (int), username (str) or phone number (str).
+                Multiple users can be added by passing a list of IDs, usernames or phone numbers.
+
+            forward_limit (``int``, *optional*):
+                How many of the latest messages you want to forward to the new members. Pass 0 to forward none of them.
+                Only applicable to basic groups (the argument is ignored for supergroups or channels).
+                Defaults to 100 (max amount).
+
+        Returns:
+            List[:obj:`~pyrogram.types.Message`] | :obj:`~pyrogram.types.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.
+
+        Example:
+            .. code-block:: python
+
+                # Add one member to a group or channel
+                await app.add_chat_members(chat_id, user_id)
+
+                # Add multiple members to a group or channel
+                await app.add_chat_members(chat_id, [user_id1, user_id2, user_id3])
+
+                # Change forward_limit (for basic groups only)
+                await app.add_chat_members(chat_id, user_id, forward_limit=25)
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if not isinstance(user_ids, list):
+            user_ids = [user_ids]
+
+        r = []
+
+        if isinstance(peer, raw.types.InputPeerChat):
+            for user_id in user_ids:
+                r.append(
+                    await self.invoke(
+                        raw.functions.messages.AddChatUser(
+                            chat_id=peer.chat_id,
+                            user_id=await self.resolve_peer(user_id),
+                            fwd_limit=forward_limit
+                        )
+                    )
+                )
+        else:
+            r.append(
+                await self.invoke(
+                    raw.functions.channels.InviteToChannel(
+                        channel=peer,
+                        users=[
+                            await self.resolve_peer(user_id)
+                            for user_id in user_ids
+                        ]
+                    )
+                )
+            )
+
+        _rc = []
+        for rr in r:
+            for i in rr.updates.updates:
+                if isinstance(
+                    i,
+                    (
+                        raw.types.UpdateNewMessage,
+                        raw.types.UpdateNewChannelMessage
+                    )
+                ):
+                    _rc.append(
+                        await types.Message._parse(
+                            self,
+                            i.message,
+                            {i.id: i for i in rr.updates.users},
+                            {i.id: i for i in rr.updates.chats},
+                            replies=self.fetch_replies
+                        )
+                    )
+                    break
+
+        if len(_rc) > 0:
+            if len(_rc) == 1:
+                return _rc[0]
+            else:
+                return types.List(_rc)
+        else:
+            return True
diff --git a/pyrogram/methods/chats/archive_chats.py b/pyrogram/methods/chats/archive_chats.py
new file mode 100644
index 0000000000..661b450cff
--- /dev/null
+++ b/pyrogram/methods/chats/archive_chats.py
@@ -0,0 +1,71 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class ArchiveChats:
+    async def archive_chats(
+        self: "pyrogram.Client",
+        chat_ids: Union[int, str, List[Union[int, str]]],
+    ) -> bool:
+        """Archive one or more chats.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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.
+
+        Example:
+            .. code-block:: python
+
+                # Archive chat
+                await app.archive_chats(chat_id)
+
+                # Archive multiple chats at once
+                await app.archive_chats([chat_id1, chat_id2, chat_id3])
+        """
+
+        if not isinstance(chat_ids, list):
+            chat_ids = [chat_ids]
+
+        folder_peers = []
+
+        for chat in chat_ids:
+            folder_peers.append(
+                raw.types.InputFolderPeer(
+                    peer=await self.resolve_peer(chat),
+                    folder_id=1
+                )
+            )
+
+        await self.invoke(
+            raw.functions.folders.EditPeerFolders(
+                folder_peers=folder_peers
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/chats/ban_chat_member.py b/pyrogram/methods/chats/ban_chat_member.py
new file mode 100644
index 0000000000..79769aa640
--- /dev/null
+++ b/pyrogram/methods/chats/ban_chat_member.py
@@ -0,0 +1,119 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+
+
+class BanChatMember:
+    async def ban_chat_member(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: Union[int, str],
+        until_date: datetime = utils.zero_datetime(),
+        revoke_messages: bool = None
+    ) -> Union["types.Message", bool]:
+        """Ban 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.
+
+        Note:
+            In regular groups (non-supergroups), this method will only work if the "All Members Are Admins" setting is
+            off in the target group. Otherwise members may only be removed by the group's creator or by the member
+            that added them.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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 user.
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            until_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the user will be unbanned.
+                If user is banned for more than 366 days or less than 30 seconds from the current time they are
+                considered to be banned forever. Defaults to epoch (ban forever).
+
+            revoke_messages (``bool``, *optional*):
+                Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed.
+                Always True for supergroups and channels.
+
+        Returns:
+            :obj:`~pyrogram.types.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.
+
+        Example:
+            .. code-block:: python
+
+                from datetime import datetime, timedelta
+
+                # Ban chat member forever
+                await app.ban_chat_member(chat_id, user_id)
+
+                # Ban chat member and automatically unban after 24h
+                await app.ban_chat_member(chat_id, user_id, datetime.now() + timedelta(days=1))
+        """
+        chat_peer = await self.resolve_peer(chat_id)
+        user_peer = await self.resolve_peer(user_id)
+
+        if isinstance(chat_peer, raw.types.InputPeerChannel):
+            r = await self.invoke(
+                raw.functions.channels.EditBanned(
+                    channel=chat_peer,
+                    participant=user_peer,
+                    banned_rights=raw.types.ChatBannedRights(
+                        until_date=utils.datetime_to_timestamp(until_date),
+                        view_messages=True,
+                        send_messages=True,
+                        send_media=True,
+                        send_stickers=True,
+                        send_gifs=True,
+                        send_games=True,
+                        send_inline=True,
+                        embed_links=True
+                    )
+                )
+            )
+        else:
+            r = await self.invoke(
+                raw.functions.messages.DeleteChatUser(
+                    chat_id=abs(chat_id),
+                    user_id=user_peer,
+                    revoke_history=revoke_messages
+                )
+            )
+
+        for i in r.updates:
+            if isinstance(i, (raw.types.UpdateNewMessage, raw.types.UpdateNewChannelMessage)):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    replies=self.fetch_replies
+                )
+        else:
+            return True
diff --git a/pyrogram/methods/chats/create_channel.py b/pyrogram/methods/chats/create_channel.py
new file mode 100644
index 0000000000..3fe55bb9d7
--- /dev/null
+++ b/pyrogram/methods/chats/create_channel.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class CreateChannel:
+    async def create_channel(
+        self: "pyrogram.Client",
+        title: str,
+        description: str = "",
+        message_auto_delete_time: int = 0
+    ) -> "types.Chat":
+        """Create a new broadcast channel.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            title (``str``):
+                The channel title.
+
+            description (``str``, *optional*):
+                The channel description.
+
+            message_auto_delete_time (``int``, *optional*):
+                Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically.
+
+        Returns:
+            :obj:`~pyrogram.types.Chat`: On success, a chat object is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.create_channel("Channel Title", "Channel Description")
+        """
+        r = await self.invoke(
+            raw.functions.channels.CreateChannel(
+                title=title,
+                about=description,
+                broadcast=True,
+                ttl_period=message_auto_delete_time
+            )
+        )
+
+        return types.Chat._parse_chat(self, r.chats[0])
diff --git a/pyrogram/methods/chats/create_group.py b/pyrogram/methods/chats/create_group.py
new file mode 100644
index 0000000000..fad8e61e9d
--- /dev/null
+++ b/pyrogram/methods/chats/create_group.py
@@ -0,0 +1,70 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class CreateGroup:
+    async def create_group(
+        self: "pyrogram.Client",
+        title: str,
+        users: Union[Union[int, str], List[Union[int, str]]] = None,
+        message_auto_delete_time: int = 0
+    ) -> "types.Chat":
+        """Create a new basic group.
+
+        .. note::
+
+            If you want to create a new supergroup, use :meth:`~pyrogram.Client.create_supergroup` instead.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            title (``str``):
+                The group title.
+
+            users (``int`` | ``str`` | List of ``int`` or ``str``):
+                Users to create a chat with.
+                Multiple users can be invited by passing a list of IDs, usernames or phone numbers.
+                Identifiers of users to be added to the basic group; may be empty to create a basic group without other members
+            
+            message_auto_delete_time (``int``, *optional*):
+                Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically.
+
+        Returns:
+            :obj:`~pyrogram.types.Chat`: On success, a chat object is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.create_group("Group Title", user_id)
+        """
+        if users and not isinstance(users, list):
+            users = [users]
+        r = await self.invoke(
+            raw.functions.messages.CreateChat(
+                users=[await self.resolve_peer(u) for u in users] if users else [],
+                title=title,
+                ttl_period=message_auto_delete_time
+            )
+        )
+        return types.Chat._parse_chat(self, r.updates.chats[0])
diff --git a/pyrogram/methods/chats/create_supergroup.py b/pyrogram/methods/chats/create_supergroup.py
new file mode 100644
index 0000000000..6f1a1f1df1
--- /dev/null
+++ b/pyrogram/methods/chats/create_supergroup.py
@@ -0,0 +1,70 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class CreateSupergroup:
+    async def create_supergroup(
+        self: "pyrogram.Client",
+        title: str,
+        description: str = "",
+        message_auto_delete_time: int = 0,
+        is_forum: bool = False
+    ) -> "types.Chat":
+        """Create a new supergroup.
+
+        .. note::
+
+            If you want to create a new basic group, use :meth:`~pyrogram.Client.create_group` instead.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            title (``str``):
+                The supergroup title.
+
+            description (``str``, *optional*):
+                The supergroup description.
+
+            message_auto_delete_time (``int``, *optional*):
+                Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically.
+
+            is_forum (``bool``, *optional*):
+                Pass True to create a forum supergroup chat. Defaults to False.
+
+        Returns:
+            :obj:`~pyrogram.types.Chat`: On success, a chat object is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.create_supergroup("Supergroup Title", "Supergroup Description")
+        """
+        r = await self.invoke(
+            raw.functions.channels.CreateChannel(
+                title=title,
+                about=description,
+                megagroup=True,
+                ttl_period=message_auto_delete_time,
+                forum=is_forum
+            )
+        )
+
+        return types.Chat._parse_chat(self, r.chats[0])
diff --git a/pyrogram/methods/chats/delete_channel.py b/pyrogram/methods/chats/delete_channel.py
new file mode 100644
index 0000000000..374d89a6f4
--- /dev/null
+++ b/pyrogram/methods/chats/delete_channel.py
@@ -0,0 +1,52 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class DeleteChannel:
+    async def delete_channel(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str]
+    ) -> bool:
+        """Delete a channel.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                The id of the channel to be deleted.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.delete_channel(channel_id)
+        """
+        await self.invoke(
+            raw.functions.channels.DeleteChannel(
+                channel=await self.resolve_peer(chat_id)
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/chats/delete_chat_photo.py b/pyrogram/methods/chats/delete_chat_photo.py
new file mode 100644
index 0000000000..1984bc0cc2
--- /dev/null
+++ b/pyrogram/methods/chats/delete_chat_photo.py
@@ -0,0 +1,70 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class DeleteChatPhoto:
+    async def delete_chat_photo(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str]
+    ) -> bool:
+        """Delete a chat photo.
+
+        You must be an administrator in the chat for this to work and must have the appropriate admin rights.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            ValueError: if a chat_id belongs to user.
+
+        Example:
+            .. code-block:: python
+
+                await app.delete_chat_photo(chat_id)
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChat):
+            await self.invoke(
+                raw.functions.messages.EditChatPhoto(
+                    chat_id=peer.chat_id,
+                    photo=raw.types.InputChatPhotoEmpty()
+                )
+            )
+        elif isinstance(peer, raw.types.InputPeerChannel):
+            await self.invoke(
+                raw.functions.channels.EditPhoto(
+                    channel=peer,
+                    photo=raw.types.InputChatPhotoEmpty()
+                )
+            )
+        else:
+            raise ValueError(f'The chat_id "{chat_id}" belongs to a user')
+
+        return True
diff --git a/pyrogram/methods/chats/delete_supergroup.py b/pyrogram/methods/chats/delete_supergroup.py
new file mode 100644
index 0000000000..ebd60befa8
--- /dev/null
+++ b/pyrogram/methods/chats/delete_supergroup.py
@@ -0,0 +1,52 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class DeleteSupergroup:
+    async def delete_supergroup(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str]
+    ) -> bool:
+        """Delete a supergroup.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                The id of the supergroup to be deleted.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.delete_supergroup(supergroup_id)
+        """
+        await self.invoke(
+            raw.functions.channels.DeleteChannel(
+                channel=await self.resolve_peer(chat_id)
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/chats/delete_user_history.py b/pyrogram/methods/chats/delete_user_history.py
new file mode 100644
index 0000000000..7769c7c3c0
--- /dev/null
+++ b/pyrogram/methods/chats/delete_user_history.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class DeleteUserHistory:
+    async def delete_user_history(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: Union[int, str],
+    ) -> bool:
+        """Delete all messages sent by a certain user in a supergroup.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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 user whose messages will be deleted.
+
+        Returns:
+            ``bool``: True on success, False otherwise.
+        """
+
+        r = await self.invoke(
+            raw.functions.channels.DeleteParticipantHistory(
+                channel=await self.resolve_peer(chat_id),
+                participant=await self.resolve_peer(user_id)
+            )
+        )
+
+        # 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/methods/chats/get_chat.py b/pyrogram/methods/chats/get_chat.py
new file mode 100644
index 0000000000..1cf828f5bc
--- /dev/null
+++ b/pyrogram/methods/chats/get_chat.py
@@ -0,0 +1,106 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types, utils
+
+
+class GetChat:
+    async def get_chat(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        force_full: bool = True
+    ) -> "types.Chat":
+        """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.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            force_full (``bool``, *optional*):
+                Defaults to True.
+                Pass False, if do not need to fetch the full variant.
+
+        Returns:
+            :obj:`~pyrogram.types.Chat`: On success, if you've already joined the chat, a chat object is returned,
+            otherwise, a chat preview object is returned.
+
+        Raises:
+            ValueError: In case the chat invite link points to a chat you haven't joined yet.
+
+        Example:
+            .. code-block:: python
+
+                chat = await app.get_chat("pyrogram")
+                print(chat)
+        """
+        match = self.INVITE_LINK_RE.match(str(chat_id))
+
+        if match:
+            r = await self.invoke(
+                raw.functions.messages.CheckChatInvite(
+                    hash=match.group(1)
+                )
+            )
+
+            if isinstance(r, raw.types.ChatInvite):
+                return types.Chat._parse_chat_preview(self, r)
+
+            await self.fetch_peers([r.chat])
+
+            if isinstance(r.chat, raw.types.Chat):
+                chat_id = -r.chat.id
+
+            if isinstance(r.chat, raw.types.Channel):
+                chat_id = utils.get_channel_id(r.chat.id)
+
+        match2 = self.TME_PUBLIC_LINK_RE.match(str(chat_id))
+        if match2:
+            chat_id = match2.group(1) or match2.group(2) or chat_id
+
+        peer = await self.resolve_peer(chat_id)
+
+        if force_full:
+            if isinstance(peer, raw.types.InputPeerChannel):
+                r = await self.invoke(raw.functions.channels.GetFullChannel(channel=peer))
+            elif isinstance(peer, (raw.types.InputPeerUser, raw.types.InputPeerSelf)):
+                r = await self.invoke(raw.functions.users.GetFullUser(id=peer))
+            else:
+                r = await self.invoke(raw.functions.messages.GetFullChat(chat_id=peer.chat_id))
+            return await types.Chat._parse_full(self, r)
+        else:
+            if isinstance(peer, (raw.types.InputPeerUser, raw.types.InputPeerSelf)):
+                r = await self.invoke(raw.functions.users.GetUsers(id=[peer]))
+                return types.Chat._parse_chat(self, r[0])
+            else:
+                if isinstance(peer, raw.types.InputPeerChannel):
+                    r = await self.invoke(raw.functions.channels.GetChannels(id=[peer]))
+                elif isinstance(peer, raw.types.InputPeerChat):
+                    r = await self.invoke(raw.functions.messages.GetChats(id=[peer.chat_id]))
+                else:
+                    raise ValueError("unknown chat type")
+                return types.Chat._parse_chat(self, r.chats[0])
diff --git a/pyrogram/methods/chats/get_chat_event_log.py b/pyrogram/methods/chats/get_chat_event_log.py
new file mode 100644
index 0000000000..06fa01c849
--- /dev/null
+++ b/pyrogram/methods/chats/get_chat_event_log.py
@@ -0,0 +1,109 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, AsyncGenerator, Optional
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetChatEventLog:
+    async def get_chat_event_log(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        query: str = "",
+        offset_id: int = 0,
+        limit: int = 0,
+        filters: "types.ChatEventFilter" = None,
+        user_ids: List[Union[int, str]] = None
+    ) -> Optional[AsyncGenerator["types.ChatEvent", None]]:
+        """Get the actions taken by chat members and administrators in the last 48h.
+
+        Only available for supergroups and channels. Requires administrator rights.
+        Results are returned in reverse chronological order (i.e., newest first).
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            query (``str``, *optional*):
+                Search query to filter events based on text.
+                By default, an empty query is applied and all events will be returned.
+
+            offset_id (``int``, *optional*):
+                Offset event identifier from which to start returning results.
+                By default, no offset is applied and events will be returned starting from the latest.
+
+            limit (``int``, *optional*):
+                Maximum amount of events to be returned.
+                By default, all events will be returned.
+
+            filters (:obj:`~pyrogram.types.ChatEventFilter`, *optional*):
+                The types of events to return.
+                By default, all types will be returned.
+
+            user_ids (List of ``int`` | ``str``, *optional*):
+                User identifiers (int) or usernames (str) by which to filter events.
+                By default, events relating to all users will be returned.
+
+        Yields:
+            :obj:`~pyrogram.types.ChatEvent` objects.
+
+        Example:
+            .. code-block:: python
+
+                async for event in app.get_chat_event_log(chat_id):
+                    print(event)
+        """
+        current = 0
+        total = abs(limit) or (1 << 31)
+        limit = min(100, total)
+
+        while True:
+            r: raw.base.channels.AdminLogResults = await self.invoke(
+                raw.functions.channels.GetAdminLog(
+                    channel=await self.resolve_peer(chat_id),
+                    q=query,
+                    min_id=0,
+                    max_id=offset_id,
+                    limit=limit,
+                    events_filter=filters.write() if filters else None,
+                    admins=(
+                        [await self.resolve_peer(i) for i in user_ids]
+                        if user_ids is not None
+                        else user_ids
+                    )
+                )
+            )
+
+            if not r.events:
+                return
+
+            last = r.events[-1]
+            offset_id = last.id
+
+            for event in r.events:
+                yield await types.ChatEvent._parse(self, event, r.users, r.chats)
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/chats/get_chat_member.py b/pyrogram/methods/chats/get_chat_member.py
new file mode 100644
index 0000000000..53d2faad83
--- /dev/null
+++ b/pyrogram/methods/chats/get_chat_member.py
@@ -0,0 +1,92 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+from pyrogram.errors import UserNotParticipant
+
+
+class GetChatMember:
+    async def get_chat_member(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: Union[int, str]
+    ) -> "types.ChatMember":
+        """Get information about one member of a chat.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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 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:
+            :obj:`~pyrogram.types.ChatMember`: On success, a chat member is returned.
+
+        Example:
+            .. code-block:: python
+
+                member = await app.get_chat_member(chat_id, "me")
+                print(member)
+        """
+        chat = await self.resolve_peer(chat_id)
+        user = await self.resolve_peer(user_id)
+
+        if isinstance(chat, raw.types.InputPeerChat):
+            r = await self.invoke(
+                raw.functions.messages.GetFullChat(
+                    chat_id=chat.chat_id
+                )
+            )
+
+            members = getattr(r.full_chat.participants, "participants", [])
+            users = {i.id: i for i in r.users}
+
+            for member in members:
+                member = types.ChatMember._parse(self, member, users, {})
+
+                if isinstance(user, raw.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, raw.types.InputPeerChannel):
+            r = await self.invoke(
+                raw.functions.channels.GetParticipant(
+                    channel=chat,
+                    participant=user
+                )
+            )
+
+            users = {i.id: i for i in r.users}
+            chats = {i.id: i for i in r.chats}
+
+            return types.ChatMember._parse(self, r.participant, users, chats)
+        else:
+            raise ValueError(f'The chat_id "{chat_id}" belongs to a user')
diff --git a/pyrogram/methods/chats/get_chat_members.py b/pyrogram/methods/chats/get_chat_members.py
new file mode 100644
index 0000000000..49fb0a094d
--- /dev/null
+++ b/pyrogram/methods/chats/get_chat_members.py
@@ -0,0 +1,158 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional, AsyncGenerator
+
+import pyrogram
+from pyrogram import raw, types, enums
+
+log = logging.getLogger(__name__)
+
+
+async def get_chunk(
+    client: "pyrogram.Client",
+    chat_id: Union[int, str],
+    offset: int,
+    filter: "enums.ChatMembersFilter",
+    limit: int,
+    query: str,
+):
+    is_queryable = filter in [enums.ChatMembersFilter.SEARCH,
+                              enums.ChatMembersFilter.BANNED,
+                              enums.ChatMembersFilter.RESTRICTED]
+
+    filter = filter.value(q=query) if is_queryable else filter.value()
+
+    r = await client.invoke(
+        raw.functions.channels.GetParticipants(
+            channel=await client.resolve_peer(chat_id),
+            filter=filter,
+            offset=offset,
+            limit=limit,
+            hash=0
+        ),
+        sleep_threshold=60
+    )
+
+    members = r.participants
+    users = {u.id: u for u in r.users}
+    chats = {c.id: c for c in r.chats}
+
+    return [types.ChatMember._parse(client, member, users, chats) for member in members]
+
+
+class GetChatMembers:
+    async def get_chat_members(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        query: str = "",
+        limit: int = 0,
+        filter: "enums.ChatMembersFilter" = enums.ChatMembersFilter.SEARCH
+    ) -> Optional[AsyncGenerator["types.ChatMember", None]]:
+        """Get the members list of a chat.
+
+        A chat can be either a basic group, a supergroup or a channel.
+        Requires administrator rights in channels.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            query (``str``, *optional*):
+                Query string to filter members based on their display names and usernames.
+                Only applicable to supergroups and channels. Defaults to "" (empty string).
+                A query string is applicable only for :obj:`~pyrogram.enums.ChatMembersFilter.SEARCH`,
+                :obj:`~pyrogram.enums.ChatMembersFilter.BANNED` and :obj:`~pyrogram.enums.ChatMembersFilter.RESTRICTED`
+                filters only.
+
+            limit (``int``, *optional*):
+                Limits the number of members to be retrieved.
+
+            filter (:obj:`~pyrogram.enums.ChatMembersFilter`, *optional*):
+                Filter used to select the kind of members you want to retrieve. Only applicable for supergroups
+                and channels.
+
+        Returns:
+            ``Generator``: On success, a generator yielding :obj:`~pyrogram.types.ChatMember` objects is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import enums
+
+                # Get members
+                async for member in app.get_chat_members(chat_id):
+                    print(member)
+
+                # Get administrators
+                administrators = []
+                async for m in app.get_chat_members(chat_id, filter=enums.ChatMembersFilter.ADMINISTRATORS):
+                    administrators.append(m)
+
+                # Get bots
+                bots = []
+                async for m in app.get_chat_members(chat_id, filter=enums.ChatMembersFilter.BOTS):
+                    bots.append(m)
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChat):
+            r = await self.invoke(
+                raw.functions.messages.GetFullChat(
+                    chat_id=peer.chat_id
+                )
+            )
+
+            members = getattr(r.full_chat.participants, "participants", [])
+            users = {i.id: i for i in r.users}
+
+            for member in members:
+                yield types.ChatMember._parse(self, member, users, {})
+
+            return
+
+        current = 0
+        offset = 0
+        total = abs(limit) or (1 << 31) - 1
+        limit = min(200, total)
+
+        while True:
+            members = await get_chunk(
+                client=self,
+                chat_id=chat_id,
+                offset=offset,
+                filter=filter,
+                limit=limit,
+                query=query
+            )
+
+            if not members:
+                return
+
+            offset += len(members)
+
+            for member in members:
+                yield member
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/chats/get_chat_members_count.py b/pyrogram/methods/chats/get_chat_members_count.py
new file mode 100644
index 0000000000..2680702833
--- /dev/null
+++ b/pyrogram/methods/chats/get_chat_members_count.py
@@ -0,0 +1,69 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class GetChatMembersCount:
+    async def get_chat_members_count(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str]
+    ) -> int:
+        """Get the number of members in a chat.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+        Returns:
+            ``int``: On success, the chat members count is returned.
+
+        Raises:
+            ValueError: In case a chat id belongs to user.
+
+        Example:
+            .. code-block:: python
+
+                count = await app.get_chat_members_count(chat_id)
+                print(count)
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChat):
+            r = await self.invoke(
+                raw.functions.messages.GetChats(
+                    id=[peer.chat_id]
+                )
+            )
+
+            return r.chats[0].participants_count
+        elif isinstance(peer, raw.types.InputPeerChannel):
+            r = await self.invoke(
+                raw.functions.channels.GetFullChannel(
+                    channel=peer
+                )
+            )
+
+            return r.full_chat.participants_count
+        else:
+            raise ValueError(f'The chat_id "{chat_id}" belongs to a user')
diff --git a/pyrogram/methods/chats/get_chat_online_count.py b/pyrogram/methods/chats/get_chat_online_count.py
new file mode 100644
index 0000000000..6ecd5727dd
--- /dev/null
+++ b/pyrogram/methods/chats/get_chat_online_count.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class GetChatOnlineCount:
+    async def get_chat_online_count(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str]
+    ) -> int:
+        """Get the number of members that are currently online in a chat.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+        Returns:
+            ``int``: On success, the chat members online count is returned.
+
+        Example:
+            .. code-block:: python
+
+                online = await app.get_chat_online_count(chat_id)
+                print(online)
+        """
+        return (await self.invoke(
+            raw.functions.messages.GetOnlines(
+                peer=await self.resolve_peer(chat_id)
+            )
+        )).onlines
diff --git a/pyrogram/methods/chats/get_created_chats.py b/pyrogram/methods/chats/get_created_chats.py
new file mode 100644
index 0000000000..ada8146f7c
--- /dev/null
+++ b/pyrogram/methods/chats/get_created_chats.py
@@ -0,0 +1,83 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class GetCreatedChats:
+    async def get_created_chats(
+        self: "pyrogram.Client",
+        # TODO: find a better name?
+        is_inactive_chat: bool = False,
+        is_my_public_has_username: bool = True,
+        is_my_public_location_based: bool = False,
+        check_created_my_public_chat_limit: bool = False,
+        is_suitable_for_my_personal_chat: bool = False,
+    ) -> List["types.Chat"]:
+        """Get a list of chats of the specified type of the current user account
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Exactly one of ``is_inactive_chat`` OR ``is_my_public_has_username`` should be passed.
+
+        Parameters:
+            is_inactive_chat (``bool``, *optional*):
+                True, to return a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium. Defaults to False.
+
+            is_my_public_has_username (``bool``, *optional*):
+                True, if the chat is public, because it has an active username. Defaults to True.
+            
+            is_my_public_location_based (``bool``, *optional*):
+                True, if the chat is public, because it is a location-based supergroup. Defaults to False.
+
+            check_created_my_public_chat_limit (``bool``, *optional*):
+                Checks whether the maximum number of owned public chats has been reached. The limit can be increased with Telegram Premium. Defaults to False.
+
+            is_suitable_for_my_personal_chat (``bool``, *optional*):
+                True, if the chat can be used as a personal chat. Defaults to False.
+
+        Returns:
+            List[:obj:`~pyrogram.types.Chat`]: The list of chats.
+
+        Example:
+            .. code-block:: python
+
+                chats = await app.get_created_chats()
+                print(chats)
+        """
+        if is_inactive_chat:
+            r = await self.invoke(
+                raw.functions.channels.GetInactiveChannels()
+            )
+        else:
+            r = await self.invoke(
+                raw.functions.channels.GetAdminedPublicChannels(
+                    by_location=is_my_public_location_based,
+                    check_limit=check_created_my_public_chat_limit,
+                    for_personal=is_suitable_for_my_personal_chat
+                )
+            )
+        # TODO: fix inconsistency
+        return types.List([
+            types.Chat._parse_chat(self, x)
+            for x in getattr(r, "chats", [])
+        ])
diff --git a/pyrogram/methods/chats/get_dialogs.py b/pyrogram/methods/chats/get_dialogs.py
new file mode 100644
index 0000000000..c991a4e362
--- /dev/null
+++ b/pyrogram/methods/chats/get_dialogs.py
@@ -0,0 +1,115 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 AsyncGenerator, Optional
+
+import pyrogram
+from pyrogram import types, raw, utils
+
+
+class GetDialogs:
+    async def get_dialogs(
+        self: "pyrogram.Client",
+        limit: int = 0,
+        chat_list: int = 0
+    ) -> Optional[AsyncGenerator["types.Dialog", None]]:
+        """Get a user's dialogs sequentially.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            limit (``int``, *optional*):
+                Limits the number of dialogs to be retrieved.
+                By default, no limit is applied and all dialogs are returned.
+            
+            chat_list (``int``, *optional*):
+                Chat list in which to search messages; Only Main (0) and Archive (1) chat lists are supported. Defaults to (0) Main chat list.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.Dialog` objects.
+
+        Example:
+            .. code-block:: python
+
+                # Iterate through all dialogs
+                async for dialog in app.get_dialogs():
+                    print(dialog.chat.first_name or dialog.chat.title)
+        """
+        current = 0
+        total = limit or (1 << 31) - 1
+        limit = min(100, total)
+
+        offset_date = 0
+        offset_id = 0
+        offset_peer = raw.types.InputPeerEmpty()
+
+        while True:
+            r = await self.invoke(
+                raw.functions.messages.GetDialogs(
+                    offset_date=offset_date,
+                    offset_id=offset_id,
+                    offset_peer=offset_peer,
+                    limit=limit,
+                    hash=0,
+                    folder_id=chat_list
+                ),
+                sleep_threshold=60
+            )
+
+            users = {i.id: i for i in r.users}
+            chats = {i.id: i for i in r.chats}
+
+            messages = {}
+
+            for message in r.messages:
+                if isinstance(message, raw.types.MessageEmpty):
+                    continue
+
+                chat_id = utils.get_peer_id(message.peer_id)
+                messages[chat_id] = await types.Message._parse(
+                    self,
+                    message,
+                    users,
+                    chats,
+                    replies=self.fetch_replies
+                )
+
+            dialogs = []
+
+            for dialog in r.dialogs:
+                if not isinstance(dialog, raw.types.Dialog):
+                    continue
+
+                dialogs.append(types.Dialog._parse(self, dialog, messages, users, chats))
+
+            if not dialogs:
+                return
+
+            last = dialogs[-1]
+
+            offset_id = last.top_message.id
+            offset_date = utils.datetime_to_timestamp(last.top_message.date)
+            offset_peer = await self.resolve_peer(last.chat.id)
+
+            for dialog in dialogs:
+                yield dialog
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/chats/get_dialogs_count.py b/pyrogram/methods/chats/get_dialogs_count.py
new file mode 100644
index 0000000000..8a93527f3c
--- /dev/null
+++ b/pyrogram/methods/chats/get_dialogs_count.py
@@ -0,0 +1,68 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class GetDialogsCount:
+    async def get_dialogs_count(
+        self: "pyrogram.Client",
+        pinned_only: bool = False,
+        chat_list: int = 0
+    ) -> int:
+        """Get the total count of your dialogs.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            pinned_only (``bool``, *optional*):
+                Pass True if you want to count only pinned dialogs.
+                Defaults to False.
+            
+            chat_list (``int``, *optional*):
+                Chat list in which to search messages; Only Main (0) and Archive (1) chat lists are supported. Defaults to (0) Main chat list.
+
+        Returns:
+            ``int``: On success, the dialogs count is returned.
+
+        Example:
+            .. code-block:: python
+
+                count = await app.get_dialogs_count()
+                print(count)
+        """
+
+        if pinned_only:
+            return len((await self.invoke(raw.functions.messages.GetPinnedDialogs(folder_id=chat_list))).dialogs)
+        else:
+            r = await self.invoke(
+                raw.functions.messages.GetDialogs(
+                    offset_date=0,
+                    offset_id=0,
+                    offset_peer=raw.types.InputPeerEmpty(),
+                    limit=1,
+                    hash=0,
+                    folder_id=chat_list
+                )
+            )
+
+            if isinstance(r, raw.types.messages.Dialogs):
+                return len(r.dialogs)
+            else:
+                return r.count
diff --git a/pyrogram/methods/chats/get_nearby_chats.py b/pyrogram/methods/chats/get_nearby_chats.py
new file mode 100644
index 0000000000..8d1163ac9d
--- /dev/null
+++ b/pyrogram/methods/chats/get_nearby_chats.py
@@ -0,0 +1,78 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+from pyrogram import utils
+
+
+class GetNearbyChats:
+    async def get_nearby_chats(
+        self: "pyrogram.Client",
+        latitude: float,
+        longitude: float
+    ) -> List["types.Chat"]:
+        """Get nearby chats.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            latitude (``float``):
+                Latitude of the location.
+
+            longitude (``float``):
+                Longitude of the location.
+
+        Returns:
+            List of :obj:`~pyrogram.types.Chat`: On success, a list of nearby chats is returned.
+
+        Example:
+            .. code-block:: python
+
+                chats = await app.get_nearby_chats(latitude, longitude)
+                print(chats)
+        """
+
+        r = await self.invoke(
+            raw.functions.contacts.GetLocated(
+                geo_point=raw.types.InputGeoPoint(
+                    lat=latitude,
+                    long=longitude
+                )
+            )
+        )
+
+        if not r.updates:
+            return []
+
+        chats = types.List([types.Chat._parse_chat(self, chat) for chat in r.chats])
+        peers = r.updates[0].peers
+
+        for peer in peers:
+            if isinstance(peer.peer, raw.types.PeerChannel):
+                chat_id = utils.get_channel_id(peer.peer.channel_id)
+
+                for chat in chats:
+                    if chat.id == chat_id:
+                        chat.distance = peer.distance
+                        break
+
+        return chats
diff --git a/pyrogram/methods/chats/get_send_as_chats.py b/pyrogram/methods/chats/get_send_as_chats.py
new file mode 100644
index 0000000000..c9a358c398
--- /dev/null
+++ b/pyrogram/methods/chats/get_send_as_chats.py
@@ -0,0 +1,65 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class GetSendAsChats:
+    async def get_send_as_chats(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str]
+    ) -> List["types.Chat"]:
+        """Get the list of "send_as" chats available.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+        Returns:
+            List[:obj:`~pyrogram.types.Chat`]: The list of chats.
+
+        Example:
+            .. code-block:: python
+
+                chats = await app.get_send_as_chats(chat_id)
+                print(chats)
+        """
+        r = await self.invoke(
+            raw.functions.channels.GetSendAs(
+                peer=await self.resolve_peer(chat_id)
+            )
+        )
+
+        users = {u.id: u for u in r.users}
+        chats = {c.id: c for c in r.chats}
+
+        send_as_chats = types.List()
+
+        for p in r.peers:
+            if isinstance(p, raw.types.PeerUser):
+                send_as_chats.append(types.Chat._parse_chat(self, users[p.user_id]))
+            else:
+                send_as_chats.append(types.Chat._parse_chat(self, chats[p.channel_id]))
+
+        return send_as_chats
diff --git a/pyrogram/methods/chats/join_chat.py b/pyrogram/methods/chats/join_chat.py
new file mode 100644
index 0000000000..9aa7db3598
--- /dev/null
+++ b/pyrogram/methods/chats/join_chat.py
@@ -0,0 +1,81 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class JoinChat:
+    async def join_chat(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str]
+    ) -> "types.Chat":
+        """Join a group chat or channel.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat in form of a *t.me/joinchat/* link, a username of the target
+                channel/supergroup (in the format @username) or a chat id of a linked chat (channel or supergroup).
+
+        Returns:
+            :obj:`~pyrogram.types.Chat`: On success, a chat object is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Join chat via invite link
+                await app.join_chat("https://t.me/+AbCdEf0123456789")
+
+                # Join chat via username
+                await app.join_chat("pyrogram")
+
+                # Join chat via Telegram Public Link
+                await app.join_chat("https://t.me/pyrogram")
+
+                # Join a linked chat
+                await app.join_chat(app.get_chat("pyrogram").linked_chat.id)
+        """
+        match = self.INVITE_LINK_RE.match(str(chat_id))
+
+        if match:
+            chat = await self.invoke(
+                raw.functions.messages.ImportChatInvite(
+                    hash=match.group(1)
+                )
+            )
+            if isinstance(chat.chats[0], raw.types.Chat):
+                return types.Chat._parse_chat_chat(self, chat.chats[0])
+            elif isinstance(chat.chats[0], raw.types.Channel):
+                return types.Chat._parse_channel_chat(self, chat.chats[0])
+
+        else:
+            match2 = self.TME_PUBLIC_LINK_RE.match(str(chat_id))
+            if match2:
+                chat_id = match2.group(1) or match2.group(2) or chat_id
+            chat = await self.invoke(
+                raw.functions.channels.JoinChannel(
+                    channel=await self.resolve_peer(chat_id)
+                )
+            )
+
+            return types.Chat._parse_channel_chat(self, chat.chats[0])
diff --git a/pyrogram/methods/chats/leave_chat.py b/pyrogram/methods/chats/leave_chat.py
new file mode 100644
index 0000000000..b974e38771
--- /dev/null
+++ b/pyrogram/methods/chats/leave_chat.py
@@ -0,0 +1,77 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class LeaveChat:
+    async def leave_chat(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        delete: bool = False
+    ):
+        """Leave a group chat or channel.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            delete (``bool``, *optional*):
+                Deletes the group chat dialog after leaving (for simple group chats, not supergroups).
+                Defaults to False.
+
+        Example:
+            .. code-block:: python
+
+                # Leave chat or channel
+                await app.leave_chat(chat_id)
+
+                # Leave basic chat and also delete the dialog
+                await app.leave_chat(chat_id, delete=True)
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChannel):
+            return await self.invoke(
+                raw.functions.channels.LeaveChannel(
+                    channel=await self.resolve_peer(chat_id)
+                )
+            )
+        elif isinstance(peer, raw.types.InputPeerChat):
+            r = await self.invoke(
+                raw.functions.messages.DeleteChatUser(
+                    chat_id=peer.chat_id,
+                    user_id=raw.types.InputUserSelf()
+                )
+            )
+
+            if delete:
+                await self.invoke(
+                    raw.functions.messages.DeleteHistory(
+                        peer=peer,
+                        max_id=0
+                    )
+                )
+
+            return r
diff --git a/pyrogram/methods/chats/mark_chat_unread.py b/pyrogram/methods/chats/mark_chat_unread.py
new file mode 100644
index 0000000000..45aec2f878
--- /dev/null
+++ b/pyrogram/methods/chats/mark_chat_unread.py
@@ -0,0 +1,47 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class MarkChatUnread:
+    async def mark_chat_unread(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+    ) -> bool:
+        """Mark a chat as unread.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+        Returns:
+            ``bool``: On success, True is returned.
+        """
+
+        return await self.invoke(
+            raw.functions.messages.MarkDialogUnread(
+                peer=await self.resolve_peer(chat_id),
+                unread=True
+            )
+        )
diff --git a/pyrogram/methods/chats/pin_chat_message.py b/pyrogram/methods/chats/pin_chat_message.py
new file mode 100644
index 0000000000..5e190c5c5e
--- /dev/null
+++ b/pyrogram/methods/chats/pin_chat_message.py
@@ -0,0 +1,133 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+from ..messages.inline_session import get_session
+
+
+class PinChatMessage:
+    async def pin_chat_message(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        disable_notification: bool = False,
+        both_sides: bool = False,
+        business_connection_id: str = None,
+    ) -> "types.Message":
+        """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.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_id (``int``):
+                Identifier of a message to pin.
+
+            disable_notification (``bool``, *optional*):
+                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.
+
+            both_sides (``bool``, *optional*):
+                Pass True to pin the message for both sides (you and recipient).
+                Applicable to private chats only. Defaults to False.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be pinned.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the service message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Pin with notification
+                await app.pin_chat_message(chat_id, message_id)
+
+                # Pin without notification
+                await app.pin_chat_message(chat_id, message_id, disable_notification=True)
+        """
+        rpc = raw.functions.messages.UpdatePinnedMessage(
+            peer=await self.resolve_peer(chat_id),
+            id=message_id,
+            silent=disable_notification or None,
+            pm_oneside=not both_sides or None
+        )
+
+        session = None
+        business_connection = None
+        if business_connection_id:
+            business_connection = self.business_user_connection_cache[business_connection_id]
+            if not business_connection:
+                business_connection = await self.get_business_connection(business_connection_id)
+            session = await get_session(
+                self,
+                business_connection._raw.connection.dc_id
+            )
+
+        if business_connection_id:
+            r = await session.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+            # await session.stop()
+        else:
+            r = await self.invoke(rpc)
+
+        users = {u.id: u for u in r.users}
+        chats = {c.id: c for c in r.chats}
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    users,
+                    chats,
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotNewBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/chats/promote_chat_member.py b/pyrogram/methods/chats/promote_chat_member.py
new file mode 100644
index 0000000000..0e82452cbb
--- /dev/null
+++ b/pyrogram/methods/chats/promote_chat_member.py
@@ -0,0 +1,105 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types, errors
+
+
+class PromoteChatMember:
+    async def promote_chat_member(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: Union[int, str],
+        privileges: "types.ChatPrivileges" = None,
+    ) -> Union["types.Message", bool]:
+        """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.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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 user.
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            privileges (:obj:`~pyrogram.types.ChatPrivileges`, *optional*):
+                New user privileges.
+
+        Returns:
+            :obj:`~pyrogram.types.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.
+
+        Example:
+            .. code-block:: python
+
+                # Promote chat member to admin
+                await app.promote_chat_member(chat_id, user_id)
+        """
+        chat_id = await self.resolve_peer(chat_id)
+        user_id = await self.resolve_peer(user_id)
+
+        # See Chat.promote_member for the reason of this (instead of setting types.ChatPrivileges() as default arg).
+        if privileges is None:
+            privileges = types.ChatPrivileges()
+
+        try:
+            raw_chat_member = (await self.invoke(
+                raw.functions.channels.GetParticipant(
+                    channel=chat_id,
+                    participant=user_id
+                )
+            )).participant
+        except errors.RPCError:
+            raw_chat_member = None
+
+        rank = None
+        if isinstance(raw_chat_member, raw.types.ChannelParticipantAdmin):
+            rank = raw_chat_member.rank
+
+        r = await self.invoke(
+            raw.functions.channels.EditAdmin(
+                channel=chat_id,
+                user_id=user_id,
+                admin_rights=privileges.write(),
+                rank=rank or ""
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    replies=self.fetch_replies
+                )
+        else:
+            return True
diff --git a/pyrogram/methods/chats/restrict_chat_member.py b/pyrogram/methods/chats/restrict_chat_member.py
new file mode 100644
index 0000000000..d31d8481d6
--- /dev/null
+++ b/pyrogram/methods/chats/restrict_chat_member.py
@@ -0,0 +1,93 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+
+
+class RestrictChatMember:
+    async def restrict_chat_member(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: Union[int, str],
+        permissions: "types.ChatPermissions",
+        use_independent_chat_permissions: bool = False,
+        until_date: datetime = utils.zero_datetime()
+    ) -> "types.Chat":
+        """Restrict a user in a supergroup.
+
+        You must be an administrator in the supergroup for this to work and must have the appropriate admin rights.
+        Pass True for all permissions to lift restrictions from a user.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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 user.
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            permissions (:obj:`~pyrogram.types.ChatPermissions`):
+                New user permissions.
+
+            use_independent_chat_permissions (``bool``, *optional*):
+                Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
+
+            until_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the user will be unbanned.
+                If user is banned for more than 366 days or less than 30 seconds from the current time they are
+                considered to be banned forever. Defaults to epoch (ban forever).
+
+        Returns:
+            :obj:`~pyrogram.types.Chat`: On success, a chat object is returned.
+
+        Example:
+            .. code-block:: python
+
+                from datetime import datetime, timedelta
+                from pyrogram.types import ChatPermissions
+
+                # Completely restrict chat member (mute) forever
+                await app.restrict_chat_member(chat_id, user_id, ChatPermissions())
+
+                # Chat member muted for 24h
+                await app.restrict_chat_member(chat_id, user_id, ChatPermissions(),
+                    datetime.now() + timedelta(days=1))
+
+                # Chat member can only send text messages
+                await app.restrict_chat_member(chat_id, user_id,
+                    ChatPermissions(can_send_messages=True))
+        """
+        r = await self.invoke(
+            raw.functions.channels.EditBanned(
+                channel=await self.resolve_peer(chat_id),
+                participant=await self.resolve_peer(user_id),
+                banned_rights=permissions.write(
+                    use_independent_chat_permissions,
+                    until_date
+                )
+            )
+        )
+
+        return types.Chat._parse_chat(self, r.chats[0])
diff --git a/pyrogram/methods/chats/search_chats.py b/pyrogram/methods/chats/search_chats.py
new file mode 100644
index 0000000000..d5d3e61a9d
--- /dev/null
+++ b/pyrogram/methods/chats/search_chats.py
@@ -0,0 +1,81 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types, utils
+
+
+class SearchChats:
+    async def search_chats(
+        self: "pyrogram.Client",
+        query: str,
+        limit: int = 10,
+        personalize_result: bool = False
+    ) -> bool:
+        """Searches for the specified query in the title and username of already known chats via request to the server.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            query (``str``):
+                Query to search for.
+
+            limit (``int``, *optional*):
+                The maximum number of chats to be returned. Defaults to 10.
+
+            personalize_result (``bool``, *optional*):
+                True, if should return personalized results, else would return all found user identifiers. Defaults to False.
+
+        Returns:
+            List[:obj:`~pyrogram.types.Chat`]: Returns chats in the order seen in the main chat list
+
+        Example:
+            .. code-block:: python
+
+                chats = await app.search_chats("Pyrogram")
+        """
+        r = await self.invoke(
+            raw.functions.contacts.Search(
+                q=query,
+                limit=limit
+            )
+        )
+        users = {i.id: i for i in r.users}
+        chats = {i.id: i for i in r.chats}
+        c = []
+        attr = "my_results" if personalize_result else "results"
+        m = getattr(r, attr, [])
+        for o in m:
+            id = utils.get_raw_peer_id(o)
+            if isinstance(o, raw.types.PeerUser):
+                c.append(
+                    types.Chat._parse_chat(
+                        self,
+                        users[id]
+                    )
+                )
+            else:
+                c.append(
+                    types.Chat._parse_chat(
+                        self,
+                        chats[id]
+                    )
+                )
+        return types.List(c)
diff --git a/pyrogram/methods/chats/set_administrator_title.py b/pyrogram/methods/chats/set_administrator_title.py
new file mode 100644
index 0000000000..2c77066ed7
--- /dev/null
+++ b/pyrogram/methods/chats/set_administrator_title.py
@@ -0,0 +1,85 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetAdministratorTitle:
+    async def set_administrator_title(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: Union[int, str],
+        title: str,
+    ) -> bool:
+        """Set a custom title (rank) to an administrator of a supergroup.
+
+        If you are an administrator of a supergroup (i.e. not the owner), you can only set the title of other
+        administrators who have been promoted by you. If you are the owner, you can change every administrator's title.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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 user.
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            title (``str``, *optional*):
+                A custom title that will be shown to all members instead of "Owner" or "Admin".
+                Pass None or "" (empty string) to remove the custom title.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                await app.set_administrator_title(chat_id, user_id, "Admin Title")
+        """
+        chat_id = await self.resolve_peer(chat_id)
+        user_id = await self.resolve_peer(user_id)
+
+        r = (await self.invoke(
+            raw.functions.channels.GetParticipant(
+                channel=chat_id,
+                participant=user_id
+            )
+        )).participant
+
+        if isinstance(r, raw.types.ChannelParticipantCreator):
+            admin_rights = raw.types.ChatAdminRights()
+        elif isinstance(r, raw.types.ChannelParticipantAdmin):
+            admin_rights = r.admin_rights
+        else:
+            raise ValueError("Custom titles can only be applied to owners or administrators of supergroups")
+
+        await self.invoke(
+            raw.functions.channels.EditAdmin(
+                channel=chat_id,
+                user_id=user_id,
+                admin_rights=admin_rights,
+                rank=title
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/chats/set_chat_description.py b/pyrogram/methods/chats/set_chat_description.py
new file mode 100644
index 0000000000..563e990c4c
--- /dev/null
+++ b/pyrogram/methods/chats/set_chat_description.py
@@ -0,0 +1,66 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetChatDescription:
+    async def set_chat_description(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        description: str
+    ) -> bool:
+        """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.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            description (``str``):
+                New chat description, 0-255 characters.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            ValueError: if a chat_id doesn't belong to a supergroup or a channel.
+
+        Example:
+            .. code-block:: python
+
+                await app.set_chat_description(chat_id, "New Description")
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, (raw.types.InputPeerChannel, raw.types.InputPeerChat)):
+            await self.invoke(
+                raw.functions.messages.EditChatAbout(
+                    peer=peer,
+                    about=description
+                )
+            )
+        else:
+            raise ValueError(f'The chat_id "{chat_id}" belongs to a user')
+
+        return True
diff --git a/pyrogram/methods/chats/set_chat_message_auto_delete_time.py b/pyrogram/methods/chats/set_chat_message_auto_delete_time.py
new file mode 100644
index 0000000000..50d434a123
--- /dev/null
+++ b/pyrogram/methods/chats/set_chat_message_auto_delete_time.py
@@ -0,0 +1,73 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-2021 Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+
+class SetChatMessageAutoDeleteTime:
+    async def set_chat_message_auto_delete_time(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_auto_delete_time: int
+    ) -> "types.Message":
+        """Changes the message auto-delete or self-destruct (for secret chats) time in a chat.
+        
+        Requires change_info administrator right in basic groups, supergroups and channels.
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_auto_delete_time (``int``):
+                New time value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                # Set message auto delete for a chat to 1 day
+                app.set_chat_message_auto_delete_time(chat_id, 86400)
+
+                # Set message auto delete for a chat to 1 week
+                app.set_chat_message_auto_delete_time(chat_id, 604800)
+
+                # Disable message auto delete for this chat
+                app.set_chat_message_auto_delete_time(chat_id, 0)
+        """
+        r = await self.invoke(
+            raw.functions.messages.SetHistoryTTL(
+                peer=await self.resolve_peer(chat_id),
+                period=message_auto_delete_time,
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(i, (raw.types.UpdateNewMessage,
+                              raw.types.UpdateNewChannelMessage)):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    replies=self.fetch_replies
+                )
diff --git a/pyrogram/methods/chats/set_chat_permissions.py b/pyrogram/methods/chats/set_chat_permissions.py
new file mode 100644
index 0000000000..d8ec0cf02b
--- /dev/null
+++ b/pyrogram/methods/chats/set_chat_permissions.py
@@ -0,0 +1,87 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class SetChatPermissions:
+    async def set_chat_permissions(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        permissions: "types.ChatPermissions",
+    ) -> "types.Chat":
+        """Set default chat permissions for all members.
+
+        You must be an administrator in the group or a supergroup for this to work and must have the
+        *can_restrict_members* admin rights.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            permissions (:obj:`~pyrogram.types.ChatPermissions`):
+                New default chat permissions.
+
+        Returns:
+            :obj:`~pyrogram.types.Chat`: On success, a chat object is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import ChatPermissions
+
+                # Completely restrict chat
+                await app.set_chat_permissions(chat_id, ChatPermissions())
+
+                # Chat members can only send text messages and media messages
+                await app.set_chat_permissions(
+                    chat_id,
+                    ChatPermissions(
+                        can_send_messages=True,
+                        can_send_media_messages=True
+                    )
+                )
+        """
+
+        r = await self.invoke(
+            raw.functions.messages.EditChatDefaultBannedRights(
+                peer=await self.resolve_peer(chat_id),
+                banned_rights=raw.types.ChatBannedRights(
+                    until_date=0,
+                    send_messages=not permissions.can_send_messages,
+                    send_media=not permissions.can_send_media_messages,
+                    send_stickers=not permissions.can_send_other_messages,
+                    send_gifs=not permissions.can_send_other_messages,
+                    send_games=not permissions.can_send_other_messages,
+                    send_inline=not permissions.can_send_other_messages,
+                    embed_links=not permissions.can_add_web_page_previews,
+                    send_polls=not permissions.can_send_polls,
+                    change_info=not permissions.can_change_info,
+                    invite_users=not permissions.can_invite_users,
+                    pin_messages=not permissions.can_pin_messages,
+                )
+            )
+        )
+
+        return types.Chat._parse_chat(self, r.chats[0])
diff --git a/pyrogram/methods/chats/set_chat_photo.py b/pyrogram/methods/chats/set_chat_photo.py
new file mode 100644
index 0000000000..f3db532991
--- /dev/null
+++ b/pyrogram/methods/chats/set_chat_photo.py
@@ -0,0 +1,121 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, BinaryIO
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import utils
+from pyrogram.file_id import FileType
+
+
+class SetChatPhoto:
+    async def set_chat_photo(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        *,
+        photo: Union[str, BinaryIO] = None,
+        video: Union[str, BinaryIO] = None,
+        video_start_ts: float = None,
+    ) -> bool:
+        """Set a new chat photo or video (H.264/MPEG-4 AVC video, max 5 seconds).
+
+        The ``photo`` and ``video`` arguments are mutually exclusive.
+        Pass either one as named argument (see examples below).
+
+        You must be an administrator in the chat for this to work and must have the appropriate admin rights.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            photo (``str`` | ``BinaryIO``, *optional*):
+                New chat photo. You can pass a :obj:`~pyrogram.types.Photo` file_id, a file path to upload a new photo
+                from your local machine or a binary file-like object with its attribute
+                ".name" set for in-memory uploads.
+
+            video (``str`` | ``BinaryIO``, *optional*):
+                New chat video. You can pass a :obj:`~pyrogram.types.Video` file_id, a file path to upload a new video
+                from your local machine or a binary file-like object with its attribute
+                ".name" set for in-memory uploads.
+
+            video_start_ts (``float``, *optional*):
+                The timestamp in seconds of the video frame to use as photo profile preview.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            ValueError: if a chat_id belongs to user.
+
+        Example:
+            .. code-block:: python
+
+                # Set chat photo using a local file
+                await app.set_chat_photo(chat_id, photo="photo.jpg")
+
+                # Set chat photo using an existing Photo file_id
+                await app.set_chat_photo(chat_id, photo=photo.file_id)
+
+
+                # Set chat video using a local file
+                await app.set_chat_photo(chat_id, video="video.mp4")
+
+                # Set chat photo using an existing Video file_id
+                await app.set_chat_photo(chat_id, video=video.file_id)
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(photo, str):
+            if os.path.isfile(photo):
+                photo = raw.types.InputChatUploadedPhoto(
+                    file=await self.save_file(photo),
+                    video=await self.save_file(video),
+                    video_start_ts=video_start_ts,
+                )
+            else:
+                photo = utils.get_input_media_from_file_id(photo, FileType.PHOTO)
+                photo = raw.types.InputChatPhoto(id=photo.id)
+        else:
+            photo = raw.types.InputChatUploadedPhoto(
+                file=await self.save_file(photo),
+                video=await self.save_file(video),
+                video_start_ts=video_start_ts,
+            )
+
+        if isinstance(peer, raw.types.InputPeerChat):
+            await self.invoke(
+                raw.functions.messages.EditChatPhoto(
+                    chat_id=peer.chat_id,
+                    photo=photo,
+                )
+            )
+        elif isinstance(peer, raw.types.InputPeerChannel):
+            await self.invoke(
+                raw.functions.channels.EditPhoto(
+                    channel=peer,
+                    photo=photo
+                )
+            )
+        else:
+            raise ValueError(f'The chat_id "{chat_id}" belongs to a user')
+
+        return True
diff --git a/pyrogram/methods/chats/set_chat_protected_content.py b/pyrogram/methods/chats/set_chat_protected_content.py
new file mode 100644
index 0000000000..b6a89c1190
--- /dev/null
+++ b/pyrogram/methods/chats/set_chat_protected_content.py
@@ -0,0 +1,53 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetChatProtectedContent:
+    async def set_chat_protected_content(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        enabled: bool
+    ) -> bool:
+        """Set the chat protected content setting.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            enabled (``bool``):
+                Pass True to enable the protected content setting, False to disable.
+
+        Returns:
+            ``bool``: On success, True is returned.
+        """
+
+        await self.invoke(
+            raw.functions.messages.ToggleNoForwards(
+                peer=await self.resolve_peer(chat_id),
+                enabled=enabled
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/chats/set_chat_title.py b/pyrogram/methods/chats/set_chat_title.py
new file mode 100644
index 0000000000..9a963571c0
--- /dev/null
+++ b/pyrogram/methods/chats/set_chat_title.py
@@ -0,0 +1,78 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetChatTitle:
+    async def set_chat_title(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        title: str
+    ) -> bool:
+        """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.
+
+        Note:
+            In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
+            setting is off.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            title (``str``):
+                New chat title, 1-255 characters.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            ValueError: In case a chat id belongs to user.
+
+        Example:
+            .. code-block:: python
+
+                await app.set_chat_title(chat_id, "New Title")
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChat):
+            await self.invoke(
+                raw.functions.messages.EditChatTitle(
+                    chat_id=peer.chat_id,
+                    title=title
+                )
+            )
+        elif isinstance(peer, raw.types.InputPeerChannel):
+            await self.invoke(
+                raw.functions.channels.EditTitle(
+                    channel=peer,
+                    title=title
+                )
+            )
+        else:
+            raise ValueError(f'The chat_id "{chat_id}" belongs to a user')
+
+        return True
diff --git a/pyrogram/methods/chats/set_chat_username.py b/pyrogram/methods/chats/set_chat_username.py
new file mode 100644
index 0000000000..e6d64e98c1
--- /dev/null
+++ b/pyrogram/methods/chats/set_chat_username.py
@@ -0,0 +1,68 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetChatUsername:
+    async def set_chat_username(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        username: Optional[str]
+    ) -> bool:
+        """Set a channel or a supergroup username.
+
+        To set your own username (for users only, not bots) you can use :meth:`~pyrogram.Client.set_username`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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:
+            ``bool``: True on success.
+
+        Raises:
+            ValueError: In case a chat id belongs to a user or chat.
+
+        Example:
+            .. code-block:: python
+
+                await app.set_chat_username(chat_id, "new_username")
+        """
+
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChannel):
+            return bool(
+                await self.invoke(
+                    raw.functions.channels.UpdateUsername(
+                        channel=peer,
+                        username=username or ""
+                    )
+                )
+            )
+        else:
+            raise ValueError(f'The chat_id "{chat_id}" belongs to a user or chat')
diff --git a/pyrogram/methods/chats/set_send_as_chat.py b/pyrogram/methods/chats/set_send_as_chat.py
new file mode 100644
index 0000000000..15201f3bea
--- /dev/null
+++ b/pyrogram/methods/chats/set_send_as_chat.py
@@ -0,0 +1,57 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetSendAsChat:
+    async def set_send_as_chat(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        send_as_chat_id: Union[int, str]
+    ) -> bool:
+        """Set the default "send_as" chat for a chat.
+
+        Use :meth:`~pyrogram.Client.get_send_as_chats` to get all the "send_as" chats available for use.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            send_as_chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the send_as chat.
+
+        Returns:
+            ``bool``: On success, true is returned
+
+        Example:
+            .. code-block:: python
+
+                await app.set_send_as_chat(chat_id, send_as_chat_id)
+        """
+        return await self.invoke(
+            raw.functions.messages.SaveDefaultSendAs(
+                peer=await self.resolve_peer(chat_id),
+                send_as=await self.resolve_peer(send_as_chat_id)
+            )
+        )
diff --git a/pyrogram/methods/chats/set_slow_mode.py b/pyrogram/methods/chats/set_slow_mode.py
new file mode 100644
index 0000000000..60e88e6de5
--- /dev/null
+++ b/pyrogram/methods/chats/set_slow_mode.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetSlowMode:
+    async def set_slow_mode(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        seconds: Optional[int]
+    ) -> bool:
+        """Set the slow mode interval for a chat.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            seconds (``int`` | ``None``):
+                Seconds in which members will be able to send only one message per this interval.
+                Valid values are: 0 or None (off), 10, 30, 60 (1m), 300 (5m), 900 (15m) or 3600 (1h).
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                # Set slow mode to 60 seconds
+                await app.set_slow_mode(chat_id, 60)
+
+                # Disable slow mode
+                await app.set_slow_mode(chat_id, None)
+        """
+
+        await self.invoke(
+            raw.functions.channels.ToggleSlowMode(
+                channel=await self.resolve_peer(chat_id),
+                seconds=seconds or 0
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/chats/transfer_chat_ownership.py b/pyrogram/methods/chats/transfer_chat_ownership.py
new file mode 100644
index 0000000000..e61406c59e
--- /dev/null
+++ b/pyrogram/methods/chats/transfer_chat_ownership.py
@@ -0,0 +1,82 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram.utils import compute_password_check
+
+
+class TransferChatOwnership:
+    async def transfer_chat_ownership(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: Union[int, str],
+        password: str,
+    ) -> bool:
+        """Changes the owner of a chat.
+        
+        Requires owner privileges in the chat. Available only for supergroups and channel chats.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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 new owner.
+                The ownership can't be transferred to a bot or to a deleted user.
+
+            password (``str``):
+                The 2-step verification password of the current user.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            ValueError: In case of invalid parameters.
+            RPCError: In case of a Telegram RPC error.
+
+        Example:
+            .. code-block:: python
+
+                await app.transfer_chat_ownership(chat_id, user_id, "password")
+        """
+
+        peer_channel = await self.resolve_peer(chat_id)
+        peer_user = await self.resolve_peer(user_id)
+
+        if not isinstance(peer_channel, raw.types.InputPeerChannel):
+            raise ValueError("The chat_id must belong to a channel/supergroup.")
+
+        if not isinstance(peer_user, raw.types.InputPeerUser):
+            raise ValueError("The user_id must belong to a user.")
+
+        r = await self.invoke(
+            raw.functions.channels.EditCreator(
+                channel=peer_channel,
+                user_id=peer_user,
+                password=compute_password_check(
+                    await self.invoke(raw.functions.account.GetPassword()), password
+                ),
+            )
+        )
+
+        return bool(r)
diff --git a/pyrogram/methods/chats/unarchive_chats.py b/pyrogram/methods/chats/unarchive_chats.py
new file mode 100644
index 0000000000..4d2cb0e411
--- /dev/null
+++ b/pyrogram/methods/chats/unarchive_chats.py
@@ -0,0 +1,71 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class UnarchiveChats:
+    async def unarchive_chats(
+        self: "pyrogram.Client",
+        chat_ids: Union[int, str, List[Union[int, str]]],
+    ) -> bool:
+        """Unarchive one or more chats.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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.
+
+        Example:
+            .. code-block:: python
+
+                # Unarchive chat
+                await app.unarchive_chats(chat_id)
+
+                # Unarchive multiple chats at once
+                await app.unarchive_chats([chat_id1, chat_id2, chat_id3])
+        """
+
+        if not isinstance(chat_ids, list):
+            chat_ids = [chat_ids]
+
+        folder_peers = []
+
+        for chat in chat_ids:
+            folder_peers.append(
+                raw.types.InputFolderPeer(
+                    peer=await self.resolve_peer(chat),
+                    folder_id=0
+                )
+            )
+
+        await self.invoke(
+            raw.functions.folders.EditPeerFolders(
+                folder_peers=folder_peers
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/chats/unban_chat_member.py b/pyrogram/methods/chats/unban_chat_member.py
new file mode 100644
index 0000000000..bbe7b45492
--- /dev/null
+++ b/pyrogram/methods/chats/unban_chat_member.py
@@ -0,0 +1,64 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class UnbanChatMember:
+    async def unban_chat_member(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: Union[int, str]
+    ) -> bool:
+        """Unban a previously banned 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.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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 user.
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                # Unban chat member right now
+                await app.unban_chat_member(chat_id, user_id)
+        """
+        await self.invoke(
+            raw.functions.channels.EditBanned(
+                channel=await self.resolve_peer(chat_id),
+                participant=await self.resolve_peer(user_id),
+                banned_rights=raw.types.ChatBannedRights(
+                    until_date=0
+                )
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/chats/unpin_all_chat_messages.py b/pyrogram/methods/chats/unpin_all_chat_messages.py
new file mode 100644
index 0000000000..4153deb9be
--- /dev/null
+++ b/pyrogram/methods/chats/unpin_all_chat_messages.py
@@ -0,0 +1,60 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class UnpinAllChatMessages:
+    async def unpin_all_chat_messages(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_thread_id: int = None
+    ) -> int:
+        """
+        Use this method to clear the list of pinned messages in a chat.
+        If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have
+        the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_thread_id (``int``, *optional*):
+                Unique identifier for the target message thread of the forum topic
+
+        Returns:
+            ``int``: Amount of affected messages
+
+        Example:
+            .. code-block:: python
+
+                # Unpin all chat messages
+                await app.unpin_all_chat_messages(chat_id)
+        """
+        r = await self.invoke(
+            raw.functions.messages.UnpinAllMessages(
+                peer=await self.resolve_peer(chat_id),
+                top_msg_id=message_thread_id
+            )
+        )
+        return r.pts_count
diff --git a/pyrogram/methods/chats/unpin_chat_message.py b/pyrogram/methods/chats/unpin_chat_message.py
new file mode 100644
index 0000000000..2cf2b47fa4
--- /dev/null
+++ b/pyrogram/methods/chats/unpin_chat_message.py
@@ -0,0 +1,88 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+from ..messages.inline_session import get_session
+
+
+class UnpinChatMessage:
+    async def unpin_chat_message(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int = 0,
+        business_connection_id: str = None,
+    ) -> bool:
+        """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.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_id (``int``, *optional*):
+                Identifier of a message to unpin.
+                Required if ``business_connection_id`` is specified.
+                If not specified, the most recent pinned message (by sending date) will be unpinned.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be unpinned.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                await app.unpin_chat_message(chat_id, message_id)
+        """
+        rpc = raw.functions.messages.UpdatePinnedMessage(
+            peer=await self.resolve_peer(chat_id),
+            id=message_id,
+            unpin=True
+        )
+        
+        session = None
+        business_connection = None
+        if business_connection_id:
+            business_connection = self.business_user_connection_cache[business_connection_id]
+            if not business_connection:
+                business_connection = await self.get_business_connection(business_connection_id)
+            session = await get_session(
+                self,
+                business_connection._raw.connection.dc_id
+            )
+
+        if business_connection_id:
+            r = await session.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+            # await session.stop()
+        else:
+            r = await self.invoke(rpc)
+
+        return True
diff --git a/pyrogram/methods/contacts/__init__.py b/pyrogram/methods/contacts/__init__.py
new file mode 100644
index 0000000000..d3fd274656
--- /dev/null
+++ b/pyrogram/methods/contacts/__init__.py
@@ -0,0 +1,33 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .add_contact import AddContact
+from .delete_contacts import DeleteContacts
+from .get_contacts import GetContacts
+from .get_contacts_count import GetContactsCount
+from .import_contacts import ImportContacts
+
+
+class Contacts(
+    AddContact,
+    DeleteContacts,
+    GetContacts,
+    GetContactsCount,
+    ImportContacts,
+):
+    pass
diff --git a/pyrogram/methods/contacts/add_contact.py b/pyrogram/methods/contacts/add_contact.py
new file mode 100644
index 0000000000..9c4faa7e48
--- /dev/null
+++ b/pyrogram/methods/contacts/add_contact.py
@@ -0,0 +1,78 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class AddContact:
+    async def add_contact(
+        self: "pyrogram.Client",
+        user_id: Union[int, str],
+        first_name: str,
+        last_name: str = "",
+        phone_number: str = "",
+        share_phone_number: bool = False
+    ):
+        """Add an existing Telegram user as contact, even without a phone number.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            user_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target user.
+
+            first_name (``str``):
+                User's first name.
+
+            last_name (``str``, *optional*):
+                User's last name.
+
+            phone_number (``str``, *optional*):
+                User's phone number.
+
+            share_phone_number (``bool``, *optional*):
+                Whether or not to share the phone number with the user.
+                Defaults to False.
+
+        Returns:
+            :obj:`~pyrogram.types.User`: On success the user is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Add contact by id
+                await app.add_contact(12345678, "Foo")
+
+                # Add contact by username
+                await app.add_contact("username", "Bar")
+        """
+        r = await self.invoke(
+            raw.functions.contacts.AddContact(
+                id=await self.resolve_peer(user_id),
+                first_name=first_name,
+                last_name=last_name,
+                phone=phone_number,
+                add_phone_privacy_exception=share_phone_number
+            )
+        )
+
+        return types.User._parse(self, r.users[0])
diff --git a/pyrogram/methods/contacts/delete_contacts.py b/pyrogram/methods/contacts/delete_contacts.py
new file mode 100644
index 0000000000..7f08f29730
--- /dev/null
+++ b/pyrogram/methods/contacts/delete_contacts.py
@@ -0,0 +1,66 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+
+class DeleteContacts:
+    async def delete_contacts(
+        self: "pyrogram.Client",
+        user_ids: Union[int, str, List[Union[int, str]]]
+    ) -> Union["types.User", List["types.User"], None]:
+        """Delete contacts from your Telegram address book.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            user_ids (``int`` | ``str`` | List of ``int`` or ``str``):
+                A single user id/username or a list of user identifiers (id or username).
+
+        Returns:
+            :obj:`~pyrogram.types.User` | List of :obj:`~pyrogram.types.User` | ``None``: In case *user_ids* was an
+            integer or a string, a single User object is returned. In case *user_ids* was a list, a list of User objects
+            is returned. In case nothing changed after calling the method (for example, when deleting a non-existent
+            contact), None is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.delete_contacts(user_id)
+                await app.delete_contacts([user_id1, user_id2, user_id3])
+        """
+        is_list = isinstance(user_ids, list)
+
+        if not is_list:
+            user_ids = [user_ids]
+
+        r = await self.invoke(
+            raw.functions.contacts.DeleteContacts(
+                id=[await self.resolve_peer(i) for i in user_ids]
+            )
+        )
+
+        if not r.updates:
+            return None
+
+        users = types.List([types.User._parse(self, i) for i in r.users])
+
+        return users if is_list else users[0]
diff --git a/pyrogram/methods/contacts/get_contacts.py b/pyrogram/methods/contacts/get_contacts.py
new file mode 100644
index 0000000000..763f9a3058
--- /dev/null
+++ b/pyrogram/methods/contacts/get_contacts.py
@@ -0,0 +1,47 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 List
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class GetContacts:
+    async def get_contacts(
+        self: "pyrogram.Client"
+    ) -> List["types.User"]:
+        """Get contacts from your Telegram address book.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Returns:
+            List of :obj:`~pyrogram.types.User`: On success, a list of users is returned.
+
+        Example:
+            .. code-block:: python
+
+                contacts = await app.get_contacts()
+                print(contacts)
+        """
+        contacts = await self.invoke(raw.functions.contacts.GetContacts(hash=0))
+        return types.List(types.User._parse(self, user) for user in contacts.users)
diff --git a/pyrogram/methods/contacts/get_contacts_count.py b/pyrogram/methods/contacts/get_contacts_count.py
new file mode 100644
index 0000000000..56120bac71
--- /dev/null
+++ b/pyrogram/methods/contacts/get_contacts_count.py
@@ -0,0 +1,41 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class GetContactsCount:
+    async def get_contacts_count(
+        self: "pyrogram.Client"
+    ) -> int:
+        """Get the total count of contacts from your Telegram address book.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Returns:
+            ``int``: On success, the contacts count is returned.
+
+        Example:
+            .. code-block:: python
+
+                count = await app.get_contacts_count()
+                print(count)
+        """
+
+        return len((await self.invoke(raw.functions.contacts.GetContacts(hash=0))).contacts)
diff --git a/pyrogram/methods/contacts/import_contacts.py b/pyrogram/methods/contacts/import_contacts.py
new file mode 100644
index 0000000000..aa8fd4ae37
--- /dev/null
+++ b/pyrogram/methods/contacts/import_contacts.py
@@ -0,0 +1,58 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class ImportContacts:
+    async def import_contacts(
+        self: "pyrogram.Client",
+        contacts: List["types.InputPhoneContact"]
+    ):
+        """Import contacts to your Telegram address book.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            contacts (List of :obj:`~pyrogram.types.InputPhoneContact`):
+                The contact list to be added
+
+        Returns:
+            :obj:`types.contacts.ImportedContacts`
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import InputPhoneContact
+
+                await app.import_contacts([
+                    InputPhoneContact("+1-123-456-7890", "Foo"),
+                    InputPhoneContact("+1-456-789-0123", "Bar"),
+                    InputPhoneContact("+1-789-012-3456", "Baz")])
+        """
+        imported_contacts = await self.invoke(
+            raw.functions.contacts.ImportContacts(
+                contacts=contacts
+            )
+        )
+
+        return imported_contacts
diff --git a/pyrogram/methods/decorators/__init__.py b/pyrogram/methods/decorators/__init__.py
new file mode 100644
index 0000000000..fc90783ed9
--- /dev/null
+++ b/pyrogram/methods/decorators/__init__.py
@@ -0,0 +1,60 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .on_callback_query import OnCallbackQuery
+from .on_chat_join_request import OnChatJoinRequest
+from .on_chat_member_updated import OnChatMemberUpdated
+from .on_chosen_inline_result import OnChosenInlineResult
+from .on_deleted_messages import OnDeletedMessages
+from .on_disconnect import OnDisconnect
+from .on_edited_message import OnEditedMessage
+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
+from .on_message_reaction_updated import OnMessageReactionUpdated
+from .on_message_reaction_count_updated import OnMessageReactionCountUpdated
+from .on_pre_checkout_query import OnPreCheckoutQuery
+from .on_shipping_query import OnShippingQuery
+from .on_story import OnStory
+
+
+class Decorators(
+    OnMessage,
+    OnEditedMessage,
+    OnDeletedMessages,
+    OnMessageReactionUpdated,
+    OnMessageReactionCountUpdated,
+    OnInlineQuery,
+    OnChosenInlineResult,
+    OnCallbackQuery,
+    OnShippingQuery,
+    OnPreCheckoutQuery,
+    OnPoll,
+    
+    OnChatMemberUpdated,
+    OnChatJoinRequest,
+
+
+    OnDisconnect,
+    OnUserStatus,
+    OnStory,
+    OnRawUpdate,
+):
+    pass
diff --git a/pyrogram/methods/decorators/on_callback_query.py b/pyrogram/methods/decorators/on_callback_query.py
new file mode 100644
index 0000000000..cffa26f168
--- /dev/null
+++ b/pyrogram/methods/decorators/on_callback_query.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnCallbackQuery:
+    def on_callback_query(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling callback queries.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.CallbackQueryHandler`.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        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.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.CallbackQueryHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.CallbackQueryHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_chat_join_request.py b/pyrogram/methods/decorators/on_chat_join_request.py
new file mode 100644
index 0000000000..a7c71cb889
--- /dev/null
+++ b/pyrogram/methods/decorators/on_chat_join_request.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnChatJoinRequest:
+    def on_chat_join_request(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling chat join requests.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.ChatJoinRequestHandler`.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            filters (:obj:`~pyrogram.filters`, *optional*):
+                Pass one or more filters to allow only a subset of updates to be passed in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.ChatJoinRequestHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.ChatJoinRequestHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_chat_member_updated.py b/pyrogram/methods/decorators/on_chat_member_updated.py
new file mode 100644
index 0000000000..d9610bb391
--- /dev/null
+++ b/pyrogram/methods/decorators/on_chat_member_updated.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnChatMemberUpdated:
+    def on_chat_member_updated(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling event changes on chat members.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.ChatMemberUpdatedHandler`.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            filters (:obj:`~pyrogram.filters`, *optional*):
+                Pass one or more filters to allow only a subset of updates to be passed in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.ChatMemberUpdatedHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.ChatMemberUpdatedHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_chosen_inline_result.py b/pyrogram/methods/decorators/on_chosen_inline_result.py
new file mode 100644
index 0000000000..05fbbec70f
--- /dev/null
+++ b/pyrogram/methods/decorators/on_chosen_inline_result.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnChosenInlineResult:
+    def on_chosen_inline_result(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling chosen inline results.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.ChosenInlineResultHandler`.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            filters (:obj:`~pyrogram.filters`, *optional*):
+                Pass one or more filters to allow only a subset of chosen inline results to be passed
+                in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.ChosenInlineResultHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.ChosenInlineResultHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_deleted_messages.py b/pyrogram/methods/decorators/on_deleted_messages.py
new file mode 100644
index 0000000000..df6b1dc9ee
--- /dev/null
+++ b/pyrogram/methods/decorators/on_deleted_messages.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnDeletedMessages:
+    def on_deleted_messages(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling deleted messages.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.DeletedMessagesHandler`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            filters (:obj:`~pyrogram.filters`, *optional*):
+                Pass one or more filters to allow only a subset of messages to be passed
+                in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.DeletedMessagesHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.DeletedMessagesHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_disconnect.py b/pyrogram/methods/decorators/on_disconnect.py
new file mode 100644
index 0000000000..6a58759471
--- /dev/null
+++ b/pyrogram/methods/decorators/on_disconnect.py
@@ -0,0 +1,46 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+
+
+class OnDisconnect:
+    def on_disconnect(self=None) -> Callable:
+        """Decorator for handling disconnections.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.DisconnectHandler`.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.DisconnectHandler(func))
+            else:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append((pyrogram.handlers.DisconnectHandler(func), 0))
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_edited_message.py b/pyrogram/methods/decorators/on_edited_message.py
new file mode 100644
index 0000000000..b2dbc9d06f
--- /dev/null
+++ b/pyrogram/methods/decorators/on_edited_message.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnEditedMessage:
+    def on_edited_message(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling edited messages.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.EditedMessageHandler`.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            filters (:obj:`~pyrogram.filters`, *optional*):
+                Pass one or more filters to allow only a subset of messages to be passed
+                in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.EditedMessageHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.EditedMessageHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_inline_query.py b/pyrogram/methods/decorators/on_inline_query.py
new file mode 100644
index 0000000000..44c327af8f
--- /dev/null
+++ b/pyrogram/methods/decorators/on_inline_query.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnInlineQuery:
+    def on_inline_query(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling inline queries.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.InlineQueryHandler`.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        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.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.InlineQueryHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.InlineQueryHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_message.py b/pyrogram/methods/decorators/on_message.py
new file mode 100644
index 0000000000..c82ef7b67b
--- /dev/null
+++ b/pyrogram/methods/decorators/on_message.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnMessage:
+    def on_message(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling new messages.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.MessageHandler`.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            filters (:obj:`~pyrogram.filters`, *optional*):
+                Pass one or more filters to allow only a subset of messages to be passed
+                in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.MessageHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.MessageHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_message_reaction_count_updated.py b/pyrogram/methods/decorators/on_message_reaction_count_updated.py
new file mode 100644
index 0000000000..7c2c7c3b90
--- /dev/null
+++ b/pyrogram/methods/decorators/on_message_reaction_count_updated.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnMessageReactionCountUpdated:
+    def on_message_reaction_count_updated(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling anonymous reaction changes on messages.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.MessageReactionCountUpdatedHandler`.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            filters (:obj:`~pyrogram.filters`, *optional*):
+                Pass one or more filters to allow only a subset of updates to be passed in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.MessageReactionCountUpdatedHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.MessageReactionCountUpdatedHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_message_reaction_updated.py b/pyrogram/methods/decorators/on_message_reaction_updated.py
new file mode 100644
index 0000000000..548aa795c4
--- /dev/null
+++ b/pyrogram/methods/decorators/on_message_reaction_updated.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnMessageReactionUpdated:
+    def on_message_reaction_updated(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling reaction changes on messages.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.MessageReactionUpdatedHandler`.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            filters (:obj:`~pyrogram.filters`, *optional*):
+                Pass one or more filters to allow only a subset of updates to be passed in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.MessageReactionUpdatedHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.MessageReactionUpdatedHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_poll.py b/pyrogram/methods/decorators/on_poll.py
new file mode 100644
index 0000000000..0bee354245
--- /dev/null
+++ b/pyrogram/methods/decorators/on_poll.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnPoll:
+    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.handlers.PollHandler`.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.PollHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.PollHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_pre_checkout_query.py b/pyrogram/methods/decorators/on_pre_checkout_query.py
new file mode 100644
index 0000000000..0a28edb718
--- /dev/null
+++ b/pyrogram/methods/decorators/on_pre_checkout_query.py
@@ -0,0 +1,64 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable, Optional, Union
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnPreCheckoutQuery:
+    def on_pre_checkout_query(
+        self=None,
+        filters=None,
+        group: int = 0,
+    ) -> Callable:
+        """Decorator for handling pre-checkout queries.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.PreCheckoutQueryHandler`.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        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.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.PreCheckoutQueryHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.PreCheckoutQueryHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_raw_update.py b/pyrogram/methods/decorators/on_raw_update.py
new file mode 100644
index 0000000000..644bc8a5b9
--- /dev/null
+++ b/pyrogram/methods/decorators/on_raw_update.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+
+
+class OnRawUpdate:
+    def on_raw_update(
+        self=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling raw updates.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.RawUpdateHandler`.
+
+        Parameters:
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.RawUpdateHandler(func), group)
+            else:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.RawUpdateHandler(func),
+                        group
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_shipping_query.py b/pyrogram/methods/decorators/on_shipping_query.py
new file mode 100644
index 0000000000..e8962ef4ac
--- /dev/null
+++ b/pyrogram/methods/decorators/on_shipping_query.py
@@ -0,0 +1,64 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable, Optional, Union
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnShippingQuery:
+    def on_shipping_query(
+        self=None,
+        filters=None,
+        group: int = 0,
+    ) -> Callable:
+        """Decorator for handling shipping queries.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.ShippingQueryHandler`.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        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.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.ShippingQueryHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.ShippingQueryHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_story.py b/pyrogram/methods/decorators/on_story.py
new file mode 100644
index 0000000000..ea0407b9a0
--- /dev/null
+++ b/pyrogram/methods/decorators/on_story.py
@@ -0,0 +1,64 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable, Optional, Union
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnStory:
+    def on_story(
+        self: Union["OnStory", Filter, None] = None,
+        filters: Optional[Filter] = None,
+        group: int = 0,
+    ) -> Callable:
+        """Decorator for handling new stories.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.StoryHandler`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            filters (:obj:`~pyrogram.filters`, *optional*):
+                Pass one or more filters to allow only a subset of stories to be passed
+                in your function.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.StoryHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.StoryHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/decorators/on_user_status.py b/pyrogram/methods/decorators/on_user_status.py
new file mode 100644
index 0000000000..27f79e687b
--- /dev/null
+++ b/pyrogram/methods/decorators/on_user_status.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Callable
+
+import pyrogram
+from pyrogram.filters import Filter
+
+
+class OnUserStatus:
+    def on_user_status(
+        self=None,
+        filters=None,
+        group: int = 0
+    ) -> Callable:
+        """Decorator for handling user status updates.
+
+        This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
+        :obj:`~pyrogram.handlers.UserStatusHandler`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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*):
+                The group identifier, defaults to 0.
+        """
+
+        def decorator(func: Callable) -> Callable:
+            if isinstance(self, pyrogram.Client):
+                self.add_handler(pyrogram.handlers.UserStatusHandler(func, filters), group)
+            elif isinstance(self, Filter) or self is None:
+                if not hasattr(func, "handlers"):
+                    func.handlers = []
+
+                func.handlers.append(
+                    (
+                        pyrogram.handlers.UserStatusHandler(func, self),
+                        group if filters is None else filters
+                    )
+                )
+
+            return func
+
+        return decorator
diff --git a/pyrogram/methods/invite_links/__init__.py b/pyrogram/methods/invite_links/__init__.py
new file mode 100644
index 0000000000..51145dcfac
--- /dev/null
+++ b/pyrogram/methods/invite_links/__init__.py
@@ -0,0 +1,58 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .approve_all_chat_join_requests import ApproveAllChatJoinRequests
+from .approve_chat_join_request import ApproveChatJoinRequest
+from .create_chat_invite_link import CreateChatInviteLink
+from .decline_all_chat_join_requests import DeclineAllChatJoinRequests
+from .decline_chat_join_request import DeclineChatJoinRequest
+from .delete_chat_admin_invite_links import DeleteChatAdminInviteLinks
+from .delete_chat_invite_link import DeleteChatInviteLink
+from .edit_chat_invite_link import EditChatInviteLink
+from .export_chat_invite_link import ExportChatInviteLink
+from .get_chat_admin_invite_links import GetChatAdminInviteLinks
+from .get_chat_admin_invite_links_count import GetChatAdminInviteLinksCount
+from .get_chat_admins_with_invite_links import GetChatAdminsWithInviteLinks
+from .get_chat_invite_link import GetChatInviteLink
+from .get_chat_invite_link_joiners import GetChatInviteLinkJoiners
+from .get_chat_invite_link_joiners_count import GetChatInviteLinkJoinersCount
+from .get_chat_join_requests import GetChatJoinRequests
+from .revoke_chat_invite_link import RevokeChatInviteLink
+
+
+class InviteLinks(
+    ApproveAllChatJoinRequests,
+    ApproveChatJoinRequest,
+    CreateChatInviteLink,
+    DeclineAllChatJoinRequests,
+    DeclineChatJoinRequest,
+    DeleteChatAdminInviteLinks,
+    DeleteChatInviteLink,
+    EditChatInviteLink,
+    ExportChatInviteLink,
+    GetChatAdminInviteLinks,
+    GetChatAdminInviteLinksCount,
+    GetChatAdminsWithInviteLinks,
+    GetChatInviteLink,
+    GetChatInviteLinkJoiners,
+    GetChatInviteLinkJoinersCount,
+    GetChatJoinRequests,
+    RevokeChatInviteLink,
+):
+    pass
diff --git a/pyrogram/methods/invite_links/approve_all_chat_join_requests.py b/pyrogram/methods/invite_links/approve_all_chat_join_requests.py
new file mode 100644
index 0000000000..623fd87fcc
--- /dev/null
+++ b/pyrogram/methods/invite_links/approve_all_chat_join_requests.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class ApproveAllChatJoinRequests:
+    async def approve_all_chat_join_requests(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        invite_link: str = None
+    ) -> bool:
+        """Approve all pending join requests in a chat.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            invite_link (``str``, *optional*):
+                Pass an invite link to approve only its join requests.
+                By default, all join requests are approved.
+
+        Returns:
+            ``bool``: True on success.
+        """
+        await self.invoke(
+            raw.functions.messages.HideAllChatJoinRequests(
+                peer=await self.resolve_peer(chat_id),
+                approved=True,
+                link=invite_link
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/invite_links/approve_chat_join_request.py b/pyrogram/methods/invite_links/approve_chat_join_request.py
new file mode 100644
index 0000000000..2fc4e6d309
--- /dev/null
+++ b/pyrogram/methods/invite_links/approve_chat_join_request.py
@@ -0,0 +1,57 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class ApproveChatJoinRequest:
+    async def approve_chat_join_request(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: int,
+    ) -> bool:
+        """Approve a chat join request.
+
+        You must be an administrator in the chat for this to work and must have the *can_invite_users* administrator
+        right.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            user_id (``int``):
+                Unique identifier of the target user.
+
+        Returns:
+            ``bool``: True on success.
+        """
+        await self.invoke(
+            raw.functions.messages.HideChatJoinRequest(
+                peer=await self.resolve_peer(chat_id),
+                user_id=await self.resolve_peer(user_id),
+                approved=True
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/invite_links/create_chat_invite_link.py b/pyrogram/methods/invite_links/create_chat_invite_link.py
new file mode 100644
index 0000000000..ccf8d6505a
--- /dev/null
+++ b/pyrogram/methods/invite_links/create_chat_invite_link.py
@@ -0,0 +1,87 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+
+
+class CreateChatInviteLink:
+    async def create_chat_invite_link(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        name: str = None,
+        expire_date: datetime = None,
+        member_limit: int = None,
+        creates_join_request: bool = None
+    ) -> "types.ChatInviteLink":
+        """Create an additional invite link for a chat.
+
+        You must be an administrator in the chat for this to work and must have the appropriate admin rights.
+
+        The link can be revoked using the method :meth:`~pyrogram.Client.revoke_chat_invite_link`.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            name (``str``, *optional*):
+                Invite link name.
+
+            expire_date (:py:obj:`~datetime.datetime`, *optional*):
+                Point in time when the link will expire.
+                Defaults to None (no expiration date).
+
+            member_limit (``int``, *optional*):
+                Maximum number of users that can be members of the chat simultaneously after joining the chat via
+                this invite link; 1-99999.
+                Defaults to None (no member limit).
+
+            creates_join_request (``bool``, *optional*):
+                True, if users joining the chat via the link need to be approved by chat administrators.
+                If True, member_limit can't be specified.
+
+        Returns:
+            :obj:`~pyrogram.types.ChatInviteLink`: On success, the new invite link is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Create a new link without limits
+                link = await app.create_chat_invite_link(chat_id)
+
+                # Create a new link for up to 3 new users
+                link = await app.create_chat_invite_link(chat_id, member_limit=3)
+        """
+        r = await self.invoke(
+            raw.functions.messages.ExportChatInvite(
+                peer=await self.resolve_peer(chat_id),
+                expire_date=utils.datetime_to_timestamp(expire_date),
+                usage_limit=member_limit,
+                title=name,
+                request_needed=creates_join_request
+            )
+        )
+
+        return types.ChatInviteLink._parse(self, r)
diff --git a/pyrogram/methods/invite_links/decline_all_chat_join_requests.py b/pyrogram/methods/invite_links/decline_all_chat_join_requests.py
new file mode 100644
index 0000000000..9cf5095507
--- /dev/null
+++ b/pyrogram/methods/invite_links/decline_all_chat_join_requests.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class DeclineAllChatJoinRequests:
+    async def decline_all_chat_join_requests(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        invite_link: str = None
+    ) -> bool:
+        """Decline all pending join requests in a chat.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            invite_link (``str``, *optional*):
+                Pass an invite link to decline only its join requests.
+                By default, all join requests are declined.
+
+        Returns:
+            ``bool``: True on success.
+        """
+        await self.invoke(
+            raw.functions.messages.HideAllChatJoinRequests(
+                peer=await self.resolve_peer(chat_id),
+                approved=False,
+                link=invite_link
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/invite_links/decline_chat_join_request.py b/pyrogram/methods/invite_links/decline_chat_join_request.py
new file mode 100644
index 0000000000..9a35b8ee4b
--- /dev/null
+++ b/pyrogram/methods/invite_links/decline_chat_join_request.py
@@ -0,0 +1,57 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class DeclineChatJoinRequest:
+    async def decline_chat_join_request(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_id: int,
+    ) -> bool:
+        """Decline a chat join request.
+
+        You must be an administrator in the chat for this to work and must have the *can_invite_users* administrator
+        right.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            user_id (``int``):
+                Unique identifier of the target user.
+
+        Returns:
+            ``bool``: True on success.
+        """
+        await self.invoke(
+            raw.functions.messages.HideChatJoinRequest(
+                peer=await self.resolve_peer(chat_id),
+                user_id=await self.resolve_peer(user_id),
+                approved=False
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/invite_links/delete_chat_admin_invite_links.py b/pyrogram/methods/invite_links/delete_chat_admin_invite_links.py
new file mode 100644
index 0000000000..32ef1de5e7
--- /dev/null
+++ b/pyrogram/methods/invite_links/delete_chat_admin_invite_links.py
@@ -0,0 +1,54 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class DeleteChatAdminInviteLinks:
+    async def delete_chat_admin_invite_links(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        admin_id: Union[int, str],
+    ) -> bool:
+        """Delete all revoked invite links of an administrator.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            admin_id (``int`` | ``str``):
+                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:
+            ``bool``: On success ``True`` is returned.
+        """
+
+        return await self.invoke(
+            raw.functions.messages.DeleteRevokedExportedChatInvites(
+                peer=await self.resolve_peer(chat_id),
+                admin_id=await self.resolve_peer(admin_id),
+            )
+        )
diff --git a/pyrogram/methods/invite_links/delete_chat_invite_link.py b/pyrogram/methods/invite_links/delete_chat_invite_link.py
new file mode 100644
index 0000000000..82db623abe
--- /dev/null
+++ b/pyrogram/methods/invite_links/delete_chat_invite_link.py
@@ -0,0 +1,52 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class DeleteChatInviteLink:
+    async def delete_chat_invite_link(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        invite_link: str,
+    ) -> bool:
+        """Delete an already revoked invite link.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            invite_link (``str``):
+                The revoked invite link to delete.
+
+        Returns:
+            ``bool``: On success ``True`` is returned.
+        """
+
+        return await self.invoke(
+            raw.functions.messages.DeleteExportedChatInvite(
+                peer=await self.resolve_peer(chat_id),
+                link=invite_link,
+            )
+        )
diff --git a/pyrogram/methods/invite_links/edit_chat_invite_link.py b/pyrogram/methods/invite_links/edit_chat_invite_link.py
new file mode 100644
index 0000000000..553c25dd17
--- /dev/null
+++ b/pyrogram/methods/invite_links/edit_chat_invite_link.py
@@ -0,0 +1,92 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+
+
+class EditChatInviteLink:
+    async def edit_chat_invite_link(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        invite_link: str,
+        name: str = None,
+        expire_date: datetime = None,
+        member_limit: int = None,
+        creates_join_request: bool = None
+    ) -> "types.ChatInviteLink":
+        """Edit a non-primary invite link.
+
+        You must be an administrator in the chat for this to work and must have the appropriate admin rights.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            invite_link (``str``):
+                The invite link to edit
+
+            name (``str``, *optional*):
+                Invite link name.
+
+            expire_date (:py:obj:`~datetime.datetime`, *optional*):
+                Point in time when the link will expire.
+                Defaults to None (no change), pass None to set no expiration date.
+
+            member_limit (``int``, *optional*):
+                Maximum number of users that can be members of the chat simultaneously after joining the chat via this
+                invite link; 1-99999.
+                Defaults to None (no change), pass 0 to set no member limit.
+
+            creates_join_request (``bool``, *optional*):
+                True, if users joining the chat via the link need to be approved by chat administrators.
+                If True, member_limit can't be specified.
+
+        Returns:
+            :obj:`~pyrogram.types.ChatInviteLink`: On success, the new invite link is returned
+
+        Example:
+            .. code-block:: python
+
+                # Edit the member limit of a link
+                link = await app.edit_chat_invite_link(chat_id, invite_link, member_limit=5)
+
+                # Set no expiration date of a link
+                link = await app.edit_chat_invite_link(chat_id, invite_link, expire_date=0)
+        """
+        r = await self.invoke(
+            raw.functions.messages.EditExportedChatInvite(
+                peer=await self.resolve_peer(chat_id),
+                link=invite_link,
+                expire_date=utils.datetime_to_timestamp(expire_date),
+                usage_limit=member_limit,
+                title=name,
+                request_needed=creates_join_request
+            )
+        )
+
+        users = {i.id: i for i in r.users}
+
+        return types.ChatInviteLink._parse(self, r.invite, users)
diff --git a/pyrogram/methods/invite_links/export_chat_invite_link.py b/pyrogram/methods/invite_links/export_chat_invite_link.py
new file mode 100644
index 0000000000..f06caf0f9a
--- /dev/null
+++ b/pyrogram/methods/invite_links/export_chat_invite_link.py
@@ -0,0 +1,65 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class ExportChatInviteLink:
+    async def export_chat_invite_link(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+    ) -> "types.ChatInviteLink":
+        """Generate a new primary invite link for a chat; any previously generated primary link is revoked.
+
+        You must be an administrator in the chat for this to work and must have the appropriate admin rights.
+
+        .. 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:`~pyrogram.Client.get_chat` method. If your bot needs to generate a new invite link replacing its
+            previous one, use this method again.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+        Returns:
+            ``str``: On success, the new invite link as string is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Generate a new primary link
+                link = await app.export_chat_invite_link(chat_id)
+        """
+        r = await self.invoke(
+            raw.functions.messages.ExportChatInvite(
+                peer=await self.resolve_peer(chat_id),
+                legacy_revoke_permanent=True
+            )
+        )
+
+        return r.link
diff --git a/pyrogram/methods/invite_links/get_chat_admin_invite_links.py b/pyrogram/methods/invite_links/get_chat_admin_invite_links.py
new file mode 100644
index 0000000000..62acca10e8
--- /dev/null
+++ b/pyrogram/methods/invite_links/get_chat_admin_invite_links.py
@@ -0,0 +1,100 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional, AsyncGenerator
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetChatAdminInviteLinks:
+    async def get_chat_admin_invite_links(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        admin_id: Union[int, str],
+        revoked: bool = False,
+        limit: int = 0,
+    ) -> Optional[AsyncGenerator["types.ChatInviteLink", None]]:
+        """Get the invite links created by an administrator in a chat.
+
+        .. note::
+
+            As an administrator you can only get your own links you have exported.
+            As the chat or channel owner you can get everyones links.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            admin_id (``int`` | ``str``):
+                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).
+
+            revoked (``bool``, *optional*):
+                True, if you want to get revoked links instead.
+                Defaults to False (get active links only).
+
+            limit (``int``, *optional*):
+                Limits the number of invite links to be retrieved.
+                By default, no limit is applied and all invite links are returned.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.ChatInviteLink` objects.
+
+        Yields:
+            :obj:`~pyrogram.types.ChatInviteLink` objects.
+        """
+        current = 0
+        total = abs(limit) or (1 << 31) - 1
+        limit = min(100, total)
+
+        offset_date = None
+        offset_link = None
+
+        while True:
+            r = await self.invoke(
+                raw.functions.messages.GetExportedChatInvites(
+                    peer=await self.resolve_peer(chat_id),
+                    admin_id=await self.resolve_peer(admin_id),
+                    limit=limit,
+                    revoked=revoked,
+                    offset_date=offset_date,
+                    offset_link=offset_link
+                )
+            )
+
+            if not r.invites:
+                break
+
+            users = {i.id: i for i in r.users}
+
+            offset_date = r.invites[-1].date
+            offset_link = r.invites[-1].link
+
+            for i in r.invites:
+                yield types.ChatInviteLink._parse(self, i, users)
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py b/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py
new file mode 100644
index 0000000000..528876ed4e
--- /dev/null
+++ b/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class GetChatAdminInviteLinksCount:
+    async def get_chat_admin_invite_links_count(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        admin_id: Union[int, str],
+        revoked: bool = False,
+    ) -> int:
+        """Get the count of the invite links created by an administrator in a chat.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            admin_id (``int`` | ``str``):
+                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).
+
+            revoked (``bool``, *optional*):
+                True, if you want to get revoked links instead.
+                Defaults to False (get active links only).
+
+        Returns:
+            ``int``: On success, the invite links count is returned.
+        """
+        r = await self.invoke(
+            raw.functions.messages.GetExportedChatInvites(
+                peer=await self.resolve_peer(chat_id),
+                admin_id=await self.resolve_peer(admin_id),
+                limit=1,
+                revoked=revoked
+            )
+        )
+
+        return r.count
diff --git a/pyrogram/methods/invite_links/get_chat_admins_with_invite_links.py b/pyrogram/methods/invite_links/get_chat_admins_with_invite_links.py
new file mode 100644
index 0000000000..f283e53464
--- /dev/null
+++ b/pyrogram/methods/invite_links/get_chat_admins_with_invite_links.py
@@ -0,0 +1,56 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+
+class GetChatAdminsWithInviteLinks:
+    async def get_chat_admins_with_invite_links(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+    ):
+        """Get the list of the administrators that have exported invite links in a chat.
+
+        You must be the owner of a chat for this to work.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+        Returns:
+            List of :obj:`~pyrogram.types.ChatAdminWithInviteLink`: On success, the list of admins that have exported
+            invite links is returned.
+        """
+        r = await self.invoke(
+            raw.functions.messages.GetAdminsWithInvites(
+                peer=await self.resolve_peer(chat_id)
+            )
+        )
+
+        users = {i.id: i for i in r.users}
+
+        return types.List(
+            types.ChatAdminWithInviteLinks._parse(self, admin, users)
+            for admin in r.admins
+        )
diff --git a/pyrogram/methods/invite_links/get_chat_invite_link.py b/pyrogram/methods/invite_links/get_chat_invite_link.py
new file mode 100644
index 0000000000..8ad575f34a
--- /dev/null
+++ b/pyrogram/methods/invite_links/get_chat_invite_link.py
@@ -0,0 +1,56 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetChatInviteLink:
+    async def get_chat_invite_link(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        invite_link: str,
+    ) -> "types.ChatInviteLink":
+        """Get detailed information about a chat invite link.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            invite_link (str):
+                The invite link.
+
+        Returns:
+            :obj:`~pyrogram.types.ChatInviteLink`: On success, the invite link is returned.
+        """
+        r = await self.invoke(
+            raw.functions.messages.GetExportedChatInvite(
+                peer=await self.resolve_peer(chat_id),
+                link=invite_link
+            )
+        )
+
+        users = {i.id: i for i in r.users}
+
+        return types.ChatInviteLink._parse(self, r.invite, users)
diff --git a/pyrogram/methods/invite_links/get_chat_invite_link_joiners.py b/pyrogram/methods/invite_links/get_chat_invite_link_joiners.py
new file mode 100644
index 0000000000..c1fc43a71f
--- /dev/null
+++ b/pyrogram/methods/invite_links/get_chat_invite_link_joiners.py
@@ -0,0 +1,87 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional, AsyncGenerator
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetChatInviteLinkJoiners:
+    async def get_chat_invite_link_joiners(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        invite_link: str,
+        limit: int = 0
+    ) -> Optional[AsyncGenerator["types.ChatJoiner", None]]:
+        """Get the members who joined the chat with the invite link.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            invite_link (str):
+                The invite link.
+
+            limit (``int``, *optional*):
+                Limits the number of invite links to be retrieved.
+                By default, no limit is applied and all invite links are returned.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.ChatJoiner` objects.
+
+        Yields:
+            :obj:`~pyrogram.types.ChatJoiner` objects.
+        """
+        current = 0
+        total = abs(limit) or (1 << 31) - 1
+        limit = min(100, total)
+
+        offset_date = 0
+        offset_user = raw.types.InputUserEmpty()
+
+        while True:
+            r = await self.invoke(
+                raw.functions.messages.GetChatInviteImporters(
+                    peer=await self.resolve_peer(chat_id),
+                    link=invite_link,
+                    limit=limit,
+                    offset_date=offset_date,
+                    offset_user=offset_user
+                )
+            )
+
+            if not r.importers:
+                break
+
+            users = {i.id: i for i in r.users}
+
+            offset_date = r.importers[-1].date
+            offset_user = await self.resolve_peer(r.importers[-1].user_id)
+
+            for i in r.importers:
+                yield types.ChatJoiner._parse(self, i, users)
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/invite_links/get_chat_invite_link_joiners_count.py b/pyrogram/methods/invite_links/get_chat_invite_link_joiners_count.py
new file mode 100644
index 0000000000..c591be1927
--- /dev/null
+++ b/pyrogram/methods/invite_links/get_chat_invite_link_joiners_count.py
@@ -0,0 +1,56 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class GetChatInviteLinkJoinersCount:
+    async def get_chat_invite_link_joiners_count(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        invite_link: str
+    ) -> int:
+        """Get the count of the members who joined the chat with the invite link.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            invite_link (str):
+                The invite link.
+
+        Returns:
+            ``int``: On success, the joined chat members count is returned.
+        """
+        r = await self.invoke(
+            raw.functions.messages.GetChatInviteImporters(
+                peer=await self.resolve_peer(chat_id),
+                link=invite_link,
+                limit=1,
+                offset_date=0,
+                offset_user=raw.types.InputUserEmpty()
+            )
+        )
+
+        return r.count
diff --git a/pyrogram/methods/invite_links/get_chat_join_requests.py b/pyrogram/methods/invite_links/get_chat_join_requests.py
new file mode 100644
index 0000000000..a75498e2f6
--- /dev/null
+++ b/pyrogram/methods/invite_links/get_chat_join_requests.py
@@ -0,0 +1,88 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional, AsyncGenerator
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetChatJoinRequests:
+    async def get_chat_join_requests(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        limit: int = 0,
+        query: str = ""
+    ) -> Optional[AsyncGenerator["types.ChatJoiner", None]]:
+        """Get the pending join requests of a chat.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            limit (``int``, *optional*):
+                Limits the number of invite links to be retrieved.
+                By default, no limit is applied and all invite links are returned.
+
+            query (``str``, *optional*):
+                Query to search for a user.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.ChatJoiner` objects.
+
+        Yields:
+            :obj:`~pyrogram.types.ChatJoiner` objects.
+        """
+        current = 0
+        total = abs(limit) or (1 << 31) - 1
+        limit = min(100, total)
+
+        offset_date = 0
+        offset_user = raw.types.InputUserEmpty()
+
+        while True:
+            r = await self.invoke(
+                raw.functions.messages.GetChatInviteImporters(
+                    peer=await self.resolve_peer(chat_id),
+                    limit=limit,
+                    offset_date=offset_date,
+                    offset_user=offset_user,
+                    requested=True,
+                    q=query
+                )
+            )
+
+            if not r.importers:
+                break
+
+            users = {i.id: i for i in r.users}
+
+            offset_date = r.importers[-1].date
+            offset_user = await self.resolve_peer(r.importers[-1].user_id)
+
+            for i in r.importers:
+                yield types.ChatJoiner._parse(self, i, users)
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/invite_links/revoke_chat_invite_link.py b/pyrogram/methods/invite_links/revoke_chat_invite_link.py
new file mode 100644
index 0000000000..ff55a04e03
--- /dev/null
+++ b/pyrogram/methods/invite_links/revoke_chat_invite_link.py
@@ -0,0 +1,68 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class RevokeChatInviteLink:
+    async def revoke_chat_invite_link(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        invite_link: str,
+    ) -> "types.ChatInviteLink":
+        """Revoke a previously created invite link.
+
+        If the primary link is revoked, a new link is automatically generated.
+
+        You must be an administrator in the chat for this to work and must have the appropriate admin rights.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel/supergroup
+                (in the format @username).
+
+            invite_link (``str``):
+               The invite link to revoke.
+
+        Returns:
+            :obj:`~pyrogram.types.ChatInviteLink`: On success, the invite link object is returned.
+        """
+
+        r = await self.invoke(
+            raw.functions.messages.EditExportedChatInvite(
+                peer=await self.resolve_peer(chat_id),
+                link=invite_link,
+                revoked=True
+            )
+        )
+
+        users = {i.id: i for i in r.users}
+
+        chat_invite = (
+            r.new_invite
+            if isinstance(r, raw.types.messages.ExportedChatInviteReplaced)
+            else r.invite
+        )
+
+        return types.ChatInviteLink._parse(self, chat_invite, users)
diff --git a/pyrogram/methods/messages/__init__.py b/pyrogram/methods/messages/__init__.py
new file mode 100644
index 0000000000..2328d02a99
--- /dev/null
+++ b/pyrogram/methods/messages/__init__.py
@@ -0,0 +1,132 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .copy_media_group import CopyMediaGroup
+from .copy_message import CopyMessage
+from .delete_messages import DeleteMessages
+from .download_media import DownloadMedia
+from .edit_cached_media import EditCachedMedia
+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_chat_history import GetChatHistory
+from .get_chat_history_count import GetChatHistoryCount
+from .get_custom_emoji_stickers import GetCustomEmojiStickers
+from .get_discussion_message import GetDiscussionMessage
+from .get_discussion_replies import GetDiscussionReplies
+from .get_discussion_replies_count import GetDiscussionRepliesCount
+from .get_media_group import GetMediaGroup
+from .get_messages import GetMessages
+from .read_chat_history import ReadChatHistory
+from .retract_vote import RetractVote
+from .search_global import SearchGlobal
+from .search_global_count import SearchGlobalCount
+from .search_messages import SearchMessages
+from .search_messages_count import SearchMessagesCount
+from .send_animation import SendAnimation
+from .send_audio import SendAudio
+from .send_cached_media import SendCachedMedia
+from .send_chat_action import SendChatAction
+from .send_contact import SendContact
+from .send_dice import SendDice
+from .send_document import SendDocument
+from .send_location import SendLocation
+from .send_media_group import SendMediaGroup
+from .send_message import SendMessage
+from .send_paid_media import SendPaidMedia
+from .send_photo import SendPhoto
+from .send_poll import SendPoll
+from .set_reaction import SetReaction
+from .send_sticker import SendSticker
+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 .stream_media import StreamMedia
+from .view_messages import ViewMessages
+from .vote_poll import VotePoll
+from .get_chat_sponsored_messages import GetChatSponsoredMessages
+from .search_public_messages_by_tag import SearchPublicMessagesByTag
+from .count_public_messages_by_tag import CountPublicMessagesByTag
+from .translate_text import TranslateText
+
+class Messages(
+    CopyMediaGroup,
+    CopyMessage,
+    DeleteMessages,
+    DownloadMedia,
+    EditCachedMedia,
+    EditInlineCaption,
+    EditInlineMedia,
+    EditInlineReplyMarkup,
+    EditInlineText,
+    EditMessageCaption,
+    EditMessageMedia,
+    EditMessageReplyMarkup,
+    EditMessageText,
+    ForwardMessages,
+    GetChatHistory,
+    GetChatHistoryCount,
+    GetCustomEmojiStickers,
+    GetDiscussionMessage,
+    GetDiscussionReplies,
+    GetDiscussionRepliesCount,
+    GetMediaGroup,
+    GetMessages,
+    ReadChatHistory,
+    RetractVote,
+    SearchGlobal,
+    SearchGlobalCount,
+    SearchMessages,
+    SearchMessagesCount,
+    SearchPublicMessagesByTag,
+    CountPublicMessagesByTag,
+    SendAnimation,
+    SendAudio,
+    SendCachedMedia,
+    SendChatAction,
+    SendContact,
+    SendDice,
+    SendDocument,
+    SendLocation,
+    SendMediaGroup,
+    SendMessage,
+    SendPaidMedia,
+    SendPhoto,
+    SendPoll,
+    SendSticker,
+    SendVenue,
+    SendVideo,
+    SendVideoNote,
+    SendVoice,
+    SetReaction,
+    StopPoll,
+    StreamMedia,
+    ViewMessages,
+    VotePoll,
+    GetChatSponsoredMessages,
+    TranslateText,
+):
+    pass
diff --git a/pyrogram/methods/messages/copy_media_group.py b/pyrogram/methods/messages/copy_media_group.py
new file mode 100644
index 0000000000..e145ee49c1
--- /dev/null
+++ b/pyrogram/methods/messages/copy_media_group.py
@@ -0,0 +1,170 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import enums, raw, types, utils
+
+log = logging.getLogger(__name__)
+
+
+class CopyMediaGroup:
+    async def copy_media_group(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        from_chat_id: Union[int, str],
+        message_id: int,
+        captions: Union[List[str], str] = None,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        schedule_date: datetime = None,
+        reply_to_message_id: int = None
+    ) -> List["types.Message"]:
+        """Copy a media group by providing one of the message ids.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            from_chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the source chat where the original media group was sent.
+                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``):
+                Message identifier in the chat specified in *from_chat_id*.
+
+            captions (``str`` | List of ``str`` , *optional*):
+                New caption for media, 0-1024 characters after entities parsing for each media.
+                If not specified, the original caption is kept.
+                Pass "" (empty string) to remove the caption.
+
+                If a ``string`` is passed, it becomes a caption only for the first media.
+                If a list of ``string`` passed, each element becomes caption for each media element.
+                You can pass ``None`` in list to keep the original caption (see examples below).
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+        Returns:
+            List of :obj:`~pyrogram.types.Message`: On success, a list of copied messages is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Copy a media group
+                await app.copy_media_group(to_chat, from_chat, 123)
+
+                await app.copy_media_group(to_chat, from_chat, 123, captions="single caption")
+                
+                await app.copy_media_group(to_chat, from_chat, 123,
+                    captions=["caption 1", None, ""])
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        media_group = await self.get_media_group(from_chat_id, message_id)
+        multi_media = []
+        show_caption_above_media = []
+
+        for i, message in enumerate(media_group):
+            if message.photo:
+                file_id = message.photo.file_id
+            elif message.audio:
+                file_id = message.audio.file_id
+            elif message.document:
+                file_id = message.document.file_id
+            elif message.video:
+                file_id = message.video.file_id
+            else:
+                raise ValueError("Message with this type can't be copied.")
+
+            media = utils.get_input_media_from_file_id(file_id=file_id)
+
+            sent_message, sent_entities = None, None
+            if isinstance(captions, list) and i < len(captions) and isinstance(captions[i], str):
+                sent_message, sent_entities = (await utils.parse_text_entities(self, captions[i], self.parse_mode, None)).values()
+            elif isinstance(captions, str) and i == 0:
+                sent_message, sent_entities = (await utils.parse_text_entities(self, captions, self.parse_mode, None)).values()
+            elif message.caption and message.caption != "None" and not type(captions) is str:  # TODO
+                sent_message, sent_entities = (await utils.parse_text_entities(self, message.caption, None, message.caption_entities)).values()
+            else:
+                sent_message, sent_entities = "", None
+
+            multi_media.append(
+                raw.types.InputSingleMedia(
+                    media=media,
+                    random_id=self.rnd_id(),
+                    message=sent_message,
+                    entities=sent_entities
+                )
+            )
+            show_caption_above_media.append(message.show_caption_above_media)
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+
+        r = await self.invoke(
+            raw.functions.messages.SendMultiMedia(
+                peer=await self.resolve_peer(chat_id),
+                multi_media=multi_media,
+                silent=disable_notification or None,
+                reply_to=reply_to,
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                invert_media=any(show_caption_above_media)
+            ),
+            sleep_threshold=60
+        )
+
+        return await utils.parse_messages(
+            client=self,
+            messages=None,
+            r=r
+        )
diff --git a/pyrogram/methods/messages/copy_message.py b/pyrogram/methods/messages/copy_message.py
new file mode 100644
index 0000000000..bba4a6f97f
--- /dev/null
+++ b/pyrogram/methods/messages/copy_message.py
@@ -0,0 +1,156 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List, Optional
+
+import pyrogram
+from pyrogram import types, enums
+
+log = logging.getLogger(__name__)
+
+
+class CopyMessage:
+    async def copy_message(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        from_chat_id: Union[int, str],
+        message_id: int,
+        caption: str = None,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        schedule_date: datetime = None,
+        business_connection_id: str = None,
+        protect_content: bool = None,
+        message_thread_id: int = None,
+        reply_to_message_id: int = None
+    ) -> "types.Message":
+        """Copy messages of any kind.
+
+        Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field ``correct_option_id`` is known to the bot.
+
+        The method is analogous to the method :meth:`~Client.forward_messages`, but the copied message doesn't have a
+        link to the original message.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            from_chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the source chat where the original message was sent.
+                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``):
+                Message identifier in the chat specified in *from_chat_id*.
+
+            caption (``string``, *optional*):
+                New caption for media, 0-1024 characters after entities parsing.
+                If not specified, the original caption is kept.
+                Pass "" (empty string) to remove the caption.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the new caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_thread_id (``int``, *optional*):
+                Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the copied message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Copy a message
+                await app.copy_message(to_chat, from_chat, 123)
+
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        message: types.Message = await self.get_messages(
+            chat_id=from_chat_id,
+            message_ids=message_id
+        )
+
+        return await message.copy(
+            chat_id=chat_id,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            show_caption_above_media=show_caption_above_media,
+            disable_notification=disable_notification,
+            reply_parameters=reply_parameters,
+            reply_markup=reply_markup,
+            schedule_date=schedule_date,
+            business_connection_id=business_connection_id,
+            protect_content=protect_content,
+            message_thread_id=message_thread_id
+        )
diff --git a/pyrogram/methods/messages/count_public_messages_by_tag.py b/pyrogram/methods/messages/count_public_messages_by_tag.py
new file mode 100644
index 0000000000..b1cb2cd744
--- /dev/null
+++ b/pyrogram/methods/messages/count_public_messages_by_tag.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class CountPublicMessagesByTag:
+    async def count_public_messages_by_tag(
+        self: "pyrogram.Client",
+        tag: str = "",
+    ) -> int:
+        """Get the count of messages with the provided hashtag or cashtag.
+
+        If you want to get the actual messages, see :meth:`~pyrogram.Client.search_public_messages_by_tag`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            hashtag (``str``, *optional*):
+                Hashtag or cashtag to search for.
+
+        Returns:
+            ``int``: On success, the messages count is returned.
+
+        """
+        r = await self.invoke(
+            raw.functions.channels.SearchPosts(
+                hashtag=tag,
+                offset_rate=0,
+                offset_peer=raw.types.InputPeerEmpty(),
+                offset_id=0,
+                limit=1
+            )
+        )
+
+        if hasattr(r, "count"):
+            return r.count
+        else:
+            return len(r.messages)
diff --git a/pyrogram/methods/messages/delete_messages.py b/pyrogram/methods/messages/delete_messages.py
new file mode 100644
index 0000000000..f29a8fe48b
--- /dev/null
+++ b/pyrogram/methods/messages/delete_messages.py
@@ -0,0 +1,113 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Iterable
+
+import pyrogram
+from pyrogram import raw
+
+
+class DeleteMessages:
+    async def delete_messages(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_ids: Union[int, Iterable[int]],
+        revoke: bool = True,
+        is_scheduled: bool = False
+    ) -> int:
+        """Delete messages, including service messages, with the following limitations:
+
+        - **For BOTS Only**: A message can only be deleted if it was sent less than 48 hours ago.
+        - Service messages about a supergroup, channel, or forum topic creation can't be deleted.
+        - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
+        - :obj:`~pyrogram.Client` can delete outgoing messages in private chats, groups, and supergroups.
+        - :obj:`~pyrogram.Client` can delete incoming messages in private chats.
+        - :obj:`~pyrogram.Client` granted can_post_messages permissions can delete outgoing messages in channels.
+        - If the :obj:`~pyrogram.Client` is an administrator of a group, it can delete any message there.
+        - If the :obj:`~pyrogram.Client` has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
+
+        Use this method to delete multiple messages simultaneously.
+        If some of the specified messages can't be found, they are skipped.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Please be aware about using the correct :doc:`Message Identifiers <../../topics/message-identifiers>`, specifically when using the ``is_scheduled`` parameter.
+
+        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_ids (``int`` | Iterable of ``int``):
+                An iterable of message identifiers to delete (integers) or a single message id.
+
+            revoke (``bool``, *optional*):
+                Deletes messages on both parts.
+                This is only for private cloud chats and normal groups, messages on
+                channels and supergroups are always revoked (i.e.: deleted for everyone).
+                Defaults to True.
+
+            is_scheduled (``bool``, *optional*):
+                True, if the specified ``message_ids`` refers to a scheduled message. Defaults to False.
+
+        Returns:
+            ``int``: Amount of affected messages
+
+        Example:
+            .. code-block:: python
+
+                # Delete one message
+                await app.delete_messages(chat_id, message_id)
+
+                # Delete multiple messages at once
+                await app.delete_messages(chat_id, list_of_message_ids)
+
+                # Delete messages only on your side (without revoking)
+                await app.delete_messages(chat_id, message_id, revoke=False)
+        """
+        peer = await self.resolve_peer(chat_id)
+        message_ids = list(message_ids) if not isinstance(message_ids, int) else [message_ids]
+
+        if is_scheduled:
+            r = await self.invoke(
+                raw.functions.messages.DeleteScheduledMessages(
+                    peer=peer,
+                    id=message_ids
+                )
+            )
+            for i in r.updates:
+                if isinstance(i, raw.types.UpdateDeleteScheduledMessages):
+                    return len(i.messages)
+        else:
+            if isinstance(peer, raw.types.InputPeerChannel):
+                r = await self.invoke(
+                    raw.functions.channels.DeleteMessages(
+                        channel=peer,
+                        id=message_ids
+                    )
+                )
+            else:
+                r = await self.invoke(
+                    raw.functions.messages.DeleteMessages(
+                        id=message_ids,
+                        revoke=revoke
+                    )
+                )
+
+            return r.pts_count
diff --git a/pyrogram/methods/messages/download_media.py b/pyrogram/methods/messages/download_media.py
new file mode 100644
index 0000000000..b1bdea7e9e
--- /dev/null
+++ b/pyrogram/methods/messages/download_media.py
@@ -0,0 +1,213 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+import os
+from datetime import datetime
+from typing import Union, Optional, Callable, BinaryIO
+
+import pyrogram
+from pyrogram import types, enums
+from pyrogram.file_id import FileId, FileType, PHOTO_TYPES
+
+DEFAULT_DOWNLOAD_DIR = "downloads/"
+
+
+class DownloadMedia:
+    async def download_media(
+        self: "pyrogram.Client",
+        message: Union["types.Message", "types.Story", str],
+        file_name: str = DEFAULT_DOWNLOAD_DIR,
+        in_memory: bool = False,
+        block: bool = True,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> Optional[Union[str, BinaryIO]]:
+        """Download the media from a message.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            message (:obj:`~pyrogram.types.Message` | :obj:`~pyrogram.types.Story` | ``str``):
+                Pass a Message containing the media, the media itself (message.audio, message.video, ...) or a file id
+                as string.
+
+            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.
+                You can also specify a path for downloading files in a custom location: paths that end with "/"
+                are considered directories. All non-existent folders will be created automatically.
+
+            in_memory (``bool``, *optional*):
+                Pass True to download the media in-memory.
+                A binary file-like object with its attribute ".name" set will be returned.
+                Defaults to False.
+
+            block (``bool``, *optional*):
+                Blocks the code execution until the file has been downloaded.
+                Defaults to True.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            ``str`` | ``None`` | ``BinaryIO``: On success, the absolute path of the downloaded file is returned,
+            otherwise, in case the download failed or was deliberately stopped with
+            :meth:`~pyrogram.Client.stop_transmission`, None is returned.
+            Otherwise, in case ``in_memory=True``, a binary file-like object with its attribute ".name" set is returned.
+
+        Raises:
+            ValueError: if the message doesn't contain any downloadable media
+
+        Example:
+            Download media to file
+
+            .. code-block:: python
+
+                # Download from Message
+                await app.download_media(message)
+
+                # Download from file id
+                await app.download_media(message.photo.file_id)
+
+                # Keep track of the progress while downloading
+                async def progress(current, total):
+                    print(f"{current * 100 / total:.1f}%")
+
+                await app.download_media(message, progress=progress)
+
+            Download media in-memory
+
+            .. code-block:: python
+
+                file = await app.download_media(message, in_memory=True)
+
+                file_name = file.name
+                file_bytes = bytes(file.getbuffer())
+        """
+
+        media = message
+
+        if isinstance(message, types.Message):
+            if message.new_chat_photo:
+                media = message.new_chat_photo
+
+            elif (
+                not self.me.is_bot and
+                message.story or message.reply_to_story
+            ):
+                story_media = message.story or message.reply_to_story or None
+                if story_media and story_media.media:
+                    media = getattr(story_media, story_media.media.value, None)
+                else:
+                    media = None
+
+            else:
+                if message.media:
+                    media = getattr(message, message.media.value, None)
+                else:
+                    media = None
+
+        elif isinstance(message, str):
+            media = message
+
+        if isinstance(media, types.Story):
+            if self.me.is_bot:
+                raise ValueError("This method cannot be used by bots")
+            else:
+                if media.media:
+                    media = getattr(message, message.media.value, None)
+                else:
+                    media = None
+
+        if not media:
+            raise ValueError(
+                f"The message {message if isinstance(message, str) else message.id} doesn't contain any downloadable media"
+            )
+
+        if isinstance(media, str):
+            file_id_str = media
+        else:
+            file_id_str = media.file_id
+
+        file_id_obj = FileId.decode(file_id_str)
+
+        file_type = file_id_obj.file_type
+        media_file_name = getattr(media, "file_name", "")  # TODO
+        file_size = getattr(media, "file_size", 0)
+        mime_type = getattr(media, "mime_type", "")
+        date = getattr(media, "date", None)
+
+        directory, file_name = os.path.split(file_name)
+        file_name = file_name or media_file_name or ""
+
+        if not os.path.isabs(file_name):
+            directory = self.WORKDIR / (directory or DEFAULT_DOWNLOAD_DIR)
+
+        if not file_name:
+            guessed_extension = self.guess_extension(mime_type)
+
+            if file_type in PHOTO_TYPES:
+                extension = ".jpg"
+            elif file_type == FileType.VOICE:
+                extension = guessed_extension or ".ogg"
+            elif file_type in (FileType.VIDEO, FileType.ANIMATION, FileType.VIDEO_NOTE):
+                extension = guessed_extension or ".mp4"
+            elif file_type == FileType.DOCUMENT:
+                extension = guessed_extension or ".zip"
+            elif file_type == FileType.STICKER:
+                extension = guessed_extension or ".webp"
+            elif file_type == FileType.AUDIO:
+                extension = guessed_extension or ".mp3"
+            else:
+                extension = ".unknown"
+
+            file_name = "{}_{}_{}{}".format(
+                FileType(file_id_obj.file_type).name.lower(),
+                (date or datetime.now()).strftime("%Y-%m-%d_%H-%M-%S"),
+                self.rnd_id(),
+                extension
+            )
+
+        downloader = self.handle_download(
+            (file_id_obj, directory, file_name, in_memory, file_size, progress, progress_args)
+        )
+
+        if block:
+            return await downloader
+        else:
+            asyncio.get_event_loop().create_task(downloader)
diff --git a/pyrogram/methods/messages/edit_cached_media.py b/pyrogram/methods/messages/edit_cached_media.py
new file mode 100644
index 0000000000..533c47ecc5
--- /dev/null
+++ b/pyrogram/methods/messages/edit_cached_media.py
@@ -0,0 +1,161 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List, Optional
+
+import pyrogram
+from pyrogram import raw, enums, types, utils
+
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class EditCachedMedia:
+    async def edit_cached_media(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        file_id: str,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        schedule_date: datetime = None,
+        has_spoiler: bool = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        business_connection_id: str = None
+    ) -> Optional["types.Message"]:
+        """Edit a 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 editing media using a file_id, thus saving you from the
+        hassle of using the correct :obj:`~pyrogram.types.InputMedia` for the media the file_id is pointing to.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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``):
+                Message identifier in the chat specified in chat_id.
+
+            file_id (``str``):
+                Media to send.
+                Pass a file_id as string to send a media that exists on the Telegram servers.
+
+            caption (``str``, *optional*):
+                Media caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            has_spoiler (``bool``, *optional*):
+                True, if the message media is covered by a spoiler animation.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message to be edited was sent
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited media message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.edit_cached_media(chat_id, message_id, file_id)
+        """
+
+        rpc = raw.functions.messages.EditMessage(
+            peer=await self.resolve_peer(chat_id),
+            id=message_id,
+            media=utils.get_input_media_from_file_id(file_id, has_spoiler=has_spoiler),
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            invert_media=show_caption_above_media,
+            **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+        )
+        session = None
+        business_connection = None
+        if business_connection_id:
+            business_connection = self.business_user_connection_cache[business_connection_id]
+            if not business_connection:
+                business_connection = await self.get_business_connection(business_connection_id)
+            session = await get_session(
+                self,
+                business_connection._raw.connection.dc_id
+            )
+        if business_connection_id:
+            r = await session.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+            # await session.stop()
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateEditMessage,
+                    raw.types.UpdateEditChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotEditBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/edit_inline_caption.py b/pyrogram/methods/messages/edit_inline_caption.py
new file mode 100644
index 0000000000..69c7333416
--- /dev/null
+++ b/pyrogram/methods/messages/edit_inline_caption.py
@@ -0,0 +1,65 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import types, enums
+
+
+class EditInlineCaption:
+    async def edit_inline_caption(
+        self: "pyrogram.Client",
+        inline_message_id: str,
+        caption: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None
+    ) -> bool:
+        """Edit the caption of inline media messages.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            inline_message_id (``str``):
+                Identifier of the inline message.
+
+            caption (``str``):
+                New caption of the media message.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Bots only
+                await app.edit_inline_caption(inline_message_id, "new media caption")
+        """
+        return await self.edit_inline_text(
+            inline_message_id=inline_message_id,
+            text=caption,
+            parse_mode=parse_mode,
+            reply_markup=reply_markup
+        )
diff --git a/pyrogram/methods/messages/edit_inline_media.py b/pyrogram/methods/messages/edit_inline_media.py
new file mode 100644
index 0000000000..d549ccfbaf
--- /dev/null
+++ b/pyrogram/methods/messages/edit_inline_media.py
@@ -0,0 +1,247 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+import io
+import os
+import re
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+from pyrogram import utils
+from pyrogram.errors import RPCError, MediaEmpty
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+
+class EditInlineMedia:
+    MAX_RETRIES = 3
+
+    async def edit_inline_media(
+        self: "pyrogram.Client",
+        inline_message_id: str,
+        media: "types.InputMedia",
+        reply_markup: "types.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.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            inline_message_id (``str``):
+                Required if *chat_id* and *message_id* are not specified.
+                Identifier of the inline message.
+
+            media (:obj:`~pyrogram.types.InputMedia`):
+                One of the InputMedia objects describing an animation, audio, document, photo or video.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import InputMediaPhoto, InputMediaVideo, InputMediaAudio
+
+                # Bots only
+
+                # Replace the current media with a local photo
+                await app.edit_inline_media(inline_message_id, InputMediaPhoto("new_photo.jpg"))
+
+                # Replace the current media with a local video
+                await app.edit_inline_media(inline_message_id, InputMediaVideo("new_video.mp4"))
+
+                # Replace the current media with a local audio
+                await app.edit_inline_media(inline_message_id, InputMediaAudio("new_audio.mp3"))
+        """
+        caption = media.caption
+        parse_mode = media.parse_mode
+        caption_entities = media.caption_entities
+
+        is_bytes_io = isinstance(media.media, io.BytesIO)
+        is_uploaded_file = is_bytes_io or os.path.isfile(media.media)
+
+        is_external_url = not is_uploaded_file and re.match("^https?://", media.media)
+
+        if is_bytes_io and not hasattr(media.media, "name"):
+            media.media.name = "media"
+
+        if is_uploaded_file:
+            filename_attribute = [
+                raw.types.DocumentAttributeFilename(
+                    file_name=media.media.name if is_bytes_io else os.path.basename(media.media)
+                )
+            ]
+        else:
+            filename_attribute = []
+
+        if isinstance(media, types.InputMediaPhoto):
+            if is_uploaded_file:
+                media = raw.types.InputMediaUploadedPhoto(
+                    file=await self.save_file(media.media),
+                    spoiler=media.has_spoiler
+                )
+            elif is_external_url:
+                media = raw.types.InputMediaPhotoExternal(
+                    url=media.media,
+                    spoiler=media.has_spoiler
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.PHOTO)
+        elif isinstance(media, types.InputMediaVideo):
+            if is_uploaded_file:
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "video/mp4",
+                    thumb=await self.save_file(media.thumb),
+                    file=await self.save_file(media.media),
+                    spoiler=media.has_spoiler,
+                    attributes=[
+                                   raw.types.DocumentAttributeVideo(
+                                       supports_streaming=media.supports_streaming or None,
+                                       duration=media.duration,
+                                       w=media.width,
+                                       h=media.height
+                                   )
+                               ] + filename_attribute
+                )
+            elif is_external_url:
+                media = raw.types.InputMediaDocumentExternal(
+                    url=media.media,
+                    spoiler=media.has_spoiler
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.VIDEO)
+        elif isinstance(media, types.InputMediaAudio):
+            if is_uploaded_file:
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "audio/mpeg",
+                    thumb=await self.save_file(media.thumb),
+                    file=await self.save_file(media.media),
+                    attributes=[
+                                   raw.types.DocumentAttributeAudio(
+                                       duration=media.duration,
+                                       performer=media.performer,
+                                       title=media.title
+                                   )
+                               ] + filename_attribute
+                )
+            elif is_external_url:
+                media = raw.types.InputMediaDocumentExternal(
+                    url=media.media
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.AUDIO)
+        elif isinstance(media, types.InputMediaAnimation):
+            if is_uploaded_file:
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "video/mp4",
+                    thumb=await self.save_file(media.thumb),
+                    file=await self.save_file(media.media),
+                    spoiler=media.has_spoiler,
+                    attributes=[
+                                   raw.types.DocumentAttributeVideo(
+                                       supports_streaming=True,
+                                       duration=media.duration,
+                                       w=media.width,
+                                       h=media.height
+                                   ),
+                                   raw.types.DocumentAttributeAnimated()
+                               ] + filename_attribute,
+                    nosound_video=True,
+                    force_file=False
+                )
+            elif is_external_url:
+                media = raw.types.InputMediaDocumentExternal(
+                    url=media.media,
+                    spoiler=media.has_spoiler
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.ANIMATION)
+        elif isinstance(media, types.InputMediaDocument):
+            if is_uploaded_file:
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "application/zip",
+                    thumb=await self.save_file(media.thumb),
+                    file=await self.save_file(media.media),
+                    attributes=filename_attribute,
+                    force_file=True
+                )
+            elif is_external_url:
+                media = raw.types.InputMediaDocumentExternal(
+                    url=media.media
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.DOCUMENT)
+
+        unpacked = utils.unpack_inline_message_id(inline_message_id)
+        dc_id = unpacked.dc_id
+
+        session = await get_session(self, dc_id)
+
+        if is_uploaded_file:
+            uploaded_media = await self.invoke(
+                raw.functions.messages.UploadMedia(
+                    business_connection_id=None,  # TODO
+                    peer=raw.types.InputPeerSelf(),
+                    media=media
+                )
+            )
+
+            actual_media = raw.types.InputMediaPhoto(
+                id=raw.types.InputPhoto(
+                    id=uploaded_media.photo.id,
+                    access_hash=uploaded_media.photo.access_hash,
+                    file_reference=uploaded_media.photo.file_reference
+                ),
+                spoiler=getattr(media, "has_spoiler", None)
+            ) if isinstance(uploaded_media, raw.types.MessageMediaPhoto) else raw.types.InputMediaDocument(
+                id=raw.types.InputDocument(
+                    id=uploaded_media.document.id,
+                    access_hash=uploaded_media.document.access_hash,
+                    file_reference=uploaded_media.document.file_reference
+                ),
+                spoiler=getattr(media, "has_spoiler", None)
+            )
+        else:
+            actual_media = media
+
+        for i in range(self.MAX_RETRIES):
+            try:
+                return await session.invoke(
+                    raw.functions.messages.EditInlineBotMessage(
+                        id=unpacked,
+                        media=actual_media,
+                        reply_markup=await reply_markup.write(self) if reply_markup else None,
+                        **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+                    ),
+                    sleep_threshold=self.sleep_threshold
+                )
+            except RPCError as e:
+                if i == self.MAX_RETRIES - 1:
+                    raise
+
+                if isinstance(e, MediaEmpty):
+                    # Must wait due to a server race condition
+                    await asyncio.sleep(1)
diff --git a/pyrogram/methods/messages/edit_inline_reply_markup.py b/pyrogram/methods/messages/edit_inline_reply_markup.py
new file mode 100644
index 0000000000..e2ef40e160
--- /dev/null
+++ b/pyrogram/methods/messages/edit_inline_reply_markup.py
@@ -0,0 +1,69 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+from pyrogram import utils
+from .inline_session import get_session
+
+
+class EditInlineReplyMarkup:
+    async def edit_inline_reply_markup(
+        self: "pyrogram.Client",
+        inline_message_id: str,
+        reply_markup: "types.InlineKeyboardMarkup" = None
+    ) -> bool:
+        """Edit only the reply markup of inline messages sent via the bot (for inline bots).
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            inline_message_id (``str``):
+                Identifier of the inline message.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
+
+                # Bots only
+                await app.edit_inline_reply_markup(
+                    inline_message_id,
+                    InlineKeyboardMarkup([[
+                        InlineKeyboardButton("New button", callback_data="new_data")]]))
+        """
+
+        unpacked = utils.unpack_inline_message_id(inline_message_id)
+        dc_id = unpacked.dc_id
+
+        session = await get_session(self, dc_id)
+
+        return await session.invoke(
+            raw.functions.messages.EditInlineBotMessage(
+                id=unpacked,
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+            ),
+            sleep_threshold=self.sleep_threshold
+        )
diff --git a/pyrogram/methods/messages/edit_inline_text.py b/pyrogram/methods/messages/edit_inline_text.py
new file mode 100644
index 0000000000..2f0dd30ef1
--- /dev/null
+++ b/pyrogram/methods/messages/edit_inline_text.py
@@ -0,0 +1,112 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, enums, types, utils
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class EditInlineText:
+    async def edit_inline_text(
+        self: "pyrogram.Client",
+        inline_message_id: str,
+        text: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        entities: List["types.MessageEntity"] = None,
+        link_preview_options: "types.LinkPreviewOptions" = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        disable_web_page_preview: bool = None
+    ) -> bool:
+        """Edit the text of inline messages.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        Parameters:
+            inline_message_id (``str``):
+                Identifier of the inline message.
+
+            text (``str``):
+                New text of the message.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in message text, which can be specified instead of *parse_mode*.
+
+            link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*):
+                Link preview generation options for the message
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Bots only
+
+                # Simple edit text
+                await app.edit_inline_text(inline_message_id, "new text")
+
+                # Take the same text message, remove the web page preview only
+                await app.edit_inline_text(
+                    inline_message_id, message.text,
+                    link_preview_options=types.LinkPreviewOptions(
+                        is_disabled=True
+                    )
+                )
+        """
+        if disable_web_page_preview and link_preview_options:
+            raise ValueError(
+                "Parameters `disable_web_page_preview` and `link_preview_options` are mutually "
+                "exclusive."
+            )
+
+        if disable_web_page_preview is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use link_preview_options instead"
+            )
+            link_preview_options = types.LinkPreviewOptions(is_disabled=disable_web_page_preview)
+
+        link_preview_options = link_preview_options or self.link_preview_options
+
+        unpacked = utils.unpack_inline_message_id(inline_message_id)
+        dc_id = unpacked.dc_id
+
+        session = await get_session(self, dc_id)
+
+        return await session.invoke(
+            raw.functions.messages.EditInlineBotMessage(
+                id=unpacked,
+                no_webpage=link_preview_options.is_disabled if link_preview_options else None,
+                invert_media=link_preview_options.show_above_text if link_preview_options else None,
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                **await utils.parse_text_entities(self, text, parse_mode, entities)
+            ),
+            sleep_threshold=self.sleep_threshold
+        )
diff --git a/pyrogram/methods/messages/edit_message_caption.py b/pyrogram/methods/messages/edit_message_caption.py
new file mode 100644
index 0000000000..6752d00258
--- /dev/null
+++ b/pyrogram/methods/messages/edit_message_caption.py
@@ -0,0 +1,98 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List, Optional
+
+import pyrogram
+from pyrogram import types, enums
+
+
+class EditMessageCaption:
+    async def edit_message_caption(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        caption: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        schedule_date: datetime = None,
+        business_connection_id: str = None
+    ) -> "types.Message":
+        """Edit the caption of media messages.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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``):
+                Message identifier in the chat specified in chat_id.
+
+            caption (``str``):
+                New caption of the media message.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message to be edited was sent
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.edit_message_caption(chat_id, message_id, "new media caption")
+        """
+        link_preview_options = None
+        if show_caption_above_media:
+            link_preview_options = types.LinkPreviewOptions(
+                show_above_text=show_caption_above_media
+            )
+
+        return await self.edit_message_text(
+            chat_id=chat_id,
+            message_id=message_id,
+            text=caption,
+            parse_mode=parse_mode,
+            entities=caption_entities,
+            reply_markup=reply_markup,
+            link_preview_options=link_preview_options,
+            schedule_date=schedule_date,
+            business_connection_id=business_connection_id
+        )
diff --git a/pyrogram/methods/messages/edit_message_media.py b/pyrogram/methods/messages/edit_message_media.py
new file mode 100644
index 0000000000..3a9086fcb4
--- /dev/null
+++ b/pyrogram/methods/messages/edit_message_media.py
@@ -0,0 +1,349 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+import io
+import os
+import re
+from typing import Union
+
+import pyrogram
+from pyrogram import raw, types, utils
+from pyrogram.file_id import FileType
+
+from .inline_session import get_session
+
+
+class EditMessageMedia:
+    async def edit_message_media(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        media: "types.InputMedia",
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        file_name: str = None,
+        schedule_date: datetime = None,
+        business_connection_id: str = None
+    ) -> "types.Message":
+        """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, the
+        message type can be changed arbitrarily.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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``):
+                Message identifier in the chat specified in chat_id.
+
+            media (:obj:`~pyrogram.types.InputMedia`):
+                One of the InputMedia objects describing an animation, audio, document, photo or video.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+            file_name (``str``, *optional*):
+                File name of the media to be sent. Not applicable to photos.
+                Defaults to file's path basename.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message to be edited was sent
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import InputMediaPhoto, InputMediaVideo, InputMediaAudio
+
+                # Replace the current media with a local photo
+                await app.edit_message_media(chat_id, message_id,
+                    InputMediaPhoto("new_photo.jpg"))
+
+                # Replace the current media with a local video
+                await app.edit_message_media(chat_id, message_id,
+                    InputMediaVideo("new_video.mp4"))
+
+                # Replace the current media with a local audio
+                await app.edit_message_media(chat_id, message_id,
+                    InputMediaAudio("new_audio.mp3"))
+        """
+        caption = media.caption
+        parse_mode = media.parse_mode
+        caption_entities = media.caption_entities
+
+        message, entities = None, None
+
+        if caption is not None:
+            message, entities = (await utils.parse_text_entities(self, caption, parse_mode, caption_entities)).values()
+
+        if isinstance(media, types.InputMediaPhoto):
+            if isinstance(media.media, io.BytesIO) or os.path.isfile(media.media):
+                uploaded_media = await self.invoke(
+                    raw.functions.messages.UploadMedia(
+                        business_connection_id=None,  # TODO
+                        peer=await self.resolve_peer(chat_id),
+                        media=raw.types.InputMediaUploadedPhoto(
+                            file=await self.save_file(media.media),
+                            spoiler=media.has_spoiler
+                        )
+                    )
+                )
+
+                media = raw.types.InputMediaPhoto(
+                    id=raw.types.InputPhoto(
+                        id=uploaded_media.photo.id,
+                        access_hash=uploaded_media.photo.access_hash,
+                        file_reference=uploaded_media.photo.file_reference
+                    ),
+                    spoiler=media.has_spoiler
+                )
+            elif re.match("^https?://", media.media):
+                media = raw.types.InputMediaPhotoExternal(
+                    url=media.media,
+                    spoiler=media.has_spoiler
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.PHOTO, has_spoiler=media.has_spoiler)
+        elif isinstance(media, types.InputMediaVideo):
+            if isinstance(media.media, io.BytesIO) or os.path.isfile(media.media):
+                uploaded_media = await self.invoke(
+                    raw.functions.messages.UploadMedia(
+                        business_connection_id=None,  # TODO
+                        peer=await self.resolve_peer(chat_id),
+                        media=raw.types.InputMediaUploadedDocument(
+                            mime_type=self.guess_mime_type(media.media) or "video/mp4",
+                            thumb=await self.save_file(media.thumb),
+                            spoiler=media.has_spoiler,
+                            file=await self.save_file(media.media),
+                            attributes=[
+                                raw.types.DocumentAttributeVideo(
+                                    supports_streaming=media.supports_streaming or None,
+                                    duration=media.duration,
+                                    w=media.width,
+                                    h=media.height
+                                ),
+                                raw.types.DocumentAttributeFilename(
+                                    file_name=file_name or os.path.basename(media.media)
+                                )
+                            ],
+                            nosound_video=not media.disable_content_type_detection,
+                            force_file=media.disable_content_type_detection or None,
+                        )
+                    )
+                )
+
+                media = raw.types.InputMediaDocument(
+                    id=raw.types.InputDocument(
+                        id=uploaded_media.document.id,
+                        access_hash=uploaded_media.document.access_hash,
+                        file_reference=uploaded_media.document.file_reference
+                    ),
+                    spoiler=media.has_spoiler
+                )
+            elif re.match("^https?://", media.media):
+                media = raw.types.InputMediaDocumentExternal(
+                    url=media.media,
+                    spoiler=media.has_spoiler
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.VIDEO)
+        elif isinstance(media, types.InputMediaAudio):
+            if isinstance(media.media, io.BytesIO) or os.path.isfile(media.media):
+                media = await self.invoke(
+                    raw.functions.messages.UploadMedia(
+                        business_connection_id=None,  # TODO
+                        peer=await self.resolve_peer(chat_id),
+                        media=raw.types.InputMediaUploadedDocument(
+                            mime_type=self.guess_mime_type(media.media) or "audio/mpeg",
+                            thumb=await self.save_file(media.thumb),
+                            file=await self.save_file(media.media),
+                            attributes=[
+                                raw.types.DocumentAttributeAudio(
+                                    duration=media.duration,
+                                    performer=media.performer,
+                                    title=media.title
+                                ),
+                                raw.types.DocumentAttributeFilename(
+                                    file_name=file_name or os.path.basename(media.media)
+                                )
+                            ]
+                        )
+                    )
+                )
+
+                media = raw.types.InputMediaDocument(
+                    id=raw.types.InputDocument(
+                        id=media.document.id,
+                        access_hash=media.document.access_hash,
+                        file_reference=media.document.file_reference
+                    )
+                )
+            elif re.match("^https?://", media.media):
+                media = raw.types.InputMediaDocumentExternal(
+                    url=media.media
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.AUDIO)
+        elif isinstance(media, types.InputMediaAnimation):
+            if isinstance(media.media, io.BytesIO) or os.path.isfile(media.media):
+                uploaded_media = await self.invoke(
+                    raw.functions.messages.UploadMedia(
+                        business_connection_id=None,  # TODO
+                        peer=await self.resolve_peer(chat_id),
+                        media=raw.types.InputMediaUploadedDocument(
+                            mime_type=self.guess_mime_type(media.media) or "video/mp4",
+                            thumb=await self.save_file(media.thumb),
+                            spoiler=media.has_spoiler,
+                            file=await self.save_file(media.media),
+                            attributes=[
+                                raw.types.DocumentAttributeVideo(
+                                    supports_streaming=True,
+                                    duration=media.duration,
+                                    w=media.width,
+                                    h=media.height
+                                ),
+                                raw.types.DocumentAttributeFilename(
+                                    file_name=file_name or os.path.basename(media.media)
+                                ),
+                                raw.types.DocumentAttributeAnimated()
+                            ]
+                        )
+                    )
+                )
+
+                media = raw.types.InputMediaDocument(
+                    id=raw.types.InputDocument(
+                        id=uploaded_media.document.id,
+                        access_hash=uploaded_media.document.access_hash,
+                        file_reference=uploaded_media.document.file_reference
+                    ),
+                    spoiler=media.has_spoiler
+                )
+            elif re.match("^https?://", media.media):
+                media = raw.types.InputMediaDocumentExternal(
+                    url=media.media,
+                    spoiler=media.has_spoiler
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.ANIMATION)
+        elif isinstance(media, types.InputMediaDocument):
+            if isinstance(media.media, io.BytesIO) or os.path.isfile(media.media):
+                media = await self.invoke(
+                    raw.functions.messages.UploadMedia(
+                        business_connection_id=None,  # TODO
+                        peer=await self.resolve_peer(chat_id),
+                        media=raw.types.InputMediaUploadedDocument(
+                            mime_type=self.guess_mime_type(media.media) or "application/zip",
+                            thumb=await self.save_file(media.thumb),
+                            file=await self.save_file(media.media),
+                            attributes=[
+                                raw.types.DocumentAttributeFilename(
+                                    file_name=file_name or os.path.basename(media.media)
+                                )
+                            ],
+                            # force_file= #TODO
+                        )
+                    )
+                )
+
+                media = raw.types.InputMediaDocument(
+                    id=raw.types.InputDocument(
+                        id=media.document.id,
+                        access_hash=media.document.access_hash,
+                        file_reference=media.document.file_reference
+                    )
+                )
+            elif re.match("^https?://", media.media):
+                media = raw.types.InputMediaDocumentExternal(
+                    url=media.media
+                )
+            else:
+                media = utils.get_input_media_from_file_id(media.media, FileType.DOCUMENT)
+
+        rpc = raw.functions.messages.EditMessage(
+            peer=await self.resolve_peer(chat_id),
+            id=message_id,
+            media=media,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            message=message,
+            entities=entities,
+            # TODO
+            schedule_date=utils.datetime_to_timestamp(schedule_date)
+        )
+        session = None
+        business_connection = None
+        if business_connection_id:
+            business_connection = self.business_user_connection_cache[business_connection_id]
+            if not business_connection:
+                business_connection = await self.get_business_connection(business_connection_id)
+            session = await get_session(
+                self,
+                business_connection._raw.connection.dc_id
+            )
+        if business_connection_id:
+            r = await session.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+            # await session.stop()
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateEditMessage,
+                    raw.types.UpdateEditChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotEditBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/edit_message_reply_markup.py b/pyrogram/methods/messages/edit_message_reply_markup.py
new file mode 100644
index 0000000000..cb4a5e53b9
--- /dev/null
+++ b/pyrogram/methods/messages/edit_message_reply_markup.py
@@ -0,0 +1,122 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+from .inline_session import get_session
+
+
+class EditMessageReplyMarkup:
+    async def edit_message_reply_markup(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        business_connection_id: str = None
+    ) -> "types.Message":
+        """Edit only the reply markup of messages sent by the bot.
+
+        .. include:: /_includes/usable-by/bots.rst
+
+        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``):
+                Message identifier in the chat specified in chat_id.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message to be edited was sent
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
+
+                # Bots only
+                await app.edit_message_reply_markup(
+                    chat_id, message_id,
+                    InlineKeyboardMarkup([[
+                        InlineKeyboardButton("New button", callback_data="new_data")]]))
+        """
+        rpc = raw.functions.messages.EditMessage(
+            peer=await self.resolve_peer(chat_id),
+            id=message_id,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+        )
+        session = None
+        business_connection = None
+        if business_connection_id:
+            business_connection = self.business_user_connection_cache[business_connection_id]
+            if not business_connection:
+                business_connection = await self.get_business_connection(business_connection_id)
+            session = await get_session(
+                self,
+                business_connection._raw.connection.dc_id
+            )
+        if business_connection_id:
+            r = await session.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+            # await session.stop()
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateEditMessage,
+                    raw.types.UpdateEditChannelMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotEditBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/edit_message_text.py b/pyrogram/methods/messages/edit_message_text.py
new file mode 100644
index 0000000000..62ad47f507
--- /dev/null
+++ b/pyrogram/methods/messages/edit_message_text.py
@@ -0,0 +1,185 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List, Optional
+
+import pyrogram
+from pyrogram import raw, enums, types, utils
+
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class EditMessageText:
+    async def edit_message_text(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        text: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        entities: List["types.MessageEntity"] = None,
+        link_preview_options: "types.LinkPreviewOptions" = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        schedule_date: datetime = None,
+        business_connection_id: str = None,
+        disable_web_page_preview: bool = None
+    ) -> "types.Message":
+        """Edit the text of messages.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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``):
+                Message identifier in the chat specified in chat_id.
+
+            text (``str``):
+                New text of the message.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in message text, which can be specified instead of *parse_mode*.
+
+            link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*):
+                Link preview generation options for the message. Ignored if the specified URL does not have a valid preview.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message to be edited was sent
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Simple edit text
+                await app.edit_message_text(chat_id, message_id, "new text")
+
+                # Take the same text message, remove the web page preview only
+                await app.edit_message_text(
+                    chat_id, message_id, message.text,
+                    link_preview_options=types.LinkPreviewOptions(
+                        is_disabled=True
+                    )
+                )
+        """
+        if disable_web_page_preview and link_preview_options:
+            raise ValueError(
+                "Parameters `disable_web_page_preview` and `link_preview_options` are mutually "
+                "exclusive."
+            )
+
+        if disable_web_page_preview is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use link_preview_options instead"
+            )
+            link_preview_options = types.LinkPreviewOptions(is_disabled=disable_web_page_preview)
+
+        link_preview_options = link_preview_options or self.link_preview_options
+
+        media = None
+        if (
+            link_preview_options and
+            link_preview_options.url
+        ):
+            media = raw.types.InputMediaWebPage(
+                url=link_preview_options.url,
+                force_large_media=link_preview_options.prefer_large_media,
+                force_small_media=link_preview_options.prefer_small_media,
+                optional=True
+            )
+
+        rpc = raw.functions.messages.EditMessage(
+            peer=await self.resolve_peer(chat_id),
+            id=message_id,
+            no_webpage=link_preview_options.is_disabled if link_preview_options else None,
+            invert_media=link_preview_options.show_above_text if link_preview_options else None,
+            media=media,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            **await utils.parse_text_entities(self, text, parse_mode, entities)
+        )
+        session = None
+        business_connection = None
+        if business_connection_id:
+            business_connection = self.business_user_connection_cache[business_connection_id]
+            if not business_connection:
+                business_connection = await self.get_business_connection(business_connection_id)
+            session = await get_session(
+                self,
+                business_connection._raw.connection.dc_id
+            )
+        if business_connection_id:
+            r = await session.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+            # await session.stop()
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateEditMessage,
+                    raw.types.UpdateEditChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotEditBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/forward_messages.py b/pyrogram/methods/messages/forward_messages.py
new file mode 100644
index 0000000000..024d61e5ed
--- /dev/null
+++ b/pyrogram/methods/messages/forward_messages.py
@@ -0,0 +1,136 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List, Iterable
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+
+
+class ForwardMessages:
+    async def forward_messages(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        from_chat_id: Union[int, str],
+        message_ids: Union[int, Iterable[int]],
+        message_thread_id: int = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        drop_author: bool = None,
+        drop_media_captions: bool = None,
+        schedule_date: datetime = None
+    ) -> Union["types.Message", List["types.Message"]]:
+        """Forward messages of any kind.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            from_chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the source chat where the original message was sent.
+                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_ids (``int`` | Iterable of ``int``):
+                An iterable of message identifiers in the chat specified in *from_chat_id* or a single message id.
+
+            message_thread_id (``int``, *optional*):
+                Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            drop_author (``bool``, *optional*):
+                Whether to forward messages without quoting the original author.
+
+            drop_media_captions (``bool``, *optional*):
+                Whether to strip captions from media.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+        Returns:
+            :obj:`~pyrogram.types.Message` | List of :obj:`~pyrogram.types.Message`: In case *message_ids* was not
+            a list, a single message is returned, otherwise a list of messages is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Forward a single message
+                await app.forward_messages(to_chat, from_chat, 123)
+
+                # Forward multiple messages at once
+                await app.forward_messages(to_chat, from_chat, [1, 2, 3])
+        """
+
+        is_iterable = not isinstance(message_ids, int)
+        message_ids = list(message_ids) if is_iterable else [message_ids]
+
+        r = await self.invoke(
+            raw.functions.messages.ForwardMessages(
+                to_peer=await self.resolve_peer(chat_id),
+                from_peer=await self.resolve_peer(from_chat_id),
+                id=message_ids,
+                silent=disable_notification or None,
+                # TODO
+                # TODO
+                drop_author=drop_author,
+                drop_media_captions=drop_media_captions,
+                noforwards=protect_content,
+                random_id=[self.rnd_id() for _ in message_ids],
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                top_msg_id=message_thread_id
+                # TODO
+            )
+        )
+
+        forwarded_messages = []
+
+        users = {i.id: i for i in r.users}
+        chats = {i.id: i for i in r.chats}
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                forwarded_messages.append(
+                    await types.Message._parse(
+                        self,
+                        i.message,
+                        users,
+                        chats,
+                        is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                        replies=self.fetch_replies
+                    )
+                )
+
+        return types.List(forwarded_messages) if is_iterable else forwarded_messages[0]
diff --git a/pyrogram/methods/messages/get_chat_history.py b/pyrogram/methods/messages/get_chat_history.py
new file mode 100644
index 0000000000..6fb8ca0e51
--- /dev/null
+++ b/pyrogram/methods/messages/get_chat_history.py
@@ -0,0 +1,176 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, Optional, AsyncGenerator
+
+import pyrogram
+from pyrogram import types, raw, utils
+
+
+async def get_chunk(
+    *,
+    client: "pyrogram.Client",
+    chat_id: Union[int, str],
+    limit: int = 0,
+    offset: int = 0,
+    min_id: int = 0,
+    max_id: int = 0,
+    from_message_id: int = 0,
+    from_date: datetime = utils.zero_datetime(),
+    reverse: bool = False,
+    is_scheduled: bool = False
+):
+    if is_scheduled:
+        r = await client.invoke(
+            raw.functions.messages.GetScheduledHistory(
+                peer=await client.resolve_peer(chat_id),
+                hash=0
+            ),
+            sleep_threshold=60
+        )
+        messages = await utils.parse_messages(
+            client,
+            r,
+            is_scheduled=True,
+            replies=0
+        )
+        if reverse:
+            messages.reverse()
+        return messages
+    else:
+        from_message_id = from_message_id or (1 if reverse else 0)
+        messages = await client.invoke(
+            raw.functions.messages.GetHistory(
+                peer=await client.resolve_peer(chat_id),
+                offset_id=from_message_id,
+                offset_date=utils.datetime_to_timestamp(from_date),
+                add_offset=offset * (-1 if reverse else 1) - (limit if reverse else 0),
+                limit=limit,
+                max_id=max_id,
+                min_id=min_id,
+                hash=0
+            ),
+            sleep_threshold=60
+        )
+        messages =await utils.parse_messages(
+            client,
+            messages,
+            is_scheduled=False,
+            replies=0
+        )
+        if reverse:
+            messages.reverse()
+        return messages
+
+
+class GetChatHistory:
+    async def get_chat_history(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        limit: int = 0,
+        offset: int = 0,
+        offset_id: int = 0,
+        min_id: int = 0,
+        max_id: int = 0,
+        offset_date: datetime = utils.zero_datetime(),
+        reverse: bool = False,
+        is_scheduled: bool = False
+    ) -> Optional[AsyncGenerator["types.Message", None]]:
+        """Get messages from a chat history.
+
+        The messages are returned in reverse chronological order.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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 messages to be retrieved.
+                By default, no limit is applied and all messages are returned.
+
+            offset (``int``, *optional*):
+                Sequential number of the first message to be returned.
+                Negative values are also accepted and become useful in case you set offset_id or offset_date.
+
+            offset_id (``int``, *optional*):
+                Identifier of the first message to be returned.
+
+            min_id (``int``, *optional*):
+                If a positive value was transferred, the method will return only messages with IDs more than min_id.
+                Defaults to 0.
+
+            max_id (``int``, *optional*):
+                If a positive value was transferred, the method will return only messages with IDs less than max_id.
+                Defaults to 0.
+
+            offset_date (:py:obj:`~datetime.datetime`, *optional*):
+                Pass a date as offset to retrieve only older messages starting from that date.
+
+            reverse (``bool``, *optional*):
+                Pass True to retrieve the messages in reversed order (from older to most recent). Defaults to False.
+
+            is_scheduled (``bool``, *optional*):
+                Whether to get scheduled messages. Defaults to False.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.Message` objects.
+
+        Example:
+            .. code-block:: python
+
+                async for message in app.get_chat_history(chat_id):
+                    print(message.text)
+        """
+        current = 0
+        total = limit or (1 << 31) - 1
+        limit = min(100, total)
+
+        while True:
+            messages = await get_chunk(
+                client=self,
+                chat_id=chat_id,
+                limit=limit,
+                offset=offset,
+                from_message_id=offset_id,
+                min_id=min_id,
+                max_id=max_id,
+                from_date=offset_date,
+                reverse=reverse,
+                is_scheduled=is_scheduled
+            )
+
+            if not messages:
+                return
+
+            offset_id = messages[-1].id + (1 if reverse else 0)
+
+            for message in messages:
+                yield message
+
+                current += 1
+
+                if current >= total:
+                    return
+
+            if is_scheduled:
+                break
diff --git a/pyrogram/methods/messages/get_chat_history_count.py b/pyrogram/methods/messages/get_chat_history_count.py
new file mode 100644
index 0000000000..78baa1a57e
--- /dev/null
+++ b/pyrogram/methods/messages/get_chat_history_count.py
@@ -0,0 +1,72 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+log = logging.getLogger(__name__)
+
+
+class GetChatHistoryCount:
+    async def get_chat_history_count(
+        self: "pyrogram.Client",
+        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.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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.
+
+        Example:
+            .. code-block:: python
+
+                await app.get_chat_history_count(chat_id)
+        """
+
+        r = await self.invoke(
+            raw.functions.messages.GetHistory(
+                peer=await 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, raw.types.messages.Messages):
+            return len(r.messages)
+        else:
+            return r.count
diff --git a/pyrogram/methods/messages/get_chat_sponsored_messages.py b/pyrogram/methods/messages/get_chat_sponsored_messages.py
new file mode 100644
index 0000000000..08eea342d7
--- /dev/null
+++ b/pyrogram/methods/messages/get_chat_sponsored_messages.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, Union, List
+
+import pyrogram
+from pyrogram import raw, types
+
+
+class GetChatSponsoredMessages:
+    async def get_chat_sponsored_messages(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+    ) -> Optional[List["types.SponsoredMessage"]]:
+        """Returns sponsored messages to be shown in a chat; for channel chats only.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+        Returns:
+            List of :obj:`~pyrogram.types.SponsoredMessage`: a list of sponsored messages is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Get a sponsored messages
+                sm = await app.get_chat_sponsored_messages(chat_id)
+                print(sm)
+
+        """
+        r = await self.invoke(
+            raw.functions.channels.GetSponsoredMessages(
+                channel=await self.resolve_peer(chat_id)
+            )
+        )
+
+        if isinstance(r, raw.types.messages.SponsoredMessagesEmpty):
+            return None
+
+        return types.List([
+            types.SponsoredMessage._parse(self, sm)
+            for sm in r.messages
+        ])
diff --git a/pyrogram/methods/messages/get_custom_emoji_stickers.py b/pyrogram/methods/messages/get_custom_emoji_stickers.py
new file mode 100644
index 0000000000..c8d7f4354b
--- /dev/null
+++ b/pyrogram/methods/messages/get_custom_emoji_stickers.py
@@ -0,0 +1,54 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+
+class GetCustomEmojiStickers:
+    async def get_custom_emoji_stickers(
+        self: "pyrogram.Client",
+        custom_emoji_ids: List[int],
+    ) -> List["types.Sticker"]:
+        """Get information about custom emoji stickers by their identifiers.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            custom_emoji_ids (List of ``int``):
+                List of custom emoji identifiers.
+                At most 200 custom emoji identifiers can be specified.
+
+        Returns:
+            List of :obj:`~pyrogram.types.Sticker`: On success, a list of sticker objects is returned.
+        """
+        result = await self.invoke(
+            raw.functions.messages.GetCustomEmojiDocuments(
+                document_id=custom_emoji_ids
+            )
+        )
+
+        stickers = []
+        for item in result:
+            attributes = {type(i): i for i in item.attributes}
+            sticker = await types.Sticker._parse(self, item, attributes)
+            stickers.append(sticker)
+
+        return types.List(stickers)
diff --git a/pyrogram/methods/messages/get_discussion_message.py b/pyrogram/methods/messages/get_discussion_message.py
new file mode 100644
index 0000000000..7d641a8d30
--- /dev/null
+++ b/pyrogram/methods/messages/get_discussion_message.py
@@ -0,0 +1,71 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetDiscussionMessage:
+    async def get_discussion_message(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+    ) -> "types.Message":
+        """Get the first discussion message of a channel post or a discussion thread in a group.
+
+        Reply to the returned message to leave a comment on the linked channel post or to continue
+        the discussion thread.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_id (``int``):
+                Message id.
+
+        Example:
+            .. code-block:: python
+
+                # Get the discussion message
+                m = await app.get_discussion_message(channel_id, message_id)
+
+                # Comment to the post by replying
+                await m.reply("comment")
+        """
+        r = await self.invoke(
+            raw.functions.messages.GetDiscussionMessage(
+                peer=await self.resolve_peer(chat_id),
+                msg_id=message_id
+            )
+        )
+
+        users = {u.id: u for u in r.users}
+        chats = {c.id: c for c in r.chats}
+
+        return await types.Message._parse(
+            self,
+            r.messages[0],
+            users,
+            chats,
+            replies=self.fetch_replies
+        )
diff --git a/pyrogram/methods/messages/get_discussion_replies.py b/pyrogram/methods/messages/get_discussion_replies.py
new file mode 100644
index 0000000000..7ea8479775
--- /dev/null
+++ b/pyrogram/methods/messages/get_discussion_replies.py
@@ -0,0 +1,92 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional, AsyncGenerator
+
+import pyrogram
+from pyrogram import types, raw
+
+
+class GetDiscussionReplies:
+    async def get_discussion_replies(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        limit: int = 0,
+    ) -> Optional[AsyncGenerator["types.Message", None]]:
+        """Get the message replies of a discussion thread.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_id (``int``):
+                Message id.
+
+            limit (``int``, *optional*):
+                Limits the number of messages to be retrieved.
+                By default, no limit is applied and all messages are returned.
+
+        Example:
+            .. code-block:: python
+
+                async for message in app.get_discussion_replies(chat_id, message_id):
+                    print(message)
+        """
+
+        current = 0
+        total = limit or (1 << 31) - 1
+        limit = min(100, total)
+
+        while True:
+            r = await self.invoke(
+                raw.functions.messages.GetReplies(
+                    peer=await self.resolve_peer(chat_id),
+                    msg_id=message_id,
+                    offset_id=0,
+                    offset_date=0,
+                    add_offset=current,
+                    limit=limit,
+                    max_id=0,
+                    min_id=0,
+                    hash=0
+                )
+            )
+
+            users = {u.id: u for u in r.users}
+            chats = {c.id: c for c in r.chats}
+            messages = r.messages
+
+            if not messages:
+                return
+
+            for message in messages:
+                yield await types.Message._parse(
+                    self,
+                    message,
+                    users,
+                    chats,
+                    replies=self.fetch_replies
+                )
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/messages/get_discussion_replies_count.py b/pyrogram/methods/messages/get_discussion_replies_count.py
new file mode 100644
index 0000000000..bbb90ac3a2
--- /dev/null
+++ b/pyrogram/methods/messages/get_discussion_replies_count.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class GetDiscussionRepliesCount:
+    async def get_discussion_replies_count(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+    ) -> int:
+        """Get the total count of replies in a discussion thread.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_id (``int``):
+                Message id.
+
+        Example:
+            .. code-block:: python
+
+                count = await app.get_discussion_replies_count(chat_id, message_id)
+        """
+
+        r = await self.invoke(
+            raw.functions.messages.GetReplies(
+                peer=await self.resolve_peer(chat_id),
+                msg_id=message_id,
+                offset_id=0,
+                offset_date=0,
+                add_offset=0,
+                limit=1,
+                max_id=0,
+                min_id=0,
+                hash=0
+            )
+        )
+
+        return r.count
diff --git a/pyrogram/methods/messages/get_media_group.py b/pyrogram/methods/messages/get_media_group.py
new file mode 100644
index 0000000000..97770d90f5
--- /dev/null
+++ b/pyrogram/methods/messages/get_media_group.py
@@ -0,0 +1,73 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, List
+
+import pyrogram
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class GetMediaGroup:
+    async def get_media_group(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int
+    ) -> List["types.Message"]:
+        """Get the media group a message belongs to.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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``):
+                The id of one of the messages that belong to the media group.
+                
+        Returns:
+            List of :obj:`~pyrogram.types.Message`: On success, a list of messages of the media group is returned.
+            
+        Raises:
+            ValueError: 
+                In case the passed message_id is negative or equal 0. 
+                In case target message doesn't belong to a media group.
+        """
+
+        if message_id <= 0:
+            raise ValueError("Passed message_id is negative or equal to zero.")
+
+        # Get messages with id from `id - 9` to `id + 10` to get all possible media group messages.
+        messages = await self.get_messages(
+            chat_id=chat_id,
+            message_ids=[msg_id for msg_id in range(message_id - 9, message_id + 10)],
+            replies=0
+        )
+
+        # There can be maximum 10 items in a media group.
+        # If/else condition to fix the problem of getting correct `media_group_id` when `message_id` is less than 10.
+        media_group_id = messages[9].media_group_id if len(messages) == 19 else messages[message_id - 1].media_group_id
+
+        if media_group_id is None:
+            raise ValueError("The message doesn't belong to a media group")
+
+        return types.List(msg for msg in messages if msg.media_group_id == media_group_id)
diff --git a/pyrogram/methods/messages/get_messages.py b/pyrogram/methods/messages/get_messages.py
new file mode 100644
index 0000000000..acfbe478bb
--- /dev/null
+++ b/pyrogram/methods/messages/get_messages.py
@@ -0,0 +1,220 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, List, Iterable
+
+import pyrogram
+from pyrogram import raw, types, utils
+from pyrogram.types.messages_and_media.message import Str
+
+log = logging.getLogger(__name__)
+
+
+# TODO: Rewrite using a flag for replied messages and have message_ids non-optional
+
+
+class GetMessages:
+    async def get_messages(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str] = None,
+        message_ids: Union[int, Iterable[int]] = None,
+        reply_to_message_ids: Union[int, Iterable[int]] = None,
+        replies: int = 1,
+        is_scheduled: bool = False,
+        link: str = None,
+    ) -> Union["types.Message", List["types.Message"]]:
+        """Get one or more messages from a chat by using message identifiers.
+
+        You can retrieve up to 200 messages at once.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        You must use exactly one of ``chat_id`` OR ``link``.
+
+        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_ids (``int`` | Iterable of ``int``, *optional*):
+                Pass a single message identifier or an iterable of message ids (as integers) to get the content of the
+                message themselves.
+
+            reply_to_message_ids (``int`` | Iterable of ``int``, *optional*):
+                Pass a single message identifier or an iterable of message ids (as integers) to get the content of
+                the previous message you replied to using this message.
+                If *message_ids* is set, this argument will be ignored.
+
+            replies (``int``, *optional*):
+                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.
+
+            is_scheduled (``bool``, *optional*):
+                Whether to get scheduled messages. Defaults to False.
+
+            link (``str``):
+                A link of the message, usually can be copied using ``Copy Link`` functionality OR obtained using :obj:`~pyrogram.raw.types.Message.link` OR  :obj:`~pyrogram.raw.functions.channels.ExportMessageLink`
+
+        Returns:
+            :obj:`~pyrogram.types.Message` | List of :obj:`~pyrogram.types.Message`: In case *message_ids* was not
+            a list, a single message is returned, otherwise a list of messages is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Get one message
+                await app.get_messages(chat_id=chat_id, message_ids=12345)
+
+                # Get more than one message (list of messages)
+                await app.get_messages(chat_id=chat_id, message_ids=[12345, 12346])
+
+                # Get message by ignoring any replied-to message
+                await app.get_messages(chat_id=chat_id, message_ids=message_id, replies=0)
+
+                # Get message with all chained replied-to messages
+                await app.get_messages(chat_id=chat_id, message_ids=message_id, replies=-1)
+
+                # Get the replied-to message of a message
+                await app.get_messages(chat_id=chat_id, reply_to_message_ids=message_id)
+
+        Raises:
+            ValueError: In case of invalid arguments.
+        """
+        if chat_id:
+            ids, ids_type = (
+                (message_ids, raw.types.InputMessageID) if message_ids
+                else (reply_to_message_ids, raw.types.InputMessageReplyTo) if reply_to_message_ids
+                else (None, None)
+            )
+
+            if ids is None:
+                raise ValueError("No argument supplied. Either pass message_ids or reply_to_message_ids")
+
+            peer = await self.resolve_peer(chat_id)
+
+            is_iterable = not isinstance(ids, int)
+            ids = list(ids) if is_iterable else [ids]
+
+            if replies < 0:
+                replies = (1 << 31) - 1
+
+            if is_scheduled:
+                rpc = raw.functions.messages.GetScheduledMessages(
+                    peer=peer,
+                    id=ids
+                )
+            else:
+                ids = [ids_type(id=i) for i in ids]
+                if isinstance(peer, raw.types.InputPeerChannel):
+                    rpc = raw.functions.channels.GetMessages(channel=peer, id=ids)
+                else:
+                    rpc = raw.functions.messages.GetMessages(id=ids)
+
+            r = await self.invoke(rpc, sleep_threshold=-1)
+
+            messages = await utils.parse_messages(
+                self,
+                r,
+                is_scheduled=is_scheduled,
+                replies=replies
+            )
+
+            return messages if is_iterable else messages[0] if messages else None
+
+        if link:
+            linkps = link.split("/")
+            raw_chat_id, message_thread_id, message_id = None, None, None
+            if (
+                len(linkps) == 7 and
+                linkps[3] == "c"
+            ):
+                # https://t.me/c/1192302355/322/487
+                raw_chat_id = utils.get_channel_id(
+                    int(linkps[4])
+                )
+                message_thread_id = int(linkps[5])
+                message_id = int(linkps[6])
+            elif len(linkps) == 6:
+                if linkps[3] == "c":
+                    # https://t.me/c/1387666944/609282
+                    raw_chat_id = utils.get_channel_id(
+                        int(linkps[4])
+                    )
+                    message_id = int(linkps[5])
+                else:
+                    # https://t.me/TheForum/322/487
+                    raw_chat_id = linkps[3]
+                    message_thread_id = int(linkps[4])
+                    message_id = int(linkps[5])
+
+            elif (
+                not self.me.is_bot and
+                len(linkps) == 5 and
+                linkps[3] == "m"
+            ):
+                r = await self.invoke(
+                    raw.functions.account.ResolveBusinessChatLink(
+                        slug=linkps[4]
+                    )
+                )
+                users = {i.id: i for i in r.users}
+                # chats = {i.id: i for i in r.chats}
+                entities = [
+                    types.MessageEntity._parse(
+                        self, entity, users
+                    )
+                    for entity in getattr(r, "entities", [])
+                ]
+                entities = types.List(
+                    filter(lambda x: x is not None, entities)
+                )
+                sender_chat = None
+                cat_id = utils.get_raw_peer_id(r.peer)
+                if isinstance(r.peer, raw.types.PeerUser):
+                    sender_chat = types.Chat._parse_user_chat(self, users[cat_id])
+                # elif isinstance(r.peer, raw.types.PeerChat):
+                #     sender_chat = types.Chat._parse_chat_chat(self, chats[cat_id])
+                # else:
+                #     sender_chat = types.Chat._parse_channel_chat(
+                #         self, chats[cat_id]
+                #     )
+                return types.Message(
+                    id=0,  # TODO modify this later with a Draft type
+                    text=Str(r.message).init(entities) or None,
+                    entities=entities or None,
+                    sender_chat=sender_chat,
+                )
+
+            elif len(linkps) == 5:
+                # https://t.me/pyrogramchat/609282
+                raw_chat_id = linkps[3]
+                if raw_chat_id == "m":
+                    raise ValueError(
+                        "Invalid ClientType used to parse this message link"
+                    )
+                message_id = int(linkps[4])
+
+            return await self.get_messages(
+                chat_id=raw_chat_id,
+                message_ids=message_id
+            )
+
+        raise ValueError("No argument supplied. Either pass link OR (chat_id, message_ids or reply_to_message_ids)")
diff --git a/pyrogram/methods/messages/inline_session.py b/pyrogram/methods/messages/inline_session.py
new file mode 100644
index 0000000000..a514f5a68c
--- /dev/null
+++ b/pyrogram/methods/messages/inline_session.py
@@ -0,0 +1,64 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram.errors import AuthBytesInvalid
+from pyrogram.session import Session
+from pyrogram.session.auth import Auth
+
+
+async def get_session(client: "pyrogram.Client", dc_id: int):
+    if dc_id == await client.storage.dc_id():
+        return client
+
+    async with client.media_sessions_lock:
+        if client.media_sessions.get(dc_id):
+            return client.media_sessions[dc_id]
+
+        session = client.media_sessions[dc_id] = Session(
+            client, dc_id,
+            await Auth(client, dc_id, await client.storage.test_mode()).create(),
+            await client.storage.test_mode(), is_media=True
+        )
+
+        await session.start()
+
+        for _ in range(3):
+            exported_auth = await client.invoke(
+                raw.functions.auth.ExportAuthorization(
+                    dc_id=dc_id
+                )
+            )
+
+            try:
+                await session.invoke(
+                    raw.functions.auth.ImportAuthorization(
+                        id=exported_auth.id,
+                        bytes=exported_auth.bytes
+                    )
+                )
+            except AuthBytesInvalid:
+                continue
+            else:
+                break
+        else:
+            await session.stop()
+            raise AuthBytesInvalid
+
+        return session
diff --git a/pyrogram/methods/messages/read_chat_history.py b/pyrogram/methods/messages/read_chat_history.py
new file mode 100644
index 0000000000..4b96273936
--- /dev/null
+++ b/pyrogram/methods/messages/read_chat_history.py
@@ -0,0 +1,73 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class ReadChatHistory:
+    async def read_chat_history(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        max_id: int = 0
+    ) -> bool:
+        """Mark a chat's message history as read.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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.
+
+        Example:
+            .. code-block:: python
+
+                # Mark the whole chat as read
+                await app.read_chat_history(chat_id)
+
+                # Mark messages as read only up to the given message id
+                await app.read_chat_history(chat_id, 12345)
+        """
+
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChannel):
+            q = raw.functions.channels.ReadHistory(
+                channel=peer,
+                max_id=max_id
+            )
+        else:
+            q = raw.functions.messages.ReadHistory(
+                peer=peer,
+                max_id=max_id
+            )
+
+        await self.invoke(q)
+
+        return True
diff --git a/pyrogram/methods/messages/retract_vote.py b/pyrogram/methods/messages/retract_vote.py
new file mode 100644
index 0000000000..c456f4d08b
--- /dev/null
+++ b/pyrogram/methods/messages/retract_vote.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class RetractVote:
+    async def retract_vote(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int
+    ) -> "types.Poll":
+        """Retract your vote in a poll.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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``):
+                Identifier of the original message with the poll.
+
+        Returns:
+            :obj:`~pyrogram.types.Poll`: On success, the poll with the retracted vote is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.retract_vote(chat_id, message_id)
+        """
+        r = await self.invoke(
+            raw.functions.messages.SendVote(
+                peer=await self.resolve_peer(chat_id),
+                msg_id=message_id,
+                options=[]
+            )
+        )
+
+        return types.Poll._parse(self, r.updates[0])
diff --git a/pyrogram/methods/messages/search_global.py b/pyrogram/methods/messages/search_global.py
new file mode 100644
index 0000000000..c171c7ced0
--- /dev/null
+++ b/pyrogram/methods/messages/search_global.py
@@ -0,0 +1,128 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 AsyncGenerator, Optional
+
+import pyrogram
+from pyrogram import raw, enums
+from pyrogram import types
+from pyrogram import utils
+
+
+class SearchGlobal:
+    async def search_global(
+        self: "pyrogram.Client",
+        query: str = "",
+        filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY,
+        limit: int = 0,
+        chat_list: int = 0,
+        only_in_channels: bool = False,
+    ) -> Optional[AsyncGenerator["types.Message", None]]:
+        """Search messages globally from all of your chats.
+
+        If you want to get the messages count only, see :meth:`~pyrogram.Client.search_global_count`.
+
+        .. note::
+
+            Due to server-side limitations, you can only get up to around ~10,000 messages and each message
+            retrieved will not have any *reply_to_message* field.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            query (``str``, *optional*):
+                Text query string.
+                Use "@" to search for mentions.
+            
+            filter (:obj:`~pyrogram.enums.MessagesFilter`, *optional*):
+                Pass a filter in order to search for specific kind of messages only.
+                Defaults to any message (no filter).
+
+            limit (``int``, *optional*):
+                Limits the number of messages to be retrieved.
+                By default, no limit is applied and all messages are returned.
+
+            chat_list (``int``, *optional*):
+                Chat list in which to search messages; Only Main (0) and Archive (1) chat lists are supported. Defaults to (0) Main chat list.
+
+            only_in_channels (``bool``, *optional*):
+                True, if should search only in joined channels.
+                Defaults to False. All available chats are searched.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.Message` objects.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import enums
+
+                # Search for "pyrogram". Get the first 50 results
+                async for message in app.search_global("pyrogram", limit=50):
+                    print(message.text)
+
+                # Search for recent photos from Global. Get the first 20 results
+                async for message in app.search_global(filter=enums.MessagesFilter.PHOTO, limit=20):
+                    print(message.photo)
+        """
+        current = 0
+        # There seems to be an hard limit of 10k, beyond which Telegram starts spitting one message at a time.
+        total = abs(limit) or (1 << 31)
+        limit = min(100, total)
+
+        offset_date = 0
+        offset_peer = raw.types.InputPeerEmpty()
+        offset_id = 0
+
+        while True:
+            messages = await utils.parse_messages(
+                self,
+                await self.invoke(
+                    raw.functions.messages.SearchGlobal(
+                        q=query,
+                        filter=filter.value(),
+                        min_date=0,
+                        max_date=0,
+                        offset_rate=offset_date,
+                        offset_peer=offset_peer,
+                        offset_id=offset_id,
+                        limit=limit,
+                        folder_id=chat_list,
+                        broadcasts_only=only_in_channels
+                    ),
+                    sleep_threshold=60
+                ),
+                replies=0
+            )
+
+            if not messages:
+                return
+
+            last = messages[-1]
+
+            offset_date = utils.datetime_to_timestamp(last.date)
+            offset_peer = await self.resolve_peer(last.chat.id)
+            offset_id = last.id
+
+            for message in messages:
+                yield message
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/messages/search_global_count.py b/pyrogram/methods/messages/search_global_count.py
new file mode 100644
index 0000000000..c0683c8648
--- /dev/null
+++ b/pyrogram/methods/messages/search_global_count.py
@@ -0,0 +1,73 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, enums
+
+
+class SearchGlobalCount:
+    async def search_global_count(
+        self: "pyrogram.Client",
+        query: str = "",
+        filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY,
+        chat_list: int = 0,
+        only_in_channels: bool = False,
+    ) -> int:
+        """Get the count of messages resulting from a global search.
+
+        If you want to get the actual messages, see :meth:`~pyrogram.Client.search_global`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            query (``str``, *optional*):
+                Text query string.
+                Use "@" to search for mentions.
+
+            filter (:obj:`~pyrogram.enums.MessagesFilter`, *optional*):
+                Pass a filter in order to search for specific kind of messages only:
+
+            chat_list (``int``, *optional*):
+                Chat list in which to search messages; Only Main (0) and Archive (1) chat lists are supported. Defaults to (0) Main chat list.
+
+            only_in_channels (``bool``, *optional*):
+                True, if should search only in joined channels.
+                Defaults to False. All available chats are searched.
+
+        Returns:
+            ``int``: On success, the messages count is returned.
+        """
+        r = await self.invoke(
+            raw.functions.messages.SearchGlobal(
+                q=query,
+                filter=filter.value(),
+                min_date=0,
+                max_date=0,
+                offset_rate=0,
+                offset_peer=raw.types.InputPeerEmpty(),
+                offset_id=0,
+                limit=1,
+                folder_id=chat_list,
+                broadcasts_only=only_in_channels
+            )
+        )
+
+        if hasattr(r, "count"):
+            return r.count
+        else:
+            return len(r.messages)
diff --git a/pyrogram/methods/messages/search_messages.py b/pyrogram/methods/messages/search_messages.py
new file mode 100644
index 0000000000..c4da6cf790
--- /dev/null
+++ b/pyrogram/methods/messages/search_messages.py
@@ -0,0 +1,197 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List, AsyncGenerator, Optional
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+
+
+# noinspection PyShadowingBuiltins
+async def get_chunk(
+    client,
+    chat_id: Union[int, str],
+    query: str = "",
+    offset: int = 0,
+    filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY,
+    limit: int = 100,
+    from_user: Union[int, str] = None,
+    message_thread_id: int = None,
+    offset_id: int = 0,
+    min_date: datetime = utils.zero_datetime(),
+    max_date: datetime = utils.zero_datetime(),
+    min_id: int = 0,
+    max_id: int = 0,
+    saved_messages_topic_id: Optional[Union[int, str]] = None
+) -> List["types.Message"]:
+    r = await client.invoke(
+        raw.functions.messages.Search(
+            peer=await client.resolve_peer(chat_id),
+            q=query,
+            filter=filter.value(),
+            min_date=utils.datetime_to_timestamp(min_date),
+            max_date= utils.datetime_to_timestamp(max_date),
+            offset_id=offset_id,
+            add_offset=offset,
+            limit=limit,
+            min_id=min_id,
+            max_id=max_id,
+            from_id=(
+                await client.resolve_peer(from_user)
+                if from_user
+                else None
+            ),
+            hash=0,
+            top_msg_id=message_thread_id,
+            saved_peer_id=await client.resolve_peer(saved_messages_topic_id) if saved_messages_topic_id else None
+            # saved_reaction:flags.3?Vector
+        ),
+        sleep_threshold=60
+    )
+
+    return await utils.parse_messages(client, r, replies=0)
+
+
+class SearchMessages:
+    # noinspection PyShadowingBuiltins
+    async def search_messages(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        query: str = "",
+        filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY,
+        from_user: Union[int, str] = None,
+        message_thread_id: int = None,
+        offset: int = 0,
+        limit: int = 0,
+        offset_id: int = 0,
+        min_date: datetime = utils.zero_datetime(),
+        max_date: datetime = utils.zero_datetime(),
+        min_id: int = 0,
+        max_id: int = 0,
+        saved_messages_topic_id: Optional[Union[int, str]] = None
+    ) -> Optional[AsyncGenerator["types.Message", None]]:
+        """Search for text and media messages inside a specific chat.
+
+        If you want to get the messages count only, see :meth:`~pyrogram.Client.search_messages_count`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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).
+
+            query (``str``, *optional*):
+                Text query string.
+                Required for text-only messages, optional for media messages (see the ``filter`` argument).
+                When passed while searching for media messages, the query will be applied to captions.
+                Defaults to "" (empty string).
+
+            filter (:obj:`~pyrogram.enums.MessagesFilter`, *optional*):
+                Pass a filter in order to search for specific kind of messages only.
+                Defaults to any message (no filter).
+
+            from_user (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the target user you want to search for messages from.
+
+            message_thread_id (``int``, *optional*):
+                Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+
+            offset (``int``, *optional*):
+                Sequential number of the first message to be returned.
+                Defaults to 0.
+
+            limit (``int``, *optional*):
+                Limits the number of messages to be retrieved.
+                By default, no limit is applied and all messages are returned.
+
+            offset_id (``int``, *optional*):
+                Identifier of the first message to be returned.
+            
+            min_date (:py:obj:`~datetime.datetime`, *optional*):
+                Pass a date as offset to retrieve only older messages starting from that date.
+            
+            max_date (:py:obj:`~datetime.datetime`, *optional*):
+                Pass a date as offset to retrieve only newer messages starting from that date.
+            
+            min_id (``int``, *optional*):
+                If a positive value was provided, the method will return only messages with IDs more than min_id.
+            
+            max_id (``int``, *optional*):
+                If a positive value was provided, the method will return only messages with IDs less than max_id.      
+
+            saved_messages_topic_id (``int`` | ``str``, *optional*):
+                If not None, only messages in the specified Saved Messages topic will be returned; pass None to return all messages, or for chats other than Saved Messages.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.Message` objects.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import enums
+
+                # Search for text messages in chat. Get the last 120 results
+                async for message in app.search_messages(chat_id, query="hello", limit=120):
+                    print(message.text)
+
+                # Search for pinned messages in chat
+                async for message in app.search_messages(chat_id, filter=enums.MessagesFilter.PINNED):
+                    print(message.text)
+
+                # Search for messages containing "hello" sent by yourself in chat
+                async for message in app.search_messages(chat, "hello", from_user="me"):
+                    print(message.text)
+        """
+
+        current = 0
+        total = abs(limit) or (1 << 31) - 1
+        limit = min(100, total)
+
+        while True:
+            messages = await get_chunk(
+                client=self,
+                chat_id=chat_id,
+                query=query,
+                offset=offset,
+                filter=filter,
+                limit=limit,
+                from_user=from_user,
+                message_thread_id=message_thread_id,
+                offset_id=offset_id,
+                min_date=min_date,
+                max_date=max_date,
+                min_id=min_id,
+                max_id=max_id,
+                saved_messages_topic_id=saved_messages_topic_id
+            )
+
+            if not messages:
+                return
+
+            offset += len(messages)
+
+            for message in messages:
+                yield message
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/messages/search_messages_count.py b/pyrogram/methods/messages/search_messages_count.py
new file mode 100644
index 0000000000..e4a19113eb
--- /dev/null
+++ b/pyrogram/methods/messages/search_messages_count.py
@@ -0,0 +1,113 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Optional, Union
+
+import pyrogram
+from pyrogram import enums, raw, utils
+
+
+class SearchMessagesCount:
+    async def search_messages_count(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        query: str = "",
+        filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY,
+        from_user: Union[int, str] = None,
+        message_thread_id: int = None,
+        min_date: datetime = utils.zero_datetime(),
+        max_date: datetime = utils.zero_datetime(),
+        min_id: int = 0,
+        max_id: int = 0,
+        saved_messages_topic_id: Optional[Union[int, str]] = None
+    ) -> int:
+        """Get the count of messages resulting from a search inside a chat.
+
+        If you want to get the actual messages, see :meth:`~pyrogram.Client.search_messages`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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).
+
+            query (``str``, *optional*):
+                Text query string.
+                Required for text-only messages, optional for media messages (see the ``filter`` argument).
+                When passed while searching for media messages, the query will be applied to captions.
+                Defaults to "" (empty string).
+
+            filter (:obj:`~pyrogram.enums.MessagesFilter`, *optional*):
+                Pass a filter in order to search for specific kind of messages only:
+
+            from_user (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the target user you want to search for messages from.
+
+            message_thread_id (``int``, *optional*):
+                Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+
+            min_date (:py:obj:`~datetime.datetime`, *optional*):
+                Pass a date as offset to retrieve only older messages starting from that date.
+            
+            max_date (:py:obj:`~datetime.datetime`, *optional*):
+                Pass a date as offset to retrieve only newer messages starting from that date.
+            
+            min_id (``int``, *optional*):
+                If a positive value was provided, the method will return only messages with IDs more than min_id.
+            
+            max_id (``int``, *optional*):
+                If a positive value was provided, the method will return only messages with IDs less than max_id.      
+
+            saved_messages_topic_id (``int`` | ``str``, *optional*):
+                If not None, only messages in the specified Saved Messages topic will be returned; pass None to return all messages, or for chats other than Saved Messages.
+
+        Returns:
+            ``int``: On success, the messages count is returned.
+
+        """
+        r = await self.invoke(
+            raw.functions.messages.Search(
+                peer=await self.resolve_peer(chat_id),
+                q=query,
+                filter=filter.value(),
+                min_date=utils.datetime_to_timestamp(min_date),
+                max_date= utils.datetime_to_timestamp(max_date),
+                offset_id=0,
+                add_offset=0,
+                limit=1,
+                min_id=min_id,
+                max_id=max_id,
+                from_id=(
+                    await self.resolve_peer(from_user)
+                    if from_user
+                    else None
+                ),
+                hash=0,
+                top_msg_id=message_thread_id,
+                saved_peer_id=await self.resolve_peer(saved_messages_topic_id) if saved_messages_topic_id else None
+                # saved_reaction:flags.3?Vector
+            )
+        )
+
+        if hasattr(r, "count"):
+            return r.count
+        else:
+            return len(r.messages)
diff --git a/pyrogram/methods/messages/search_public_messages_by_tag.py b/pyrogram/methods/messages/search_public_messages_by_tag.py
new file mode 100644
index 0000000000..b42e8fdf23
--- /dev/null
+++ b/pyrogram/methods/messages/search_public_messages_by_tag.py
@@ -0,0 +1,102 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import AsyncGenerator
+
+import pyrogram
+from pyrogram import raw, types, utils
+
+
+class SearchPublicMessagesByTag:
+    async def search_public_messages_by_tag(
+        self: "pyrogram.Client",
+        tag: str = "",
+        offset_id: int = 0,
+        offset_date: datetime = utils.zero_datetime(),
+        limit: int = 0,
+    ) -> AsyncGenerator["types.Message", None]:
+        """Searches for public channel posts containing the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by Telegram Server and can be smaller than the specified limit.
+
+        If you want to get the posts count only, see :meth:`~pyrogram.Client.count_public_messages_by_tag`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            tag (``str``, *optional*):
+                Hashtag or cashtag to search for.
+
+            offset_id (``int``, *optional*):
+                Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results.
+
+            offset_date (:py:obj:`~datetime.datetime`, *optional*):
+                Pass a date as offset to retrieve only older messages starting from that date.
+
+            limit (``int``, *optional*):
+                The maximum number of messages to be returned. 
+                By default, no limit is applied and all posts are returned.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.Message` objects.
+
+        Example:
+            .. code-block:: python
+
+                # Search for "#pyrogram". Get the first 50 results
+                async for message in app.search_public_messages_by_tag("pyrogram", limit=50):
+                    print(message.text)
+                    
+        """
+        current = 0
+        total = abs(limit) or (1 << 31)
+        limit = min(100, total)
+
+        offset_peer = raw.types.InputPeerEmpty()
+
+        while True:
+            messages = await utils.parse_messages(
+                self,
+                await self.invoke(
+                    raw.functions.channels.SearchPosts(
+                        hashtag=tag,
+                        offset_rate=utils.datetime_to_timestamp(offset_date),
+                        offset_peer=offset_peer,
+                        offset_id=offset_id,
+                        limit=limit
+                    ),
+                    sleep_threshold=60
+                ),
+                replies=0
+            )
+
+            if not messages:
+                return
+
+            last = messages[-1]
+
+            offset_date = utils.datetime_to_timestamp(last.date)
+            offset_peer = await self.resolve_peer(last.chat.id)
+            offset_id = last.id
+
+            for message in messages:
+                yield message
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/messages/send_animation.py b/pyrogram/methods/messages/send_animation.py
new file mode 100644
index 0000000000..a020d79293
--- /dev/null
+++ b/pyrogram/methods/messages/send_animation.py
@@ -0,0 +1,369 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import os
+import re
+from datetime import datetime
+from typing import Union, BinaryIO, List, Optional, Callable
+
+import pyrogram
+from pyrogram import StopTransmission, enums, raw, types, utils
+from pyrogram.errors import FilePartMissing
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendAnimation:
+    async def send_animation(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        animation: Union[str, BinaryIO],
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        unsave: bool = False,
+        has_spoiler: bool = None,
+        duration: int = 0,
+        width: int = 0,
+        height: int = 0,
+        thumb: Union[str, BinaryIO] = None,
+        file_name: str = None,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        message_effect_id: int = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        ttl_seconds: int = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> Optional["types.Message"]:
+        """Send animation files (animation or H.264/MPEG-4 AVC video without sound).
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            animation (``str`` | ``BinaryIO``):
+                Animation to send.
+                Pass a file_id as string to send an animation that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get an animation from the Internet,
+                pass a file path as string to upload a new animation that exists on your local machine, or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+
+            caption (``str``, *optional*):
+                Animation caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media.
+
+            unsave (``bool``, *optional*):
+                By default, the server will save into your own collection any new animation you send.
+                Pass True to automatically unsave the sent animation. Defaults to False.
+
+            has_spoiler (``bool``, *optional*):
+                Pass True if the animation needs to be covered with a spoiler animation.
+
+            duration (``int``, *optional*):
+                Duration of sent animation in seconds.
+
+            width (``int``, *optional*):
+                Animation width.
+
+            height (``int``, *optional*):
+                Animation height.
+
+            thumb (``str`` | ``BinaryIO``, *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 320 pixels.
+                Thumbnails can't be reused and can be only uploaded as a new file.
+
+            file_name (``str``, *optional*):
+                File name of the animation sent.
+                Defaults to file's path basename.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the animation will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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 file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:`~pyrogram.types.Message` | ``None``: On success, the sent animation message is returned, otherwise,
+            in case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is
+            returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send animation by uploading from local file
+                await app.send_animation("me", "animation.gif")
+
+                # Add caption to the animation
+                await app.send_animation("me", "animation.gif", caption="animation caption")
+
+                # Unsave the animation once is sent
+                await app.send_animation("me", "animation.gif", unsave=True)
+
+                # Keep track of the progress while uploading
+                async def progress(current, total):
+                    print(f"{current * 100 / total:.1f}%")
+
+                await app.send_animation("me", "animation.gif", progress=progress)
+
+                # Send self-destructing animation message
+                await app.send_animation("me", "animation.gif", ttl_seconds=10)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        file = None
+
+        try:
+            if isinstance(animation, str):
+                if os.path.isfile(animation):
+                    thumb = await self.save_file(thumb)
+                    file = await self.save_file(animation, progress=progress, progress_args=progress_args)
+                    media = raw.types.InputMediaUploadedDocument(
+                        mime_type=self.guess_mime_type(animation) or "video/mp4",
+                        file=file,
+                        thumb=thumb,
+                        spoiler=has_spoiler,
+                        attributes=[
+                            raw.types.DocumentAttributeVideo(
+                                supports_streaming=True,
+                                duration=duration,
+                                w=width,
+                                h=height
+                            ),
+                            raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(animation)),
+                            raw.types.DocumentAttributeAnimated()
+                        ],
+                        ttl_seconds=ttl_seconds
+                    )
+                elif re.match("^https?://", animation):
+                    media = raw.types.InputMediaDocumentExternal(
+                        url=animation,
+                        spoiler=has_spoiler,
+                        ttl_seconds=ttl_seconds
+                    )
+                else:
+                    media = utils.get_input_media_from_file_id(
+                        animation,
+                        FileType.ANIMATION,
+                        ttl_seconds=ttl_seconds
+                    )
+            else:
+                thumb = await self.save_file(thumb)
+                file = await self.save_file(animation, progress=progress, progress_args=progress_args)
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=self.guess_mime_type(file_name or animation.name) or "video/mp4",
+                    file=file,
+                    thumb=thumb,
+                    spoiler=has_spoiler,
+                    attributes=[
+                        raw.types.DocumentAttributeVideo(
+                            supports_streaming=True,
+                            duration=duration,
+                            w=width,
+                            h=height
+                        ),
+                        raw.types.DocumentAttributeFilename(file_name=file_name or animation.name),
+                        raw.types.DocumentAttributeAnimated()
+                    ],
+                    ttl_seconds=ttl_seconds
+                )
+
+            reply_to = await utils._get_reply_message_parameters(
+                self,
+                message_thread_id,
+                reply_parameters
+            )
+
+            rpc = raw.functions.messages.SendMedia(
+                peer=await self.resolve_peer(chat_id),
+                media=media,
+                silent=disable_notification or None,
+                reply_to=reply_to,
+                random_id=self.rnd_id(),
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                noforwards=protect_content,
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                effect=message_effect_id,
+                invert_media=show_caption_above_media,
+                **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+            )
+            session = None
+            business_connection = None
+            if business_connection_id:
+                business_connection = self.business_user_connection_cache[business_connection_id]
+                if not business_connection:
+                    business_connection = await self.get_business_connection(business_connection_id)
+                session = await get_session(
+                    self,
+                    business_connection._raw.connection.dc_id
+                )
+
+            while True:
+                try:
+                    if business_connection_id:
+                        r = await session.invoke(
+                            raw.functions.InvokeWithBusinessConnection(
+                                query=rpc,
+                                connection_id=business_connection_id
+                            )
+                        )
+                        # await session.stop()
+                    else:
+                        r = await self.invoke(rpc)
+                except FilePartMissing as e:
+                    await self.save_file(animation, file_id=file.id, file_part=e.value)
+                else:
+                    for i in r.updates:
+                        if isinstance(
+                            i,
+                            (
+                                raw.types.UpdateNewMessage,
+                                raw.types.UpdateNewChannelMessage,
+                                raw.types.UpdateNewScheduledMessage
+                            )
+                        ):
+                            message = await types.Message._parse(
+                                self,
+                                i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                                replies=self.fetch_replies
+                            )
+
+                            if unsave:
+                                document = message.animation or message.document
+                                document_id = utils.get_input_media_from_file_id(
+                                    document.file_id, FileType.ANIMATION
+                                ).id
+
+                                await self.invoke(
+                                    raw.functions.messages.SaveGif(
+                                        id=document_id,
+                                        unsave=True
+                                    )
+                                )
+
+                            return message
+                        elif isinstance(
+                            i,
+                            (
+                                raw.types.UpdateBotNewBusinessMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self,
+                                i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                business_connection_id=getattr(i, "connection_id", business_connection_id),
+                                raw_reply_to_message=i.reply_to_message,
+                                replies=0
+                            )
+
+
+        except StopTransmission:
+            return None
diff --git a/pyrogram/methods/messages/send_audio.py b/pyrogram/methods/messages/send_audio.py
new file mode 100644
index 0000000000..f427f01f2d
--- /dev/null
+++ b/pyrogram/methods/messages/send_audio.py
@@ -0,0 +1,318 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import os
+import re
+from datetime import datetime
+from typing import Union, BinaryIO, List, Optional, Callable
+
+import pyrogram
+from pyrogram import StopTransmission, enums, raw, types, utils
+from pyrogram.errors import FilePartMissing
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendAudio:
+    async def send_audio(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        audio: Union[str, BinaryIO],
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        duration: int = 0,
+        performer: str = None,
+        title: str = None,
+        thumb: Union[str, BinaryIO] = None,
+        file_name: str = None,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        message_effect_id: int = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> Optional["types.Message"]:
+        """Send audio files.
+
+        For sending voice messages, use the :meth:`~pyrogram.Client.send_voice` method instead.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            audio (``str`` | ``BinaryIO``):
+                Audio file to send.
+                Pass a file_id as string to send an audio file that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get an audio file from the Internet,
+                pass a file path as string to upload a new audio file that exists on your local machine, or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+
+            caption (``str``, *optional*):
+                Audio caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            duration (``int``, *optional*):
+                Duration of the audio in seconds.
+
+            performer (``str``, *optional*):
+                Performer.
+
+            title (``str``, *optional*):
+                Track name.
+
+            thumb (``str`` | ``BinaryIO``, *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 320 pixels.
+                Thumbnails can't be reused and can be only uploaded as a new file.
+
+            file_name (``str``, *optional*):
+                File name of the audio sent.
+                Defaults to file's path basename.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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 file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:`~pyrogram.types.Message` | ``None``: On success, the sent audio message is returned, otherwise, in
+            case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send audio file by uploading from file
+                await app.send_audio("me", "audio.mp3")
+
+                # Add caption to the audio
+                await app.send_audio("me", "audio.mp3", caption="audio caption")
+
+                # Set audio metadata
+                await app.send_audio(
+                    "me", "audio.mp3",
+                    title="Title", performer="Performer", duration=234)
+
+                # Keep track of the progress while uploading
+                async def progress(current, total):
+                    print(f"{current * 100 / total:.1f}%")
+
+                await app.send_audio("me", "audio.mp3", progress=progress)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        file = None
+
+        try:
+            if isinstance(audio, str):
+                if os.path.isfile(audio):
+                    mime_type = utils.fix_up_voice_audio_uri(self, audio, 1)
+                    thumb = await self.save_file(thumb)
+                    file = await self.save_file(audio, progress=progress, progress_args=progress_args)
+                    media = raw.types.InputMediaUploadedDocument(
+                        mime_type=mime_type,
+                        file=file,
+                        thumb=thumb,
+                        attributes=[
+                            raw.types.DocumentAttributeAudio(
+                                duration=duration,
+                                performer=performer,
+                                title=title
+                            ),
+                            raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(audio))
+                        ]
+                    )
+                elif re.match("^https?://", audio):
+                    media = raw.types.InputMediaDocumentExternal(
+                        url=audio
+                    )
+                else:
+                    media = utils.get_input_media_from_file_id(audio, FileType.AUDIO)
+            else:
+                mime_type = utils.fix_up_voice_audio_uri(self, file_name or audio.name, 1)
+                thumb = await self.save_file(thumb)
+                file = await self.save_file(audio, progress=progress, progress_args=progress_args)
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=mime_type,
+                    file=file,
+                    thumb=thumb,
+                    attributes=[
+                        raw.types.DocumentAttributeAudio(
+                            duration=duration,
+                            performer=performer,
+                            title=title
+                        ),
+                        raw.types.DocumentAttributeFilename(file_name=file_name or audio.name)
+                    ]
+                )
+
+            reply_to = await utils._get_reply_message_parameters(
+                self,
+                message_thread_id,
+                reply_parameters
+            )
+            rpc = raw.functions.messages.SendMedia(
+                peer=await self.resolve_peer(chat_id),
+                media=media,
+                silent=disable_notification or None,
+                reply_to=reply_to,
+                random_id=self.rnd_id(),
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                noforwards=protect_content,
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                effect=message_effect_id,
+                **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+            )
+            session = None
+            business_connection = None
+            if business_connection_id:
+                business_connection = self.business_user_connection_cache[business_connection_id]
+                if not business_connection:
+                    business_connection = await self.get_business_connection(business_connection_id)
+                session = await get_session(
+                    self,
+                    business_connection._raw.connection.dc_id
+                )
+
+            while True:
+                try:
+                    if business_connection_id:
+                        r = await session.invoke(
+                            raw.functions.InvokeWithBusinessConnection(
+                                query=rpc,
+                                connection_id=business_connection_id
+                            )
+                        )
+                        # await session.stop()
+                    else:
+                        r = await self.invoke(rpc)
+                except FilePartMissing as e:
+                    await self.save_file(audio, file_id=file.id, file_part=e.value)
+                else:
+                    for i in r.updates:
+                        if isinstance(
+                            i,
+                            (
+                                raw.types.UpdateNewMessage,
+                                raw.types.UpdateNewChannelMessage,
+                                raw.types.UpdateNewScheduledMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self, i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                                replies=self.fetch_replies
+                            )
+                        elif isinstance(
+                            i,
+                            (
+                                raw.types.UpdateBotNewBusinessMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self,
+                                i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                business_connection_id=getattr(i, "connection_id", business_connection_id),
+                                raw_reply_to_message=i.reply_to_message,
+                                replies=0
+                            )
+        except StopTransmission:
+            return None
diff --git a/pyrogram/methods/messages/send_cached_media.py b/pyrogram/methods/messages/send_cached_media.py
new file mode 100644
index 0000000000..25ab90ed4e
--- /dev/null
+++ b/pyrogram/methods/messages/send_cached_media.py
@@ -0,0 +1,197 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List, Optional
+
+import pyrogram
+from pyrogram import raw, enums, types, utils
+
+log = logging.getLogger(__name__)
+
+
+class SendCachedMedia:
+    async def send_cached_media(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        file_id: str,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        has_spoiler: bool = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> Optional["types.Message"]:
+        """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.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            file_id (``str``):
+                Media to send.
+                Pass a file_id as string to send a media that exists on the Telegram servers.
+
+            caption (``str``, *optional*):
+                Media caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+            
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            has_spoiler (``bool``, *optional*):
+                True, if the message media is covered by a spoiler animation.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent media message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.send_cached_media("me", file_id)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+        rpc = raw.functions.messages.SendMedia(
+            peer=await self.resolve_peer(chat_id),
+            media=utils.get_input_media_from_file_id(file_id, has_spoiler=has_spoiler),
+            silent=disable_notification or None,
+            reply_to=reply_to,
+            random_id=self.rnd_id(),
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            noforwards=protect_content,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            effect=message_effect_id,
+            invert_media=show_caption_above_media,
+            **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+        )
+
+        if business_connection_id:
+            r = await self.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotNewBusinessMessage,
+                    # raw.types.UpdateBotEditBusinessMessage,
+                    # raw.types.UpdateBotDeleteBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/send_chat_action.py b/pyrogram/methods/messages/send_chat_action.py
new file mode 100644
index 0000000000..925baa2e8f
--- /dev/null
+++ b/pyrogram/methods/messages/send_chat_action.py
@@ -0,0 +1,159 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 json import dumps
+from random import randint
+from typing import Union
+
+import pyrogram
+from pyrogram import raw, enums
+
+
+class SendChatAction:
+    async def send_chat_action(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        action: "enums.ChatAction",
+        progress: int = 0,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        emoji: str = None,
+        emoji_message_id: int = None,
+        emoji_message_interaction: "raw.types.DataJSON" = None
+    ) -> bool:
+        """Use this method when you need to tell the user that something is happening on the bot's side.
+        The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        We only recommend using this method when a response from the bot will take a **noticeable** amount of time to arrive.
+
+        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:`~pyrogram.enums.ChatAction`):
+                Type of action to broadcast.
+
+            progress (``int``, *optional*):
+                Upload progress, as a percentage.
+
+            message_thread_id (``int``, *optional*):
+                Unique identifier for the target message thread; for supergroups only
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the action will be sent
+
+            emoji (``str``, *optional*):
+                The animated emoji. Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION` and :obj:`~pyrogram.enums.ChatAction.WATCH_EMOJI_ANIMATION`.
+
+            emoji_message_id (``int``, *optional*):
+                Message identifier of the message containing the animated emoji. Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION`.
+
+            emoji_message_interaction (:obj:`raw.types.DataJSON`, *optional*):
+                Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION`.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Raises:
+            ValueError: In case the provided string is not a valid chat action.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import enums
+
+                # Send "typing" chat action
+                await app.send_chat_action(chat_id, enums.ChatAction.TYPING)
+
+                # Send "upload_video" chat action
+                await app.send_chat_action(chat_id, enums.ChatAction.UPLOAD_VIDEO)
+
+                # Send "playing" chat action
+                await app.send_chat_action(chat_id, enums.ChatAction.PLAYING)
+
+                # Cancel any current chat action
+                await app.send_chat_action(chat_id, enums.ChatAction.CANCEL)
+        """
+
+        action_name = action.name.lower()
+
+        if (
+            "upload" in action_name or
+            "import" in action_name
+        ):
+            action = action.value(progress=progress)
+        elif "watch_emoji" in action_name:
+            if emoji is None:
+                raise ValueError(
+                    "Invalid Argument Provided"
+                )
+            action = action.value(emoticon=emoji)
+        elif "trigger_emoji" in action_name:
+            if (
+                emoji is None or
+                emoji_message_id is None
+            ):
+                raise ValueError(
+                    "Invalid Argument Provided"
+                )
+            if emoji_message_interaction is None:
+                _, sticker_set = await self._get_raw_stickers(
+                    raw.types.InputStickerSetAnimatedEmojiAnimations()
+                )
+                emoji_message_interaction = raw.types.DataJSON(
+                    data=dumps(
+                        {
+                            "v": 1,
+                            "a":[
+                                {
+                                    "t": 0,
+                                    "i": randint(
+                                        1,
+                                        sticker_set.count
+                                    )
+                                }
+                            ]
+                        }
+                    )
+                )
+            action = action.value(
+                emoticon=emoji,
+                msg_id=emoji_message_id,
+                interaction=emoji_message_interaction
+            )
+        else:
+            action = action.value()
+
+        rpc = raw.functions.messages.SetTyping(
+            peer=await self.resolve_peer(chat_id),
+            action=action,
+            top_msg_id=message_thread_id
+        )
+        if business_connection_id:
+            return await self.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+        else:
+            return await self.invoke(rpc)
diff --git a/pyrogram/methods/messages/send_contact.py b/pyrogram/methods/messages/send_contact.py
new file mode 100644
index 0000000000..44d78889a1
--- /dev/null
+++ b/pyrogram/methods/messages/send_contact.py
@@ -0,0 +1,184 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union
+
+import pyrogram
+from pyrogram import raw, utils, types
+
+log = logging.getLogger(__name__)
+
+
+class SendContact:
+    async def send_contact(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        phone_number: str,
+        first_name: str,
+        last_name: str = None,
+        vcard: str = None,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "types.Message":
+        """Send phone contacts.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            phone_number (``str``):
+                Contact's phone number.
+
+            first_name (``str``):
+                Contact's first name.
+
+            last_name (``str``, *optional*):
+                Contact's last name.
+
+            vcard (``str``, *optional*):
+                Additional data about the contact in the form of a vCard, 0-2048 bytes
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent contact message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.send_contact("me", "+1-123-456-7890", "Name")
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+        rpc = raw.functions.messages.SendMedia(
+            peer=await self.resolve_peer(chat_id),
+            media=raw.types.InputMediaContact(
+                phone_number=phone_number,
+                first_name=first_name,
+                last_name=last_name or "",
+                vcard=vcard or ""
+            ),
+            message="",
+            silent=disable_notification or None,
+            reply_to=reply_to,
+            random_id=self.rnd_id(),
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            noforwards=protect_content,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            effect=message_effect_id
+        )
+        if business_connection_id:
+            r = await self.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotNewBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/send_dice.py b/pyrogram/methods/messages/send_dice.py
new file mode 100644
index 0000000000..963c1ffeca
--- /dev/null
+++ b/pyrogram/methods/messages/send_dice.py
@@ -0,0 +1,178 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, Optional
+
+import pyrogram
+from pyrogram import raw, utils, types
+
+log = logging.getLogger(__name__)
+
+
+class SendDice:
+    async def send_dice(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        emoji: str = "🎲",
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> Optional["types.Message"]:
+        """Send a dice with a random value from 1 to 6.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            emoji (``str``, *optional*):
+                Emoji on which the dice throw animation is based.
+                Currently, must be one of "🎲", "🎯", "🏀", "⚽", "🎳", or "🎰".
+                Dice can have values 1-6 for "🎲", "🎯" and "🎳", values 1-5 for "🏀" and "⚽", and
+                values 1-64 for "🎰".
+                Defaults to "🎲".
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent dice message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send a dice
+                await app.send_dice(chat_id)
+
+                # Send a dart
+                await app.send_dice(chat_id, "🎯")
+
+                # Send a basketball
+                await app.send_dice(chat_id, "🏀")
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+        rpc = raw.functions.messages.SendMedia(
+            peer=await self.resolve_peer(chat_id),
+            media=raw.types.InputMediaDice(emoticon=emoji),
+            silent=disable_notification or None,
+            reply_to=reply_to,
+            random_id=self.rnd_id(),
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            noforwards=protect_content,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            effect=message_effect_id,
+            message=""
+        )
+        if business_connection_id:
+            r = await self.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotNewBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/send_document.py b/pyrogram/methods/messages/send_document.py
new file mode 100644
index 0000000000..ae768ebf98
--- /dev/null
+++ b/pyrogram/methods/messages/send_document.py
@@ -0,0 +1,311 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import os
+import re
+from datetime import datetime
+from typing import Union, BinaryIO, List, Optional, Callable
+
+import pyrogram
+from pyrogram import StopTransmission, enums, raw, types, utils
+from pyrogram.errors import FilePartMissing
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendDocument:
+    async def send_document(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        document: Union[str, BinaryIO],
+        thumb: Union[str, BinaryIO] = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        file_name: str = None,
+        disable_content_type_detection: bool = True,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        message_effect_id: int = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None,
+        force_document: bool = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> Optional["types.Message"]:
+        """Send generic files.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            document (``str`` | ``BinaryIO``):
+                File to send.
+                Pass a file_id as string to send a file that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get a file from the Internet,
+                pass a file path as string to upload a new file that exists on your local machine, or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+
+            thumb (``str`` | ``BinaryIO``, *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 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 (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            file_name (``str``, *optional*):
+                File name of the document sent.
+                Defaults to file's path basename.
+
+            disable_content_type_detection (``bool``, *optional*):
+                Disables automatic server-side content type detection for files uploaded using multipart/form-data.
+                Pass True to force sending files as document. Useful for video files that need to be sent as
+                document messages instead of video messages.
+                Defaults to False.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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 file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:`~pyrogram.types.Message` | ``None``: On success, the sent document message is returned, otherwise, in
+            case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send document by uploading from local file
+                await app.send_document("me", "document.zip")
+
+                # Add caption to the document file
+                await app.send_document("me", "document.zip", caption="document caption")
+
+                # Keep track of the progress while uploading
+                async def progress(current, total):
+                    print(f"{current * 100 / total:.1f}%")
+
+                await app.send_document("me", "document.zip", progress=progress)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        if force_document and disable_content_type_detection:
+            raise ValueError(
+                "Parameters `force_document` and `disable_content_type_detection` "
+                "are mutually exclusive."
+            )
+
+        if force_document is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use disable_content_type_detection instead"
+            )
+            disable_content_type_detection = force_document
+
+        file = None
+
+        try:
+            if isinstance(document, str):
+                if os.path.isfile(document):
+                    thumb = await self.save_file(thumb)
+                    file = await self.save_file(document, progress=progress, progress_args=progress_args)
+                    media = raw.types.InputMediaUploadedDocument(
+                        mime_type=self.guess_mime_type(document) or "application/zip",
+                        file=file,
+                        force_file=disable_content_type_detection or None,
+                        thumb=thumb,
+                        attributes=[
+                            raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(document))
+                        ]
+                    )
+                elif re.match("^https?://", document):
+                    media = raw.types.InputMediaDocumentExternal(
+                        url=document
+                    )
+                else:
+                    media = utils.get_input_media_from_file_id(document, FileType.DOCUMENT)
+            else:
+                thumb = await self.save_file(thumb)
+                file = await self.save_file(document, progress=progress, progress_args=progress_args)
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=self.guess_mime_type(file_name or document.name) or "application/zip",
+                    file=file,
+                    force_file=disable_content_type_detection or None,
+                    thumb=thumb,
+                    attributes=[
+                        raw.types.DocumentAttributeFilename(file_name=file_name or document.name)
+                    ]
+                )
+
+            reply_to = await utils._get_reply_message_parameters(
+                self,
+                message_thread_id,
+                reply_parameters
+            )
+            rpc = raw.functions.messages.SendMedia(
+                peer=await self.resolve_peer(chat_id),
+                media=media,
+                silent=disable_notification or None,
+                reply_to=reply_to,
+                random_id=self.rnd_id(),
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                noforwards=protect_content,
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                effect=message_effect_id,
+                **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+            )
+            session = None
+            business_connection = None
+            if business_connection_id:
+                business_connection = self.business_user_connection_cache[business_connection_id]
+                if not business_connection:
+                    business_connection = await self.get_business_connection(business_connection_id)
+                session = await get_session(
+                    self,
+                    business_connection._raw.connection.dc_id
+                )
+
+            while True:
+                try:
+                    if business_connection_id:
+                        r = await session.invoke(
+                            raw.functions.InvokeWithBusinessConnection(
+                                query=rpc,
+                                connection_id=business_connection_id
+                            )
+                        )
+                        # await session.stop()
+                    else:
+                        r = await self.invoke(rpc)
+                except FilePartMissing as e:
+                    await self.save_file(document, file_id=file.id, file_part=e.value)
+                else:
+                    for i in r.updates:
+                        if isinstance(
+                            i,
+                            (
+                                raw.types.UpdateNewMessage,
+                                raw.types.UpdateNewChannelMessage,
+                                raw.types.UpdateNewScheduledMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self, i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                                replies=self.fetch_replies
+                            )
+                        elif isinstance(
+                            i,
+                            (
+                                raw.types.UpdateBotNewBusinessMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self,
+                                i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                business_connection_id=getattr(i, "connection_id", business_connection_id),
+                                raw_reply_to_message=i.reply_to_message,
+                                replies=0
+                            )
+
+        except StopTransmission:
+            return None
diff --git a/pyrogram/methods/messages/send_location.py b/pyrogram/methods/messages/send_location.py
new file mode 100644
index 0000000000..f03cf62d40
--- /dev/null
+++ b/pyrogram/methods/messages/send_location.py
@@ -0,0 +1,183 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class SendLocation:
+    async def send_location(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        latitude: float,
+        longitude: float,
+        horizontal_accuracy: float = None,
+        # TODO
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "types.Message":
+        """Send points on the map.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            latitude (``float``):
+                Latitude of the location.
+
+            longitude (``float``):
+                Longitude of the location.
+
+            horizontal_accuracy (``float``, *optional*):
+                The radius of uncertainty for the location, measured in meters; 0-1500.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent location message is returned.
+
+        Example:
+            .. code-block:: python
+
+                app.send_location("me", latitude, longitude)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+        rpc = raw.functions.messages.SendMedia(
+            peer=await self.resolve_peer(chat_id),
+            media=raw.types.InputMediaGeoPoint(
+                geo_point=raw.types.InputGeoPoint(
+                    lat=latitude,
+                    long=longitude,
+                    accuracy_radius=horizontal_accuracy
+                )
+            ),
+            message="",
+            silent=disable_notification or None,
+            reply_to=reply_to,
+            random_id=self.rnd_id(),
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            noforwards=protect_content,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            effect=message_effect_id
+        )
+        if business_connection_id:
+            r = await self.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotNewBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/send_media_group.py b/pyrogram/methods/messages/send_media_group.py
new file mode 100644
index 0000000000..fb5f5e9a1e
--- /dev/null
+++ b/pyrogram/methods/messages/send_media_group.py
@@ -0,0 +1,485 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import os
+import re
+from datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import raw, types, utils
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendMediaGroup:
+    # TODO: Add progress parameter
+    async def send_media_group(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        media: List[Union[
+            "types.InputMediaPhoto",
+            "types.InputMediaVideo",
+            "types.InputMediaAudio",
+            "types.InputMediaDocument"
+        ]],
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_to_message_id: int = None
+    ) -> List["types.Message"]:
+        """Send a group of photos or videos as an album.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            media (List of :obj:`~pyrogram.types.InputMediaPhoto`, :obj:`~pyrogram.types.InputMediaVideo`, :obj:`~pyrogram.types.InputMediaAudio` and :obj:`~pyrogram.types.InputMediaDocument`):
+                A list describing photos and videos to be sent, must include 2–10 items.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+        Returns:
+            List of :obj:`~pyrogram.types.Message`: On success, a list of the sent messages is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram.types import InputMediaPhoto, InputMediaVideo
+
+                await app.send_media_group(
+                    "me",
+                    [
+                        InputMediaPhoto("photo1.jpg"),
+                        InputMediaPhoto("photo2.jpg", caption="photo caption"),
+                        InputMediaVideo("video.mp4", caption="video caption")
+                    ]
+                )
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        show_caption_above_media = []
+        multi_media = []
+
+        for i in media:
+            if isinstance(i, types.InputMediaPhoto):
+                if isinstance(i.media, str):
+                    if os.path.isfile(i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                business_connection_id=business_connection_id,
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaUploadedPhoto(
+                                    file=await self.save_file(i.media),
+                                    spoiler=i.has_spoiler
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaPhoto(
+                            id=raw.types.InputPhoto(
+                                id=media.photo.id,
+                                access_hash=media.photo.access_hash,
+                                file_reference=media.photo.file_reference
+                            ),
+                            spoiler=i.has_spoiler
+                        )
+                    elif re.match("^https?://", i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                business_connection_id=business_connection_id,
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaPhotoExternal(
+                                    url=i.media,
+                                    spoiler=i.has_spoiler
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaPhoto(
+                            id=raw.types.InputPhoto(
+                                id=media.photo.id,
+                                access_hash=media.photo.access_hash,
+                                file_reference=media.photo.file_reference
+                            ),
+                            spoiler=i.has_spoiler
+                        )
+                    else:
+                        media = utils.get_input_media_from_file_id(
+                            i.media,
+                            FileType.PHOTO,
+                            has_spoiler=i.has_spoiler
+                        )
+                else:
+                    media = await self.invoke(
+                        raw.functions.messages.UploadMedia(
+                            business_connection_id=business_connection_id,
+                            peer=await self.resolve_peer(chat_id),
+                            media=raw.types.InputMediaUploadedPhoto(
+                                file=await self.save_file(i.media),
+                                spoiler=i.has_spoiler
+                            )
+                        )
+                    )
+
+                    media = raw.types.InputMediaPhoto(
+                        id=raw.types.InputPhoto(
+                            id=media.photo.id,
+                            access_hash=media.photo.access_hash,
+                            file_reference=media.photo.file_reference
+                        ),
+                        spoiler=i.has_spoiler
+                    )
+                show_caption_above_media.append(i.show_caption_above_media)
+            elif isinstance(i, types.InputMediaVideo):
+                if isinstance(i.media, str):
+                    if os.path.isfile(i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                business_connection_id=business_connection_id,
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaUploadedDocument(
+                                    file=await self.save_file(i.media),
+                                    thumb=await self.save_file(i.thumb),
+                                    nosound_video=i.disable_content_type_detection or True,
+                                    spoiler=i.has_spoiler,
+                                    mime_type=self.guess_mime_type(i.media) or "video/mp4",
+                                    attributes=[
+                                        raw.types.DocumentAttributeVideo(
+                                            supports_streaming=i.supports_streaming or None,
+                                            duration=i.duration,
+                                            w=i.width,
+                                            h=i.height
+                                        ),
+                                        raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media))
+                                    ]
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaDocument(
+                            id=raw.types.InputDocument(
+                                id=media.document.id,
+                                access_hash=media.document.access_hash,
+                                file_reference=media.document.file_reference
+                            ),
+                            spoiler=i.has_spoiler
+                        )
+                    elif re.match("^https?://", i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                business_connection_id=business_connection_id,
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaDocumentExternal(
+                                    url=i.media,
+                                    spoiler=i.has_spoiler
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaDocument(
+                            id=raw.types.InputDocument(
+                                id=media.document.id,
+                                access_hash=media.document.access_hash,
+                                file_reference=media.document.file_reference
+                            ),
+                            spoiler=i.has_spoiler
+                        )
+                    else:
+                        media = utils.get_input_media_from_file_id(i.media, FileType.VIDEO, has_spoiler=i.has_spoiler)
+                else:
+                    media = await self.invoke(
+                        raw.functions.messages.UploadMedia(
+                            business_connection_id=business_connection_id,
+                            peer=await self.resolve_peer(chat_id),
+                            media=raw.types.InputMediaUploadedDocument(
+                                file=await self.save_file(i.media),
+                                thumb=await self.save_file(i.thumb),
+                                nosound_video=i.disable_content_type_detection or True,
+                                spoiler=i.has_spoiler,
+                                mime_type=self.guess_mime_type(getattr(i.media, "name", "video.mp4")) or "video/mp4",
+                                attributes=[
+                                    raw.types.DocumentAttributeVideo(
+                                        supports_streaming=i.supports_streaming or None,
+                                        duration=i.duration,
+                                        w=i.width,
+                                        h=i.height
+                                    ),
+                                    raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "video.mp4"))
+                                ]
+                            )
+                        )
+                    )
+
+                    media = raw.types.InputMediaDocument(
+                        id=raw.types.InputDocument(
+                            id=media.document.id,
+                            access_hash=media.document.access_hash,
+                            file_reference=media.document.file_reference
+                        ),
+                        spoiler=i.has_spoiler
+                    )
+                show_caption_above_media.append(i.show_caption_above_media)
+            elif isinstance(i, types.InputMediaAudio):
+                if isinstance(i.media, str):
+                    if os.path.isfile(i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                business_connection_id=business_connection_id,
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaUploadedDocument(
+                                    mime_type=self.guess_mime_type(i.media) or "audio/mpeg",
+                                    file=await self.save_file(i.media),
+                                    thumb=await self.save_file(i.thumb),
+                                    attributes=[
+                                        raw.types.DocumentAttributeAudio(
+                                            duration=i.duration,
+                                            performer=i.performer,
+                                            title=i.title
+                                        ),
+                                        raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media))
+                                    ]
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaDocument(
+                            id=raw.types.InputDocument(
+                                id=media.document.id,
+                                access_hash=media.document.access_hash,
+                                file_reference=media.document.file_reference
+                            )
+                        )
+                    elif re.match("^https?://", i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                business_connection_id=business_connection_id,
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaDocumentExternal(
+                                    url=i.media
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaDocument(
+                            id=raw.types.InputDocument(
+                                id=media.document.id,
+                                access_hash=media.document.access_hash,
+                                file_reference=media.document.file_reference
+                            )
+                        )
+                    else:
+                        media = utils.get_input_media_from_file_id(i.media, FileType.AUDIO)
+                else:
+                    media = await self.invoke(
+                        raw.functions.messages.UploadMedia(
+                            business_connection_id=business_connection_id,
+                            peer=await self.resolve_peer(chat_id),
+                            media=raw.types.InputMediaUploadedDocument(
+                                mime_type=self.guess_mime_type(getattr(i.media, "name", "audio.mp3")) or "audio/mpeg",
+                                file=await self.save_file(i.media),
+                                thumb=await self.save_file(i.thumb),
+                                attributes=[
+                                    raw.types.DocumentAttributeAudio(
+                                        duration=i.duration,
+                                        performer=i.performer,
+                                        title=i.title
+                                    ),
+                                    raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "audio.mp3"))
+                                ]
+                            )
+                        )
+                    )
+
+                    media = raw.types.InputMediaDocument(
+                        id=raw.types.InputDocument(
+                            id=media.document.id,
+                            access_hash=media.document.access_hash,
+                            file_reference=media.document.file_reference
+                        )
+                    )
+            elif isinstance(i, types.InputMediaDocument):
+                if isinstance(i.media, str):
+                    if os.path.isfile(i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                business_connection_id=business_connection_id,
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaUploadedDocument(
+                                    mime_type=self.guess_mime_type(i.media) or "application/zip",
+                                    file=await self.save_file(i.media),
+                                    thumb=await self.save_file(i.thumb),
+                                    attributes=[
+                                        raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media))
+                                    ]
+                                    # TODO
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaDocument(
+                            id=raw.types.InputDocument(
+                                id=media.document.id,
+                                access_hash=media.document.access_hash,
+                                file_reference=media.document.file_reference
+                            )
+                        )
+                    elif re.match("^https?://", i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                business_connection_id=business_connection_id,
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaDocumentExternal(
+                                    url=i.media
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaDocument(
+                            id=raw.types.InputDocument(
+                                id=media.document.id,
+                                access_hash=media.document.access_hash,
+                                file_reference=media.document.file_reference
+                            )
+                        )
+                    else:
+                        media = utils.get_input_media_from_file_id(i.media, FileType.DOCUMENT)
+                else:
+                    media = await self.invoke(
+                        raw.functions.messages.UploadMedia(
+                            business_connection_id=business_connection_id,
+                            peer=await self.resolve_peer(chat_id),
+                            media=raw.types.InputMediaUploadedDocument(
+                                mime_type=self.guess_mime_type(
+                                    getattr(i.media, "name", "file.zip")
+                                ) or "application/zip",
+                                file=await self.save_file(i.media),
+                                thumb=await self.save_file(i.thumb),
+                                attributes=[
+                                    raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "file.zip"))
+                                ]
+                            )
+                        )
+                    )
+
+                    media = raw.types.InputMediaDocument(
+                        id=raw.types.InputDocument(
+                            id=media.document.id,
+                            access_hash=media.document.access_hash,
+                            file_reference=media.document.file_reference
+                        )
+                    )
+            else:
+                raise ValueError(f"{i.__class__.__name__} is not a supported type for send_media_group")
+
+            multi_media.append(
+                raw.types.InputSingleMedia(
+                    media=media,
+                    random_id=self.rnd_id(),
+                    **await utils.parse_text_entities(self, i.caption, i.parse_mode, i.caption_entities)
+                )
+            )
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+        rpc = raw.functions.messages.SendMultiMedia(
+            peer=await self.resolve_peer(chat_id),
+            multi_media=multi_media,
+            silent=disable_notification or None,
+            reply_to=reply_to,
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            noforwards=protect_content,
+            effect=message_effect_id,
+            invert_media=any(show_caption_above_media)
+        )
+        session = None
+        business_connection = None
+        if business_connection_id:
+            business_connection = self.business_user_connection_cache[business_connection_id]
+            if not business_connection:
+                business_connection = await self.get_business_connection(business_connection_id)
+            session = await get_session(
+                self,
+                business_connection._raw.connection.dc_id
+            )
+        if business_connection_id:
+            r = await session.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+            # await session.stop()
+        else:
+            r = await self.invoke(
+                rpc,
+                sleep_threshold=60
+            )
+
+        return await utils.parse_messages(
+            client=self,
+            messages=None,
+            business_connection_id=business_connection_id,
+            r=r
+        )
diff --git a/pyrogram/methods/messages/send_message.py b/pyrogram/methods/messages/send_message.py
new file mode 100644
index 0000000000..afeb86c132
--- /dev/null
+++ b/pyrogram/methods/messages/send_message.py
@@ -0,0 +1,366 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List, Optional
+
+import pyrogram
+from pyrogram import raw, utils, enums, types, errors
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendMessage:
+    async def send_message(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str] = None,
+        text: str = None,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        entities: List["types.MessageEntity"] = None,
+        link_preview_options: "types.LinkPreviewOptions" = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        schedule_date: datetime = None,
+        disable_web_page_preview: bool = None,
+        reply_to_message_id: int = None
+    ) -> "types.Message":
+        """Send text messages.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            text (``str``):
+                Text of the message to be sent.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in message text, which can be specified instead of *parse_mode*.
+
+            link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*):
+                Link preview generation options for the message
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent text message is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Simple example
+                await app.send_message(chat_id="me", text="Message sent with **Pyrogram**!")
+
+                # Disable web page previews
+                await app.send_message(
+                    chat_id="me", text="https://docs.pyrogram.org",
+                    link_preview_options=types.LinkPreviewOptions(
+                        is_disabled=True
+                    )
+                )
+
+                # Reply to a message using its id
+                await app.send_message(chat_id="me", text="this is a reply", reply_parameters=types.ReplyParameters(message_id=123))
+
+            .. code-block:: python
+
+                # For bots only, send messages with keyboards attached
+
+                from pyrogram.types import (
+                    ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton)
+
+                # Send a normal keyboard
+                await app.send_message(
+                    chat_id=chat_id, text="Look at that button!",
+                    reply_markup=ReplyKeyboardMarkup([["Nice!"]]))
+
+                # Send an inline keyboard
+                await app.send_message(
+                    chat_id=chat_id, text="These are inline buttons",
+                    reply_markup=InlineKeyboardMarkup(
+                        [
+                            [InlineKeyboardButton("Data", callback_data="callback_data")],
+                            [InlineKeyboardButton("Docs", url="https://docs.pyrogram.org")]
+                        ]))
+        """
+        if disable_web_page_preview and link_preview_options:
+            raise ValueError(
+                "Parameters `disable_web_page_preview` and `link_preview_options` are mutually "
+                "exclusive."
+            )
+
+        if disable_web_page_preview is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use link_preview_options instead"
+            )
+            link_preview_options = types.LinkPreviewOptions(is_disabled=disable_web_page_preview)
+
+        link_preview_options = link_preview_options or self.link_preview_options
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+        message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()
+
+        session = None
+        business_connection = None
+        if business_connection_id:
+            business_connection = self.business_user_connection_cache[business_connection_id]
+            if not business_connection:
+                business_connection = await self.get_business_connection(business_connection_id)
+            session = await get_session(
+                self,
+                business_connection._raw.connection.dc_id
+            )
+
+        if (
+            link_preview_options and
+            link_preview_options.url
+        ):
+            try:
+                rpc = raw.functions.messages.SendMedia(
+                    peer=await self.resolve_peer(chat_id),
+                    silent=disable_notification or None,
+                    reply_to=reply_to,
+                    random_id=self.rnd_id(),
+                    schedule_date=utils.datetime_to_timestamp(schedule_date),
+                    reply_markup=await reply_markup.write(self) if reply_markup else None,
+                    message=message,
+                    media=raw.types.InputMediaWebPage(
+                        url=link_preview_options.url,
+                        force_large_media=link_preview_options.prefer_large_media,
+                        force_small_media=link_preview_options.prefer_small_media,
+                        optional=True
+                    ),
+                    invert_media=link_preview_options.show_above_text,
+                    entities=entities,
+                    noforwards=protect_content,
+                    effect=message_effect_id
+                )
+                if business_connection_id:
+                    r = await session.invoke(
+                        raw.functions.InvokeWithBusinessConnection(
+                            query=rpc,
+                            connection_id=business_connection_id
+                        )
+                    )
+                    # await session.stop()
+                else:
+                    r = await self.invoke(rpc)
+            except errors.MessageEmpty:
+                if not message:
+                    raise ValueError(
+                        "Bad Request: text is empty"
+                    ) from None
+
+                xe = [
+                    raw.types.MessageEntityTextUrl(
+                        offset=0,
+                        length=1,
+                        url=link_preview_options.url
+                    )
+                ]
+                if entities:
+                    entities = xe + entities
+                else:
+                    entities = xe
+                rpc = raw.functions.messages.SendMessage(
+                    peer=await self.resolve_peer(chat_id),
+                    no_webpage=link_preview_options.is_disabled if link_preview_options else None,
+                    silent=disable_notification or None,
+                    # TODO
+                    # TODO
+                    noforwards=protect_content,
+                    # TODO
+                    invert_media=link_preview_options.show_above_text if link_preview_options else None,
+                    reply_to=reply_to,
+                    schedule_date=utils.datetime_to_timestamp(schedule_date),
+                    reply_markup=await reply_markup.write(self) if reply_markup else None,
+                    # TODO
+                    random_id=self.rnd_id(),
+                    message=message,
+                    entities=entities,
+                    # TODO
+                    effect=message_effect_id
+                )
+                if business_connection_id:
+                    r = await session.invoke(
+                        raw.functions.InvokeWithBusinessConnection(
+                            query=rpc,
+                            connection_id=business_connection_id
+                        )
+                    )
+                    # await session.stop()
+                else:
+                    r = await self.invoke(rpc)
+
+        elif message:
+            rpc = raw.functions.messages.SendMessage(
+                peer=await self.resolve_peer(chat_id),
+                no_webpage=link_preview_options.is_disabled if link_preview_options else None,
+                silent=disable_notification or None,
+                # TODO
+                # TODO
+                noforwards=protect_content,
+                # TODO
+                invert_media=link_preview_options.show_above_text if link_preview_options else None,
+                reply_to=reply_to,
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                # TODO
+                random_id=self.rnd_id(),
+                message=message,
+                entities=entities,
+                # TODO
+                effect=message_effect_id
+            )
+            if business_connection_id:
+                r = await session.invoke(
+                    raw.functions.InvokeWithBusinessConnection(
+                        query=rpc,
+                        connection_id=business_connection_id
+                    )
+                )
+                # await session.stop()
+            else:
+                r = await self.invoke(rpc)
+
+        else:
+            raise ValueError("Invalid Arguments passed")
+
+        if isinstance(r, raw.types.UpdateShortSentMessage):
+            peer = await self.resolve_peer(chat_id)
+
+            peer_id = (
+                peer.user_id
+                if isinstance(peer, raw.types.InputPeerUser)
+                else -peer.chat_id
+            )
+
+            return types.Message(
+                id=r.id,
+                outgoing=r.out,
+                date=utils.timestamp_to_datetime(r.date),
+                entities=[
+                    types.MessageEntity._parse(None, entity, {})
+                    for entity in r.entities
+                ] if r.entities else None,
+                message_auto_delete_timer_changed=types.MessageAutoDeleteTimerChanged(
+                    message_auto_delete_time=getattr(r, "ttl_period", None)
+                ),
+                # TODO: #52 fix inconsistency
+                chat=types.Chat(
+                    id=peer_id,
+                    type=enums.ChatType.PRIVATE,
+                    client=self
+                ),
+                text=message,
+                reply_markup=reply_markup,
+                client=self
+            )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotNewBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/send_paid_media.py b/pyrogram/methods/messages/send_paid_media.py
new file mode 100644
index 0000000000..1d92953b68
--- /dev/null
+++ b/pyrogram/methods/messages/send_paid_media.py
@@ -0,0 +1,274 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import re
+
+from datetime import datetime
+from typing import Union, List, Optional
+
+import pyrogram
+from pyrogram import enums, raw, types, utils
+from pyrogram.file_id import FileType
+
+
+class SendPaidMedia:
+    async def send_paid_media(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        star_count: int,
+        media: List[Union[
+            "types.InputPaidMediaPhoto",
+            "types.InputPaidMediaVideo"
+        ]],
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        schedule_date: datetime = None
+    ) -> "types.Message":
+        """Use this method to send paid media to channel chats.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier for the target chat or username of the target channel (in the format @channelusername).
+
+            star_count (``int``):
+                The number of Telegram Stars that must be paid to buy access to the media.
+
+            media (List of :obj:`~pyrogram.types.InputPaidMedia`):
+                A list describing the media to be sent; up to 10 items.
+                
+            caption (``str``, *optional*):
+                Media caption, 0-1024 characters after entities parsing.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media.            
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently. Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            schedule_date (:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent. Pass a :obj:`~datetime.datetime` object.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent message is returned.
+
+        """
+        multi_media = []
+
+        peer = await self.resolve_peer(chat_id)
+        for i in media:
+            if isinstance(i, types.InputPaidMediaPhoto):
+                if isinstance(i.media, str):
+                    if os.path.isfile(i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaUploadedPhoto(
+                                    file=await self.save_file(i.media)
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaPhoto(
+                            id=raw.types.InputPhoto(
+                                id=media.photo.id,
+                                access_hash=media.photo.access_hash,
+                                file_reference=media.photo.file_reference
+                            )
+                        )
+                    elif re.match("^https?://", i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaPhotoExternal(
+                                    url=i.media
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaPhoto(
+                            id=raw.types.InputPhoto(
+                                id=media.photo.id,
+                                access_hash=media.photo.access_hash,
+                                file_reference=media.photo.file_reference
+                            )
+                        )
+                    else:
+                        media = utils.get_input_media_from_file_id(i.media, FileType.PHOTO)
+                else:
+                    media = await self.invoke(
+                        raw.functions.messages.UploadMedia(
+                            peer=await self.resolve_peer(chat_id),
+                            media=raw.types.InputMediaUploadedPhoto(
+                                file=await self.save_file(i.media)
+                            )
+                        )
+                    )
+
+                    media = raw.types.InputMediaPhoto(
+                        id=raw.types.InputPhoto(
+                            id=media.photo.id,
+                            access_hash=media.photo.access_hash,
+                            file_reference=media.photo.file_reference
+                        )
+                    )
+            elif (
+                isinstance(i, types.InputPaidMediaVideo)
+            ):
+                if isinstance(i.media, str):
+                    if os.path.isfile(i.media):
+                        attributes = [
+                            raw.types.DocumentAttributeVideo(
+                                supports_streaming=i.supports_streaming or None,
+                                duration=i.duration,
+                                w=i.width,
+                                h=i.height
+                            ),
+                            raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media))
+                        ]
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaUploadedDocument(
+                                    file=await self.save_file(i.media),
+                                    thumb=await self.save_file(i.thumbnail),
+                                    mime_type=self.guess_mime_type(i.media) or "video/mp4",
+                                    nosound_video=True,
+                                    attributes=attributes
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaDocument(
+                            id=raw.types.InputDocument(
+                                id=media.document.id,
+                                access_hash=media.document.access_hash,
+                                file_reference=media.document.file_reference
+                            )
+                        )
+                    elif re.match("^https?://", i.media):
+                        media = await self.invoke(
+                            raw.functions.messages.UploadMedia(
+                                peer=await self.resolve_peer(chat_id),
+                                media=raw.types.InputMediaDocumentExternal(
+                                    url=i.media
+                                )
+                            )
+                        )
+
+                        media = raw.types.InputMediaDocument(
+                            id=raw.types.InputDocument(
+                                id=media.document.id,
+                                access_hash=media.document.access_hash,
+                                file_reference=media.document.file_reference
+                            )
+                        )
+                    else:
+                        media = utils.get_input_media_from_file_id(i.media, FileType.VIDEO)
+                else:
+                    media = await self.invoke(
+                        raw.functions.messages.UploadMedia(
+                            peer=await self.resolve_peer(chat_id),
+                            media=raw.types.InputMediaUploadedDocument(
+                                file=await self.save_file(i.media),
+                                thumb=await self.save_file(i.thumbnail),
+                                mime_type=self.guess_mime_type(getattr(i.media, "name", "video.mp4")) or "video/mp4",
+                                attributes=[
+                                    raw.types.DocumentAttributeVideo(
+                                        supports_streaming=i.supports_streaming or None,
+                                        duration=i.duration,
+                                        w=i.width,
+                                        h=i.height
+                                    ),
+                                    raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "video.mp4"))
+                                ]
+                            )
+                        )
+                    )
+
+                    media = raw.types.InputMediaDocument(
+                        id=raw.types.InputDocument(
+                            id=media.document.id,
+                            access_hash=media.document.access_hash,
+                            file_reference=media.document.file_reference
+                        )
+                    )
+            else:
+                raise ValueError(f"{i.__class__.__name__} is not a supported type for send_paid_media")
+            multi_media.append(media)
+        
+        rpc = raw.functions.messages.SendMedia(
+            peer=await self.resolve_peer(chat_id),
+            media=raw.types.InputMediaPaidMedia(
+                stars_amount=star_count,
+                extended_media=multi_media
+            ),
+            silent=disable_notification or None,
+            random_id=self.rnd_id(),
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            noforwards=protect_content,
+            invert_media=show_caption_above_media,
+            **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+        )
+        r = await self.invoke(rpc, sleep_threshold=60)
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
diff --git a/pyrogram/methods/messages/send_photo.py b/pyrogram/methods/messages/send_photo.py
new file mode 100644
index 0000000000..dbfcfaebc0
--- /dev/null
+++ b/pyrogram/methods/messages/send_photo.py
@@ -0,0 +1,294 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import os
+import re
+from datetime import datetime
+from typing import Union, BinaryIO, List, Optional, Callable
+
+import pyrogram
+from pyrogram import raw, enums, types, utils
+from pyrogram.errors import FilePartMissing
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendPhoto:
+    async def send_photo(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        photo: Union[str, BinaryIO],
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        has_spoiler: bool = None,
+        ttl_seconds: int = None,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        view_once: bool = None,
+        message_effect_id: int = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> Optional["types.Message"]:
+        """Send photos.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            photo (``str`` | ``BinaryIO``):
+                Photo to send.
+                Pass a file_id as string to send a photo that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get a photo from the Internet,
+                pass a file path as string to upload a new photo that exists on your local machine, or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+
+            caption (``str``, *optional*):
+                Photo caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media.
+
+            has_spoiler (``bool``, *optional*):
+                Pass True if the photo needs to be covered with a spoiler animation.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the photo will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            view_once (``bool``, *optional*):
+                Pass True if the photo should be viewable only once.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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 file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:`~pyrogram.types.Message` | ``None``: On success, the sent photo message is returned, otherwise, in
+            case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send photo by uploading from local file
+                await app.send_photo("me", "photo.jpg")
+
+                # Send photo by uploading from URL
+                await app.send_photo("me", "https://example.com/example.jpg")
+
+                # Add caption to a photo
+                await app.send_photo("me", "photo.jpg", caption="Caption")
+
+                # Send self-destructing photo
+                await app.send_photo("me", "photo.jpg", ttl_seconds=10)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        file = None
+        ttl_seconds = 0x7FFFFFFF if view_once else ttl_seconds
+
+        try:
+            if isinstance(photo, str):
+                if os.path.isfile(photo):
+                    file = await self.save_file(photo, progress=progress, progress_args=progress_args)
+                    media = raw.types.InputMediaUploadedPhoto(
+                        file=file,
+                        ttl_seconds=ttl_seconds,
+                        spoiler=has_spoiler,
+                    )
+                elif re.match("^https?://", photo):
+                    media = raw.types.InputMediaPhotoExternal(
+                        url=photo,
+                        ttl_seconds=ttl_seconds,
+                        spoiler=has_spoiler
+                    )
+                else:
+                    media = utils.get_input_media_from_file_id(
+                        photo,
+                        FileType.PHOTO,
+                        ttl_seconds=ttl_seconds,
+                        has_spoiler=has_spoiler
+                    )
+            else:
+                file = await self.save_file(photo, progress=progress, progress_args=progress_args)
+                media = raw.types.InputMediaUploadedPhoto(
+                    file=file,
+                    ttl_seconds=ttl_seconds,
+                    spoiler=has_spoiler
+                )
+
+            reply_to = await utils._get_reply_message_parameters(
+                self,
+                message_thread_id,
+                reply_parameters
+            )
+            rpc = raw.functions.messages.SendMedia(
+                peer=await self.resolve_peer(chat_id),
+                media=media,
+                silent=disable_notification or None,
+                reply_to=reply_to,
+                random_id=self.rnd_id(),
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                noforwards=protect_content,
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                effect=message_effect_id,
+                invert_media=show_caption_above_media,
+                **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+            )
+            session = None
+            business_connection = None
+            if business_connection_id:
+                business_connection = self.business_user_connection_cache[business_connection_id]
+                if not business_connection:
+                    business_connection = await self.get_business_connection(business_connection_id)
+                session = await get_session(
+                    self,
+                    business_connection._raw.connection.dc_id
+                )
+
+            while True:
+                try:
+                    if business_connection_id:
+                        r = await session.invoke(
+                            raw.functions.InvokeWithBusinessConnection(
+                                query=rpc,
+                                connection_id=business_connection_id
+                            )
+                        )
+                        # await session.stop()
+                    else:
+                        r = await self.invoke(rpc)
+                except FilePartMissing as e:
+                    await self.save_file(photo, file_id=file.id, file_part=e.value)
+                else:
+                    for i in r.updates:
+                        if isinstance(
+                            i,
+                            (
+                                raw.types.UpdateNewMessage,
+                                raw.types.UpdateNewChannelMessage,
+                                raw.types.UpdateNewScheduledMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self, i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                                replies=self.fetch_replies
+                            )
+                        elif isinstance(
+                            i,
+                            (
+                                raw.types.UpdateBotNewBusinessMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self,
+                                i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                business_connection_id=getattr(i, "connection_id", business_connection_id),
+                                raw_reply_to_message=i.reply_to_message,
+                                replies=0
+                            )
+        except pyrogram.StopTransmission:
+            return None
diff --git a/pyrogram/methods/messages/send_poll.py b/pyrogram/methods/messages/send_poll.py
new file mode 100644
index 0000000000..6ae28cc3fd
--- /dev/null
+++ b/pyrogram/methods/messages/send_poll.py
@@ -0,0 +1,272 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List
+
+import pyrogram
+from pyrogram import raw, utils, types, enums
+
+log = logging.getLogger(__name__)
+
+
+class SendPoll:
+    async def send_poll(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        question: str,
+        options: List["types.InputPollOption"],
+        question_parse_mode: "enums.ParseMode" = None,
+        question_entities: List["types.MessageEntity"] = None,
+        is_anonymous: bool = True,
+        type: "enums.PollType" = enums.PollType.REGULAR,
+        allows_multiple_answers: bool = None,
+        correct_option_id: int = None,
+        explanation: str = None,
+        explanation_parse_mode: "enums.ParseMode" = None,
+        explanation_entities: List["types.MessageEntity"] = None,
+        open_period: int = None,
+        close_date: datetime = None,
+        is_closed: bool = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        schedule_date: datetime = None,
+        message_effect_id: int = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "types.Message":
+        """Send a new poll.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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``):
+                Poll question, 1-255 characters.
+
+            options (List of :obj:`~pyrogram.types.InputPollOption`):
+                List of answer options, 2-10 answer options.
+
+            question_parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            question_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the poll question, which can be specified instead of *question_parse_mode*.
+
+            is_anonymous (``bool``, *optional*):
+                True, if the poll needs to be anonymous.
+                Defaults to True.
+
+            type (:obj:`~pyrogram.enums.PollType`, *optional*):
+                Poll type, :obj:`~pyrogram.enums.PollType.QUIZ` or :obj:`~pyrogram.enums.PollType.REGULAR`.
+                Defaults to :obj:`~pyrogram.enums.PollType.REGULAR`.
+
+            allows_multiple_answers (``bool``, *optional*):
+                True, if the poll allows multiple answers, ignored for polls in quiz mode.
+                Defaults to False.
+
+            correct_option_id (``int``, *optional*):
+                0-based identifier of the correct answer option, required for polls in quiz mode.
+
+            explanation (``str``, *optional*):
+                Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style
+                poll, 0-200 characters with at most 2 line feeds after entities parsing.
+
+            explanation_parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            explanation_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the poll explanation, which can be specified instead of
+                *explanation_parse_mode*.
+
+            open_period (``int``, *optional*):
+                Amount of time in seconds the poll will be active after creation, 5-600.
+                Can't be used together with *close_date*.
+
+            close_date (:py:obj:`~datetime.datetime`, *optional*):
+                Point in time when the poll will be automatically closed.
+                Must be at least 5 and no more than 600 seconds in the future.
+                Can't be used together with *open_period*.
+
+            is_closed (``bool``, *optional*):
+                Pass True, if the poll needs to be immediately closed.
+                This can be useful for poll preview.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent poll message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.send_poll(chat_id, "Is this a poll question?", ["Yes", "No", "Maybe"])
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        solution, solution_entities = (await utils.parse_text_entities(
+            self, explanation, explanation_parse_mode, explanation_entities
+        )).values()
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+
+        question, question_entities = (await utils.parse_text_entities(self, question, question_parse_mode, question_entities)).values()
+        if not question_entities:
+            question_entities = []
+
+        answers = []
+        for i, answer_ in enumerate(options):
+            answer, answer_entities = (await utils.parse_text_entities(self, answer_.text, answer_.text_parse_mode, answer_.text_entities)).values()
+            if not answer_entities:
+                answer_entities = []
+            answers.append(
+                raw.types.PollAnswer(
+                    text=raw.types.TextWithEntities(
+                        text=answer,
+                        entities=answer_entities
+                    ),
+                    option=bytes([i])
+                )
+            )
+
+        rpc = raw.functions.messages.SendMedia(
+            peer=await self.resolve_peer(chat_id),
+            media=raw.types.InputMediaPoll(
+                poll=raw.types.Poll(
+                    id=self.rnd_id(),
+                    question=raw.types.TextWithEntities(
+                        text=question,
+                        entities=question_entities
+                    ),
+                    answers=answers,
+                    closed=is_closed,
+                    public_voters=not is_anonymous,
+                    multiple_choice=allows_multiple_answers,
+                    quiz=type == enums.PollType.QUIZ or False,
+                    close_period=open_period,
+                    close_date=utils.datetime_to_timestamp(close_date)
+                ),
+                correct_answers=[bytes([correct_option_id])] if correct_option_id is not None else None,
+                solution=solution,
+                solution_entities=solution_entities or []
+            ),
+            message="",
+            silent=disable_notification,
+            reply_to=reply_to,
+            random_id=self.rnd_id(),
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            noforwards=protect_content,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            effect=message_effect_id
+        )
+        if business_connection_id:
+            r = await self.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotNewBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/send_sticker.py b/pyrogram/methods/messages/send_sticker.py
new file mode 100644
index 0000000000..b26aba79bb
--- /dev/null
+++ b/pyrogram/methods/messages/send_sticker.py
@@ -0,0 +1,276 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import os
+import re
+from datetime import datetime
+from typing import List, Union, BinaryIO, Optional, Callable
+
+import pyrogram
+from pyrogram import StopTransmission, raw, types, utils
+from pyrogram.errors import FilePartMissing
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendSticker:
+    async def send_sticker(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        sticker: Union[str, BinaryIO],
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        # emoji: str = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None,
+        schedule_date: datetime = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> Optional["types.Message"]:
+        """Send static .webp or animated .tgs stickers.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            sticker (``str`` | ``BinaryIO``):
+                Sticker to send.
+                Pass a file_id as string to send a sticker that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get a .webp sticker file from the Internet,
+                pass a file path as string to upload a new sticker that exists on your local machine, or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+
+            caption (``str``, *optional*):
+                Photo caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            emoji (``str``, *optional*):  // UNUSED CURRENTLY
+                Emoji associated with the sticker; only for just uploaded stickers
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:`~pyrogram.types.Message` | ``None``: On success, the sent sticker message is returned, otherwise,
+            in case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is
+            returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send sticker by uploading from local file
+                await app.send_sticker("me", "sticker.webp")
+
+                # Send sticker using file_id
+                await app.send_sticker("me", file_id)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        file = None
+
+        try:
+            if isinstance(sticker, str):
+                if os.path.isfile(sticker):
+                    file = await self.save_file(sticker, progress=progress, progress_args=progress_args)
+                    media = raw.types.InputMediaUploadedDocument(
+                        mime_type=self.guess_mime_type(sticker) or "image/webp",
+                        file=file,
+                        attributes=[
+                            raw.types.DocumentAttributeFilename(file_name=os.path.basename(sticker)),
+                        ]
+                    )
+                elif re.match("^https?://", sticker):
+                    media = raw.types.InputMediaDocumentExternal(
+                        url=sticker
+                    )
+                else:
+                    media = utils.get_input_media_from_file_id(sticker, FileType.STICKER)
+            else:
+                file = await self.save_file(sticker, progress=progress, progress_args=progress_args)
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=self.guess_mime_type(sticker.name) or "image/webp",
+                    file=file,
+                    attributes=[
+                        raw.types.DocumentAttributeFilename(file_name=sticker.name),
+                    ]
+                )
+
+            reply_to = await utils._get_reply_message_parameters(
+                self,
+                message_thread_id,
+                reply_parameters
+            )
+            rpc = raw.functions.messages.SendMedia(
+                silent=disable_notification or None,
+                
+
+                noforwards=protect_content,
+
+
+                peer=await self.resolve_peer(chat_id),
+                reply_to=reply_to,
+                media=media,
+                random_id=self.rnd_id(),
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+
+
+                effect=message_effect_id,
+                **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+            )
+            session = None
+            business_connection = None
+            if business_connection_id:
+                business_connection = self.business_user_connection_cache[business_connection_id]
+                if not business_connection:
+                    business_connection = await self.get_business_connection(business_connection_id)
+                session = await get_session(
+                    self,
+                    business_connection._raw.connection.dc_id
+                )
+
+            while True:
+                try:
+                    if business_connection_id:
+                        r = await session.invoke(
+                            raw.functions.InvokeWithBusinessConnection(
+                                query=rpc,
+                                connection_id=business_connection_id
+                            )
+                        )
+                        # await session.stop()
+                    else:
+                        r = await self.invoke(rpc)
+                except FilePartMissing as e:
+                    await self.save_file(sticker, file_id=file.id, file_part=e.value)
+                else:
+                    for i in r.updates:
+                        if isinstance(
+                            i,
+                            (
+                                raw.types.UpdateNewMessage,
+                                raw.types.UpdateNewChannelMessage,
+                                raw.types.UpdateNewScheduledMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self, i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                                replies=self.fetch_replies
+                            )
+                        elif isinstance(
+                            i,
+                            (
+                                raw.types.UpdateBotNewBusinessMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self,
+                                i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                business_connection_id=getattr(i, "connection_id", business_connection_id),
+                                raw_reply_to_message=i.reply_to_message,
+                                replies=0
+                            )
+        except StopTransmission:
+            return None
diff --git a/pyrogram/methods/messages/send_venue.py b/pyrogram/methods/messages/send_venue.py
new file mode 100644
index 0000000000..61501fe544
--- /dev/null
+++ b/pyrogram/methods/messages/send_venue.py
@@ -0,0 +1,203 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union
+
+import pyrogram
+from pyrogram import raw, utils, types
+
+log = logging.getLogger(__name__)
+
+
+class SendVenue:
+    async def send_venue(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        latitude: float,
+        longitude: float,
+        title: str,
+        address: str,
+        foursquare_id: str = "",
+        foursquare_type: str = "",
+        google_place_id: str = "",
+        google_place_type: str = "",
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "types.Message":
+        """Send information about a venue.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            latitude (``float``):
+                Latitude of the venue.
+
+            longitude (``float``):
+                Longitude of the venue.
+
+            title (``str``):
+                Name of the venue.
+
+            address (``str``):
+                Address of the venue.
+
+            foursquare_id (``str``, *optional*):
+                Foursquare identifier of the venue.
+
+            foursquare_type (``str``, *optional*):
+                Foursquare type of the venue, if known.
+                (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent venue message is returned.
+
+        Example:
+            .. code-block:: python
+
+                app.send_venue(
+                    "me", latitude, longitude,
+                    "Venue title", "Venue address")
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        reply_to = await utils._get_reply_message_parameters(
+            self,
+            message_thread_id,
+            reply_parameters
+        )
+
+        rpc = raw.functions.messages.SendMedia(
+            peer=await self.resolve_peer(chat_id),
+            media=raw.types.InputMediaVenue(
+                geo_point=raw.types.InputGeoPoint(
+                    lat=latitude,
+                    long=longitude
+                ),
+                title=title,
+                address=address,
+                provider="", # TODO
+                venue_id=foursquare_id,
+                venue_type=foursquare_type
+            ),
+            message="",
+            silent=disable_notification or None,
+            reply_to=reply_to,
+            random_id=self.rnd_id(),
+            schedule_date=utils.datetime_to_timestamp(schedule_date),
+            noforwards=protect_content,
+            reply_markup=await reply_markup.write(self) if reply_markup else None,
+            effect=message_effect_id
+        )
+        if business_connection_id:
+            r = await self.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+        else:
+            r = await self.invoke(rpc)
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self, i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                    replies=self.fetch_replies
+                )
+            elif isinstance(
+                i,
+                (
+                    raw.types.UpdateBotNewBusinessMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    business_connection_id=getattr(i, "connection_id", business_connection_id),
+                    raw_reply_to_message=i.reply_to_message,
+                    replies=0
+                )
diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py
new file mode 100644
index 0000000000..6e588ac643
--- /dev/null
+++ b/pyrogram/methods/messages/send_video.py
@@ -0,0 +1,354 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import os
+import re
+from datetime import datetime
+from typing import Union, BinaryIO, List, Optional, Callable
+
+import pyrogram
+from pyrogram import StopTransmission, enums, raw, types, utils
+from pyrogram.errors import FilePartMissing
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendVideo:
+    async def send_video(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        video: Union[str, BinaryIO],
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        duration: int = 0,
+        width: int = 0,
+        height: int = 0,
+        thumb: Union[str, BinaryIO] = None,
+        has_spoiler: bool = None,
+        supports_streaming: bool = True,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        ttl_seconds: int = None,
+        view_once: bool = None,
+        file_name: str = None,
+        schedule_date: datetime = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> Optional["types.Message"]:
+        """Send video files.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            video (``str`` | ``BinaryIO``):
+                Video to send.
+                Pass a file_id as string to send a video that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get a video from the Internet,
+                pass a file path as string to upload a new video that exists on your local machine, or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+
+            caption (``str``, *optional*):
+                Video caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media.
+
+            duration (``int``, *optional*):
+                Duration of sent video in seconds.
+
+            width (``int``, *optional*):
+                Video width.
+
+            height (``int``, *optional*):
+                Video height.
+
+            thumb (``str`` | ``BinaryIO``, *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 320 pixels.
+                Thumbnails can't be reused and can be only uploaded as a new file.
+
+            has_spoiler (``bool``, *optional*):
+                Pass True if the video needs to be covered with a spoiler animation.
+
+            supports_streaming (``bool``, *optional*):
+                Pass True, if the uploaded video is suitable for streaming.
+                Defaults to True.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the video will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            view_once (``bool``, *optional*):
+                Pass True if the photo should be viewable only once.
+
+            file_name (``str``, *optional*):
+                File name of the video sent.
+                Defaults to file's path basename.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:`~pyrogram.types.Message` | ``None``: On success, the sent video message is returned, otherwise, in
+            case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send video by uploading from local file
+                await app.send_video("me", "video.mp4")
+
+                # Add caption to the video
+                await app.send_video("me", "video.mp4", caption="video caption")
+
+                # Send self-destructing video
+                await app.send_video("me", "video.mp4", ttl_seconds=10)
+
+                # Send view-once video
+                await app.send_video("me", "video.mp4", view_once=True)
+
+                # Keep track of the progress while uploading
+                async def progress(current, total):
+                    print(f"{current * 100 / total:.1f}%")
+
+                await app.send_video("me", "video.mp4", progress=progress)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        file = None
+        ttl_seconds = 0x7FFFFFFF if view_once else ttl_seconds
+
+        try:
+            if isinstance(video, str):
+                if os.path.isfile(video):
+                    thumb = await self.save_file(thumb)
+                    file = await self.save_file(video, progress=progress, progress_args=progress_args)
+                    media = raw.types.InputMediaUploadedDocument(
+                        mime_type=self.guess_mime_type(video) or "video/mp4",
+                        file=file,
+                        ttl_seconds=ttl_seconds,
+                        nosound_video=True,
+                        spoiler=has_spoiler,
+                        thumb=thumb,
+                        attributes=[
+                            raw.types.DocumentAttributeVideo(
+                                supports_streaming=supports_streaming or None,
+                                duration=duration,
+                                w=width,
+                                h=height
+                            ),
+                            raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(video))
+                        ]
+                    )
+                elif re.match("^https?://", video):
+                    media = raw.types.InputMediaDocumentExternal(
+                        url=video,
+                        ttl_seconds=ttl_seconds,
+                        spoiler=has_spoiler
+                    )
+                else:
+                    media = utils.get_input_media_from_file_id(
+                        video,
+                        FileType.VIDEO,
+                        ttl_seconds=ttl_seconds,
+                        has_spoiler=has_spoiler
+                    )
+            else:
+                thumb = await self.save_file(thumb)
+                file = await self.save_file(video, progress=progress, progress_args=progress_args)
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=self.guess_mime_type(file_name or video.name) or "video/mp4",
+                    file=file,
+                    ttl_seconds=ttl_seconds,
+                    spoiler=has_spoiler,
+                    thumb=thumb,
+                    attributes=[
+                        raw.types.DocumentAttributeVideo(
+                            supports_streaming=supports_streaming or None,
+                            duration=duration,
+                            w=width,
+                            h=height
+                        ),
+                        raw.types.DocumentAttributeFilename(file_name=file_name or video.name)
+                    ]
+                )
+
+            reply_to = await utils._get_reply_message_parameters(
+                self,
+                message_thread_id,
+                reply_parameters
+            )
+            rpc = raw.functions.messages.SendMedia(
+                peer=await self.resolve_peer(chat_id),
+                media=media,
+                silent=disable_notification or None,
+                reply_to=reply_to,
+                random_id=self.rnd_id(),
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                noforwards=protect_content,
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                effect=message_effect_id,
+                invert_media=show_caption_above_media,
+                **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+            )
+            session = None
+            business_connection = None
+            if business_connection_id:
+                business_connection = self.business_user_connection_cache[business_connection_id]
+                if not business_connection:
+                    business_connection = await self.get_business_connection(business_connection_id)
+                session = await get_session(
+                    self,
+                    business_connection._raw.connection.dc_id
+                )
+
+            while True:
+                try:
+                    if business_connection_id:
+                        r = await session.invoke(
+                            raw.functions.InvokeWithBusinessConnection(
+                                query=rpc,
+                                connection_id=business_connection_id
+                            )
+                        )
+                        # await session.stop()
+                    else:
+                        r = await self.invoke(rpc)
+                except FilePartMissing as e:
+                    await self.save_file(video, file_id=file.id, file_part=e.value)
+                else:
+                    for i in r.updates:
+                        if isinstance(
+                            i,
+                            (
+                                raw.types.UpdateNewMessage,
+                                raw.types.UpdateNewChannelMessage,
+                                raw.types.UpdateNewScheduledMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self, i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                                replies=self.fetch_replies
+                            )
+                        elif isinstance(
+                            i,
+                            (
+                                raw.types.UpdateBotNewBusinessMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self,
+                                i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                business_connection_id=getattr(i, "connection_id", business_connection_id),
+                                raw_reply_to_message=i.reply_to_message,
+                                replies=0
+                            )
+        except StopTransmission:
+            return None
diff --git a/pyrogram/methods/messages/send_video_note.py b/pyrogram/methods/messages/send_video_note.py
new file mode 100644
index 0000000000..a9dba1fd66
--- /dev/null
+++ b/pyrogram/methods/messages/send_video_note.py
@@ -0,0 +1,313 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import os
+from datetime import datetime
+from typing import List, Union, BinaryIO, Optional, Callable
+
+import pyrogram
+from pyrogram import StopTransmission, raw, types, utils
+from pyrogram.errors import FilePartMissing
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendVideoNote:
+    async def send_video_note(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        video_note: Union[str, BinaryIO],
+        duration: int = 0,
+        length: int = 1,
+        thumb: Union[str, BinaryIO] = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        schedule_date: datetime = None,
+        ttl_seconds: int = None,
+        view_once: bool = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> Optional["types.Message"]:
+        """Send video messages.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            video_note (``str`` | ``BinaryIO``):
+                Video note to send.
+                Pass a file_id as string to send a video note that exists on the Telegram servers,
+                pass a file path as string to upload a new video note that exists on your local machine, or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+                Sending video notes by a URL is currently unsupported.
+
+            duration (``int``, *optional*):
+                Duration of sent video in seconds.
+
+            length (``int``, *optional*):
+                Video width and height.
+
+            thumb (``str`` | ``BinaryIO``, *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 320 pixels.
+                Thumbnails can't be reused and can be only uploaded as a new file.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            caption (``str``, *optional*):
+                Video caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the video note will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            view_once (``bool``, *optional*):
+                Pass True if the photo should be viewable only once.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:`~pyrogram.types.Message` | ``None``: On success, the sent video note message is returned, otherwise,
+            in case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is
+            returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send video note by uploading from local file
+                await app.send_video_note("me", "video_note.mp4")
+
+                # Set video note length
+                await app.send_video_note("me", "video_note.mp4", length=25)
+
+                # Send self-destructing video note message
+                await app.send_video_note("me", "video_note.mp4", ttl_seconds=10)
+
+                # Send view-once video note message
+                await app.send_video_note("me", "video_note.mp4", view_once=True)
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        file = None
+        ttl_seconds = 0x7FFFFFFF if view_once else ttl_seconds
+
+        try:
+            if isinstance(video_note, str):
+                if os.path.isfile(video_note):
+                    thumb = await self.save_file(thumb)
+                    file = await self.save_file(video_note, progress=progress, progress_args=progress_args)
+                    media = raw.types.InputMediaUploadedDocument(
+                        mime_type=self.guess_mime_type(video_note) or "video/mp4",
+                        file=file,
+                        thumb=thumb,
+                        attributes=[
+                            raw.types.DocumentAttributeVideo(
+                                round_message=True,
+                                duration=duration,
+                                w=length,
+                                h=length
+                            )
+                        ],
+                        ttl_seconds=ttl_seconds
+                    )
+                else:
+                    media = utils.get_input_media_from_file_id(
+                        video_note,
+                        FileType.VIDEO_NOTE,
+                        ttl_seconds=ttl_seconds
+                    )
+            else:
+                thumb = await self.save_file(thumb)
+                file = await self.save_file(video_note, progress=progress, progress_args=progress_args)
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=self.guess_mime_type(video_note.name) or "video/mp4",
+                    file=file,
+                    thumb=thumb,
+                    attributes=[
+                        raw.types.DocumentAttributeVideo(
+                            round_message=True,
+                            duration=duration,
+                            w=length,
+                            h=length
+                        )
+                    ],
+                    ttl_seconds=ttl_seconds
+                )
+
+            reply_to = await utils._get_reply_message_parameters(
+                self,
+                message_thread_id,
+                reply_parameters
+            )
+            rpc = raw.functions.messages.SendMedia(
+                peer=await self.resolve_peer(chat_id),
+                media=media,
+                silent=disable_notification or None,
+                reply_to=reply_to,
+                random_id=self.rnd_id(),
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                noforwards=protect_content,
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                effect=message_effect_id,
+                **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+            )
+            session = None
+            business_connection = None
+            if business_connection_id:
+                business_connection = self.business_user_connection_cache[business_connection_id]
+                if not business_connection:
+                    business_connection = await self.get_business_connection(business_connection_id)
+                session = await get_session(
+                    self,
+                    business_connection._raw.connection.dc_id
+                )
+
+            while True:
+                try:
+                    if business_connection_id:
+                        r = await session.invoke(
+                            raw.functions.InvokeWithBusinessConnection(
+                                query=rpc,
+                                connection_id=business_connection_id
+                            )
+                        )
+                        # await session.stop()
+                    else:
+                        r = await self.invoke(rpc)
+                except FilePartMissing as e:
+                    await self.save_file(video_note, file_id=file.id, file_part=e.value)
+                else:
+                    for i in r.updates:
+                        if isinstance(
+                            i,
+                            (
+                                raw.types.UpdateNewMessage,
+                                raw.types.UpdateNewChannelMessage,
+                                raw.types.UpdateNewScheduledMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self, i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                                replies=self.fetch_replies
+                            )
+                        elif isinstance(
+                            i,
+                            (
+                                raw.types.UpdateBotNewBusinessMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self,
+                                i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                business_connection_id=getattr(i, "connection_id", business_connection_id),
+                                raw_reply_to_message=i.reply_to_message,
+                                replies=0
+                            )
+        except StopTransmission:
+            return None
diff --git a/pyrogram/methods/messages/send_voice.py b/pyrogram/methods/messages/send_voice.py
new file mode 100644
index 0000000000..c5c7b5de98
--- /dev/null
+++ b/pyrogram/methods/messages/send_voice.py
@@ -0,0 +1,308 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+import os
+import re
+from datetime import datetime
+from typing import Union, BinaryIO, List, Optional, Callable
+
+import pyrogram
+from pyrogram import StopTransmission, enums, raw, types, utils
+from pyrogram.errors import FilePartMissing
+from pyrogram.file_id import FileType
+from .inline_session import get_session
+
+log = logging.getLogger(__name__)
+
+
+class SendVoice:
+    async def send_voice(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        voice: Union[str, BinaryIO],
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        duration: int = 0,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_thread_id: int = None,
+        business_connection_id: str = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        schedule_date: datetime = None,
+        ttl_seconds: int = None,
+        view_once: bool = None,
+        waveform: bytes = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> Optional["types.Message"]:
+        """Send audio files.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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).
+
+            voice (``str`` | ``BinaryIO``):
+                Audio file to send.
+                Pass a file_id as string to send an audio that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get an audio from the Internet,
+                pass a file path as string to upload a new audio that exists on your local machine, or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+
+            caption (``str``, *optional*):
+                Voice message caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            duration (``int``, *optional*):
+                Duration of the voice message in seconds.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the voice message will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            view_once (``bool``, *optional*):
+                Pass True if the photo should be viewable only once.
+
+            waveform (``bytes``, *optional*):
+                no docs!
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:`~pyrogram.types.Message` | ``None``: On success, the sent voice message is returned, otherwise, in
+            case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send voice note by uploading from local file
+                await app.send_voice("me", "voice.ogg")
+
+                # Add caption to the voice note
+                await app.send_voice("me", "voice.ogg", caption="voice caption")
+
+                # Set voice note duration
+                await app.send_voice("me", "voice.ogg", duration=20)
+
+                # Send self-destructing voice message
+                await app.send_voice("me", "voice.ogg", ttl_seconds=10)
+
+        """
+
+        if reply_to_message_id and reply_parameters:
+            raise ValueError(
+                "Parameters `reply_to_message_id` and `reply_parameters` are mutually "
+                "exclusive."
+            )
+        
+        if reply_to_message_id is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use reply_parameters instead"
+            )
+            reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)
+
+        file = None
+        ttl_seconds = 0x7FFFFFFF if view_once else ttl_seconds
+
+        try:
+            if isinstance(voice, str):
+                if os.path.isfile(voice):
+                    mime_type = utils.fix_up_voice_audio_uri(self, voice, 2)
+                    file = await self.save_file(voice, progress=progress, progress_args=progress_args)
+                    media = raw.types.InputMediaUploadedDocument(
+                        mime_type=mime_type,
+                        file=file,
+                        attributes=[
+                            raw.types.DocumentAttributeAudio(
+                                voice=True,
+                                duration=duration,
+                                waveform=waveform
+                            )
+                        ],
+                        ttl_seconds=ttl_seconds
+                    )
+                elif re.match("^https?://", voice):
+                    media = raw.types.InputMediaDocumentExternal(
+                        url=voice,
+                        ttl_seconds=ttl_seconds
+                    )
+                else:
+                    media = utils.get_input_media_from_file_id(
+                        voice,
+                        FileType.VOICE,
+                        ttl_seconds=ttl_seconds
+                    )
+            else:
+                mime_type = utils.fix_up_voice_audio_uri(self, voice.name, 2)
+                file = await self.save_file(voice, progress=progress, progress_args=progress_args)
+                media = raw.types.InputMediaUploadedDocument(
+                    mime_type=mime_type,
+                    file=file,
+                    attributes=[
+                        raw.types.DocumentAttributeAudio(
+                            voice=True,
+                            duration=duration,
+                            waveform=waveform
+                        )
+                    ],
+                    ttl_seconds=ttl_seconds
+                )
+
+            reply_to = await utils._get_reply_message_parameters(
+                self,
+                message_thread_id,
+                reply_parameters
+            )
+            rpc = raw.functions.messages.SendMedia(
+                peer=await self.resolve_peer(chat_id),
+                media=media,
+                silent=disable_notification or None,
+                reply_to=reply_to,
+                random_id=self.rnd_id(),
+                schedule_date=utils.datetime_to_timestamp(schedule_date),
+                noforwards=protect_content,
+                reply_markup=await reply_markup.write(self) if reply_markup else None,
+                effect=message_effect_id,
+                **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
+            )
+            session = None
+            business_connection = None
+            if business_connection_id:
+                business_connection = self.business_user_connection_cache[business_connection_id]
+                if not business_connection:
+                    business_connection = await self.get_business_connection(business_connection_id)
+                session = await get_session(
+                    self,
+                    business_connection._raw.connection.dc_id
+                )
+
+            while True:
+                try:
+                    if business_connection_id:
+                        r = await session.invoke(
+                            raw.functions.InvokeWithBusinessConnection(
+                                query=rpc,
+                                connection_id=business_connection_id
+                            )
+                        )
+                        # await session.stop()
+                    else:
+                        r = await self.invoke(rpc)
+                except FilePartMissing as e:
+                    await self.save_file(voice, file_id=file.id, file_part=e.value)
+                else:
+                    for i in r.updates:
+                        if isinstance(
+                            i,
+                            (
+                                raw.types.UpdateNewMessage,
+                                raw.types.UpdateNewChannelMessage,
+                                raw.types.UpdateNewScheduledMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self, i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                                replies=self.fetch_replies
+                            )
+                        elif isinstance(
+                            i,
+                            (
+                                raw.types.UpdateBotNewBusinessMessage
+                            )
+                        ):
+                            return await types.Message._parse(
+                                self,
+                                i.message,
+                                {i.id: i for i in r.users},
+                                {i.id: i for i in r.chats},
+                                business_connection_id=getattr(i, "connection_id", business_connection_id),
+                                raw_reply_to_message=i.reply_to_message,
+                                replies=0
+                            )
+        except StopTransmission:
+            return None
diff --git a/pyrogram/methods/messages/set_reaction.py b/pyrogram/methods/messages/set_reaction.py
new file mode 100644
index 0000000000..b96661ebfc
--- /dev/null
+++ b/pyrogram/methods/messages/set_reaction.py
@@ -0,0 +1,153 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 typing import List
+
+import pyrogram
+from pyrogram import raw, types
+
+log = logging.getLogger(__name__)
+
+
+class SetReaction:
+    async def set_reaction(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int = None,
+        story_id: int = None,
+        reaction: List["types.ReactionType"] = [],
+        is_big: bool = False,
+        add_to_recent: bool = True
+    ) -> "types.MessageReactions":
+        """Use this method to change the chosen reactions on a message.
+        Service messages can't be reacted to.
+        Automatically forwarded messages from
+        a channel to its discussion group have the
+        same available reactions as messages in the channel.
+
+        You must use exactly one of ``message_id`` OR ``story_id``.
+
+            If you specify, ``message_id``
+
+                .. include:: /_includes/usable-by/users-bots.rst
+
+            If you specify, ``story_id``
+
+                .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_id (``int``, *optional*):
+                Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
+
+            story_id (``int``, *optional*):
+                Identifier of the story.
+
+            reaction (List of :obj:`~pyrogram.types.ReactionType`, *optional*):
+                New list of reaction types to set on the message.
+                Pass None as emoji (default) to retract the reaction.
+
+            is_big (``bool``, *optional*):
+                Pass True to set the reaction with a big animation.
+                Defaults to False.
+
+            add_to_recent (``bool``, *optional*):
+                Pass True if the reaction should appear in the recently used reactions.
+                This option is applicable only for users.
+                Defaults to True.
+        Returns:
+            On success, :obj:`~pyrogram.types.MessageReactions`: is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Send a reaction as a bot
+                await app.set_reaction(chat_id, message_id, [ReactionTypeEmoji(emoji="👍")])
+
+                # Send multiple reaction as a premium user
+                await app.set_reaction(chat_id, message_id, [ReactionTypeEmoji(emoji="👍"),ReactionTypeEmoji(emoji="😍")],True)
+
+                # Retract a reaction
+                await app.set_reaction(chat_id, message_id=message_id)
+        """
+        if message_id is not None:
+            r = await self.invoke(
+                raw.functions.messages.SendReaction(
+                    peer=await self.resolve_peer(chat_id),
+                    msg_id=message_id,
+                    reaction=[
+                        r.write(self)
+                        for r in reaction
+                    ] if reaction else [raw.types.ReactionEmpty()],
+                    big=is_big,
+                    add_to_recent=add_to_recent
+                )
+            )
+            for i in r.updates:
+                if isinstance(i, raw.types.UpdateMessageReactions):
+                    return types.MessageReactions._parse(self, i.reactions)
+        
+        elif story_id is not None:
+            r = await self.invoke(
+                raw.functions.stories.SendReaction(
+                    peer=await self.resolve_peer(chat_id),
+                    story_id=story_id,
+                    reaction=(
+                        [
+                            r.write(self)
+                            for r in reaction
+                        ] if reaction else [
+                            raw.types.ReactionEmpty()
+                        ]
+                    )[0],
+                    add_to_recent=add_to_recent
+                )
+            )
+            # TODO
+            return r
+        else:
+            raise ValueError("You need to pass one of message_id OR story_id!")
+
+
+    async def send_reaction(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        emoji: str = "",
+        big: bool = False,
+        add_to_recent: bool = True
+    ) -> bool:
+        log.warning(
+            "This property is deprecated. "
+            "Please use set_reaction instead"
+        )
+        return bool(
+            await self.invoke(
+                raw.functions.messages.SendReaction(
+                    reaction=[raw.types.ReactionEmoji(emoticon=emoji)] if emoji else None,
+                    big=big,
+                    peer=await self.resolve_peer(chat_id),
+                    msg_id=message_id,
+                    add_to_recent=add_to_recent
+                )
+            )
+        )
diff --git a/pyrogram/methods/messages/stop_poll.py b/pyrogram/methods/messages/stop_poll.py
new file mode 100644
index 0000000000..65380e37ac
--- /dev/null
+++ b/pyrogram/methods/messages/stop_poll.py
@@ -0,0 +1,103 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+from .inline_session import get_session
+
+
+class StopPoll:
+    async def stop_poll(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        business_connection_id: str = None
+    ) -> "types.Poll":
+        """Stop a poll which was sent by you.
+
+        Stopped polls can't be reopened and nobody will be able to vote in it anymore.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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``):
+                Identifier of the original message with the poll.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message to be edited was sent
+
+        Returns:
+            :obj:`~pyrogram.types.Poll`: On success, the stopped poll with the final results is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.stop_poll(chat_id, message_id)
+        """
+        poll = (await self.get_messages(
+            chat_id=chat_id,
+            message_ids=message_id
+        )).poll
+        # TODO
+        rpc = raw.functions.messages.EditMessage(
+            peer=await self.resolve_peer(chat_id),
+            id=message_id,
+            media=raw.types.InputMediaPoll(
+                poll=raw.types.Poll(
+                    id=int(poll.id),
+                    closed=True,
+                    question=raw.types.TextWithEntities(text="", entities=[]),
+                    answers=[]
+                )
+            ),
+            reply_markup=await reply_markup.write(self) if reply_markup else None
+        )
+        session = None
+        business_connection = None
+        if business_connection_id:
+            business_connection = self.business_user_connection_cache[business_connection_id]
+            if not business_connection:
+                business_connection = await self.get_business_connection(business_connection_id)
+            session = await get_session(
+                self,
+                business_connection._raw.connection.dc_id
+            )
+        if business_connection_id:
+            r = await session.invoke(
+                raw.functions.InvokeWithBusinessConnection(
+                    query=rpc,
+                    connection_id=business_connection_id
+                )
+            )
+            # await session.stop()
+        else:
+            r = await self.invoke(rpc)
+
+        return types.Poll._parse(self, r.updates[0])
diff --git a/pyrogram/methods/messages/stream_media.py b/pyrogram/methods/messages/stream_media.py
new file mode 100644
index 0000000000..b432badb4c
--- /dev/null
+++ b/pyrogram/methods/messages/stream_media.py
@@ -0,0 +1,106 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 math
+from typing import Union, Optional, BinaryIO
+
+import pyrogram
+from pyrogram import types
+from pyrogram.file_id import FileId
+
+
+class StreamMedia:
+    async def stream_media(
+        self: "pyrogram.Client",
+        message: Union["types.Message", str],
+        limit: int = 0,
+        offset: int = 0
+    ) -> Optional[Union[str, BinaryIO]]:
+        """Stream the media from a message chunk by chunk.
+
+        You can use this method to partially download a file into memory or to selectively download chunks of file.
+        The chunk maximum size is 1 MiB (1024 * 1024 bytes).
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            message (:obj:`~pyrogram.types.Message` | ``str``):
+                Pass a Message containing the media, the media itself (message.audio, message.video, ...) or a file id
+                as string.
+
+            limit (``int``, *optional*):
+                Limit the amount of chunks to stream.
+                Defaults to 0 (stream the whole media).
+
+            offset (``int``, *optional*):
+                How many chunks to skip before starting to stream.
+                Defaults to 0 (start from the beginning).
+
+        Returns:
+            ``Generator``: A generator yielding bytes chunk by chunk
+
+        Example:
+            .. code-block:: python
+
+                # Stream the whole media
+                async for chunk in app.stream_media(message):
+                    print(len(chunk))
+
+                # Stream the first 3 chunks only
+                async for chunk in app.stream_media(message, limit=3):
+                    print(len(chunk))
+
+                # Stream the rest of the media by skipping the first 3 chunks
+                async for chunk in app.stream_media(message, offset=3):
+                    print(len(chunk))
+
+                # Stream the last 3 chunks only (negative offset)
+                async for chunk in app.stream_media(message, offset=-3):
+                    print(len(chunk))
+        """
+        available_media = ("audio", "document", "photo", "sticker", "animation", "video", "voice", "video_note",
+                           "new_chat_photo")
+
+        if isinstance(message, types.Message):
+            for kind in available_media:
+                media = getattr(message, kind, None)
+
+                if media is not None:
+                    break
+            else:
+                raise ValueError("This message doesn't contain any downloadable media")
+        else:
+            media = message
+
+        if isinstance(media, str):
+            file_id_str = media
+        else:
+            file_id_str = media.file_id
+
+        file_id_obj = FileId.decode(file_id_str)
+        file_size = getattr(media, "file_size", 0)
+
+        if offset < 0:
+            if file_size == 0:
+                raise ValueError("Negative offsets are not supported for file ids, pass a Message object instead")
+
+            chunks = math.ceil(file_size / 1024 / 1024)
+            offset += chunks
+
+        async for chunk in self.get_file(file_id_obj, file_size, limit, offset):
+            yield chunk
diff --git a/pyrogram/methods/messages/translate_text.py b/pyrogram/methods/messages/translate_text.py
new file mode 100644
index 0000000000..fa1b367488
--- /dev/null
+++ b/pyrogram/methods/messages/translate_text.py
@@ -0,0 +1,139 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional, Union
+
+import pyrogram
+from pyrogram import enums, raw, types, utils
+
+
+class TranslateText:
+    async def translate_message_text(
+        self: "pyrogram.Client",
+        to_language_code: str,
+        chat_id: Union[int, str],
+        message_ids: Union[int, List[int]]
+    ) -> Union["types.TranslatedText", List["types.TranslatedText"]]:
+        """Extracts text or caption of the given message and translates it to the given language. If the current user is a Telegram Premium user, then text formatting is preserved.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            to_language_code (``str``):
+                Language code of the language to which the message is translated.
+                Must be one of "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", "st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu".
+
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_ids (``int`` | List of ``int``):
+                Identifier or list of message identifiers of the target message.
+
+        Returns:
+            :obj:`~pyrogram.types.TranslatedText` | List of :obj:`~pyrogram.types.TranslatedText`: In case *message_ids* was not
+            a list, a single result is returned, otherwise a list of results is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.translate_message_text("en", chat_id, message_id)
+        """
+        ids = [message_ids] if not isinstance(message_ids, list) else message_ids
+
+        r = await self.invoke(
+            raw.functions.messages.TranslateText(
+                to_lang=to_language_code,
+                peer=await self.resolve_peer(chat_id),
+                id=ids
+            )
+        )
+
+        return (
+            types.TranslatedText._parse(self, r.result[0])
+            if len(r.result) == 1
+            else [
+                types.TranslatedText._parse(self, i)
+                for i in r.result
+            ]
+        )
+
+
+    async def translate_text(
+        self: "pyrogram.Client",
+        to_language_code: str,
+        text: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        entities: List["types.MessageEntity"] = None
+    ) -> Union["types.TranslatedText", List["types.TranslatedText"]]:
+        """Translates a text to the given language. If the current user is a Telegram Premium user, then text formatting is preserved.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            to_language_code (``str``):
+                Language code of the language to which the message is translated.
+                Must be one of "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", "st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu".
+
+            text (``str``):
+                Text to translate.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in message text, which can be specified instead of *parse_mode*.
+
+        Returns:
+            :obj:`~pyrogram.types.TranslatedText` | List of :obj:`~pyrogram.types.TranslatedText`: In case *message_ids* was not
+            a list, a single result is returned, otherwise a list of results is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.translate_text("fa", "Pyrogram")
+        """
+        message, entities = (
+            await utils.parse_text_entities(
+                self,
+                text,
+                parse_mode,
+                entities
+            )
+        ).values()
+
+        r = await self.invoke(
+            raw.functions.messages.TranslateText(
+                to_lang=to_language_code,
+                text=[
+                    raw.types.TextWithEntities(
+                        text=message,
+                        entities=entities or []
+                    )
+                ]
+            )
+        )
+
+        return (
+            types.TranslatedText._parse(self, r.result[0])
+            if len(r.result) == 1
+            else [
+                types.TranslatedText._parse(self, i)
+                for i in r.result
+            ]
+        )
diff --git a/pyrogram/methods/messages/view_messages.py b/pyrogram/methods/messages/view_messages.py
new file mode 100644
index 0000000000..bf76ada083
--- /dev/null
+++ b/pyrogram/methods/messages/view_messages.py
@@ -0,0 +1,65 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class ViewMessages:
+    async def view_messages(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_ids: Union[int, List[int]],
+        force_read: bool = True
+    ) -> bool:
+        """Informs the server that messages are being viewed by the current user.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat.
+
+            message_ids (``int`` | List of ``int``):
+                Identifier or list of message identifiers of the target message.
+
+            force_read (``bool``, *optional*):
+                Pass True to mark as read the specified messages and also increment the view counter.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Increment message views
+                await app.view_messages(chat_id, 1)
+        """
+        ids = [message_ids] if not isinstance(message_ids, list) else message_ids
+
+        r = await self.invoke(
+            raw.functions.messages.GetMessagesViews(
+                peer=await self.resolve_peer(chat_id),
+                id=ids,
+                increment=force_read
+            )
+        )
+
+        return bool(r)
diff --git a/pyrogram/methods/messages/vote_poll.py b/pyrogram/methods/messages/vote_poll.py
new file mode 100644
index 0000000000..5b91e210ce
--- /dev/null
+++ b/pyrogram/methods/messages/vote_poll.py
@@ -0,0 +1,72 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class VotePoll:
+    async def vote_poll(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        message_id: int,
+        options: Union[int, List[int]]
+    ) -> "types.Poll":
+        """Vote a poll.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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``):
+                Identifier of the original message with the poll.
+
+            options (``Int`` | List of ``int``):
+                Index or list of indexes (for multiple answers) of the poll option(s) you want to vote for (0 to 9).
+
+        Returns:
+            :obj:`~pyrogram.types.Poll` - On success, the poll with the chosen option is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.vote_poll(chat_id, message_id, 6)
+        """
+
+        poll = (await self.get_messages(
+            chat_id=chat_id,
+            message_ids=message_id
+        )).poll
+        options = [options] if not isinstance(options, list) else options
+
+        r = await self.invoke(
+            raw.functions.messages.SendVote(
+                peer=await self.resolve_peer(chat_id),
+                msg_id=message_id,
+                options=[poll.options[option].data for option in options]
+            )
+        )
+
+        return types.Poll._parse(self, r.updates[0])
diff --git a/pyrogram/methods/password/__init__.py b/pyrogram/methods/password/__init__.py
new file mode 100644
index 0000000000..dd204aac90
--- /dev/null
+++ b/pyrogram/methods/password/__init__.py
@@ -0,0 +1,29 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .change_cloud_password import ChangeCloudPassword
+from .enable_cloud_password import EnableCloudPassword
+from .remove_cloud_password import RemoveCloudPassword
+
+
+class Password(
+    ChangeCloudPassword,
+    EnableCloudPassword,
+    RemoveCloudPassword,
+):
+    pass
diff --git a/pyrogram/methods/password/change_cloud_password.py b/pyrogram/methods/password/change_cloud_password.py
new file mode 100644
index 0000000000..29540d653b
--- /dev/null
+++ b/pyrogram/methods/password/change_cloud_password.py
@@ -0,0 +1,82 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram.utils import compute_password_hash, compute_password_check, btoi, itob
+
+
+class ChangeCloudPassword:
+    async def change_cloud_password(
+        self: "pyrogram.Client",
+        current_password: str,
+        new_password: str,
+        new_hint: str = ""
+    ) -> bool:
+        """Change your Two-Step Verification password (Cloud Password) with a new one.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            current_password (``str``):
+                Your current password.
+
+            new_password (``str``):
+                Your new password.
+
+            new_hint (``str``, *optional*):
+                A new password hint.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            ValueError: In case there is no cloud password to change.
+
+        Example:
+            .. code-block:: python
+
+                # Change password only
+                await app.change_cloud_password("current_password", "new_password")
+
+                # Change password and hint
+                await app.change_cloud_password("current_password", "new_password", new_hint="hint")
+        """
+        r = await self.invoke(raw.functions.account.GetPassword())
+
+        if not r.has_password:
+            raise ValueError("There is no cloud password to change")
+
+        r.new_algo.salt1 += os.urandom(32)
+        new_hash = btoi(compute_password_hash(r.new_algo, new_password))
+        new_hash = itob(pow(r.new_algo.g, new_hash, btoi(r.new_algo.p)))
+
+        await self.invoke(
+            raw.functions.account.UpdatePasswordSettings(
+                password=compute_password_check(r, current_password),
+                new_settings=raw.types.account.PasswordInputSettings(
+                    new_algo=r.new_algo,
+                    new_password_hash=new_hash,
+                    hint=new_hint
+                )
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/password/enable_cloud_password.py b/pyrogram/methods/password/enable_cloud_password.py
new file mode 100644
index 0000000000..8f5e59c570
--- /dev/null
+++ b/pyrogram/methods/password/enable_cloud_password.py
@@ -0,0 +1,88 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram.utils import compute_password_hash, btoi, itob
+
+
+class EnableCloudPassword:
+    async def enable_cloud_password(
+        self: "pyrogram.Client",
+        password: str,
+        hint: str = "",
+        email: str = None
+    ) -> bool:
+        """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.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            password (``str``):
+                Your password.
+
+            hint (``str``, *optional*):
+                A password hint.
+
+            email (``str``, *optional*):
+                Recovery e-mail.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            ValueError: In case there is already a cloud password enabled.
+
+        Example:
+            .. code-block:: python
+
+                # Enable password without hint and email
+                await app.enable_cloud_password("password")
+
+                # Enable password with hint and without email
+                await app.enable_cloud_password("password", hint="hint")
+
+                # Enable password with hint and email
+                await app.enable_cloud_password("password", hint="hint", email="user@email.com")
+        """
+        r = await self.invoke(raw.functions.account.GetPassword())
+
+        if r.has_password:
+            raise ValueError("There is already a cloud password enabled")
+
+        r.new_algo.salt1 += os.urandom(32)
+        new_hash = btoi(compute_password_hash(r.new_algo, password))
+        new_hash = itob(pow(r.new_algo.g, new_hash, btoi(r.new_algo.p)))
+
+        await self.invoke(
+            raw.functions.account.UpdatePasswordSettings(
+                password=raw.types.InputCheckPasswordEmpty(),
+                new_settings=raw.types.account.PasswordInputSettings(
+                    new_algo=r.new_algo,
+                    new_password_hash=new_hash,
+                    hint=hint,
+                    email=email
+                )
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/password/remove_cloud_password.py b/pyrogram/methods/password/remove_cloud_password.py
new file mode 100644
index 0000000000..0ec16e12cd
--- /dev/null
+++ b/pyrogram/methods/password/remove_cloud_password.py
@@ -0,0 +1,64 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram.utils import compute_password_check
+
+
+class RemoveCloudPassword:
+    async def remove_cloud_password(
+        self: "pyrogram.Client",
+        password: str
+    ) -> bool:
+        """Turn off the Two-Step Verification security feature (Cloud Password) on your account.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            password (``str``):
+                Your current password.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            ValueError: In case there is no cloud password to remove.
+
+        Example:
+            .. code-block:: python
+
+                await app.remove_cloud_password("password")
+        """
+        r = await self.invoke(raw.functions.account.GetPassword())
+
+        if not r.has_password:
+            raise ValueError("There is no cloud password to remove")
+
+        await self.invoke(
+            raw.functions.account.UpdatePasswordSettings(
+                password=compute_password_check(r, password),
+                new_settings=raw.types.account.PasswordInputSettings(
+                    new_algo=raw.types.PasswordKdfAlgoUnknown(),
+                    new_password_hash=b"",
+                    hint=""
+                )
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/phone/__init__.py b/pyrogram/methods/phone/__init__.py
new file mode 100644
index 0000000000..622c8f526f
--- /dev/null
+++ b/pyrogram/methods/phone/__init__.py
@@ -0,0 +1,34 @@
+
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .load_group_call_participants import LoadGroupCallParticipants
+from .invite_group_call_participants import InviteGroupCallParticipants
+from .create_video_chat import CreateVideoChat
+from .discard_group_call import DiscardGroupCall
+from .get_video_chat_rtmp_url import GetVideoChatRtmpUrl
+
+
+class Phone(
+    InviteGroupCallParticipants,
+    LoadGroupCallParticipants,
+    CreateVideoChat,
+    DiscardGroupCall,
+    GetVideoChatRtmpUrl,
+):
+    pass
diff --git a/pyrogram/methods/phone/create_video_chat.py b/pyrogram/methods/phone/create_video_chat.py
new file mode 100644
index 0000000000..2477dbfe3e
--- /dev/null
+++ b/pyrogram/methods/phone/create_video_chat.py
@@ -0,0 +1,96 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+import pyrogram
+from pyrogram import types, raw, utils
+
+
+class CreateVideoChat:
+    async def create_video_chat(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        title: str = None,
+        start_date: datetime = utils.zero_datetime(),
+        is_rtmp_stream: bool = None
+    ) -> "types.Message":
+        """Creates a video chat (a group call bound to a chat).
+        
+        Available only for basic groups, supergroups and channels; requires can_manage_video_chats administrator right.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat in which the video chat will be created. A chat can be either a basic group, supergroup or a channel.
+
+            title (``str``, *optional*):
+                Group call title; if empty, chat title will be used.
+
+            start_date (:py:obj:`~datetime.datetime`, *optional*):
+                Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future.
+
+            is_rtmp_stream (``bool``, *optional*):
+                Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent service message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.create_video_chat(chat_id)
+
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if not isinstance(peer, (raw.types.InputPeerChat, raw.types.InputPeerChannel)):
+            raise ValueError(
+                "Target chat should be group, supergroup or channel."
+            )
+
+        r = await self.invoke(
+            raw.functions.phone.CreateGroupCall(
+                rtmp_stream=is_rtmp_stream,
+                peer=peer,
+                # TODO: temp. workaround
+                random_id=self.rnd_id() >> 32,
+                title=title,
+                schedule_date=utils.datetime_to_timestamp(start_date),
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewScheduledMessage,
+                ),
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                )
diff --git a/pyrogram/methods/phone/discard_group_call.py b/pyrogram/methods/phone/discard_group_call.py
new file mode 100644
index 0000000000..fb911a7e99
--- /dev/null
+++ b/pyrogram/methods/phone/discard_group_call.py
@@ -0,0 +1,85 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import types, raw
+
+
+class DiscardGroupCall:
+    async def discard_group_call(
+        # TODO
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+    ) -> "types.Message":
+        """Terminate a group/channel call or livestream
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat. A chat can be either a basic group, supergroup or a channel.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent service message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.discard_group_call(chat_id)
+
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChannel):
+            r = await self.invoke(raw.functions.channels.GetFullChannel(channel=peer))
+        elif isinstance(peer, raw.types.InputPeerChat):
+            r = await self.invoke(
+                raw.functions.messages.GetFullChat(chat_id=peer.chat_id)
+            )
+        else:
+            raise ValueError("Target chat should be group, supergroup or channel.")
+
+        call = r.full_chat.call
+
+        if call is None:
+            raise ValueError("No active group call at this chat.")
+
+        r = await self.invoke(
+            raw.functions.phone.DiscardGroupCall(
+                call=call
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewScheduledMessage,
+                ),
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage),
+                )
diff --git a/pyrogram/methods/phone/get_video_chat_rtmp_url.py b/pyrogram/methods/phone/get_video_chat_rtmp_url.py
new file mode 100644
index 0000000000..bbf14f752f
--- /dev/null
+++ b/pyrogram/methods/phone/get_video_chat_rtmp_url.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import types, raw
+
+
+class GetVideoChatRtmpUrl:
+    async def get_video_chat_rtmp_url(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        replace: bool = False
+    ) -> "types.RtmpUrl":
+        """Returns RTMP URL for streaming to the chat; requires owner privileges.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat. A chat can be either a basic group, supergroup or a channel.
+
+            replace (``bool``, *optional*):
+                Whether to replace the previous stream key or simply return the existing one. Defaults to False, i.e., return the existing one.
+
+        Returns:
+            :obj:`~pyrogram.types.RtmpUrl`: On success, the RTMP URL and stream key is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.get_stream_rtmp_url(chat_id)
+
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if not isinstance(peer, (raw.types.InputPeerChat, raw.types.InputPeerChannel)):
+            raise ValueError("Target chat should be group, supergroup or channel.")
+
+        r = await self.invoke(
+            raw.functions.phone.GetGroupCallStreamRtmpUrl(
+                peer=peer,
+                revoke=replace
+            )
+        )
+
+        return types.RtmpUrl._parse(r)
diff --git a/pyrogram/methods/phone/invite_group_call_participants.py b/pyrogram/methods/phone/invite_group_call_participants.py
new file mode 100644
index 0000000000..3b6db763fd
--- /dev/null
+++ b/pyrogram/methods/phone/invite_group_call_participants.py
@@ -0,0 +1,96 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import types, raw
+
+
+class InviteGroupCallParticipants:
+    async def invite_group_call_participants(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        user_ids: Union[Union[int, str], List[Union[int, str]]],
+    ) -> "types.Message":
+        """Invites users to an active group call. Sends a service message of type :obj:`~pyrogram.enums.MessageServiceType.VIDEO_CHAT_PARTICIPANTS_INVITED` for video chats.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat. A chat can be either a basic group or a supergroup.
+
+            user_ids (``int`` | ``str`` | List of ``int`` or ``str``):
+                Users identifiers to invite to group call in the chat.
+                You can pass an ID (int) or username (str).
+                At most 10 users can be invited simultaneously.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the sent service message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await app.invite_group_call_participants(chat_id, user_id)
+
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChannel):
+            r = await self.invoke(raw.functions.channels.GetFullChannel(channel=peer))
+        elif isinstance(peer, raw.types.InputPeerChat):
+            r = await self.invoke(
+                raw.functions.messages.GetFullChat(chat_id=peer.chat_id)
+            )
+        else:
+            raise ValueError("Target chat should be group, supergroup or channel.")
+
+        call = r.full_chat.call
+
+        if call is None:
+            raise ValueError("No active group call at this chat.")
+
+        user_ids = [user_ids] if not isinstance(user_ids, list) else user_ids
+
+        r = await self.invoke(
+            raw.functions.phone.InviteToGroupCall(
+                call=call,
+                users=[
+                    await self.resolve_peer(i)
+                    for i in user_ids
+                ]
+            )
+        )
+
+        for i in r.updates:
+            if isinstance(
+                i,
+                (
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewScheduledMessage
+                )
+            ):
+                return await types.Message._parse(
+                    self,
+                    i.message,
+                    {i.id: i for i in r.users},
+                    {i.id: i for i in r.chats},
+                    is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage)
+                )
diff --git a/pyrogram/methods/phone/load_group_call_participants.py b/pyrogram/methods/phone/load_group_call_participants.py
new file mode 100644
index 0000000000..0d402bfc27
--- /dev/null
+++ b/pyrogram/methods/phone/load_group_call_participants.py
@@ -0,0 +1,103 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, AsyncGenerator
+
+import pyrogram
+from pyrogram import types, raw
+
+
+class LoadGroupCallParticipants:
+    async def load_group_call_participants(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        limit: int = 0
+    ) -> AsyncGenerator["types.GroupCallParticipant", None]:
+        """Loads participants list in a group call of a chat.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target chat. A chat can be either a basic group or a supergroup.
+
+            limit (``int``, *optional*):
+                Limits the number of participants to be retrieved. By default, no limit is applied and all participants are returned.
+
+        Returns:
+            ``Generator``: On success, a generator yielding :obj:`~pyrogram.types.GroupCallParticipant` object is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Get participants
+                async for participant in app.load_group_call_participants(chat_id):
+                    print(participant)
+
+        """
+        peer = await self.resolve_peer(chat_id)
+
+        if isinstance(peer, raw.types.InputPeerChannel):
+            r = await self.invoke(raw.functions.channels.GetFullChannel(channel=peer))
+        elif isinstance(peer, raw.types.InputPeerChat):
+            r = await self.invoke(raw.functions.messages.GetFullChat(chat_id=peer.chat_id))
+        else:
+            raise ValueError("Target chat should be group, supergroup or channel.")
+
+        full_chat = r.full_chat
+
+        if not getattr(full_chat, "call", None):
+            raise ValueError("There is no active call in this chat.")
+
+        current = 0
+        offset = ""
+        total = abs(limit) or (1 << 31) - 1
+        limit = min(20, total)
+
+        while True:
+            r = await self.invoke(
+                raw.functions.phone.GetGroupParticipants(
+                    call=full_chat.call,
+                    ids=[],
+                    sources=[],
+                    offset=offset,
+                    limit=limit
+                ),
+                sleep_threshold=60
+            )
+
+            users = {u.id: u for u in r.users}
+            chats = {c.id: c for c in r.chats}
+            participants = [
+                types.GroupCallParticipant._parse(
+                    self, participant, users, chats
+                ) for participant in r.participants
+            ]
+
+            if not participants:
+                return
+
+            offset = r.next_offset
+
+            for participant in participants:
+                yield participant
+
+                current += 1
+
+                if current >= total:
+                    return
diff --git a/pyrogram/methods/stickers/__init__.py b/pyrogram/methods/stickers/__init__.py
new file mode 100644
index 0000000000..f213537d69
--- /dev/null
+++ b/pyrogram/methods/stickers/__init__.py
@@ -0,0 +1,27 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .get_message_effects import GetMessageEffects
+from .get_stickers import GetStickers
+
+
+class Stickers(
+    GetMessageEffects,
+    GetStickers,
+):
+    pass
diff --git a/pyrogram/methods/stickers/get_message_effects.py b/pyrogram/methods/stickers/get_message_effects.py
new file mode 100644
index 0000000000..b16e00859c
--- /dev/null
+++ b/pyrogram/methods/stickers/get_message_effects.py
@@ -0,0 +1,67 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 List
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class GetMessageEffects:
+    async def get_message_effects(
+        self: "pyrogram.Client"
+    ) -> List["types.MessageEffect"]:
+        """Returns information about all available message effects.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Returns:
+            List of :obj:`~pyrogram.types.MessageEffect`: A list of message effects is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Get all message effects
+                await app.get_message_effects()
+
+        """
+        r = await self.invoke(
+            raw.functions.messages.GetAvailableEffects(
+                hash=0
+            )
+        )
+        documents = {d.id: d for d in r.documents}
+        outlst = []
+        for effect in r.effects:
+            effect_animation_document = documents.get(effect.effect_sticker_id, None)
+            static_icon_document = documents.get(effect.static_icon_id, None) if getattr(effect, "static_icon_id", None) else None
+            select_animation_document = documents.get(effect.effect_animation_id, None) if getattr(effect, "effect_animation_id", None) else None
+            outlst.append(
+                await types.MessageEffect._parse(
+                    self,
+                    effect,
+                    effect_animation_document,
+                    static_icon_document,
+                    select_animation_document
+                )
+            )
+        return types.List(outlst)
diff --git a/pyrogram/methods/stickers/get_stickers.py b/pyrogram/methods/stickers/get_stickers.py
new file mode 100644
index 0000000000..fb94272424
--- /dev/null
+++ b/pyrogram/methods/stickers/get_stickers.py
@@ -0,0 +1,88 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 List
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+log = logging.getLogger(__name__)
+
+
+class GetStickers:
+    async def get_stickers(
+        self: "pyrogram.Client",
+        short_name: str
+    ) -> List["types.Sticker"]:
+        """Get all stickers from set by short name.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            short_name (``str``):
+                Short name of the sticker set, serves as the unique identifier for the sticker set.
+
+        Returns:
+            List of :obj:`~pyrogram.types.Sticker`: A list of stickers is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Get all stickers by short name
+                await app.get_stickers("short_name")
+
+        Raises:
+            ValueError: In case of invalid arguments.
+        """
+        r, _ = await self._get_raw_stickers(
+            raw.types.InputStickerSetShortName(
+                short_name=short_name
+            )
+        )
+        return r
+
+
+    async def _get_raw_stickers(
+        self: "pyrogram.Client",
+        sticker_set: "raw.base.InputStickerSet"
+    ) -> List["types.Sticker"]:
+        """Internal Method.
+
+        Parameters:
+            sticker_set (:obj:`~pyrogram.raw.base.InputStickerSet`):
+
+        Returns:
+            List of :obj:`~pyrogram.types.Sticker`: A list of stickers is returned.
+
+        Raises:
+            ValueError: In case of invalid arguments.
+        """
+        sticker_set = await self.invoke(
+            raw.functions.messages.GetStickerSet(
+                stickerset=sticker_set,
+                hash=0
+            )
+        )
+        r = types.List([
+            await types.Sticker._parse(
+                self, doc, {type(a): a for a in doc.attributes}
+            ) for doc in sticker_set.documents
+        ])
+        return r, sticker_set.set
diff --git a/pyrogram/methods/stories/__init__.py b/pyrogram/methods/stories/__init__.py
new file mode 100644
index 0000000000..b7c0c724a1
--- /dev/null
+++ b/pyrogram/methods/stories/__init__.py
@@ -0,0 +1,25 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .get_stories import GetStories
+
+class Stories(
+    GetStories,
+):
+    pass
diff --git a/pyrogram/methods/stories/get_stories.py b/pyrogram/methods/stories/get_stories.py
new file mode 100644
index 0000000000..88f6fa77a8
--- /dev/null
+++ b/pyrogram/methods/stories/get_stories.py
@@ -0,0 +1,89 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Iterable
+
+import pyrogram
+from pyrogram import raw, types
+
+
+class GetStories:
+    async def get_stories(
+        self: "pyrogram.Client",
+        story_sender_chat_id: Union[int, str],
+        story_ids: Union[int, Iterable[int]],
+    ) -> "types.Story":
+        """Get one or more stories from a chat by using stories identifiers.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            story_sender_chat_id (``int`` | ``str``):
+                Identifier of the chat that posted the story.
+
+            story_ids (``int`` | Iterable of ``int``, *optional*):
+                Pass a single story identifier or an iterable of story ids (as integers) to get the content of the
+                story themselves.
+
+        Returns:
+            :obj:`~pyrogram.types.Story` | List of :obj:`~pyrogram.types.Story`: In case *story_ids* was not
+            a list, a single story is returned, otherwise a list of stories is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Get stories by id
+                stories = await app.get_stories(
+                    story_sender_chat_id,
+                    [1, 2, 3]
+                )
+
+                for story in stories:
+                    print(story)
+        """
+        is_iterable = not isinstance(story_ids, int)
+        ids = list(story_ids) if is_iterable else [story_ids]
+
+        peer = await self.resolve_peer(story_sender_chat_id)
+        r = await self.invoke(
+            raw.functions.stories.GetStoriesByID(
+                peer=peer,
+                id=ids
+            )
+        )
+
+        stories = []
+
+        users = {i.id: i for i in r.users}
+        chats = {i.id: i for i in r.chats}
+
+        for story in r.stories:
+            stories.append(
+                await types.Story._parse(
+                    self,
+                    users,
+                    chats,
+                    None, None, None,
+                    # TODO
+                    story,
+                    None, #
+                    # TODO
+                )
+            )
+
+        return types.List(stories) if is_iterable else stories[0] if stories else None
diff --git a/pyrogram/methods/users/__init__.py b/pyrogram/methods/users/__init__.py
new file mode 100644
index 0000000000..d61faf20da
--- /dev/null
+++ b/pyrogram/methods/users/__init__.py
@@ -0,0 +1,57 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .block_user import BlockUser
+from .delete_profile_photos import DeleteProfilePhotos
+from .get_chat_photos import GetChatPhotos
+from .get_chat_photos_count import GetChatPhotosCount
+from .get_common_chats import GetCommonChats
+from .get_default_emoji_statuses import GetDefaultEmojiStatuses
+from .get_me import GetMe
+from .get_users import GetUsers
+from .set_emoji_status import SetEmojiStatus
+from .set_profile_photo import SetProfilePhoto
+from .set_username import SetUsername
+from .unblock_user import UnblockUser
+from .update_profile import UpdateProfile
+from .set_birthdate import SetBirthdate
+from .set_personal_chat import SetPersonalChat
+from .update_status import UpdateStatus
+from .delete_account import DeleteAccount
+
+
+class Users(
+    BlockUser,
+    DeleteProfilePhotos,
+    GetChatPhotos,
+    GetChatPhotosCount,
+    GetCommonChats,
+    GetDefaultEmojiStatuses,
+    GetMe,
+    GetUsers,
+    SetBirthdate,
+    SetEmojiStatus,
+    SetPersonalChat,
+    SetProfilePhoto,
+    SetUsername,
+    UnblockUser,
+    UpdateProfile,
+    UpdateStatus,
+    DeleteAccount,
+):
+    pass
diff --git a/pyrogram/methods/users/block_user.py b/pyrogram/methods/users/block_user.py
new file mode 100644
index 0000000000..0934940ebd
--- /dev/null
+++ b/pyrogram/methods/users/block_user.py
@@ -0,0 +1,59 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class BlockUser:
+    async def block_user(
+        self: "pyrogram.Client",
+        user_id: Union[int, str],
+        my_stories_from: bool = None
+    ) -> bool:
+        """Block a user.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            user_id (``int`` | ``str``):
+                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 their phone number (str).
+
+            my_stories_from (``bool``, *optional*):
+                Whether the peer should be added to the story blocklist; if not set, the peer will be added to the main blocklist.
+
+        Returns:
+            ``bool``: True on success
+
+        Example:
+            .. code-block:: python
+
+                await app.block_user(user_id)
+        """
+        return bool(
+            await self.invoke(
+                raw.functions.contacts.Block(
+                    id=await self.resolve_peer(user_id),
+                    my_stories_from=my_stories_from
+                )
+            )
+        )
diff --git a/pyrogram/methods/users/delete_account.py b/pyrogram/methods/users/delete_account.py
new file mode 100644
index 0000000000..692c6d42b3
--- /dev/null
+++ b/pyrogram/methods/users/delete_account.py
@@ -0,0 +1,58 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram.utils import compute_password_check
+
+
+class DeleteAccount:
+    async def delete_account(
+        self: "pyrogram.Client", reason: str = "", password: str = None
+    ) -> bool:
+        """Deletes the account of the current user, deleting all information associated with the user from the server.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            reason (``str``, *optional*):
+                The reason why the account was deleted.
+
+            password (``str``, *optional*):
+                The 2-step verification password of the current user. If the current user isn't authorized, then an empty string can be passed and account deletion can be canceled within one week.
+
+        Returns:
+            `bool`: True On success.
+
+        Example:
+            .. code-block:: python
+
+                await app.delete_account(reason, password)
+        """
+        r = await self.invoke(
+            raw.functions.account.DeleteAccount(
+                reason=reason,
+                password=compute_password_check(
+                    await self.invoke(raw.functions.account.GetPassword()), password
+                )
+                if password
+                else None,
+            )
+        )
+
+        return bool(r)
diff --git a/pyrogram/methods/users/delete_profile_photos.py b/pyrogram/methods/users/delete_profile_photos.py
new file mode 100644
index 0000000000..a854ee6362
--- /dev/null
+++ b/pyrogram/methods/users/delete_profile_photos.py
@@ -0,0 +1,89 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram.file_id import FileType
+
+
+class DeleteProfilePhotos:
+    async def delete_profile_photos(
+        self: "pyrogram.Client",
+        photo_ids: Union[str, List[str]] = None,
+        public: bool = False,
+        for_my_bot: Union[int, str] = None,
+    ) -> bool:
+        """Delete your own profile photos.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            photo_ids (``str`` | List of ``str``, *optional*):
+                A single :obj:`~pyrogram.types.Photo` id as string or multiple ids as list of strings for deleting
+                more than one photos at once.
+                If not specified, the most recent profile photo of the user would be deleted.
+
+            public (``bool``, *optional*):
+                Pass True to upload a public profile photo for users who are restricted from viewing your real profile photos due to your privacy settings.
+                Defaults to False.
+
+            for_my_bot (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the bot for which profile photo has to be updated instead of the current user.
+                The bot should have ``can_be_edited`` property set to True.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                # Get the photos to be deleted
+                photos = [p async for p in app.get_chat_photos("me")]
+
+                # Delete one photo
+                await app.delete_profile_photos(photos[0].file_id)
+
+                # Delete the rest of the photos
+                await app.delete_profile_photos([p.file_id for p in photos[1:]])
+
+                # Delete one photo without fetching the current profile photos of the user
+                await app.delete_profile_photos()
+        """
+        if photo_ids is None:
+            return bool(
+                await self.invoke(
+                    raw.functions.photos.UpdateProfilePhoto(
+                        id=raw.types.InputPhotoEmpty(),
+                        fallback=public,
+                        bot=await self.resolve_peer(for_my_bot) if for_my_bot else None,
+                    )
+                )
+            )
+
+        photo_ids = photo_ids if isinstance(photo_ids, list) else [photo_ids]
+        input_photos = [utils.get_input_media_from_file_id(i, FileType.PHOTO).id for i in photo_ids]
+
+        return bool(
+            await self.invoke(
+                raw.functions.photos.DeletePhotos(
+                    id=input_photos
+                )
+            )
+        )
diff --git a/pyrogram/methods/users/get_chat_photos.py b/pyrogram/methods/users/get_chat_photos.py
new file mode 100644
index 0000000000..883a2c5939
--- /dev/null
+++ b/pyrogram/methods/users/get_chat_photos.py
@@ -0,0 +1,158 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, AsyncGenerator, Optional
+
+import pyrogram
+from pyrogram import types, raw, utils
+
+
+class GetChatPhotos:
+    async def get_chat_photos(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str],
+        limit: int = 0,
+    ) -> Optional[
+        Union[
+            AsyncGenerator["types.Photo", None],
+            AsyncGenerator["types.Animation", None]
+        ]
+    ]:
+        """Get a chat or a user profile photos sequentially.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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.
+
+        Returns:
+            ``Generator``: A generator yielding :obj:`~pyrogram.types.Photo` | :obj:`~pyrogram.types.Animation` objects.
+
+        Example:
+            .. code-block:: python
+
+                async for photo in app.get_chat_photos("me"):
+                    print(photo)
+        """
+        peer_id = await self.resolve_peer(chat_id)
+
+        if isinstance(peer_id, raw.types.InputPeerChannel):
+            r = await self.invoke(
+                raw.functions.channels.GetFullChannel(
+                    channel=peer_id
+                )
+            )
+
+            current = types.Photo._parse(self, r.full_chat.chat_photo) or []
+            current = [current]
+            current_animation = types.Animation._parse_chat_animation(
+                self,
+                r.full_chat.chat_photo
+            )
+            if current_animation:
+                current = current + [current_animation]
+            extra = []
+            if not self.me.is_bot:
+                r = await utils.parse_messages(
+                    self,
+                    await self.invoke(
+                        raw.functions.messages.Search(
+                            peer=peer_id,
+                            q="",
+                            filter=raw.types.InputMessagesFilterChatPhotos(),
+                            min_date=0,
+                            max_date=0,
+                            offset_id=0,
+                            add_offset=0,
+                            limit=limit,
+                            max_id=0,
+                            min_id=0,
+                            hash=0
+                        )
+                    )
+                )
+
+                extra = [message.new_chat_photo for message in r]
+
+            if extra:
+                if current:
+                    photos = (current + extra) if current[0].file_id != extra[0].file_id else extra
+                else:
+                    photos = extra
+            else:
+                if current:
+                    photos = current
+                else:
+                    photos = []
+
+            current = 0
+
+            for photo in photos:
+                yield photo
+
+                current += 1
+
+                if current >= limit:
+                    return
+        else:
+            current = 0
+            total = limit or (1 << 31)
+            limit = min(100, total)
+            offset = 0
+
+            while True:
+                r = await self.invoke(
+                    raw.functions.photos.GetUserPhotos(
+                        user_id=peer_id,
+                        offset=offset,
+                        max_id=0,
+                        limit=limit
+                    )
+                )
+
+                photos = []
+                for photo in r.photos:
+                    photos.append(
+                        types.Photo._parse(self, photo)
+                    )
+                    current_animation = types.Animation._parse_chat_animation(
+                        self,
+                        photo
+                    )
+                    if current_animation:
+                        photos.append(current_animation)
+
+                if not photos:
+                    return
+
+                offset += len(photos)
+
+                for photo in photos:
+                    yield photo
+
+                    current += 1
+
+                    if current >= total:
+                        return
diff --git a/pyrogram/methods/users/get_chat_photos_count.py b/pyrogram/methods/users/get_chat_photos_count.py
new file mode 100644
index 0000000000..023ad2cb74
--- /dev/null
+++ b/pyrogram/methods/users/get_chat_photos_count.py
@@ -0,0 +1,78 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class GetChatPhotosCount:
+    async def get_chat_photos_count(
+        self: "pyrogram.Client",
+        chat_id: Union[int, str]
+    ) -> int:
+        """Get the total count of photos for a chat.
+
+        .. note::
+
+            This method works for bot Clients only in :obj:`~pyrogram.enums.ChatType.PRIVATE` and :obj:`~pyrogram.enums.ChatType.GROUP`
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        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.
+
+        Example:
+            .. code-block:: python
+
+                count = await app.get_chat_photos_count("me")
+                print(count)
+        """
+
+        peer_id = await self.resolve_peer(chat_id)
+
+        if isinstance(peer_id, raw.types.InputPeerChannel):
+            r = await self.invoke(
+                raw.functions.messages.GetSearchCounters(
+                    peer=peer_id,
+                    filters=[raw.types.InputMessagesFilterChatPhotos()],
+                )
+            )
+
+            return r[0].count
+        else:
+            r = await self.invoke(
+                raw.functions.photos.GetUserPhotos(
+                    user_id=peer_id,
+                    offset=0,
+                    max_id=0,
+                    limit=1
+                )
+            )
+
+            if isinstance(r, raw.types.photos.Photos):
+                return len(r.photos)
+            else:
+                return r.count
diff --git a/pyrogram/methods/users/get_common_chats.py b/pyrogram/methods/users/get_common_chats.py
new file mode 100644
index 0000000000..31e2bac38e
--- /dev/null
+++ b/pyrogram/methods/users/get_common_chats.py
@@ -0,0 +1,67 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetCommonChats:
+    async def get_common_chats(
+        self: "pyrogram.Client",
+        user_id: Union[int, str]
+    ) -> List["types.Chat"]:
+        """Get the common chats you have with a user.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        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:
+            List of :obj:`~pyrogram.types.Chat`: On success, a list of the common chats is returned.
+
+        Raises:
+            ValueError: If the user_id doesn't belong to a user.
+
+        Example:
+            .. code-block:: python
+
+                common = await app.get_common_chats(user_id)
+                print(common)
+        """
+
+        peer = await self.resolve_peer(user_id)
+
+        if isinstance(peer, raw.types.InputPeerUser):
+            r = await self.invoke(
+                raw.functions.messages.GetCommonChats(
+                    user_id=peer,
+                    max_id=0,
+                    limit=100,
+                )
+            )
+
+            return types.List([types.Chat._parse_chat(self, x) for x in r.chats])
+
+        raise ValueError(f'The user_id "{user_id}" doesn\'t belong to a user')
diff --git a/pyrogram/methods/users/get_default_emoji_statuses.py b/pyrogram/methods/users/get_default_emoji_statuses.py
new file mode 100644
index 0000000000..cd3768b9a4
--- /dev/null
+++ b/pyrogram/methods/users/get_default_emoji_statuses.py
@@ -0,0 +1,47 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class GetDefaultEmojiStatuses:
+    async def get_default_emoji_statuses(
+        self: "pyrogram.Client",
+    ) -> List["types.EmojiStatus"]:
+        """Get the default emoji statuses.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Returns:
+            List of :obj:`~pyrogram.types.EmojiStatus`: On success, a list of emoji statuses is returned.
+
+        Example:
+            .. code-block:: python
+
+                default_emoji_statuses = await app.get_default_emoji_statuses()
+                print(default_emoji_statuses)
+        """
+        r = await self.invoke(
+            raw.functions.account.GetDefaultEmojiStatuses(hash=0)
+        )
+
+        return types.List([types.EmojiStatus._parse(self, i) for i in r.statuses])
diff --git a/pyrogram/methods/users/get_me.py b/pyrogram/methods/users/get_me.py
new file mode 100644
index 0000000000..a8df3ae9f3
--- /dev/null
+++ b/pyrogram/methods/users/get_me.py
@@ -0,0 +1,49 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+
+class GetMe:
+    async def get_me(
+        self: "pyrogram.Client"
+    ) -> "types.User":
+        """Get your own user identity.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Returns:
+            :obj:`~pyrogram.types.User`: Information about the own logged in user/bot.
+
+        Example:
+            .. code-block:: python
+
+                me = await app.get_me()
+                print(me)
+        """
+        r = await self.invoke(
+            raw.functions.users.GetFullUser(
+                id=raw.types.InputUserSelf()
+            )
+        )
+
+        users = {u.id: u for u in r.users}
+
+        return types.User._parse(self, users[r.full_user.id])
diff --git a/pyrogram/methods/users/get_users.py b/pyrogram/methods/users/get_users.py
new file mode 100644
index 0000000000..39821a8c5d
--- /dev/null
+++ b/pyrogram/methods/users/get_users.py
@@ -0,0 +1,71 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+from typing import Union, List, Iterable
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+
+
+class GetUsers:
+    async def get_users(
+        self: "pyrogram.Client",
+        user_ids: Union[int, str, Iterable[Union[int, str]]]
+    ) -> Union["types.User", List["types.User"]]:
+        """Get information about a user.
+        You can retrieve up to 200 users at once.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            user_ids (``int`` | ``str`` | Iterable of ``int`` or ``str``):
+                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).
+
+        Returns:
+            :obj:`~pyrogram.types.User` | List of :obj:`~pyrogram.types.User`: In case *user_ids* was not a list,
+            a single user is returned, otherwise a list of users is returned.
+
+        Example:
+            .. code-block:: python
+
+                # Get information about one user
+                await app.get_users("me")
+
+                # Get information about multiple users at once
+                await app.get_users([user_id1, user_id2, user_id3])
+        """
+
+        is_iterable = not isinstance(user_ids, (int, str))
+        user_ids = list(user_ids) if is_iterable else [user_ids]
+        user_ids = await asyncio.gather(*[self.resolve_peer(i) for i in user_ids])
+
+        r = await self.invoke(
+            raw.functions.users.GetUsers(
+                id=user_ids
+            )
+        )
+
+        users = types.List()
+
+        for i in r:
+            users.append(types.User._parse(self, i))
+
+        return users if is_iterable else users[0]
diff --git a/pyrogram/methods/users/set_birthdate.py b/pyrogram/methods/users/set_birthdate.py
new file mode 100644
index 0000000000..fc242c66bb
--- /dev/null
+++ b/pyrogram/methods/users/set_birthdate.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import raw, types
+
+
+class SetBirthdate:
+    async def set_birthdate(
+        self: "pyrogram.Client",
+        birthdate: Optional["types.Birthdate"] = None
+    ) -> bool:
+        """Changes the birthdate of the current user 
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            birthdate (:obj:`~pyrogram.types.Birthdate`, *optional*):
+                The new value of the current user's birthdate; pass None to remove the birthdate
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                # Update your birthdate
+                await app.set_birthdate(birthdate=types.Birthdate(
+                    day=15,
+                    month=12,
+                    year=2017
+                ))
+
+                # Remove your birthdate
+                await app.set_birthdate()
+
+        """
+
+        return bool(
+            await self.invoke(
+                raw.functions.account.UpdateBirthday(
+                    birthday=birthdate.write() if birthdate else None
+                )
+            )
+        )
diff --git a/pyrogram/methods/users/set_emoji_status.py b/pyrogram/methods/users/set_emoji_status.py
new file mode 100644
index 0000000000..2d8c77cc02
--- /dev/null
+++ b/pyrogram/methods/users/set_emoji_status.py
@@ -0,0 +1,58 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import raw, types
+
+
+class SetEmojiStatus:
+    async def set_emoji_status(
+        self: "pyrogram.Client",
+        emoji_status: Optional["types.EmojiStatus"] = None
+    ) -> bool:
+        """Set the emoji status.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            emoji_status (:obj:`~pyrogram.types.EmojiStatus`, *optional*):
+                The emoji status to set. None to remove.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import types
+
+                await app.set_emoji_status(types.EmojiStatus(custom_emoji_id=1234567890987654321))
+        """
+        await self.invoke(
+            raw.functions.account.UpdateEmojiStatus(
+                emoji_status=(
+                    emoji_status.write()
+                    if emoji_status
+                    else raw.types.EmojiStatusEmpty()
+                )
+            )
+        )
+
+        return True
diff --git a/pyrogram/methods/users/set_personal_chat.py b/pyrogram/methods/users/set_personal_chat.py
new file mode 100644
index 0000000000..7813916725
--- /dev/null
+++ b/pyrogram/methods/users/set_personal_chat.py
@@ -0,0 +1,59 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, Union
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetPersonalChat:
+    async def set_personal_chat(
+        self: "pyrogram.Client",
+        chat_id: Optional[Union[int, str]] = None,
+    ) -> bool:
+        """Changes the personal chat of the current user
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            chat_id (``int`` | ``str``, *optional*):
+                Identifier of the new personal chat; pass None to remove the chat. Use :meth:`~pyrogram.Client.get_created_chats` with ``is_suitable_for_my_personal_chat`` to get suitable chats
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                # Update your personal chat
+                await app.set_personal_chat(chat_id="@Pyrogram")
+
+                # Hide your personal chat
+                await app.set_personal_chat()
+        """
+
+        return bool(
+            await self.invoke(
+                raw.functions.account.UpdatePersonalChannel(
+                    channel=await self.resolve_peer(
+                        chat_id
+                    ) if chat_id else raw.types.InputChannelEmpty()
+                )
+            )
+        )
diff --git a/pyrogram/methods/users/set_profile_photo.py b/pyrogram/methods/users/set_profile_photo.py
new file mode 100644
index 0000000000..59f5e88187
--- /dev/null
+++ b/pyrogram/methods/users/set_profile_photo.py
@@ -0,0 +1,87 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, BinaryIO
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetProfilePhoto:
+    async def set_profile_photo(
+        self: "pyrogram.Client",
+        *,
+        photo: Union[str, BinaryIO] = None,
+        video: Union[str, BinaryIO] = None,
+        public: bool = False,
+        for_my_bot: Union[int, str] = None,
+        photo_frame_start_timestamp: float = None
+    ) -> bool:
+        """Set a new profile photo or video (H.264/MPEG-4 AVC video, max 5 seconds).
+
+        The ``photo`` and ``video`` arguments are mutually exclusive.
+        Pass either one as named argument (see examples below).
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            photo (``str`` | ``BinaryIO``, *optional*):
+                Profile photo to set.
+                Pass a file path as string to upload a new photo that exists on your local machine or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+
+            video (``str`` | ``BinaryIO``, *optional*):
+                Profile video to set.
+                Pass a file path as string to upload a new video that exists on your local machine or
+                pass a binary file-like object with its attribute ".name" set for in-memory uploads.
+
+            public (``bool``, *optional*):
+                Pass True to upload a public profile photo for users who are restricted from viewing your real profile photos due to your privacy settings.
+                Defaults to False.
+
+            for_my_bot (``int`` | ``str``, *optional*):
+                Unique identifier (int) or username (str) of the bot for which profile photo has to be updated instead of the current user.
+                The bot should have ``can_be_edited`` property set to True.
+
+            photo_frame_start_timestamp (``float``, *optional*):
+                Floating point UNIX timestamp in seconds, indicating the frame of the video/sticker that should be used as static preview; can only be used if ``video`` or ``video_emoji_markup`` is set.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                # Set a new profile photo
+                await app.set_profile_photo(photo="new_photo.jpg")
+
+                # Set a new profile video
+                await app.set_profile_photo(video="new_video.mp4")
+        """
+
+        return bool(
+            await self.invoke(
+                raw.functions.photos.UploadProfilePhoto(
+                    fallback=public,
+                    file=await self.save_file(photo),
+                    video=await self.save_file(video),
+                    bot=await self.resolve_peer(for_my_bot) if for_my_bot else None,
+                    video_start_ts=photo_frame_start_timestamp
+                )
+            )
+        )
diff --git a/pyrogram/methods/users/set_username.py b/pyrogram/methods/users/set_username.py
new file mode 100644
index 0000000000..d336628eec
--- /dev/null
+++ b/pyrogram/methods/users/set_username.py
@@ -0,0 +1,57 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import raw
+
+
+class SetUsername:
+    async def set_username(
+        self: "pyrogram.Client",
+        username: Optional[str]
+    ) -> bool:
+        """Set 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 set a channel or supergroup username you can use
+        :meth:`~pyrogram.Client.set_chat_username`.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            username (``str`` | ``None``):
+                Username to set. "" (empty string) or None to remove it.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                await app.set_username("new_username")
+        """
+
+        return bool(
+            await self.invoke(
+                raw.functions.account.UpdateUsername(
+                    username=username or ""
+                )
+            )
+        )
diff --git a/pyrogram/methods/users/unblock_user.py b/pyrogram/methods/users/unblock_user.py
new file mode 100644
index 0000000000..146d719d25
--- /dev/null
+++ b/pyrogram/methods/users/unblock_user.py
@@ -0,0 +1,59 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+
+class UnblockUser:
+    async def unblock_user(
+        self: "pyrogram.Client",
+        user_id: Union[int, str],
+        my_stories_from: bool = None
+    ) -> bool:
+        """Unblock a user.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            user_id (``int`` | ``str``):
+                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).
+
+            my_stories_from (``bool``, *optional*):
+                Whether the peer should be removed from the story blocklist; if not set, the peer will be removed from the main blocklist.
+
+        Returns:
+            ``bool``: True on success
+
+        Example:
+            .. code-block:: python
+
+                await app.unblock_user(user_id)
+        """
+        return bool(
+            await self.invoke(
+                raw.functions.contacts.Unblock(
+                    id=await self.resolve_peer(user_id),
+                    my_stories_from=my_stories_from
+                )
+            )
+        )
diff --git a/pyrogram/methods/users/update_profile.py b/pyrogram/methods/users/update_profile.py
new file mode 100644
index 0000000000..6c10d16c9d
--- /dev/null
+++ b/pyrogram/methods/users/update_profile.py
@@ -0,0 +1,72 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class UpdateProfile:
+    async def update_profile(
+        self: "pyrogram.Client",
+        first_name: str = None,
+        last_name: str = None,
+        bio: str = None
+    ) -> bool:
+        """Update your profile details such as first name, last name and bio.
+
+        You can omit the parameters you don't want to change.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            first_name (``str``, *optional*):
+                The new first name.
+
+            last_name (``str``, *optional*):
+                The new last name.
+                Pass "" (empty string) to remove it.
+
+            bio (``str``, *optional*):
+                The new bio, also known as "about". Max 70 characters.
+                Pass "" (empty string) to remove it.
+
+        Returns:
+            ``bool``: True on success.
+
+        Example:
+            .. code-block:: python
+
+                # Update your first name only
+                await app.update_profile(first_name="Pyrogram")
+
+                # Update first name and bio
+                await app.update_profile(first_name="Pyrogram", bio="https://docs.pyrogram.org/")
+
+                # Remove the last name
+                await app.update_profile(last_name="")
+        """
+
+        return bool(
+            await self.invoke(
+                raw.functions.account.UpdateProfile(
+                    first_name=first_name,
+                    last_name=last_name,
+                    about=bio
+                )
+            )
+        )
diff --git a/pyrogram/methods/users/update_status.py b/pyrogram/methods/users/update_status.py
new file mode 100644
index 0000000000..841bee202c
--- /dev/null
+++ b/pyrogram/methods/users/update_status.py
@@ -0,0 +1,46 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+
+class UpdateStatus:
+    async def update_status(
+        self: "pyrogram.Client",
+        offline: bool = False,
+    ) -> bool:
+        """Updates online user status.
+
+        .. include:: /_includes/usable-by/users.rst
+
+        Parameters:
+            offline (``bool``):
+                If (True) is transmitted, user status will change to (UserStatusOffline), Otherwise user status will change to (UserStatusOnline).
+
+        Returns:
+            `bool`: True On success.
+
+        Example:
+            .. code-block:: python
+
+                await app.update_status()
+        """
+        r = await self.invoke(raw.functions.account.UpdateStatus(offline=offline))
+
+        return bool(r)
diff --git a/pyrogram/methods/utilities/__init__.py b/pyrogram/methods/utilities/__init__.py
new file mode 100644
index 0000000000..80a5f7419d
--- /dev/null
+++ b/pyrogram/methods/utilities/__init__.py
@@ -0,0 +1,39 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .add_handler import AddHandler
+from .export_session_string import ExportSessionString
+from .remove_handler import RemoveHandler
+from .restart import Restart
+from .run import Run
+from .start import Start
+from .stop import Stop
+from .stop_transmission import StopTransmission
+
+
+class Utilities(
+    AddHandler,
+    ExportSessionString,
+    RemoveHandler,
+    Restart,
+    Run,
+    Start,
+    Stop,
+    StopTransmission
+):
+    pass
diff --git a/pyrogram/methods/utilities/add_handler.py b/pyrogram/methods/utilities/add_handler.py
new file mode 100644
index 0000000000..136647d981
--- /dev/null
+++ b/pyrogram/methods/utilities/add_handler.py
@@ -0,0 +1,67 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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.handlers import DisconnectHandler
+from pyrogram.handlers.handler import Handler
+
+
+class AddHandler:
+    def add_handler(
+        self: "pyrogram.Client",
+        handler: "Handler",
+        group: int = 0
+    ):
+        """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). This mechanism is explained in greater details at
+        :doc:`More on Updates <../../topics/more-on-updates>`.
+
+        Parameters:
+            handler (``Handler``):
+                The handler to be registered.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+
+        Returns:
+            ``tuple``: A tuple consisting of *(handler, group)*.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import Client
+                from pyrogram.handlers import MessageHandler
+
+                async def hello(client, message):
+                    print(message)
+
+                app = Client("my_account")
+
+                app.add_handler(MessageHandler(hello))
+
+                app.run()
+        """
+        if isinstance(handler, DisconnectHandler):
+            self.disconnect_handler = handler.callback
+        else:
+            self.dispatcher.add_handler(handler, group)
+
+        return handler, group
diff --git a/pyrogram/methods/utilities/compose.py b/pyrogram/methods/utilities/compose.py
new file mode 100644
index 0000000000..e05773b8e1
--- /dev/null
+++ b/pyrogram/methods/utilities/compose.py
@@ -0,0 +1,78 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+from typing import List
+
+import pyrogram
+from .idle import idle
+
+
+async def compose(
+    clients: List["pyrogram.Client"],
+    sequential: bool = False
+):
+    """Run multiple clients at once.
+
+    This method can be used to run multiple clients at once and can be found directly in the ``pyrogram`` package.
+
+    If you want to run a single client, you can use Client's bound method :meth:`~pyrogram.Client.run`.
+
+    Parameters:
+        clients (List of :obj:`~pyrogram.Client`):
+            A list of client objects to run.
+
+        sequential (``bool``, *optional*):
+            Pass True to run clients sequentially.
+            Defaults to False (run clients concurrently)
+
+    Example:
+        .. code-block:: python
+
+            import asyncio
+            from pyrogram import Client, compose
+
+
+            async def main():
+                apps = [
+                    Client("account1"),
+                    Client("account2"),
+                    Client("account3")
+                ]
+
+                ...
+
+                await compose(apps)
+
+
+            asyncio.run(main())
+
+    """
+    if sequential:
+        for c in clients:
+            await c.start()
+    else:
+        await asyncio.gather(*[c.start() for c in clients])
+
+    await idle()
+
+    if sequential:
+        for c in clients:
+            await c.stop()
+    else:
+        await asyncio.gather(*[c.stop() for c in clients])
diff --git a/pyrogram/methods/utilities/export_session_string.py b/pyrogram/methods/utilities/export_session_string.py
new file mode 100644
index 0000000000..6529484d9b
--- /dev/null
+++ b/pyrogram/methods/utilities/export_session_string.py
@@ -0,0 +1,40 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+
+class ExportSessionString:
+    async def export_session_string(
+        self: "pyrogram.Client"
+    ):
+        """Export the current authorized session as a serialized string.
+
+        Session strings are useful for storing in-memory authorized sessions in a portable, serialized string.
+        More detailed information about session strings can be found at the dedicated page of
+        :doc:`Storage Engines <../../topics/storage-engines>`.
+
+        Returns:
+            ``str``: The session serialized into a printable, url-safe string.
+
+        Example:
+            .. code-block:: python
+
+                s = await app.export_session_string()
+        """
+        return await self.storage.export_session_string()
diff --git a/pyrogram/methods/utilities/idle.py b/pyrogram/methods/utilities/idle.py
new file mode 100644
index 0000000000..732cb032c0
--- /dev/null
+++ b/pyrogram/methods/utilities/idle.py
@@ -0,0 +1,87 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+import logging
+import signal
+from signal import signal as signal_fn, SIGINT, SIGTERM, SIGABRT
+
+log = logging.getLogger(__name__)
+
+# Signal number to name
+signals = {
+    k: v for v, k in signal.__dict__.items()
+    if v.startswith("SIG") and not v.startswith("SIG_")
+}
+
+
+async def idle():
+    """Block the main script execution until a signal is received.
+
+    This function will run indefinitely in order to block the main script execution and prevent it from
+    exiting while having client(s) that are still running in the background.
+
+    It is useful for event-driven application only, that are, applications which react upon incoming Telegram
+    updates through handlers, rather than executing a set of methods sequentially.
+
+    Once a signal is received (e.g.: from CTRL+C) the function will terminate and your main script will continue.
+    Don't forget to call :meth:`~pyrogram.Client.stop` for each running client before the script ends.
+
+    Example:
+        .. code-block:: python
+
+            import asyncio
+            from pyrogram import Client, idle
+
+
+            async def main():
+                apps = [
+                    Client("account1"),
+                    Client("account2"),
+                    Client("account3")
+                ]
+
+                ...  # Set up handlers
+
+                for app in apps:
+                    await app.start()
+
+                await idle()
+
+                for app in apps:
+                    await app.stop()
+
+
+            asyncio.run(main())
+    """
+    task = None
+
+    def signal_handler(signum, __):
+        logging.info(f"Stop signal received ({signals[signum]}). Exiting...")
+        asyncio.get_event_loop().run_in_executor(None, task.cancel)
+
+    for s in (SIGINT, SIGTERM, SIGABRT):
+        signal_fn(s, signal_handler)
+
+    while True:
+        task = asyncio.create_task(asyncio.sleep(600))
+
+        try:
+            await task
+        except asyncio.CancelledError:
+            break
diff --git a/pyrogram/methods/utilities/remove_handler.py b/pyrogram/methods/utilities/remove_handler.py
new file mode 100644
index 0000000000..9f1c974e69
--- /dev/null
+++ b/pyrogram/methods/utilities/remove_handler.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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.handlers import DisconnectHandler
+from pyrogram.handlers.handler import Handler
+
+
+class RemoveHandler:
+    def remove_handler(
+        self: "pyrogram.Client",
+        handler: "Handler",
+        group: int = 0
+    ):
+        """Remove a previously-registered update handler.
+
+        Make sure to provide the right group where the handler was added in. You can use the return value of the
+        :meth:`~pyrogram.Client.add_handler` method, a tuple of *(handler, group)*, and pass it directly.
+
+        Parameters:
+            handler (``Handler``):
+                The handler to be removed.
+
+            group (``int``, *optional*):
+                The group identifier, defaults to 0.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import Client
+                from pyrogram.handlers import MessageHandler
+
+                async def hello(client, message):
+                    print(message)
+
+                app = Client("my_account")
+
+                handler = app.add_handler(MessageHandler(hello))
+
+                # Starred expression to unpack (handler, group)
+                app.remove_handler(*handler)
+
+                app.run()
+        """
+        if isinstance(handler, DisconnectHandler):
+            self.disconnect_handler = None
+        else:
+            self.dispatcher.remove_handler(handler, group)
diff --git a/pyrogram/methods/utilities/restart.py b/pyrogram/methods/utilities/restart.py
new file mode 100644
index 0000000000..44fd6745ef
--- /dev/null
+++ b/pyrogram/methods/utilities/restart.py
@@ -0,0 +1,72 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+
+class Restart:
+    async def restart(
+        self: "pyrogram.Client",
+        block: bool = True
+    ):
+        """Restart the Client.
+
+        This method will first call :meth:`~pyrogram.Client.stop` and then :meth:`~pyrogram.Client.start` in a row in
+        order to restart a client using a single method.
+
+        Parameters:
+            block (``bool``, *optional*):
+                Blocks the code execution until the client has been restarted. It is useful with ``block=False`` in case
+                you want to restart the own client within an handler in order not to cause a deadlock.
+                Defaults to True.
+
+        Returns:
+            :obj:`~pyrogram.Client`: The restarted client itself.
+
+        Raises:
+            ConnectionError: In case you try to restart a stopped Client.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import Client
+
+                app = Client("my_account")
+
+
+                async def main():
+                    await app.start()
+                    ...  # Invoke API methods
+                    await app.restart()
+                    ...  # Invoke other API methods
+                    await app.stop()
+
+
+                app.run(main())
+        """
+
+        async def do_it():
+            await self.stop()
+            await self.start()
+
+        if block:
+            await do_it()
+        else:
+            self.loop.create_task(do_it())
+
+        return self
diff --git a/pyrogram/methods/utilities/run.py b/pyrogram/methods/utilities/run.py
new file mode 100644
index 0000000000..ec1bece320
--- /dev/null
+++ b/pyrogram/methods/utilities/run.py
@@ -0,0 +1,86 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+import inspect
+
+import pyrogram
+from pyrogram.methods.utilities.idle import idle
+
+
+class Run:
+    def run(
+        self: "pyrogram.Client",
+        coroutine=None
+    ):
+        """Start the client, idle the main script and finally stop the client.
+
+        When calling this method without any argument it acts as a convenience method that calls
+        :meth:`~pyrogram.Client.start`, :meth:`~pyrogram.idle` and :meth:`~pyrogram.Client.stop` in sequence.
+        It makes running a single client less verbose.
+
+        In case a coroutine is passed as argument, runs the coroutine until it's completed and doesn't do any client
+        operation. This is almost the same as :py:obj:`asyncio.run` except for the fact that Pyrogram's ``run`` uses the
+        current event loop instead of a new one.
+
+        If you want to run multiple clients at once, see :meth:`pyrogram.compose`.
+
+        Parameters:
+            coroutine (``Coroutine``, *optional*):
+                Pass a coroutine to run it until it completes.
+
+        Raises:
+            ConnectionError: In case you try to run an already started client.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import Client
+
+                app = Client("my_account")
+                ...  # Set handlers up
+                app.run()
+
+            .. code-block:: python
+
+                from pyrogram import Client
+
+                app = Client("my_account")
+
+
+                async def main():
+                    async with app:
+                        print(await app.get_me())
+
+
+                app.run(main())
+        """
+        loop = asyncio.get_event_loop()
+        run = loop.run_until_complete
+
+        if coroutine is not None:
+            run(coroutine)
+        else:
+            if inspect.iscoroutinefunction(self.start):
+                run(self.start())
+                run(idle())
+                run(self.stop())
+            else:
+                self.start()
+                run(idle())
+                self.stop()
diff --git a/pyrogram/methods/utilities/start.py b/pyrogram/methods/utilities/start.py
new file mode 100644
index 0000000000..d8314da182
--- /dev/null
+++ b/pyrogram/methods/utilities/start.py
@@ -0,0 +1,76 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+log = logging.getLogger(__name__)
+
+
+class Start:
+    async def start(
+        self: "pyrogram.Client"
+    ):
+        """Start the client.
+
+        This method connects the client to Telegram and, in case of new sessions, automatically manages the
+        authorization process using an interactive prompt.
+
+        Returns:
+            :obj:`~pyrogram.Client`: The started client itself.
+
+        Raises:
+            ConnectionError: In case you try to start an already started client.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import Client
+
+                app = Client("my_account")
+
+
+                async def main():
+                    await app.start()
+                    ...  # Invoke API methods
+                    await app.stop()
+
+
+                app.run(main())
+        """
+        is_authorized = await self.connect()
+
+        try:
+            if not is_authorized:
+                await self.authorize()
+
+            if not await self.storage.is_bot() and self.takeout:
+                self.takeout_id = (await self.invoke(raw.functions.account.InitTakeoutSession())).id
+                log.info("Takeout session %s initiated", self.takeout_id)
+
+            await self.invoke(raw.functions.updates.GetState())
+        except (Exception, KeyboardInterrupt):
+            await self.disconnect()
+            raise
+        else:
+            self.me = await self.get_me()
+            await self.initialize()
+
+            return self
diff --git a/pyrogram/methods/utilities/stop.py b/pyrogram/methods/utilities/stop.py
new file mode 100644
index 0000000000..1b28add046
--- /dev/null
+++ b/pyrogram/methods/utilities/stop.py
@@ -0,0 +1,69 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+
+class Stop:
+    async def stop(
+        self: "pyrogram.Client",
+        block: bool = True
+    ):
+        """Stop the Client.
+
+        This method disconnects the client from Telegram and stops the underlying tasks.
+
+        Parameters:
+            block (``bool``, *optional*):
+                Blocks the code execution until the client has been stopped. It is useful with ``block=False`` in case
+                you want to stop the own client *within* a handler in order not to cause a deadlock.
+                Defaults to True.
+
+        Returns:
+            :obj:`~pyrogram.Client`: The stopped client itself.
+
+        Raises:
+            ConnectionError: In case you try to stop an already stopped client.
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import Client
+
+                app = Client("my_account")
+
+
+                async def main():
+                    await app.start()
+                    ...  # Invoke API methods
+                    await app.stop()
+
+
+                app.run(main())
+        """
+
+        async def do_it():
+            await self.terminate()
+            await self.disconnect()
+
+        if block:
+            await do_it()
+        else:
+            self.loop.create_task(do_it())
+
+        return self
diff --git a/pyrogram/methods/utilities/stop_transmission.py b/pyrogram/methods/utilities/stop_transmission.py
new file mode 100644
index 0000000000..da64569523
--- /dev/null
+++ b/pyrogram/methods/utilities/stop_transmission.py
@@ -0,0 +1,43 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+
+class StopTransmission:
+    def stop_transmission(self):
+        """Stop downloading or uploading a file.
+
+        This method must be called inside a progress callback function in order to stop the transmission at the
+        desired time. The progress callback is called every time a file chunk is uploaded/downloaded.
+
+        Example:
+            .. code-block:: python
+
+                # Stop transmission once the upload progress reaches 50%
+                async def progress(current, total, client):
+                    if (current * 100 / total) > 50:
+                        client.stop_transmission()
+
+                async with app:
+                    await app.send_document(
+                        "me", "file.zip",
+                        progress=progress,
+                        progress_args=(app,))
+        """
+        raise pyrogram.StopTransmission
diff --git a/pyrogram/mime_types.py b/pyrogram/mime_types.py
new file mode 100644
index 0000000000..a853bd715b
--- /dev/null
+++ b/pyrogram/mime_types.py
@@ -0,0 +1,1884 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types.
+# Extended with extra mime types specific to Telegram.
+
+mime_types = """
+# 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 redistribution.
+#
+# 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
+# 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.slides		ggs
+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/wasm				wasm
+# 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					mpga mp2 mp2a mp3 m2a m3a
+# audio/mpeg4-generic
+# audio/musepack
+audio/ogg					oga ogg spx opus
+# 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					jpeg jpg 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
+# 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					js mjs
+# 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					ts m2t m2ts mts
+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-bad-tgsticker		tgs
+application/x-tgsticker		tgs
+"""
diff --git a/pyrogram/parser/__init__.py b/pyrogram/parser/__init__.py
new file mode 100644
index 0000000000..00c7acae76
--- /dev/null
+++ b/pyrogram/parser/__init__.py
@@ -0,0 +1,19 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .parser import Parser
diff --git a/pyrogram/parser/html.py b/pyrogram/parser/html.py
new file mode 100644
index 0000000000..594feba04b
--- /dev/null
+++ b/pyrogram/parser/html.py
@@ -0,0 +1,251 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 html
+import logging
+import re
+from html.parser import HTMLParser
+from typing import Optional
+
+import pyrogram
+from pyrogram import raw
+from pyrogram.enums import MessageEntityType
+from pyrogram.errors import PeerIdInvalid
+from . import utils
+
+log = logging.getLogger(__name__)
+
+
+class Parser(HTMLParser):
+    MENTION_RE = re.compile(r"tg://user\?id=(\d+)")
+
+    def __init__(self, client: "pyrogram.Client"):
+        super().__init__()
+
+        self.client = client
+
+        self.text = ""
+        self.entities = []
+        self.tag_entities = {}
+
+    def handle_starttag(self, tag, attrs):
+        attrs = dict(attrs)
+        extra = {}
+
+        if tag in ["b", "strong"]:
+            entity = raw.types.MessageEntityBold
+        elif tag in ["i", "em"]:
+            entity = raw.types.MessageEntityItalic
+        elif tag == "u":
+            entity = raw.types.MessageEntityUnderline
+        elif tag in ["s", "del", "strike"]:
+            entity = raw.types.MessageEntityStrike
+        elif tag == "blockquote":
+            entity = raw.types.MessageEntityBlockquote
+            extra["collapsed"] = bool("expandable" in attrs.keys())
+        elif tag == "code":
+            entity = raw.types.MessageEntityCode
+        elif tag == "pre":
+            entity = raw.types.MessageEntityPre
+            extra["language"] = attrs.get("language", "")
+        elif tag == "spoiler":
+            entity = raw.types.MessageEntitySpoiler
+        elif tag == "a":
+            url = attrs.get("href", "")
+
+            mention = Parser.MENTION_RE.match(url)
+
+            if mention:
+                entity = raw.types.InputMessageEntityMentionName
+                extra["user_id"] = int(mention.group(1))
+            else:
+                entity = raw.types.MessageEntityTextUrl
+                extra["url"] = url
+        elif tag == "emoji":
+            entity = raw.types.MessageEntityCustomEmoji
+            custom_emoji_id = int(attrs.get("id"))
+            extra["document_id"] = custom_emoji_id
+        else:
+            return
+
+        if tag not in self.tag_entities:
+            self.tag_entities[tag] = []
+
+        self.tag_entities[tag].append(entity(offset=len(self.text), length=0, **extra))
+
+    def handle_data(self, data):
+        data = html.unescape(data)
+
+        for entities in self.tag_entities.values():
+            for entity in entities:
+                entity.length += len(data)
+
+        self.text += data
+
+    def handle_endtag(self, tag):
+        try:
+            self.entities.append(self.tag_entities[tag].pop())
+        except (KeyError, IndexError):
+            line, offset = self.getpos()
+            offset += 1
+
+            log.debug("Unmatched closing tag  at line %s:%s", tag, line, offset)
+        else:
+            if not self.tag_entities[tag]:
+                self.tag_entities.pop(tag)
+
+    def error(self, message):
+        pass
+
+
+class HTML:
+    def __init__(self, client: Optional["pyrogram.Client"]):
+        self.client = client
+
+    async def parse(self, text: str):
+        # Strip whitespaces from the beginning and the end, but preserve closing tags
+        text = re.sub(r"^\s*(<[\w<>=\s\"]*>)\s*", r"\1", text)
+        text = re.sub(r"\s*(]*>)\s*$", r"\1", text)
+
+        parser = Parser(self.client)
+        parser.feed(utils.add_surrogates(text))
+        parser.close()
+
+        if parser.tag_entities:
+            unclosed_tags = []
+
+            for tag, entities in parser.tag_entities.items():
+                unclosed_tags.append(f"<{tag}> (x{len(entities)})")
+
+            log.info("Unclosed tags: %s", ", ".join(unclosed_tags))
+
+        entities = []
+
+        for entity in parser.entities:
+            if isinstance(entity, raw.types.InputMessageEntityMentionName):
+                try:
+                    if self.client is not None:
+                        entity.user_id = await self.client.resolve_peer(entity.user_id)
+                except PeerIdInvalid:
+                    continue
+
+            entities.append(entity)
+
+        # Remove zero-length entities
+        entities = list(filter(lambda x: x.length > 0, entities))
+
+        return {
+            "message": utils.remove_surrogates(parser.text),
+            "entities": sorted(entities, key=lambda e: e.offset) or None
+        }
+
+    @staticmethod
+    def unparse(text: str, entities: list):
+        def parse_one(entity):
+            """
+            Parses a single entity and returns (start_tag, start), (end_tag, end)
+            """
+            entity_type = entity.type
+            start = entity.offset
+            end = start + entity.length
+
+            if entity_type in (
+                MessageEntityType.BOLD,
+                MessageEntityType.ITALIC,
+                MessageEntityType.UNDERLINE,
+                MessageEntityType.STRIKETHROUGH,
+            ):
+                name = entity_type.name[0].lower()
+                start_tag = f"<{name}>"
+                end_tag = f""
+            elif entity_type == MessageEntityType.PRE:
+                name = entity_type.name.lower()
+                language = getattr(entity, "language", "") or ""
+                start_tag = f'<{name} language="{language}">' if language else f"<{name}>"
+                end_tag = f""
+            elif entity_type == MessageEntityType.BLOCKQUOTE:
+                name = entity_type.name.lower()
+                start_tag = f"<{name}>"
+                end_tag = f""
+            elif entity_type == MessageEntityType.EXPANDABLE_BLOCKQUOTE:
+                name = "blockquote"
+                start_tag = f"<{name} expandable>"
+                end_tag = f""
+            elif entity_type in (
+                MessageEntityType.CODE,
+                MessageEntityType.SPOILER,
+            ):
+                name = entity_type.name.lower()
+                start_tag = f"<{name}>"
+                end_tag = f""
+            elif entity_type == MessageEntityType.TEXT_LINK:
+                url = entity.url
+                start_tag = f''
+                end_tag = ""
+            elif entity_type == MessageEntityType.TEXT_MENTION:
+                user = entity.user
+                start_tag = f''
+                end_tag = ""
+            elif entity_type == MessageEntityType.CUSTOM_EMOJI:
+                custom_emoji_id = entity.custom_emoji_id
+                start_tag = f''
+                end_tag = ""
+            else:
+                return
+
+            return (start_tag, start), (end_tag, end)
+
+        def recursive(entity_i: int) -> int:
+            """
+            Takes the index of the entity to start parsing from, returns the number of parsed entities inside it.
+            Uses entities_offsets as a stack, pushing (start_tag, start) first, then parsing nested entities,
+            and finally pushing (end_tag, end) to the stack.
+            No need to sort at the end.
+            """
+            this = parse_one(entities[entity_i])
+            if this is None:
+                return 1
+            (start_tag, start), (end_tag, end) = this
+            entities_offsets.append((start_tag, start))
+            internal_i = entity_i + 1
+            # while the next entity is inside the current one, keep parsing
+            while internal_i < len(entities) and entities[internal_i].offset < end:
+                internal_i += recursive(internal_i)
+            entities_offsets.append((end_tag, end))
+            return internal_i - entity_i
+
+        text = utils.add_surrogates(text)
+
+        entities_offsets = []
+
+        # probably useless because entities are already sorted by telegram
+        entities.sort(key=lambda e: (e.offset, -e.length))
+
+        # main loop for first-level entities
+        i = 0
+        while i < len(entities):
+            i += recursive(i)
+
+        if entities_offsets:
+            last_offset = entities_offsets[-1][1]
+            # no need to sort, but still add entities starting from the end
+            for entity, offset in reversed(entities_offsets):
+                text = text[:offset] + entity + html.escape(text[offset:last_offset]) + text[last_offset:]
+                last_offset = offset
+
+        return utils.remove_surrogates(text)
diff --git a/pyrogram/parser/markdown.py b/pyrogram/parser/markdown.py
new file mode 100644
index 0000000000..fdcf80f8f7
--- /dev/null
+++ b/pyrogram/parser/markdown.py
@@ -0,0 +1,241 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 html
+import logging
+import re
+from typing import Optional
+
+import pyrogram
+from pyrogram.enums import MessageEntityType
+from . import utils
+from .html import HTML
+
+BOLD_DELIM = "**"
+ITALIC_DELIM = "__"
+UNDERLINE_DELIM = "--"
+STRIKE_DELIM = "~~"
+SPOILER_DELIM = "||"
+CODE_DELIM = "`"
+PRE_DELIM = "```"
+BLOCKQUOTE_DELIM = ">"
+BLOCKQUOTE_EXPANDABLE_DELIM = "**>"
+
+MARKDOWN_RE = re.compile(r"({d})|(!?)\[(.+?)\]\((.+?)\)".format(
+    d="|".join(
+        ["".join(i) for i in [
+            [rf"\{j}" for j in i]
+            for i in [
+                PRE_DELIM,
+                CODE_DELIM,
+                STRIKE_DELIM,
+                UNDERLINE_DELIM,
+                ITALIC_DELIM,
+                BOLD_DELIM,
+                SPOILER_DELIM
+            ]
+        ]]
+    )))
+
+OPENING_TAG = "<{}>"
+CLOSING_TAG = ""
+URL_MARKUP = '{}'
+EMOJI_MARKUP = '{}'
+FIXED_WIDTH_DELIMS = [CODE_DELIM, PRE_DELIM]
+
+
+class Markdown:
+    def __init__(self, client: Optional["pyrogram.Client"]):
+        self.html = HTML(client)
+
+    def _parse_blockquotes(self, text: str):
+        text = html.unescape(text)
+        lines = text.split('\n')
+        result = []
+        in_blockquote = False
+        is_expandable_blockquote = False
+        current_blockquote = []
+
+        for line in lines:
+            if line.startswith(BLOCKQUOTE_DELIM):
+                in_blockquote = True
+                current_blockquote.append(line[1:].strip())
+            elif line.startswith(BLOCKQUOTE_EXPANDABLE_DELIM):
+                in_blockquote = True
+                is_expandable_blockquote = True
+                current_blockquote.append(line[3:].strip())
+            else:
+                if in_blockquote:
+                    in_blockquote = False
+                    result.append(
+                        (f"
" if is_expandable_blockquote else OPENING_TAG.format("blockquote")) + + '\n'.join(current_blockquote) + + CLOSING_TAG.format("blockquote") + ) + current_blockquote = [] + result.append(line) + + if in_blockquote: + result.append( + (f"
" if is_expandable_blockquote else OPENING_TAG.format("blockquote")) + + '\n'.join(current_blockquote) + + CLOSING_TAG.format("blockquote") + ) + return '\n'.join(result) + + async def parse(self, text: str, strict: bool = False): + if strict: + text = html.escape(text) + + + text = self._parse_blockquotes(text) + + text = self._parse_blockquotes(text) + + delims = set() + is_fixed_width = False + + for i, match in enumerate(re.finditer(MARKDOWN_RE, text)): + start, _ = match.span() + delim, is_emoji, text_url, url = match.groups() + full = match.group(0) + + if delim in FIXED_WIDTH_DELIMS: + is_fixed_width = not is_fixed_width + + if is_fixed_width and delim not in FIXED_WIDTH_DELIMS: + continue + + if not is_emoji and text_url: + text = utils.replace_once(text, full, URL_MARKUP.format(url, text_url), start) + continue + + if is_emoji: + emoji = text_url + emoji_id = url.lstrip("tg://emoji?id=") + text = utils.replace_once(text, full, EMOJI_MARKUP.format(emoji_id, emoji), start) + continue + + if delim == BOLD_DELIM: + tag = "b" + elif delim == ITALIC_DELIM: + tag = "i" + elif delim == UNDERLINE_DELIM: + tag = "u" + elif delim == STRIKE_DELIM: + tag = "s" + elif delim == CODE_DELIM: + tag = "code" + elif delim == PRE_DELIM: + tag = "pre" + elif delim == SPOILER_DELIM: + tag = "spoiler" + else: + continue + + if delim not in delims: + delims.add(delim) + tag = OPENING_TAG.format(tag) + else: + delims.remove(delim) + tag = CLOSING_TAG.format(tag) + + if delim == PRE_DELIM and delim in delims: + delim_and_language = text[text.find(PRE_DELIM):].split("\n")[0] + language = delim_and_language[len(PRE_DELIM):] + text = utils.replace_once(text, delim_and_language, f'
', start)
+                continue
+
+            text = utils.replace_once(text, delim, tag, start)
+
+        return await self.html.parse(text)
+
+    @staticmethod
+    def unparse(text: str, entities: list):
+        text = utils.add_surrogates(text)
+
+        entities_offsets = []
+
+        for entity in entities:
+            entity_type = entity.type
+            start = entity.offset
+            end = start + entity.length
+
+            if entity_type == MessageEntityType.BOLD:
+                start_tag = end_tag = BOLD_DELIM
+            elif entity_type == MessageEntityType.ITALIC:
+                start_tag = end_tag = ITALIC_DELIM
+            elif entity_type == MessageEntityType.UNDERLINE:
+                start_tag = end_tag = UNDERLINE_DELIM
+            elif entity_type == MessageEntityType.STRIKETHROUGH:
+                start_tag = end_tag = STRIKE_DELIM
+            elif entity_type == MessageEntityType.CODE:
+                start_tag = end_tag = CODE_DELIM
+            elif entity_type == MessageEntityType.PRE:
+                language = getattr(entity, "language", "") or ""
+                start_tag = f"{PRE_DELIM}{language}\n"
+                end_tag = f"\n{PRE_DELIM}"
+            elif entity_type == MessageEntityType.BLOCKQUOTE:
+                start_tag = BLOCKQUOTE_DELIM + " "
+                end_tag = ""
+                blockquote_text = text[start:end]
+                lines = blockquote_text.split("\n")
+                last_length = 0
+                for line in lines:
+                    if len(line) == 0 and last_length == end:
+                        continue
+                    start_offset = start+last_length
+                    last_length = last_length+len(line)
+                    end_offset = start_offset+last_length
+                    entities_offsets.append((start_tag, start_offset,))
+                    entities_offsets.append((end_tag, end_offset,))
+                    last_length = last_length+1
+                continue
+            elif entity_type == MessageEntityType.SPOILER:
+                start_tag = end_tag = SPOILER_DELIM
+            elif entity_type == MessageEntityType.TEXT_LINK:
+                url = entity.url
+                start_tag = "["
+                end_tag = f"]({url})"
+            elif entity_type == MessageEntityType.TEXT_MENTION:
+                user = entity.user
+                start_tag = "["
+                end_tag = f"](tg://user?id={user.id})"
+            elif entity_type == MessageEntityType.CUSTOM_EMOJI:
+                emoji_id = entity.custom_emoji_id
+                start_tag = "!["
+                end_tag = f"](tg://emoji?id={emoji_id})"
+            else:
+                continue
+
+            entities_offsets.append((start_tag, start,))
+            entities_offsets.append((end_tag, end,))
+
+        entities_offsets = map(
+            lambda x: x[1],
+            sorted(
+                enumerate(entities_offsets),
+                key=lambda x: (x[1][1], x[0]),
+                reverse=True
+            )
+        )
+
+        for entity, offset in entities_offsets:
+            text = text[:offset] + entity + text[offset:]
+
+        return utils.remove_surrogates(text)
diff --git a/pyrogram/parser/parser.py b/pyrogram/parser/parser.py
new file mode 100644
index 0000000000..0ce2b2375c
--- /dev/null
+++ b/pyrogram/parser/parser.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import enums
+from .html import HTML
+from .markdown import Markdown
+
+
+class Parser:
+    def __init__(self, client: Optional["pyrogram.Client"]):
+        self.client = client
+        self.html = HTML(client)
+        self.markdown = Markdown(client)
+
+    async def parse(self, text: str, mode: Optional[enums.ParseMode] = None):
+        text = str(text if text else "").strip()
+
+        if mode is None:
+            if self.client:
+                mode = self.client.parse_mode
+            else:
+                mode = enums.ParseMode.DEFAULT
+
+        if mode == enums.ParseMode.DEFAULT:
+            return await self.markdown.parse(text)
+
+        if mode == enums.ParseMode.MARKDOWN:
+            return await self.markdown.parse(text, True)
+
+        if mode == enums.ParseMode.HTML:
+            return await self.html.parse(text)
+
+        if mode == enums.ParseMode.DISABLED:
+            return {"message": text, "entities": None}
+
+        raise ValueError(f'Invalid parse mode "{mode}"')
+
+    @staticmethod
+    def unparse(text: str, entities: list, is_html: bool):
+        if is_html:
+            return HTML.unparse(text, entities)
+        else:
+            return Markdown.unparse(text, entities)
diff --git a/pyrogram/parser/utils.py b/pyrogram/parser/utils.py
new file mode 100644
index 0000000000..32c81707f6
--- /dev/null
+++ b/pyrogram/parser/utils.py
@@ -0,0 +1,41 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 re
+from struct import unpack
+
+# SMP = Supplementary Multilingual Plane: https://en.wikipedia.org/wiki/Plane_(Unicode)#Overview
+SMP_RE = re.compile(r"[\U00010000-\U0010FFFF]")
+
+
+def add_surrogates(text):
+    # Replace each SMP code point with a surrogate pair
+    return SMP_RE.sub(
+        lambda match:  # Split SMP in two surrogates
+        "".join(chr(i) for i in 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 .
+
+from importlib import import_module
+
+from . import types, functions, base, core
+from .all import objects
+
+for k, v in objects.items():
+    path, name = v.rsplit(".", 1)
+    objects[k] = getattr(import_module(path), name)
diff --git a/pyrogram/raw/core/__init__.py b/pyrogram/raw/core/__init__.py
new file mode 100644
index 0000000000..95c8123104
--- /dev/null
+++ b/pyrogram/raw/core/__init__.py
@@ -0,0 +1,31 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .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 .primitives.bool import Bool, BoolFalse, BoolTrue
+from .primitives.bytes import Bytes
+from .primitives.double import Double
+from .primitives.int import Int, Long, Int128, Int256
+from .primitives.string import String
+from .primitives.vector import Vector
+from .tl_object import TLObject
diff --git a/pyrogram/raw/core/future_salt.py b/pyrogram/raw/core/future_salt.py
new file mode 100644
index 0000000000..ecef5e2ff3
--- /dev/null
+++ b/pyrogram/raw/core/future_salt.py
@@ -0,0 +1,53 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from typing import Any
+
+from .primitives.int import Int, Long
+from .tl_object import TLObject
+
+
+class FutureSalt(TLObject):
+    ID = 0x0949D9DC
+
+    __slots__ = ["valid_since", "valid_until", "salt"]
+
+    QUALNAME = "FutureSalt"
+
+    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(data: BytesIO, *args: Any) -> "FutureSalt":
+        valid_since = Int.read(data)
+        valid_until = Int.read(data)
+        salt = Long.read(data)
+
+        return FutureSalt(valid_since, valid_until, salt)
+
+    def write(self, *args: Any) -> bytes:
+        b = BytesIO()
+
+        b.write(Int(self.valid_since))
+        b.write(Int(self.valid_until))
+        b.write(Long(self.salt))
+
+        return b.getvalue()
diff --git a/pyrogram/raw/core/future_salts.py b/pyrogram/raw/core/future_salts.py
new file mode 100644
index 0000000000..88216387f2
--- /dev/null
+++ b/pyrogram/raw/core/future_salts.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from typing import Any, List
+
+from .future_salt import FutureSalt
+from .primitives.int import Int, Long
+from .tl_object import TLObject
+
+
+class FutureSalts(TLObject):
+    ID = 0xAE500895
+
+    __slots__ = ["req_msg_id", "now", "salts"]
+
+    QUALNAME = "FutureSalts"
+
+    def __init__(self, req_msg_id: int, now: int, salts: List[FutureSalt]):
+        self.req_msg_id = req_msg_id
+        self.now = now
+        self.salts = salts
+
+    @staticmethod
+    def read(data: BytesIO, *args: Any) -> "FutureSalts":
+        req_msg_id = Long.read(data)
+        now = Int.read(data)
+
+        count = Int.read(data)
+        salts = [FutureSalt.read(data) for _ in range(count)]
+
+        return FutureSalts(req_msg_id, now, salts)
+
+    def write(self, *args: Any) -> bytes:
+        b = BytesIO()
+
+        b.write(Int(self.ID, False))
+
+        b.write(Long(self.req_msg_id))
+        b.write(Int(self.now))
+
+        count = len(self.salts)
+        b.write(Int(count))
+
+        for salt in self.salts:
+            b.write(salt.write())
+
+        return b.getvalue()
diff --git a/pyrogram/raw/core/gzip_packed.py b/pyrogram/raw/core/gzip_packed.py
new file mode 100644
index 0000000000..685594d87a
--- /dev/null
+++ b/pyrogram/raw/core/gzip_packed.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 gzip import compress, decompress
+from io import BytesIO
+from typing import cast, Any
+
+from .primitives.bytes import Bytes
+from .primitives.int import Int
+from .tl_object import TLObject
+
+
+class GzipPacked(TLObject):
+    ID = 0x3072CFA1
+
+    __slots__ = ["packed_data"]
+
+    QUALNAME = "GzipPacked"
+
+    def __init__(self, packed_data: TLObject):
+        self.packed_data = packed_data
+
+    @staticmethod
+    def read(data: BytesIO, *args: Any) -> "GzipPacked":
+        # Return the Object itself instead of a GzipPacked wrapping it
+        return cast(GzipPacked, TLObject.read(
+            BytesIO(
+                decompress(
+                    Bytes.read(data)
+                )
+            )
+        ))
+
+    def write(self, *args: Any) -> bytes:
+        b = BytesIO()
+
+        b.write(Int(self.ID, False))
+
+        b.write(
+            Bytes(
+                compress(
+                    self.packed_data.write()
+                )
+            )
+        )
+
+        return b.getvalue()
diff --git a/pyrogram/raw/core/list.py b/pyrogram/raw/core/list.py
new file mode 100644
index 0000000000..a7bbc16b2e
--- /dev/null
+++ b/pyrogram/raw/core/list.py
@@ -0,0 +1,26 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 as TList, Any
+
+from .tl_object import TLObject
+
+
+class List(TList[Any], TLObject):
+    def __repr__(self) -> str:
+        return f"pyrogram.raw.core.List([{','.join(TLObject.__repr__(i) for i in self)}])"
diff --git a/pyrogram/raw/core/message.py b/pyrogram/raw/core/message.py
new file mode 100644
index 0000000000..1357cf8690
--- /dev/null
+++ b/pyrogram/raw/core/message.py
@@ -0,0 +1,56 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from typing import Any
+
+from .primitives.int import Int, Long
+from .tl_object import TLObject
+
+
+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: TLObject, msg_id: int, seq_no: int, length: int):
+        self.msg_id = msg_id
+        self.seq_no = seq_no
+        self.length = length
+        self.body = body
+
+    @staticmethod
+    def read(data: BytesIO, *args: Any) -> "Message":
+        msg_id = Long.read(data)
+        seq_no = Int.read(data)
+        length = Int.read(data)
+        body = data.read(length)
+
+        return Message(TLObject.read(BytesIO(body)), msg_id, seq_no, length)
+
+    def write(self, *args: Any) -> bytes:
+        b = BytesIO()
+
+        b.write(Long(self.msg_id))
+        b.write(Int(self.seq_no))
+        b.write(Int(self.length))
+        b.write(self.body.write())
+
+        return b.getvalue()
diff --git a/pyrogram/raw/core/msg_container.py b/pyrogram/raw/core/msg_container.py
new file mode 100644
index 0000000000..454a150741
--- /dev/null
+++ b/pyrogram/raw/core/msg_container.py
@@ -0,0 +1,53 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from typing import List, Any
+
+from .message import Message
+from .primitives.int import Int
+from .tl_object import TLObject
+
+
+class MsgContainer(TLObject):
+    ID = 0x73F1F8DC
+
+    __slots__ = ["messages"]
+
+    QUALNAME = "MsgContainer"
+
+    def __init__(self, messages: List[Message]):
+        self.messages = messages
+
+    @staticmethod
+    def read(data: BytesIO, *args: Any) -> "MsgContainer":
+        count = Int.read(data)
+        return MsgContainer([Message.read(data) for _ in range(count)])
+
+    def write(self, *args: Any) -> bytes:
+        b = BytesIO()
+
+        b.write(Int(self.ID, False))
+
+        count = len(self.messages)
+        b.write(Int(count))
+
+        for message in self.messages:
+            b.write(message.write())
+
+        return b.getvalue()
diff --git a/pyrogram/raw/core/primitives/__init__.py b/pyrogram/raw/core/primitives/__init__.py
new file mode 100644
index 0000000000..88f2fa5363
--- /dev/null
+++ b/pyrogram/raw/core/primitives/__init__.py
@@ -0,0 +1,24 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .bool import Bool, BoolFalse, BoolTrue
+from .bytes import Bytes
+from .double import Double
+from .int import Int, Long, Int128, Int256
+from .string import String
+from .vector import Vector
diff --git a/pyrogram/raw/core/primitives/bool.py b/pyrogram/raw/core/primitives/bool.py
new file mode 100644
index 0000000000..02cc12d131
--- /dev/null
+++ b/pyrogram/raw/core/primitives/bool.py
@@ -0,0 +1,48 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from typing import Any
+
+from ..tl_object import TLObject
+
+
+class BoolFalse(bytes, TLObject):
+    ID = 0xBC799737
+    value = False
+
+    @classmethod
+    def read(cls, *args: Any) -> bool:
+        return cls.value
+
+    def __new__(cls) -> bytes:  # type: ignore
+        return cls.ID.to_bytes(4, "little")
+
+
+class BoolTrue(BoolFalse):
+    ID = 0x997275B5
+    value = True
+
+
+class Bool(bytes, TLObject):
+    @classmethod
+    def read(cls, data: BytesIO, *args: Any) -> bool:
+        return int.from_bytes(data.read(4), "little") == BoolTrue.ID
+
+    def __new__(cls, value: bool) -> bytes:  # type: ignore
+        return BoolTrue() if value else BoolFalse()
diff --git a/pyrogram/raw/core/primitives/bytes.py b/pyrogram/raw/core/primitives/bytes.py
new file mode 100644
index 0000000000..eace1feb99
--- /dev/null
+++ b/pyrogram/raw/core/primitives/bytes.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from typing import Any
+
+from ..tl_object import TLObject
+
+
+class Bytes(bytes, TLObject):
+    @classmethod
+    def read(cls, data: BytesIO, *args: Any) -> bytes:
+        length = int.from_bytes(data.read(1), "little")
+
+        if length <= 253:
+            x = data.read(length)
+            data.read(-(length + 1) % 4)
+        else:
+            length = int.from_bytes(data.read(3), "little")
+            x = data.read(length)
+            data.read(-length % 4)
+
+        return x
+
+    def __new__(cls, value: bytes) -> bytes:  # type: ignore
+        length = len(value)
+
+        if length <= 253:
+            return (
+                bytes([length])
+                + value
+                + bytes(-(length + 1) % 4)
+            )
+        else:
+            return (
+                bytes([254])
+                + length.to_bytes(3, "little")
+                + value
+                + bytes(-length % 4)
+            )
diff --git a/pyrogram/raw/core/primitives/double.py b/pyrogram/raw/core/primitives/double.py
new file mode 100644
index 0000000000..bb7878bf1e
--- /dev/null
+++ b/pyrogram/raw/core/primitives/double.py
@@ -0,0 +1,32 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from struct import unpack, pack
+from typing import cast, Any
+
+from ..tl_object import TLObject
+
+
+class Double(bytes, TLObject):
+    @classmethod
+    def read(cls, data: BytesIO, *args: Any) -> float:
+        return cast(float, unpack("d", data.read(8))[0])
+
+    def __new__(cls, value: float) -> bytes:  # type: ignore
+        return pack("d", value)
diff --git a/pyrogram/raw/core/primitives/int.py b/pyrogram/raw/core/primitives/int.py
new file mode 100644
index 0000000000..5d5ec177d1
--- /dev/null
+++ b/pyrogram/raw/core/primitives/int.py
@@ -0,0 +1,45 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from typing import Any
+
+from ..tl_object import TLObject
+
+
+class Int(bytes, TLObject):
+    SIZE = 4
+
+    @classmethod
+    def read(cls, data: BytesIO, signed: bool = True, *args: Any) -> int:
+        return int.from_bytes(data.read(cls.SIZE), "little", signed=signed)
+
+    def __new__(cls, value: int, signed: bool = True) -> bytes:  # type: ignore
+        return value.to_bytes(cls.SIZE, "little", signed=signed)
+
+
+class Long(Int):
+    SIZE = 8
+
+
+class Int128(Int):
+    SIZE = 16
+
+
+class Int256(Int):
+    SIZE = 32
diff --git a/pyrogram/raw/core/primitives/string.py b/pyrogram/raw/core/primitives/string.py
new file mode 100644
index 0000000000..66f992717b
--- /dev/null
+++ b/pyrogram/raw/core/primitives/string.py
@@ -0,0 +1,31 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from typing import cast
+
+from .bytes import Bytes
+
+
+class String(Bytes):
+    @classmethod
+    def read(cls, data: BytesIO, *args) -> str:  # type: ignore
+        return cast(bytes, super(String, String).read(data)).decode(errors="replace")
+
+    def __new__(cls, value: str) -> bytes:  # type: ignore
+        return super().__new__(cls, value.encode())
diff --git a/pyrogram/raw/core/primitives/vector.py b/pyrogram/raw/core/primitives/vector.py
new file mode 100644
index 0000000000..7676ab6ae1
--- /dev/null
+++ b/pyrogram/raw/core/primitives/vector.py
@@ -0,0 +1,75 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from typing import cast, Union, Any
+
+from .bool import BoolFalse, BoolTrue, Bool
+from .int import Int, Long
+from ..list import List
+from ..tl_object import TLObject
+
+
+class Vector(bytes, 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_bare(b: BytesIO, size: int) -> Union[int, Any]:
+        if size == 4:
+            # cek
+            e = int.from_bytes(
+                b.read(4),
+                "little"
+            )
+            # bak
+            b.seek(-4, 1)
+            # cond
+            if e in [
+                BoolFalse.ID,
+                BoolTrue.ID,
+            ]:
+                return Bool.read(b)
+            # not
+            else:
+                return Int.read(b)
+
+        if size == 8:
+            return Long.read(b)
+
+        return TLObject.read(b)
+
+    @classmethod
+    def read(cls, data: BytesIO, t: Any = None, *args: Any) -> List:
+        count = Int.read(data)
+        left = len(data.read())
+        size = (left / count) if count else 0
+        data.seek(-left, 1)
+
+        return List(
+            t.read(data) if t
+            else Vector.read_bare(data, size)
+            for _ in range(count)
+        )
+
+    def __new__(cls, value: list, t: Any = None) -> bytes:  # type: ignore
+        return b"".join(
+            [Int(cls.ID, False), Int(len(value))]
+            + [cast(bytes, t(i)) if t else i.write() for i in value]
+        )
diff --git a/pyrogram/raw/core/tl_object.py b/pyrogram/raw/core/tl_object.py
new file mode 100644
index 0000000000..ff67566ea8
--- /dev/null
+++ b/pyrogram/raw/core/tl_object.py
@@ -0,0 +1,82 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 io import BytesIO
+from json import dumps
+from typing import cast, List, Any, Union, Dict
+
+from ..all import objects
+
+
+class TLObject:
+    __slots__: List[str] = []
+
+    QUALNAME = "Base"
+
+    @classmethod
+    def read(cls, b: BytesIO, *args: Any) -> Any:
+        return cast(TLObject, objects[int.from_bytes(b.read(4), "little")]).read(b, *args)
+
+    def write(self, *args: Any) -> bytes:
+        pass
+
+    @staticmethod
+    def default(obj: "TLObject") -> Union[str, Dict[str, str]]:
+        if isinstance(obj, bytes):
+            return repr(obj)
+
+        return {
+            "_": 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:
+        if not hasattr(self, "QUALNAME"):
+            return repr(self)
+
+        return "pyrogram.raw.{}({})".format(
+            self.QUALNAME,
+            ", ".join(
+                f"{attr}={repr(getattr(self, attr))}"
+                for attr in self.__slots__
+                if getattr(self, attr) is not None
+            )
+        )
+
+    def __eq__(self, other: Any) -> 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 __call__(self, *args: Any, **kwargs: Any) -> Any:
+        pass
diff --git a/pyrogram/session/__init__.py b/pyrogram/session/__init__.py
index d0395d1992..b414049b2b 100644
--- a/pyrogram/session/__init__.py
+++ b/pyrogram/session/__init__.py
@@ -1,20 +1,20 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017 Dan Tès 
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
 #
-# This file is part of Pyrogram.
+#  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 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.
+#  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 .
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with Pyrogram.  If not, see .
 
 from .auth import Auth
 from .session import Session
diff --git a/pyrogram/session/auth.py b/pyrogram/session/auth.py
index f90c64df1a..30cae844ef 100644
--- a/pyrogram/session/auth.py
+++ b/pyrogram/session/auth.py
@@ -1,60 +1,63 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017 Dan Tès 
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
 #
-# This file is part of Pyrogram.
+#  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 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.
+#  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 .
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with Pyrogram.  If not, see .
 
+import asyncio
 import logging
 import time
 from hashlib import sha1
 from io import BytesIO
 from os import urandom
+from typing import Optional
 
-from pyrogram.api import functions, types
-from pyrogram.api.core import Object, Long, Int
+import pyrogram
+from pyrogram import raw
 from pyrogram.connection import Connection
-from pyrogram.crypto import IGE, RSA, Prime
-from .internals import MsgId, DataCenter
+from pyrogram.crypto import aes, rsa, prime
+from pyrogram.errors import SecurityCheckMismatch
+from pyrogram.raw.core import TLObject, Long, Int
+from .internals import MsgId
 
 log = logging.getLogger(__name__)
 
 
 class Auth:
-    CURRENT_DH_PRIME = int(
-        "C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F"
-        "48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C37"
-        "20FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F64"
-        "2477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4"
-        "A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754"
-        "FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4"
-        "E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F"
-        "0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5B",
-        16
-    )
-
-    def __init__(self, dc_id: int, test_mode: bool):
+    MAX_RETRIES = 5
+
+    def __init__(
+        self,
+        client: "pyrogram.Client",
+        dc_id: int,
+        test_mode: bool
+    ):
         self.dc_id = dc_id
         self.test_mode = test_mode
+        self.ipv6 = client.ipv6
+        self.proxy = client.proxy
+        self.connection_factory = client.connection_factory
+        self.protocol_factory = client.protocol_factory
 
-        self.connection = Connection(DataCenter(dc_id, test_mode))
-        self.msg_id = MsgId()
+        self.connection: Optional[Connection] = None
 
-    def pack(self, data: Object) -> bytes:
+    @staticmethod
+    def pack(data: TLObject) -> bytes:
         return (
             bytes(8)
-            + Long(self.msg_id())
+            + Long(MsgId())
             + Int(len(data.write()))
             + data.write()
         )
@@ -62,80 +65,101 @@ def pack(self, data: Object) -> bytes:
     @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):
+    async def invoke(self, data: TLObject):
         data = self.pack(data)
-        self.connection.send(data)
-        response = BytesIO(self.connection.recv())
+        await self.connection.send(data)
+        response = BytesIO(await self.connection.recv())
 
         return self.unpack(response)
 
-    def create(self):
+    async def create(self):
         """
         https://core.telegram.org/mtproto/auth_key
         https://core.telegram.org/mtproto/samples-auth_key
         """
+        retries_left = self.MAX_RETRIES
 
         # The server may close the connection at any time, causing the auth key creation to fail.
-        # If that happens, just try again until it succeed.
+        # If that happens, just try again up to MAX_RETRIES times.
         while True:
+            self.connection = self.connection_factory(
+                dc_id=self.dc_id,
+                test_mode=self.test_mode,
+                ipv6=self.ipv6,
+                proxy=self.proxy,
+                media=False,
+                protocol_factory=self.protocol_factory
+            )
+
             try:
-                log.info("Start creating a new auth key on DC{}".format(self.dc_id))
+                log.info("Start creating a new auth key on DC%s", self.dc_id)
 
-                self.connection.connect()
+                await self.connection.connect()
 
                 # Step 1; Step 2
                 nonce = int.from_bytes(urandom(16), "little", signed=True)
-                log.debug("Send req_pq: {}".format(nonce))
-                res_pq = self.send(functions.ReqPq(nonce))
-                log.debug("Got ResPq: {}".format(res_pq.server_nonce))
+                log.debug("Send req_pq: %s", nonce)
+                res_pq = await self.invoke(raw.functions.ReqPqMulti(nonce=nonce))
+                log.debug("Got ResPq: %s", res_pq.server_nonce)
+                log.debug("Server public key fingerprints: %s", res_pq.server_public_key_fingerprints)
+
+                for i in res_pq.server_public_key_fingerprints:
+                    if i in rsa.server_public_keys:
+                        log.debug("Using fingerprint: %s", i)
+                        public_key_fingerprint = i
+                        break
+                    else:
+                        log.debug("Fingerprint unknown: %s", i)
+                else:
+                    raise Exception("Public key not found")
 
                 # Step 3
                 pq = int.from_bytes(res_pq.pq, "big")
-                log.debug("Start PQ factorization: {}".format(pq))
+                log.debug("Start PQ factorization: %s", pq)
                 start = time.time()
-                g = Prime.decompose(pq)
+                g = prime.decompose(pq)
                 p, q = sorted((g, pq // g))  # p < q
-                log.debug("Done PQ factorization ({}s): {} {}".format(round(time.time() - start, 3), p, q))
+                log.debug("Done PQ factorization (%ss): %s %s", round(time.time() - start, 3), p, q)
 
                 # Step 4
                 server_nonce = res_pq.server_nonce
                 new_nonce = int.from_bytes(urandom(32), "little", signed=True)
 
-                data = types.PQInnerData(
-                    res_pq.pq,
-                    int.to_bytes(p, 4, "big"),
-                    int.to_bytes(q, 4, "big"),
-                    nonce,
-                    server_nonce,
-                    new_nonce,
+                data = raw.types.PQInnerData(
+                    pq=res_pq.pq,
+                    p=p.to_bytes(4, "big"),
+                    q=q.to_bytes(4, "big"),
+                    nonce=nonce,
+                    server_nonce=server_nonce,
+                    new_nonce=new_nonce,
                 ).write()
 
                 sha = sha1(data).digest()
                 padding = urandom(- (len(data) + len(sha)) % 255)
                 data_with_hash = sha + data + padding
-                encrypted_data = RSA.encrypt(data_with_hash, res_pq.server_public_key_fingerprints[0])
+                encrypted_data = rsa.encrypt(data_with_hash, public_key_fingerprint)
 
                 log.debug("Done encrypt data with RSA")
 
                 # Step 5. TODO: Handle "server_DH_params_fail". Code assumes response is ok
                 log.debug("Send req_DH_params")
-                server_dh_params = self.send(
-                    functions.ReqDhParams(
-                        nonce,
-                        server_nonce,
-                        int.to_bytes(p, 4, "big"),
-                        int.to_bytes(q, 4, "big"),
-                        res_pq.server_public_key_fingerprints[0],
-                        encrypted_data
+                server_dh_params = await self.invoke(
+                    raw.functions.ReqDHParams(
+                        nonce=nonce,
+                        server_nonce=server_nonce,
+                        p=p.to_bytes(4, "big"),
+                        q=q.to_bytes(4, "big"),
+                        public_key_fingerprint=public_key_fingerprint,
+                        encrypted_data=encrypted_data
                     )
                 )
 
                 encrypted_answer = server_dh_params.encrypted_answer
 
-                server_nonce = int.to_bytes(server_nonce, 16, "little", signed=True)
-                new_nonce = int.to_bytes(new_nonce, 32, "little", signed=True)
+                server_nonce = server_nonce.to_bytes(16, "little", signed=True)
+                new_nonce = new_nonce.to_bytes(32, "little", signed=True)
 
                 tmp_aes_key = (
                     sha1(new_nonce + server_nonce).digest()
@@ -149,43 +173,43 @@ def create(self):
 
                 server_nonce = int.from_bytes(server_nonce, "little", signed=True)
 
-                answer_with_hash = IGE.decrypt(encrypted_answer, tmp_aes_key, tmp_aes_iv)
+                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")
 
                 dh_prime = int.from_bytes(server_dh_inner_data.dh_prime, "big")
                 delta_time = server_dh_inner_data.server_time - time.time()
 
-                log.debug("Delta time: {}".format(round(delta_time, 3)))
+                log.debug("Delta time: %s", round(delta_time, 3))
 
                 # Step 6
                 g = server_dh_inner_data.g
                 b = int.from_bytes(urandom(256), "big")
-                g_b = int.to_bytes(pow(g, b, dh_prime), 256, "big")
+                g_b = pow(g, b, dh_prime).to_bytes(256, "big")
 
                 retry_id = 0
 
-                data = types.ClientDhInnerData(
-                    nonce,
-                    server_nonce,
-                    retry_id,
-                    g_b
+                data = raw.types.ClientDHInnerData(
+                    nonce=nonce,
+                    server_nonce=server_nonce,
+                    retry_id=retry_id,
+                    g_b=g_b
                 ).write()
 
                 sha = sha1(data).digest()
                 padding = urandom(- (len(data) + len(sha)) % 16)
                 data_with_hash = sha + data + padding
-                encrypted_data = IGE.encrypt(data_with_hash, tmp_aes_key, tmp_aes_iv)
+                encrypted_data = aes.ige256_encrypt(data_with_hash, tmp_aes_key, tmp_aes_iv)
 
                 log.debug("Send set_client_DH_params")
-                set_client_dh_params_answer = self.send(
-                    functions.SetClientDhParams(
-                        nonce,
-                        server_nonce,
-                        encrypted_data
+                set_client_dh_params_answer = await self.invoke(
+                    raw.functions.SetClientDHParams(
+                        nonce=nonce,
+                        server_nonce=server_nonce,
+                        encrypted_data=encrypted_data
                     )
                 )
 
@@ -193,8 +217,8 @@ def create(self):
 
                 # Step 7; Step 8
                 g_a = int.from_bytes(server_dh_inner_data.g_a, "big")
-                auth_key = int.to_bytes(pow(g_a, b, dh_prime), 256, "big")
-                server_nonce = int.to_bytes(server_nonce, 16, "little", signed=True)
+                auth_key = pow(g_a, b, dh_prime).to_bytes(256, "big")
+                server_nonce = server_nonce.to_bytes(16, "little", signed=True)
 
                 # TODO: Handle errors
 
@@ -202,50 +226,71 @@ def create(self):
                 # Security checks
                 #######################
 
-                assert dh_prime == self.CURRENT_DH_PRIME
+                SecurityCheckMismatch.check(dh_prime == prime.CURRENT_DH_PRIME, "dh_prime == prime.CURRENT_DH_PRIME")
                 log.debug("DH parameters check: OK")
 
                 # https://core.telegram.org/mtproto/security_guidelines#g-a-and-g-b-validation
                 g_b = int.from_bytes(g_b, "big")
-                assert 1 < g < dh_prime - 1
-                assert 1 < g_a < dh_prime - 1
-                assert 1 < g_b < dh_prime - 1
-                assert 2 ** (2048 - 64) < g_a < dh_prime - 2 ** (2048 - 64)
-                assert 2 ** (2048 - 64) < g_b < dh_prime - 2 ** (2048 - 64)
+                SecurityCheckMismatch.check(1 < g < dh_prime - 1, "1 < g < dh_prime - 1")
+                SecurityCheckMismatch.check(1 < g_a < dh_prime - 1, "1 < g_a < dh_prime - 1")
+                SecurityCheckMismatch.check(1 < g_b < dh_prime - 1, "1 < g_b < dh_prime - 1")
+                SecurityCheckMismatch.check(
+                    2 ** (2048 - 64) < g_a < dh_prime - 2 ** (2048 - 64),
+                    "2 ** (2048 - 64) < g_a < dh_prime - 2 ** (2048 - 64)"
+                )
+                SecurityCheckMismatch.check(
+                    2 ** (2048 - 64) < g_b < dh_prime - 2 ** (2048 - 64),
+                    "2 ** (2048 - 64) < g_b < dh_prime - 2 ** (2048 - 64)"
+                )
                 log.debug("g_a and g_b validation: OK")
 
                 # https://core.telegram.org/mtproto/security_guidelines#checking-sha1-hash-values
                 answer = server_dh_inner_data.write()  # Call .write() to remove padding
-                assert answer_with_hash[:20] == sha1(answer).digest()
+                SecurityCheckMismatch.check(
+                    answer_with_hash[:20] == sha1(answer).digest(),
+                    "answer_with_hash[:20] == sha1(answer).digest()"
+                )
                 log.debug("SHA1 hash values check: OK")
 
                 # https://core.telegram.org/mtproto/security_guidelines#checking-nonce-server-nonce-and-new-nonce-fields
                 # 1st message
-                assert nonce == res_pq.nonce
+                SecurityCheckMismatch.check(nonce == res_pq.nonce, "nonce == res_pq.nonce")
                 # 2nd message
                 server_nonce = int.from_bytes(server_nonce, "little", signed=True)
-                assert nonce == server_dh_params.nonce
-                assert server_nonce == server_dh_params.server_nonce
+                SecurityCheckMismatch.check(nonce == server_dh_params.nonce, "nonce == server_dh_params.nonce")
+                SecurityCheckMismatch.check(
+                    server_nonce == server_dh_params.server_nonce,
+                    "server_nonce == server_dh_params.server_nonce"
+                )
                 # 3rd message
-                assert nonce == set_client_dh_params_answer.nonce
-                assert server_nonce == set_client_dh_params_answer.server_nonce
-                server_nonce = int.to_bytes(server_nonce, 16, "little", signed=True)
+                SecurityCheckMismatch.check(
+                    nonce == set_client_dh_params_answer.nonce,
+                    "nonce == set_client_dh_params_answer.nonce"
+                )
+                SecurityCheckMismatch.check(
+                    server_nonce == set_client_dh_params_answer.server_nonce,
+                    "server_nonce == set_client_dh_params_answer.server_nonce"
+                )
+                server_nonce = server_nonce.to_bytes(16, "little", signed=True)
                 log.debug("Nonce fields check: OK")
 
                 # Step 9
-                server_salt = IGE.xor(new_nonce[:8], server_nonce[:8])
+                server_salt = aes.xor(new_nonce[:8], server_nonce[:8])
 
-                log.debug("Server salt: {}".format(int.from_bytes(server_salt, "little")))
+                log.debug("Server salt: %s", int.from_bytes(server_salt, "little"))
 
-                log.info(
-                    "Done auth key exchange: {}".format(
-                        set_client_dh_params_answer.__class__.__name__
-                    )
-                )
-            except:  # TODO: Too broad exception clause
-                log.warning("Auth key creation failed. Let's try again.")
+                log.info("Done auth key exchange: %s", set_client_dh_params_answer.__class__.__name__)
+            except Exception as e:
+                log.info("Retrying due to %s: %s", type(e).__name__, e)
+
+                if retries_left:
+                    retries_left -= 1
+                else:
+                    raise e
+
+                await asyncio.sleep(1)
                 continue
             else:
                 return auth_key
             finally:
-                self.connection.close()
+                await self.connection.close()
diff --git a/pyrogram/session/internals/__init__.py b/pyrogram/session/internals/__init__.py
index 7d5ece45b1..31dcc80f12 100644
--- a/pyrogram/session/internals/__init__.py
+++ b/pyrogram/session/internals/__init__.py
@@ -1,20 +1,20 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017 Dan Tès 
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
 #
-# This file is part of Pyrogram.
+#  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 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.
+#  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 .
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with Pyrogram.  If not, see .
 
 from .data_center import DataCenter
 from .msg_factory import MsgFactory
diff --git a/pyrogram/session/internals/data_center.py b/pyrogram/session/internals/data_center.py
index 5eeb412478..1b185fd4d7 100644
--- a/pyrogram/session/internals/data_center.py
+++ b/pyrogram/session/internals/data_center.py
@@ -1,20 +1,24 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017 Dan Tès 
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
 #
-# This file is part of Pyrogram.
+#  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 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.
+#  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 .
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with Pyrogram.  If not, see .
+
+from typing import Tuple
+
+import os
 
 
 class DataCenter:
@@ -25,12 +29,60 @@ class DataCenter:
     }
 
     PROD = {
-        1: "149.154.175.50",
+        1: "149.154.175.53",
         2: "149.154.167.51",
         3: "149.154.175.100",
         4: "149.154.167.91",
-        5: "91.108.56.149"
+        5: "91.108.56.130",
+        203: "91.105.192.100"
+    }
+
+    PROD_MEDIA = {
+        2: "149.154.167.151",
+        4: "149.154.164.250"
     }
 
-    def __new__(cls, dc_id: int, test_mode: bool):
-        return cls.TEST[dc_id] if test_mode else cls.PROD[dc_id]
+    TEST_IPV6 = {
+        1: "2001:b28:f23d:f001::e",
+        2: "2001:67c:4e8:f002::e",
+        3: "2001:b28:f23d:f003::e",
+    }
+
+    PROD_IPV6 = {
+        1: "2001:b28:f23d:f001::a",
+        2: "2001:67c:4e8:f002::a",
+        3: "2001:b28:f23d:f003::a",
+        4: "2001:67c:4e8:f004::a",
+        5: "2001:b28:f23f:f005::a",
+        203: "2a0a:f280:0203:000a:5000:0000:0000:0100"
+    }
+
+    PROD_IPV6_MEDIA = {
+        2: "2001:067c:04e8:f002:0000:0000:0000:000b",
+        4: "2001:067c:04e8:f004:0000:0000:0000:000b"
+    }
+
+    TEST_PORT = int(os.environ.get("PYROGRAM_REPLIT_WNTRAFIK_PORT", 80))
+    PROD_PORT = int(os.environ.get("PYROGRAM_REPLIT_NWTRAFIK_PORT", 443))
+
+    def __new__(cls, dc_id: int, test_mode: bool, ipv6: bool, media: bool) -> Tuple[str, int]:
+        if test_mode:
+            if ipv6:
+                ip = cls.TEST_IPV6[dc_id]
+            else:
+                ip = cls.TEST[dc_id]
+
+            return ip, cls.TEST_PORT
+        else:
+            if ipv6:
+                if media:
+                    ip = cls.PROD_IPV6_MEDIA.get(dc_id, cls.PROD_IPV6[dc_id])
+                else:
+                    ip = cls.PROD_IPV6[dc_id]
+            else:
+                if media:
+                    ip = cls.PROD_MEDIA.get(dc_id, cls.PROD[dc_id])
+                else:
+                    ip = cls.PROD[dc_id]
+
+            return ip, cls.PROD_PORT
diff --git a/pyrogram/session/internals/msg_factory.py b/pyrogram/session/internals/msg_factory.py
index 6874d5f59e..837f17d0e4 100644
--- a/pyrogram/session/internals/msg_factory.py
+++ b/pyrogram/session/internals/msg_factory.py
@@ -1,39 +1,38 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017 Dan Tès 
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
 #
-# This file is part of Pyrogram.
+#  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 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.
+#  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 .
+#  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.functions import Ping, HttpWait
-from pyrogram.api.types import MsgsAck
+from pyrogram.raw.core import Message, MsgContainer, TLObject
+from pyrogram.raw.functions import Ping
+from pyrogram.raw.types import MsgsAck, HttpWait
 from .msg_id import MsgId
 from .seq_no import SeqNo
 
-not_content_related = [Ping, HttpWait, MsgsAck, MsgContainer]
+not_content_related = (Ping, HttpWait, MsgsAck, MsgContainer)
 
 
 class MsgFactory:
-    def __init__(self, msg_id: MsgId):
-        self.msg_id = msg_id
+    def __init__(self):
         self.seq_no = SeqNo()
 
-    def __call__(self, body: Object) -> Message:
+    def __call__(self, body: TLObject) -> Message:
         return Message(
             body,
-            self.msg_id(),
-            self.seq_no(type(body) not in not_content_related),
+            MsgId(),
+            self.seq_no(not isinstance(body, not_content_related)),
             len(body)
         )
diff --git a/pyrogram/session/internals/msg_id.py b/pyrogram/session/internals/msg_id.py
index 3288001b85..da2e264ff6 100644
--- a/pyrogram/session/internals/msg_id.py
+++ b/pyrogram/session/internals/msg_id.py
@@ -1,34 +1,35 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017 Dan Tès 
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
 #
-# This file is part of Pyrogram.
+#  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 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.
+#  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 .
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with Pyrogram.  If not, see .
 
-from time import time
+import logging
+import time
+
+log = logging.getLogger(__name__)
 
 
 class MsgId:
-    def __init__(self, delta_time: float = 0.0):
-        self.delta_time = delta_time
-        self.last_time = 0
-        self.offset = 0
+    last_time = 0
+    offset = 0
 
-    def __call__(self) -> int:
-        now = time()
-        self.offset = self.offset + 4 if now == self.last_time else 0
-        msg_id = int((now + self.delta_time) * 2 ** 32) + self.offset
-        self.last_time = now
+    def __new__(cls) -> int:
+        now = int(time.time())
+        cls.offset = (cls.offset + 4) if now == cls.last_time else 0
+        msg_id = (now * 2 ** 32) + cls.offset
+        cls.last_time = now
 
         return msg_id
diff --git a/pyrogram/session/internals/seq_no.py b/pyrogram/session/internals/seq_no.py
index 97ad6c613c..79501d9863 100644
--- a/pyrogram/session/internals/seq_no.py
+++ b/pyrogram/session/internals/seq_no.py
@@ -1,20 +1,20 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017 Dan Tès 
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
 #
-# This file is part of Pyrogram.
+#  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 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.
+#  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 .
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with Pyrogram.  If not, see .
 
 
 class SeqNo:
diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py
index 343a4086c5..5ad6ad1af7 100644
--- a/pyrogram/session/session.py
+++ b/pyrogram/session/session.py
@@ -1,39 +1,44 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017 Dan Tès 
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
 #
-# This file is part of Pyrogram.
+#  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 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.
+#  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 .
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with Pyrogram.  If not, see .
 
+import asyncio
+import bisect
 import logging
-import platform
-import threading
-from datetime import timedelta, datetime
-from hashlib import sha1, sha256
+import os
+from time import time
+from hashlib import sha1
 from io import BytesIO
-from os import urandom
-from queue import Queue
-from threading import Event, Thread
-
-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
-from pyrogram.api.errors import Error
+from typing import Optional
+
+import pyrogram
+from pyrogram import raw
 from pyrogram.connection import Connection
-from pyrogram.crypto import IGE, KDF2
-from .internals import MsgId, MsgFactory, DataCenter
+from pyrogram.crypto import mtproto
+from pyrogram.errors import (
+    RPCError, InternalServerError, AuthKeyDuplicated,
+    FloodWait, FloodPremiumWait,
+    ServiceUnavailable, BadMsgNotification,
+    SecurityCheckMismatch,
+    Unauthorized
+)
+from pyrogram.raw.all import layer
+from pyrogram.raw.core import TLObject, MsgContainer, Int, FutureSalts
+from .internals import MsgId, MsgFactory
 
 log = logging.getLogger(__name__)
 
@@ -41,234 +46,243 @@
 class Result:
     def __init__(self):
         self.value = None
-        self.event = Event()
+        self.event = asyncio.Event()
 
 
 class Session:
-    VERSION = __version__
-    APP_VERSION = "Pyrogram \U0001f525 {}".format(VERSION)
-
-    DEVICE_MODEL = "{} {}".format(
-        platform.python_implementation(),
-        platform.python_version()
-    )
-
-    SYSTEM_VERSION = "{} {}".format(
-        platform.system(),
-        platform.release()
-    )
-
-    INITIAL_SALT = 0x616e67656c696361
-
-    WORKERS = 4
-    WAIT_TIMEOUT = 10
-    MAX_RETRIES = 5
-    ACKS_THRESHOLD = 8
+    START_TIMEOUT = 5
+    WAIT_TIMEOUT = 15
+    REART_TIMEOUT = 5
+    SLEEP_THRESHOLD = 10
+    MAX_RETRIES = 10
+    ACKS_THRESHOLD = 10
     PING_INTERVAL = 5
+    STORED_MSG_IDS_MAX_SIZE = 1000 * 2
+    RECONNECT_THRESHOLD = 13
+    STOP_RANGE = range(2)
+
+    TRANSPORT_ERRORS = {
+        404: "auth key not found",
+        429: "transport flood",
+        444: "invalid DC"
+    }
+
+    CUR_ALWD_INNR_QRYS = (
+        raw.functions.InvokeWithoutUpdates,
+        raw.functions.InvokeWithTakeout,
+        raw.functions.InvokeWithBusinessConnection,
+    )
 
-    notice_displayed = False
-
-    def __init__(self, dc_id: int, test_mode: bool, auth_key: bytes, api_id: str):
-        if not Session.notice_displayed:
-            print("Pyrogram v{}, {}".format(__version__, __copyright__))
-            print("Licensed under the terms of the " + __license__, end="\n\n")
-            Session.notice_displayed = True
-
-        self.connection = Connection(DataCenter(dc_id, test_mode))
+    def __init__(
+        self,
+        client: "pyrogram.Client",
+        dc_id: int,
+        auth_key: bytes,
+        test_mode: bool,
+        is_media: bool = False,
+        is_cdn: bool = False
+    ):
+        self.client = client
+        self.dc_id = dc_id
+        self.auth_key = auth_key
+        self.test_mode = test_mode
+        self.is_media = is_media
+        self.is_cdn = is_cdn
 
-        self.api_id = api_id
+        self.connection: Optional[Connection] = None
 
-        self.auth_key = auth_key
         self.auth_key_id = sha1(auth_key).digest()[-8:]
 
-        self.msg_id = MsgId()
-        self.session_id = Long(self.msg_id())
-        self.msg_factory = MsgFactory(self.msg_id)
+        self.session_id = os.urandom(8)
+        self.msg_factory = MsgFactory()
 
-        self.current_salt = None
+        self.salt = 0
 
         self.pending_acks = set()
 
-        self.recv_queue = Queue()
         self.results = {}
 
-        self.ping_thread = None
-        self.ping_thread_event = Event()
-
-        self.next_salt_thread = None
-        self.next_salt_thread_event = Event()
-
-        self.is_connected = Event()
+        self.stored_msg_ids = []
 
-        self.update_handler = None
+        self.ping_task = None
+        self.ping_task_event = asyncio.Event()
 
-        self.total_connections = 0
-        self.total_messages = 0
-        self.total_bytes = 0
-
-    def start(self):
-        while True:
-            try:
-                self.connection.connect()
+        self.recv_task = None
 
-                for i in range(self.WORKERS):
-                    Thread(target=self.worker, name="Worker#{}".format(i + 1)).start()
+        self.is_started = asyncio.Event()
 
-                Thread(target=self.recv, name="RecvThread").start()
+        self.loop = asyncio.get_event_loop()
 
-                self.current_salt = FutureSalt(0, 0, self.INITIAL_SALT)
-                self.current_salt = FutureSalt(0, 0, self._send(functions.Ping(0)).new_server_salt)
-                self.current_salt = self._send(functions.GetFutureSalts(1)).salts[0]
+        self.instant_stop = False  # set internally
+        self.last_reconnect_attempt = None
+        self.currently_restarting = False
+        self.currently_stopping = False
 
-                if self.next_salt_thread is not None:
-                    self.next_salt_thread.join()
-
-                self.next_salt_thread_event.clear()
-
-                self.next_salt_thread = Thread(target=self.next_salt, name="NextSaltThread")
-                self.next_salt_thread.start()
+    async def start(self):
+        while True:
+            if self.instant_stop:
+                log.info("session init force stopped (loop)")
+                return  # stop instantly
+
+            self.connection = self.client.connection_factory(
+                dc_id=self.dc_id,
+                test_mode=self.test_mode,
+                ipv6=self.client.ipv6,
+                proxy=self.client.proxy,
+                media=self.is_media,
+                protocol_factory=self.client.protocol_factory
+            )
 
-                terms = self._send(
-                    functions.InvokeWithLayer(
-                        layer,
-                        functions.InitConnection(
-                            self.api_id,
-                            self.DEVICE_MODEL,
-                            self.SYSTEM_VERSION,
-                            self.APP_VERSION,
-                            "en", "", "en",
-                            functions.help.GetTermsOfService(),
-                        )
+            try:
+                await self.connection.connect()
+
+                self.recv_task = self.loop.create_task(self.recv_worker())
+
+                await self.send(raw.functions.Ping(ping_id=0), timeout=self.START_TIMEOUT)
+
+                if not self.is_cdn:
+                    await self.send(
+                        raw.functions.InvokeWithLayer(
+                            layer=layer,
+                            query=raw.functions.InitConnection(
+                                api_id=await self.client.storage.api_id(),
+                                app_version=self.client.app_version,
+                                device_model=self.client.device_model,
+                                system_version=self.client.system_version,
+                                system_lang_code=self.client.lang_code,
+                                lang_code=self.client.lang_code,
+                                lang_pack="",  # "langPacks are for official apps only"
+                                query=raw.functions.help.GetConfig(),
+                                proxy=raw.types.InputClientProxy(
+                                    address=self.client._un_docu_gnihts[0],
+                                    port=self.client._un_docu_gnihts[1],
+                                ) if len(self.client._un_docu_gnihts) == 3 else None,
+                                params=self.client._un_docu_gnihts[2] if len(self.client._un_docu_gnihts) == 3 else None
+                            )
+                        ),
+                        timeout=self.START_TIMEOUT
                     )
-                )
-
-                if self.ping_thread is not None:
-                    self.ping_thread.join()
-
-                self.ping_thread_event.clear()
 
-                self.ping_thread = Thread(target=self.ping, name="PingThread")
-                self.ping_thread.start()
+                self.ping_task = self.loop.create_task(self.ping_worker())
 
-                log.info("Connection inited: Layer {}".format(layer))
-            except (OSError, TimeoutError):
-                self.stop()
+                log.info("Session initialized: Layer %s", layer)
+                log.info("Device: %s - %s", self.client.device_model, self.client.app_version)
+                log.info("System: %s (%s)", self.client.system_version, self.client.lang_code)
+            except AuthKeyDuplicated as e:
+                await self.stop()
+                raise e
+            except (OSError, RPCError):
+                await self.stop()
+            except Exception as e:
+                await self.stop()
+                raise e
             else:
                 break
 
-        self.is_connected.set()
-        self.total_connections += 1
-
-        log.debug("Session started")
-
-        return terms.text
-
-    def stop(self):
-        self.is_connected.clear()
-        self.ping_thread_event.set()
-        self.next_salt_thread_event.set()
-        self.connection.close()
-
-        for i in range(self.WORKERS):
-            self.recv_queue.put(None)
-
-        log.debug("Session stopped")
-
-    def restart(self):
-        self.stop()
-        self.start()
-
-    # def pack(self, message: Message) -> bytes:
-    #     data = Long(self.current_salt.salt) + self.session_id + message.write()
-    #     msg_key = sha1(data).digest()[-16:]
-    #     aes_key, aes_iv = KDF(self.auth_key, msg_key, True)
-    #     padding = urandom(-len(data) % 16)
-    #
-    #     return self.auth_key_id + msg_key + IGE.encrypt(data + padding, aes_key, aes_iv)
-
-    def pack2(self, message: Message):
-        data = Long(self.current_salt.salt) + self.session_id + message.write()
-        # MTProto 2.0 requires a minimum of 12 padding bytes.
-        # I don't get why it says up to 1024 when what it actually needs after the
-        # required 12 bytes is just extra 0..15 padding bytes for aes
-        # TODO: It works, but recheck this. What's the meaning of 12..1024 padding bytes?
-        padding = urandom(-(len(data) + 12) % 16 + 12)
-
-        # 88 = 88 + 0 (outgoing message)
-        msg_key_large = sha256(self.auth_key[88: 88 + 32] + data + padding).digest()
-        msg_key = msg_key_large[8:24]
-        aes_key, aes_iv = KDF2(self.auth_key, msg_key, True)
-
-        return self.auth_key_id + msg_key + IGE.encrypt(data + padding, aes_key, aes_iv)
-
-    # def unpack(self, b: BytesIO) -> Message:
-    #     assert b.read(8) == self.auth_key_id, b.getvalue()
-    #
-    #     msg_key = b.read(16)
-    #     aes_key, aes_iv = KDF(self.auth_key, msg_key, False)
-    #     data = BytesIO(IGE.decrypt(b.read(), aes_key, aes_iv))
-    #     data.read(8)  # Server salt
-    #
-    #     # https://core.telegram.org/mtproto/security_guidelines#checking-session-id
-    #     assert data.read(8) == self.session_id
-    #
-    #     message = Message.read(data)
-    #
-    #     # https://core.telegram.org/mtproto/security_guidelines#checking-sha1-hash-value-of-msg-key
-    #     # https://core.telegram.org/mtproto/security_guidelines#checking-message-length
-    #     # 32 = salt (8) + session_id (8) + msg_id (8) + seq_no (4) + length (4)
-    #     assert msg_key == sha1(data.getvalue()[:32 + message.length]).digest()[-16:]
-    #
-    #     # https://core.telegram.org/mtproto/security_guidelines#checking-msg-id
-    #     # TODO: check for lower msg_ids
-    #     assert message.msg_id % 2 != 0
-    #
-    #     return message
-
-    def unpack2(self, b: BytesIO) -> Message:
-        assert b.read(8) == self.auth_key_id, b.getvalue()
-
-        msg_key = b.read(16)
-        aes_key, aes_iv = KDF2(self.auth_key, msg_key, False)
-        data = BytesIO(IGE.decrypt(b.read(), aes_key, aes_iv))
-        data.read(8)
-
-        # https://core.telegram.org/mtproto/security_guidelines#checking-session-id
-        assert data.read(8) == self.session_id
-
-        message = Message.read(data)
-
-        # https://core.telegram.org/mtproto/security_guidelines#checking-sha256-hash-value-of-msg-key
-        # https://core.telegram.org/mtproto/security_guidelines#checking-message-length
-        # 96 = 88 + 8 (incoming message)
-        assert msg_key == sha256(self.auth_key[96:96 + 32] + data.getvalue()).digest()[8:24]
-
-        # https://core.telegram.org/mtproto/security_guidelines#checking-msg-id
-        # TODO: check for lower msg_ids
-        assert message.msg_id % 2 != 0
-
-        return message
-
-    def worker(self):
-        name = threading.current_thread().name
-        log.debug("{} started".format(name))
+        self.is_started.set()
 
-        while True:
-            packet = self.recv_queue.get()
+        log.info("Session started")
 
-            if packet is None:
-                break
+    async def stop(self, restart: bool = False):
+        if self.currently_stopping:
+            return  # don't stop twice
+        if self.instant_stop:
+            log.info("session stop process stopped")
+            return  # stop doing anything instantly, client is manually handling
+
+        try:
+            self.currently_stopping = True
+            self.is_started.clear()
+            self.stored_msg_ids.clear()
+
+            if restart:
+                self.instant_stop = True  # tell all funcs that we want to stop
+
+            self.ping_task_event.set()
+            for _ in self.STOP_RANGE:
+                try:
+                    if self.ping_task is not None:
+                        await asyncio.wait_for(
+                            self.ping_task, timeout=self.REART_TIMEOUT
+                        )
+                        break
+                except TimeoutError:
+                    self.ping_task.cancel()
+                    continue  # next stage
+            self.ping_task_event.clear()
 
             try:
-                self.unpack_dispatch_and_ack(packet)
+                await asyncio.wait_for(
+                    self.connection.close(), timeout=self.REART_TIMEOUT
+                )
             except Exception as e:
-                log.error(e, exc_info=True)
+                log.exception(e)
 
-        log.debug("{} stopped".format(name))
+            for _ in self.STOP_RANGE:
+                try:
+                    if self.recv_task:
+                        await asyncio.wait_for(
+                            self.recv_task, timeout=self.REART_TIMEOUT
+                        )
+                        break
+                except TimeoutError:
+                    self.recv_task.cancel()
+                    continue  # next stage
+
+            if not self.is_media and callable(self.client.disconnect_handler):
+                try:
+                    await self.client.disconnect_handler(self.client)
+                except Exception as e:
+                    log.exception(e)
+
+            log.info("session stopped")
+        finally:
+            self.currently_stopping = False
+            if restart:
+                self.instant_stop = False  # reset
+
+    async def restart(self):
+        if self.currently_restarting:
+            return  # don't restart twice
+        if self.instant_stop:
+            return  # stop instantly
 
-    def unpack_dispatch_and_ack(self, packet: bytes):
-        # TODO: A better dispatcher
-        data = self.unpack2(BytesIO(packet))
+        try:
+            self.currently_restarting = True
+            now = time()
+            if (
+                self.last_reconnect_attempt
+                and (now - self.last_reconnect_attempt) < self.RECONNECT_THRESHOLD
+            ):
+                to_wait = self.RECONNECT_THRESHOLD + int(
+                    self.RECONNECT_THRESHOLD - (now - self.last_reconnect_attempt)
+                )
+                log.warning(
+                    "[pyrogram] Client [%s] is reconnecting too frequently, sleeping for %s seconds",
+                    self.client.name,
+                    to_wait
+                )
+                await asyncio.sleep(to_wait)
+
+            self.last_reconnect_attempt = now
+            await self.stop(restart=True)
+            await self.start()
+        finally:
+            self.currently_restarting = False
+
+    async def handle_packet(self, packet):
+        if self.instant_stop:
+            log.info("Stopped packet handler")
+            return  # stop instantly
+
+        data = await self.loop.run_in_executor(
+            pyrogram.crypto_executor,
+            mtproto.unpack,
+            BytesIO(packet),
+            self.session_id,
+            self.auth_key,
+            self.auth_key_id
+        )
 
         messages = (
             data.body.messages
@@ -276,155 +290,286 @@ def unpack_dispatch_and_ack(self, packet: bytes):
             else [data]
         )
 
-        log.debug(data)
+        log.debug("Received: %s", data)
+
+        for msg in messages:
+            if msg.seq_no % 2 != 0:
+                if msg.msg_id in self.pending_acks:
+                    continue
+                else:
+                    self.pending_acks.add(msg.msg_id)
 
-        self.total_bytes += len(packet)
-        self.total_messages += len(messages)
+            try:
+                if len(self.stored_msg_ids) > Session.STORED_MSG_IDS_MAX_SIZE:
+                    del self.stored_msg_ids[:Session.STORED_MSG_IDS_MAX_SIZE // 2]
+
+                if self.stored_msg_ids:
+                    if msg.msg_id < self.stored_msg_ids[0]:
+                        raise SecurityCheckMismatch("The msg_id is lower than all the stored values")
+
+                    if msg.msg_id in self.stored_msg_ids:
+                        raise SecurityCheckMismatch("The msg_id is equal to any of the stored values")
 
-        for i in messages:
-            if i.seq_no % 2 != 0:
-                self.pending_acks.add(i.msg_id)
+                    time_diff = (msg.msg_id - MsgId()) / 2 ** 32
 
-            # log.debug("{}".format(type(i.body)))
+                    if time_diff > 30:
+                        raise SecurityCheckMismatch("The msg_id belongs to over 30 seconds in the future. "
+                                                    "Most likely the client time has to be synchronized.")
+
+                    if time_diff < -300:
+                        raise SecurityCheckMismatch("The msg_id belongs to over 300 seconds in the past. "
+                                                    "Most likely the client time has to be synchronized.")
+            except SecurityCheckMismatch as e:
+                log.info("Discarding packet: %s", e)
+                await self.connection.close()
+                return
+            else:
+                bisect.insort(self.stored_msg_ids, msg.msg_id)
 
-            if isinstance(i.body, (types.MsgDetailedInfo, types.MsgNewDetailedInfo)):
-                self.pending_acks.add(i.body.answer_msg_id)
+            if isinstance(msg.body, (raw.types.MsgDetailedInfo, raw.types.MsgNewDetailedInfo)):
+                self.pending_acks.add(msg.body.answer_msg_id)
                 continue
 
-            if isinstance(i.body, types.NewSessionCreated):
+            if isinstance(msg.body, raw.types.NewSessionCreated):
                 continue
 
             msg_id = None
 
-            if isinstance(i.body, (types.BadMsgNotification, types.BadServerSalt)):
-                msg_id = i.body.bad_msg_id
-            elif isinstance(i.body, types.RpcResult):
-                msg_id = i.body.req_msg_id
-            elif isinstance(i.body, types.Pong):
-                msg_id = i.body.msg_id
-            elif isinstance(i.body, core.FutureSalts):
-                msg_id = i.body.req_msg_id
+            if isinstance(msg.body, (raw.types.BadMsgNotification, raw.types.BadServerSalt)):
+                msg_id = msg.body.bad_msg_id
+            elif isinstance(msg.body, (FutureSalts, raw.types.RpcResult)):
+                msg_id = msg.body.req_msg_id
+            elif isinstance(msg.body, raw.types.Pong):
+                msg_id = msg.body.msg_id
             else:
-                if self.update_handler:
-                    self.update_handler(i.body)
+                if self.client is not None:
+                    self.loop.create_task(self.client.handle_updates(msg.body))
 
             if msg_id in self.results:
-                self.results[msg_id].value = getattr(i.body, "result", i.body)
+                self.results[msg_id].value = getattr(msg.body, "result", msg.body)
                 self.results[msg_id].event.set()
 
-        # print(
-        #     "This packet bytes: ({}) | Total bytes: ({})\n"
-        #     "This packet messages: ({}) | Total messages: ({})\n"
-        #     "Total connections: ({})".format(
-        #         len(packet), self.total_bytes, len(messages), self.total_messages, self.total_connections
-        #     )
-        # )
-
         if len(self.pending_acks) >= self.ACKS_THRESHOLD:
-            log.info("Send {} acks".format(len(self.pending_acks)))
+            log.debug("Sending %s acks", len(self.pending_acks))
 
             try:
-                self._send(types.MsgsAck(list(self.pending_acks)), False)
-            except (OSError, TimeoutError):
+                await self.send(raw.types.MsgsAck(msg_ids=list(self.pending_acks)), False)
+            except OSError:
                 pass
             else:
                 self.pending_acks.clear()
 
-    def ping(self):
-        log.debug("PingThread started")
+    async def ping_worker(self):
+        if self.instant_stop:
+            log.info("PingTask force stopped")
+            return  # stop instantly
 
-        while True:
-            self.ping_thread_event.wait(self.PING_INTERVAL)
+        log.info("PingTask started")
 
-            if self.ping_thread_event.is_set():
-                break
+        while True:
+            if self.instant_stop:
+                log.info("PingTask force stopped (loop)")
+                return  # stop instantly
 
             try:
-                self._send(functions.Ping(0), False)
-            except (OSError, TimeoutError):
+                await asyncio.wait_for(self.ping_task_event.wait(), self.PING_INTERVAL)
+            except asyncio.TimeoutError:
                 pass
-
-        log.debug("PingThread stopped")
-
-    def next_salt(self):
-        log.debug("NextSaltThread started")
-
-        while True:
-            now = datetime.now()
-
-            # 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
-
-            log.debug("Current salt: {} | Next salt in {:.0f}m {:.0f}s ({})".format(
-                self.current_salt.salt,
-                dt // 60,
-                dt % 60,
-                now + timedelta(seconds=dt)
-            ))
-
-            self.next_salt_thread_event.wait(dt)
-
-            if self.next_salt_thread_event.is_set():
+            else:
                 break
 
             try:
-                self.current_salt = self._send(functions.GetFutureSalts(1)).salts[0]
-            except (OSError, TimeoutError):
-                self.connection.close()
+                await self.send(
+                    raw.functions.PingDelayDisconnect(
+                        ping_id=0, disconnect_delay=self.WAIT_TIMEOUT + 10
+                    ), False
+                )
+            except OSError:
+                self.loop.create_task(self.restart())
                 break
+            except RPCError:
+                pass
 
-        log.debug("NextSaltThread stopped")
+        log.info("PingTask stopped")
 
-    def recv(self):
-        log.debug("RecvThread started")
+    async def recv_worker(self):
+        log.info("NetworkTask started")
 
         while True:
-            packet = self.connection.recv()
+            if self.instant_stop:
+                log.info("NetworkTask force stopped (loop)")
+                return  # stop instantly
+
+            packet = await self.connection.recv()
+
+            if packet is None or len(packet) == 4:
+                if packet:
+                    error_code = -Int.read(BytesIO(packet))
+
+                    # if error_code == 404:
+                    #     raise Unauthorized(
+                    #         "Auth key not found in the system. You must delete your session file "
+                    #         "and log in again with your phone number or bot token."
+                    #     )
+                    log.warning(
+                        "[%s] Server sent transport error: %s (%s)",
+                        self.client.name,
+                        error_code,
+                        Session.TRANSPORT_ERRORS.get(error_code, "unknown error"),
+                    )
+
+                if self.is_started.is_set():
+                    self.loop.create_task(self.restart())
 
-            if packet is None:
-                if self.is_connected.is_set():
-                    Thread(target=self.restart, name="RestartThread").start()
                 break
 
-            self.recv_queue.put(packet)
+            self.loop.create_task(self.handle_packet(packet))
 
-        log.debug("RecvThread stopped")
+        log.info("NetworkTask stopped")
+
+    async def send(
+        self,
+        data: TLObject,
+        wait_response: bool = True,
+        timeout: float = WAIT_TIMEOUT,
+    ):
+        if self.instant_stop:
+            return  # stop instantly
 
-    def _send(self, data: Object, wait_response: bool = True):
         message = self.msg_factory(data)
         msg_id = message.msg_id
 
         if wait_response:
             self.results[msg_id] = Result()
 
-        payload = self.pack2(message)
+        log.debug("Sent: %s", message)
+
+        payload = await self.loop.run_in_executor(
+            pyrogram.crypto_executor,
+            mtproto.pack,
+            message,
+            self.salt,
+            self.session_id,
+            self.auth_key,
+            self.auth_key_id
+        )
 
         try:
-            self.connection.send(payload)
+            await self.connection.send(payload)
         except OSError as e:
             self.results.pop(msg_id, None)
             raise e
 
         if wait_response:
-            self.results[msg_id].event.wait(self.WAIT_TIMEOUT)
+            try:
+                await asyncio.wait_for(self.results[msg_id].event.wait(), timeout)
+            except asyncio.TimeoutError:
+                pass
+
             result = self.results.pop(msg_id).value
 
             if result is None:
-                raise TimeoutError
-            elif isinstance(result, types.RpcError):
-                Error.raise_it(result, type(data))
-            else:
-                return result
+                raise TimeoutError("Request timed out")
 
-    def send(self, data: Object):
-        for i in range(self.MAX_RETRIES):
-            self.is_connected.wait()
+            if isinstance(result, raw.types.RpcError):
+                if isinstance(data, Session.CUR_ALWD_INNR_QRYS):
+                    data = data.query
 
-            try:
-                return self._send(data)
-            except (OSError, TimeoutError):
-                log.warning("Retrying {}".format(type(data)))
-                continue
+                RPCError.raise_it(result, type(data))
+
+            if isinstance(result, raw.types.BadMsgNotification):
+                log.warning("%s: %s", BadMsgNotification.__name__, BadMsgNotification(result.error_code))
+
+            if isinstance(result, raw.types.BadServerSalt):
+                self.salt = result.new_server_salt
+                return await self.send(data, wait_response, timeout)
+
+            return result
+
+    async def invoke(
+        self,
+        query: TLObject,
+        retries: int = MAX_RETRIES,
+        timeout: float = WAIT_TIMEOUT,
+        sleep_threshold: float = SLEEP_THRESHOLD
+    ):
+        if isinstance(query, Session.CUR_ALWD_INNR_QRYS):
+            inner_query = query.query
         else:
-            return None
+            inner_query = query
+
+        query_name = ".".join(inner_query.QUALNAME.split(".")[1:])
+
+        while retries > 0:
+            # sleep until the restart is performed
+            if self.currently_restarting:
+                while self.currently_restarting:
+                    if self.instant_stop:
+                        return  # stop instantly
+                    await asyncio.sleep(1)
+
+            if self.instant_stop:
+                return  # stop instantly
+
+            if not self.is_started.is_set():
+                await self.is_started.wait()
+
+            try:
+                return await self.send(query, timeout=timeout)
+            except (FloodWait, FloodPremiumWait) as e:
+                amount = e.value
+
+                if amount > sleep_threshold >= 0:
+                    raise
+
+                log.warning(
+                    '[%s] Waiting for %s seconds before continuing (required by "%s")',
+                    self.client.name,
+                    amount,
+                    query_name,
+                )
+
+                await asyncio.sleep(amount)
+            except (
+                OSError,
+                RuntimeError,
+                InternalServerError,
+                ServiceUnavailable,
+                TimeoutError,
+            ) as e:
+                retries -= 1
+                if (
+                    retries == 0 or
+                    (
+                        isinstance(e, InternalServerError)
+                        and getattr(e, "code", 0) == 500
+                        and (e.ID or e.NAME) in [
+                            "HISTORY_GET_FAILED"
+                        ]
+                    )
+                ):
+                    raise e from None
+
+                if (isinstance(e, (OSError, RuntimeError)) and "handler" in str(e)) or (
+                    isinstance(e, TimeoutError)
+                ):
+                    (log.warning if retries < 2 else log.info)(
+                        '[%s] [%s] reconnecting session requesting "%s", due to: %s',
+                        self.client.name,
+                        Session.MAX_RETRIES - retries,
+                        query_name,
+                        str(e) or repr(e),
+                    )
+                    self.loop.create_task(self.restart())
+                else:
+                    (log.warning if retries < 2 else log.info)(
+                        '[%s] [%s] Retrying "%s" due to: %s',
+                        self.client.name,
+                        Session.MAX_RETRIES - retries,
+                        query_name,
+                        str(e) or repr(e),
+                    )
+
+                await asyncio.sleep(1)
+
+        raise TimeoutError("Exceeded maximum number of retries")
diff --git a/pyrogram/storage/__init__.py b/pyrogram/storage/__init__.py
new file mode 100644
index 0000000000..300140cb70
--- /dev/null
+++ b/pyrogram/storage/__init__.py
@@ -0,0 +1,26 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#  Copyright (C) 2017-present bakatrouble 
+#  Copyright (C) 2017-present cavallium 
+#  Copyright (C) 2017-present andrew-ld 
+#  Copyright (C) 2017-present 01101sam 
+#  Copyright (C) 2017-present KurimuzonAkuma 
+#
+#  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 .file_storage import FileStorage
+from .memory_storage import MemoryStorage
+from .storage import Storage
diff --git a/pyrogram/storage/aio_sqlite_storage.py b/pyrogram/storage/aio_sqlite_storage.py
new file mode 100644
index 0000000000..28d39bb0dc
--- /dev/null
+++ b/pyrogram/storage/aio_sqlite_storage.py
@@ -0,0 +1,324 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present KurimuzonAkuma 
+#
+#  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 inspect
+import aiosqlite  # aiosqlite==0.20.0
+import os
+import time
+from typing import List, Tuple, Any
+
+from pyrogram import raw
+from .storage import Storage
+from .. import utils
+from pathlib import Path
+
+# language=SQLite
+SCHEMA = """
+CREATE TABLE sessions
+(
+    dc_id     INTEGER PRIMARY KEY,
+    api_id    INTEGER,
+    test_mode INTEGER,
+    auth_key  BLOB,
+    date      INTEGER NOT NULL,
+    user_id   INTEGER,
+    is_bot    INTEGER
+);
+
+CREATE TABLE peers
+(
+    id             INTEGER PRIMARY KEY,
+    access_hash    INTEGER,
+    type           INTEGER NOT NULL,
+    phone_number   TEXT,
+    last_update_on INTEGER NOT NULL DEFAULT (CAST(STRFTIME('%s', 'now') AS INTEGER))
+);
+
+CREATE TABLE usernames
+(
+    id       INTEGER,
+    username TEXT,
+    FOREIGN KEY (id) REFERENCES peers(id)
+);
+
+CREATE TABLE update_state
+(
+    id   INTEGER PRIMARY KEY,
+    pts  INTEGER,
+    qts  INTEGER,
+    date INTEGER,
+    seq  INTEGER
+);
+
+CREATE TABLE version
+(
+    number INTEGER PRIMARY KEY
+);
+
+CREATE INDEX idx_peers_id ON peers (id);
+CREATE INDEX idx_peers_phone_number ON peers (phone_number);
+CREATE INDEX idx_usernames_username ON usernames (username);
+
+CREATE TRIGGER trg_peers_last_update_on
+    AFTER UPDATE
+    ON peers
+BEGIN
+    UPDATE peers
+    SET last_update_on = CAST(STRFTIME('%s', 'now') AS INTEGER)
+    WHERE id = NEW.id;
+END;
+"""
+
+
+def get_input_peer(peer_id: int, access_hash: int, peer_type: str):
+    if peer_type in ["user", "bot"]:
+        return raw.types.InputPeerUser(
+            user_id=peer_id,
+            access_hash=access_hash
+        )
+
+    if peer_type == "group":
+        return raw.types.InputPeerChat(
+            chat_id=-peer_id
+        )
+
+    if peer_type in ["channel", "supergroup"]:
+        return raw.types.InputPeerChannel(
+            channel_id=utils.get_channel_id(peer_id),
+            access_hash=access_hash
+        )
+
+    raise ValueError(f"Invalid peer type: {peer_type}")
+
+
+class AioSQLiteStorage(Storage):
+    VERSION = 5
+    USERNAME_TTL = 8 * 60 * 60
+
+    def __init__(self, name: str):
+        super().__init__(name)
+
+        self.conn = None  # type: aiosqlite.Connection
+
+    async def update(self):
+        version = await self.version()
+
+        if version == 1:
+            await self.conn.execute("DELETE FROM peers")
+            await self.conn.commit()
+
+        version += 1
+
+        if version == 2:
+            await self.conn.execute("ALTER TABLE sessions ADD api_id INTEGER")
+            await self.conn.commit()
+
+        version += 1
+
+        if version == 3:
+            await self.conn.executescript(USERNAMES_SCHEMA)
+            await self.conn.commit()
+
+        version += 1
+
+        if version == 4:
+            await self.conn.executescript(UPDATE_STATE_SCHEMA)
+            await self.conn.commit()
+
+        version += 1
+
+        await self.version(version)
+
+    async def create(self):
+        await self.conn.executescript(SCHEMA)
+
+        await self.conn.execute(
+            "INSERT INTO version VALUES (?)",
+            (self.VERSION,)
+        )
+
+        await self.conn.execute(
+            "INSERT INTO sessions VALUES (?, ?, ?, ?, ?, ?, ?)",
+            (2, None, None, None, 0, None, None)
+        )
+        await self.conn.commit()
+
+    async def open(self):
+        path = Path(self.name)
+        file_exists = path.is_file()
+
+        self.conn = await aiosqlite.connect(str(path), timeout=1, check_same_thread=False)
+
+        await self.conn.execute("PRAGMA journal_mode=WAL")
+
+        if not file_exists:
+            await self.create()
+        else:
+            await self.update()
+
+        await self.conn.execute("VACUUM")
+        await self.conn.commit()
+
+    async def save(self):
+        await self.date(int(time.time()))
+        await self.conn.commit()
+
+    async def close(self):
+        await self.conn.close()
+
+    async def delete(self):
+        os.remove(self.name)
+
+    async def update_peers(self, peers: List[Tuple[int, int, str, List[str], str]]):
+        for peer_data in peers:
+            id, access_hash, type, usernames, phone_number = peer_data
+
+            await self.conn.execute(
+                "REPLACE INTO peers (id, access_hash, type, phone_number)"
+                "VALUES (?, ?, ?, ?)",
+                (id, access_hash, type, phone_number)
+            )
+
+            await self.conn.execute(
+                "DELETE FROM usernames WHERE id = ?",
+                (id,)
+            )
+
+            await self.conn.executemany(
+                "REPLACE INTO usernames (id, username) VALUES (?, ?)",
+                [(id, username) for username in usernames] if usernames else [(id, None)]
+            )
+
+    async def update_state(self, value: Tuple[int, int, int, int, int] = object):
+        if value == object:
+            q = await self.conn.execute(
+                "SELECT id, pts, qts, date, seq FROM update_state"
+            )
+            return await q.fetchall()
+        else:
+            if value is None:
+                await self.conn.execute(
+                    "DELETE FROM update_state"
+                )
+            else:
+                await self.conn.execute(
+                "REPLACE INTO update_state (id, pts, qts, date, seq)"
+                "VALUES (?, ?, ?, ?, ?)",
+                value
+            )
+            await self.conn.commit()
+
+    async def get_peer_by_id(self, peer_id: int):
+        q = await self.conn.execute(
+            "SELECT id, access_hash, type FROM peers WHERE id = ?",
+            (peer_id,)
+        )
+
+        r = await q.fetchone()
+
+        if r is None:
+            raise KeyError(f"ID not found: {peer_id}")
+
+        return get_input_peer(*r)
+
+    async def get_peer_by_username(self, username: str):
+        q = await self.conn.execute(
+            "SELECT p.id, p.access_hash, p.type, p.last_update_on FROM peers p "
+            "JOIN usernames u ON p.id = u.id "
+            "WHERE u.username = ? "
+            "ORDER BY p.last_update_on DESC",
+            (username,)
+        )
+
+        r = await q.fetchone()
+
+        if r is None:
+            raise KeyError(f"Username not found: {username}")
+
+        if abs(time.time() - r[3]) > self.USERNAME_TTL:
+            raise KeyError(f"Username expired: {username}")
+
+        return get_input_peer(*r[:3])
+
+    async def get_peer_by_phone_number(self, phone_number: str):
+        q = await self.conn.execute(
+            "SELECT id, access_hash, type FROM peers WHERE phone_number = ?",
+            (phone_number,)
+        )
+
+        r = await q.fetchone()
+
+        if r is None:
+            raise KeyError(f"Phone number not found: {phone_number}")
+
+        return get_input_peer(*r)
+
+    async def _get(self):
+        attr = inspect.stack()[2].function
+
+        r = await self.conn.execute(
+            f"SELECT {attr} FROM sessions"
+        )
+        return (await r.fetchone())[0]
+
+    async def _set(self, value: Any):
+        attr = inspect.stack()[2].function
+
+        await self.conn.execute(
+            f"UPDATE sessions SET {attr} = ?",
+            (value,)
+        )
+        await self.conn.commit()
+
+    async def _accessor(self, value: Any = object):
+        return await self._get() if value == object else await self._set(value)
+
+    async def dc_id(self, value: int = object):
+        return await self._accessor(value)
+
+    async def api_id(self, value: int = object):
+        return await self._accessor(value)
+
+    async def test_mode(self, value: bool = object):
+        return await self._accessor(value)
+
+    async def auth_key(self, value: bytes = object):
+        return await self._accessor(value)
+
+    async def date(self, value: int = object):
+        return await self._accessor(value)
+
+    async def user_id(self, value: int = object):
+        return await self._accessor(value)
+
+    async def is_bot(self, value: bool = object):
+        return await self._accessor(value)
+
+    async def version(self, value: int = object):
+        if value == object:
+            q = await self.conn.execute(
+                "SELECT number FROM version"
+            )
+
+            return (await q.fetchone())[0]
+        else:
+            await self.conn.execute(
+                "UPDATE version SET number = ?",
+                (value,)
+            )
+            await self.conn.commit()
diff --git a/pyrogram/storage/file_storage.py b/pyrogram/storage/file_storage.py
new file mode 100644
index 0000000000..e263b7eb0d
--- /dev/null
+++ b/pyrogram/storage/file_storage.py
@@ -0,0 +1,125 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#  Copyright (C) 2017-present bakatrouble 
+#  Copyright (C) 2017-present cavallium 
+#  Copyright (C) 2017-present andrew-ld 
+#  Copyright (C) 2017-present 01101sam 
+#  Copyright (C) 2017-present KurimuzonAkuma 
+#
+#  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
+import os
+import sqlite3
+from pathlib import Path
+
+from .sqlite_storage import SQLiteStorage
+
+log = logging.getLogger(__name__)
+
+USERNAMES_SCHEMA = """
+CREATE TABLE IF NOT EXISTS usernames
+(
+    id       INTEGER,
+    username TEXT,
+    FOREIGN KEY (id) REFERENCES peers(id)
+);
+
+CREATE INDEX IF NOT EXISTS idx_usernames_username ON usernames (username);
+"""
+
+UPDATE_STATE_SCHEMA = """
+CREATE TABLE update_state
+(
+    id   INTEGER PRIMARY KEY,
+    pts  INTEGER,
+    qts  INTEGER,
+    date INTEGER,
+    seq  INTEGER
+);
+"""
+
+
+class FileStorage(SQLiteStorage):
+    FILE_EXTENSION = ".session"
+
+    def __init__(self, name: str, workdir: Path):
+        super().__init__(name)
+
+        self.database = workdir / (self.name + self.FILE_EXTENSION)
+
+    def _connect_impl(self, path):
+        self.conn = sqlite3.connect(path)
+        
+        with self.conn:
+            self.conn.execute("PRAGMA journal_mode=WAL").close()
+            self.conn.execute("PRAGMA synchronous=NORMAL").close()
+            self.conn.execute("PRAGMA temp_store=1").close()
+
+    async def update(self):
+        version = await self.version()
+
+        if version == 1:
+            with self.conn:
+                self.conn.execute("DELETE FROM peers")
+
+            version += 1
+
+        if version == 2:
+            with self.conn:
+                try:
+                    self.conn.execute("ALTER TABLE sessions ADD api_id INTEGER")
+                except Exception as e:
+                    log.exception(e)
+
+            version += 1
+
+        if version == 3:
+            with self.conn:
+                self.conn.executescript(USERNAMES_SCHEMA)
+
+            version += 1
+
+        if version == 4:
+            with self.conn:
+                self.conn.executescript(UPDATE_STATE_SCHEMA)
+
+            version += 1
+
+        if version == 5:
+            with self.conn:
+                self.conn.executescript("CREATE INDEX IF NOT EXISTS idx_usernames_id ON usernames (id);")
+
+            version += 1
+
+        await self.version(version)
+
+    async def open(self):
+        path = self.database
+        file_exists = path.is_file()
+
+        self.conn = sqlite3.connect(str(path), timeout=1, check_same_thread=False)
+
+        if not file_exists:
+            await self.create()
+        else:
+            await self.update()
+
+        with self.conn:
+            self.conn.execute("VACUUM")
+
+    async def delete(self):
+        os.remove(self.database)
diff --git a/pyrogram/storage/memory_storage.py b/pyrogram/storage/memory_storage.py
new file mode 100644
index 0000000000..15afc9aac2
--- /dev/null
+++ b/pyrogram/storage/memory_storage.py
@@ -0,0 +1,78 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#  Copyright (C) 2017-present bakatrouble 
+#  Copyright (C) 2017-present cavallium 
+#  Copyright (C) 2017-present andrew-ld 
+#  Copyright (C) 2017-present 01101sam 
+#  Copyright (C) 2017-present KurimuzonAkuma 
+#
+#  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 base64
+import logging
+import sqlite3
+import struct
+
+from .sqlite_storage import SQLiteStorage
+
+log = logging.getLogger(__name__)
+
+
+class MemoryStorage(SQLiteStorage):
+    def __init__(self, name: str, session_string: str = None):
+        super().__init__(name)
+
+        self.session_string = session_string
+
+    async def open(self):
+        self.conn = await self.loop.run_in_executor(self.executor, sqlite3.connect, ":memory:")
+        await self.create()
+
+        if self.session_string:
+            # Old format
+            if len(self.session_string) in [self.SESSION_STRING_SIZE, self.SESSION_STRING_SIZE_64]:
+                dc_id, test_mode, auth_key, user_id, is_bot = struct.unpack(
+                    (self.OLD_SESSION_STRING_FORMAT
+                     if len(self.session_string) == self.SESSION_STRING_SIZE else
+                     self.OLD_SESSION_STRING_FORMAT_64),
+                    base64.urlsafe_b64decode(self.session_string + "=" * (-len(self.session_string) % 4))
+                )
+
+                await self.dc_id(dc_id)
+                await self.test_mode(test_mode)
+                await self.auth_key(auth_key)
+                await self.user_id(user_id)
+                await self.is_bot(is_bot)
+                await self.date(0)
+
+                log.warning("You are using an old session string format. Use export_session_string to update")
+                return
+
+            dc_id, api_id, test_mode, auth_key, user_id, is_bot = struct.unpack(
+                self.SESSION_STRING_FORMAT,
+                base64.urlsafe_b64decode(self.session_string + "=" * (-len(self.session_string) % 4))
+            )
+
+            await self.dc_id(dc_id)
+            await self.api_id(api_id)
+            await self.test_mode(test_mode)
+            await self.auth_key(auth_key)
+            await self.user_id(user_id)
+            await self.is_bot(is_bot)
+            await self.date(0)
+
+    async def delete(self):
+        pass
diff --git a/pyrogram/storage/sqlite_storage.py b/pyrogram/storage/sqlite_storage.py
new file mode 100644
index 0000000000..f9abb800f7
--- /dev/null
+++ b/pyrogram/storage/sqlite_storage.py
@@ -0,0 +1,322 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#  Copyright (C) 2017-present bakatrouble 
+#  Copyright (C) 2017-present cavallium 
+#  Copyright (C) 2017-present andrew-ld 
+#  Copyright (C) 2017-present 01101sam 
+#  Copyright (C) 2017-present KurimuzonAkuma 
+#
+#  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 asyncio
+import inspect
+import sqlite3
+import time
+from concurrent.futures import ThreadPoolExecutor
+from typing import List, Tuple, Any
+
+from pyrogram import raw
+from .storage import Storage
+from .. import utils
+
+# language=SQLite
+SCHEMA = """
+CREATE TABLE sessions
+(
+    dc_id     INTEGER PRIMARY KEY,
+    api_id    INTEGER,
+    test_mode INTEGER,
+    auth_key  BLOB,
+    date      INTEGER NOT NULL,
+    user_id   INTEGER,
+    is_bot    INTEGER
+);
+
+CREATE TABLE peers
+(
+    id             INTEGER PRIMARY KEY,
+    access_hash    INTEGER,
+    type           INTEGER NOT NULL,
+    phone_number   TEXT,
+    last_update_on INTEGER NOT NULL DEFAULT (CAST(STRFTIME('%s', 'now') AS INTEGER))
+);
+
+CREATE TABLE usernames
+(
+    id       INTEGER,
+    username TEXT,
+    FOREIGN KEY (id) REFERENCES peers(id)
+);
+
+CREATE TABLE update_state
+(
+    id   INTEGER PRIMARY KEY,
+    pts  INTEGER,
+    qts  INTEGER,
+    date INTEGER,
+    seq  INTEGER
+);
+
+CREATE TABLE version
+(
+    number INTEGER PRIMARY KEY
+);
+
+CREATE INDEX IF NOT EXISTS idx_peers_id ON peers (id);
+CREATE INDEX IF NOT EXISTS idx_peers_phone_number ON peers (phone_number);
+CREATE INDEX IF NOT EXISTS idx_usernames_id ON usernames (id);
+CREATE INDEX IF NOT EXISTS idx_usernames_username ON usernames (username);
+
+CREATE TRIGGER trg_peers_last_update_on
+    AFTER UPDATE
+    ON peers
+BEGIN
+    UPDATE peers
+    SET last_update_on = CAST(STRFTIME('%s', 'now') AS INTEGER)
+    WHERE id = NEW.id;
+END;
+"""
+
+
+def get_input_peer(peer_id: int, access_hash: int, peer_type: str):
+    if peer_type in ["user", "bot"]:
+        return raw.types.InputPeerUser(
+            user_id=peer_id,
+            access_hash=access_hash
+        )
+
+    if peer_type == "group":
+        return raw.types.InputPeerChat(
+            chat_id=-peer_id
+        )
+
+    if peer_type in ["channel", "supergroup"]:
+        return raw.types.InputPeerChannel(
+            channel_id=utils.get_channel_id(peer_id),
+            access_hash=access_hash
+        )
+
+    raise ValueError(f"Invalid peer type: {peer_type}")
+
+
+class SQLiteStorage(Storage):
+    VERSION = 6
+    USERNAME_TTL = 8 * 60 * 60
+
+    def __init__(self, name: str):
+        super().__init__(name)
+
+        self.executor = ThreadPoolExecutor(1)
+        self.loop = asyncio.get_event_loop()
+        self.conn = None  # type: sqlite3.Connection | None
+
+    def _create_impl(self):
+        with self.conn:
+            self.conn.executescript(SCHEMA)
+
+            self.conn.execute(
+                "INSERT INTO version VALUES (?)",
+                (self.VERSION,)
+            )
+
+            self.conn.execute(
+                "INSERT INTO sessions VALUES (?, ?, ?, ?, ?, ?, ?)",
+                (2, None, None, None, 0, None, None)
+            )
+
+    async def create(self):
+        return await self.loop.run_in_executor(self.executor, self._create_impl)
+
+    async def open(self):
+        raise NotImplementedError
+
+    async def save(self):
+        await self.date(int(time.time()))
+        await self.loop.run_in_executor(self.executor, self.conn.commit)
+
+    async def close(self):
+        await self.loop.run_in_executor(self.executor, self.conn.close)
+        self.executor.shutdown()
+
+    async def delete(self):
+        raise NotImplementedError
+
+    def _update_peers_impl(self, peers):
+        with self.conn:
+            peers_data = []
+            usernames_data = []
+            ids_to_delete = []
+            for id, access_hash, type, usernames, phone_number in peers:
+                ids_to_delete.append((id,))
+                peers_data.append((id, access_hash, type, phone_number))
+
+                if usernames:
+                    usernames_data.extend([(id, username) for username in usernames])
+
+            self.conn.executemany(
+                "REPLACE INTO peers (id, access_hash, type, phone_number) VALUES (?, ?, ?, ?)",
+                peers_data
+            )
+
+            self.conn.executemany(
+                "DELETE FROM usernames WHERE id = ?",
+                ids_to_delete
+            )
+
+            if usernames_data:
+                self.conn.executemany(
+                    "REPLACE INTO usernames (id, username) VALUES (?, ?)",
+                    usernames_data
+                )
+
+    async def update_peers(self, peers: List[Tuple[int, int, str, List[str], str]]):
+        return await self.loop.run_in_executor(self.executor, self._update_peers_impl, peers)
+
+    def _update_state_impl(self, value: Tuple[int, int, int, int, int] = object):
+        if value == object:
+            return self.conn.execute(
+                "SELECT id, pts, qts, date, seq FROM update_state "
+                "ORDER BY date ASC"
+            ).fetchall()
+        else:
+            with self.conn:
+                if isinstance(value, int):
+                    self.conn.execute(
+                        "DELETE FROM update_state WHERE id = ?",
+                        (value,)
+                    )
+                else:
+                    self.conn.execute(
+                        "REPLACE INTO update_state (id, pts, qts, date, seq)"
+                        "VALUES (?, ?, ?, ?, ?)",
+                        value
+                    )
+
+    async def update_state(self, value: Tuple[int, int, int, int, int] = object):
+        return await self.loop.run_in_executor(self.executor, self._update_state_impl, value)
+
+    def _get_peer_by_id_impl(self, peer_id: int):
+        with self.conn:
+            return self.conn.execute(
+                "SELECT id, access_hash, type FROM peers WHERE id = ?",
+                (peer_id,)
+            ).fetchone()
+
+    async def get_peer_by_id(self, peer_id: int):
+        r = await self.loop.run_in_executor(self.executor, self._get_peer_by_id_impl, peer_id)
+
+        if r is None:
+            raise KeyError(f"ID not found: {peer_id}")
+
+        return get_input_peer(*r)
+
+    def _get_peer_by_username_impl(self, username: str):
+        with self.conn:
+            return self.conn.execute(
+                "SELECT p.id, p.access_hash, p.type, p.last_update_on FROM peers p "
+                "JOIN usernames u ON p.id = u.id "
+                "WHERE u.username = ? "
+                "ORDER BY p.last_update_on DESC",
+                (username,)
+            ).fetchone()
+
+    async def get_peer_by_username(self, username: str):
+        r = await self.loop.run_in_executor(self.executor, self._get_peer_by_username_impl, username)
+
+        if r is None:
+            raise KeyError(f"Username not found: {username}")
+
+        if abs(time.time() - r[3]) > self.USERNAME_TTL:
+            raise KeyError(f"Username expired: {username}")
+
+        return get_input_peer(*r[:3])
+
+    def _get_peer_by_phone_number_impl(self, phone_number: str):
+        with self.conn:
+            return self.conn.execute(
+                "SELECT id, access_hash, type FROM peers WHERE phone_number = ?",
+                (phone_number,)
+            ).fetchone()
+
+    async def get_peer_by_phone_number(self, phone_number: str):
+        r = await self.loop.run_in_executor(self.executor, self._get_peer_by_phone_number_impl, phone_number)
+
+        if r is None:
+            raise KeyError(f"Phone number not found: {phone_number}")
+
+        return get_input_peer(*r)
+
+    def _get_impl(self, attr: str):
+        with self.conn:
+            return self.conn.execute(f"SELECT {attr} FROM sessions").fetchone()[0]
+
+    # async def _get(self, attr: str):
+    #     return await self.loop.run_in_executor(self.executor, self._get_impl, attr)
+
+    async def _get(self):
+        attr = inspect.stack()[2].function
+        return await self.loop.run_in_executor(self.executor, self._get_impl, attr)
+
+    def _set_impl(self, attr: str, value: any):
+        with self.conn:
+            return self.conn.execute(f"UPDATE sessions SET {attr} = ?", (value,))
+
+    # async def _set(self, attr: str, value: Any):
+    #     return await self.loop.run_in_executor(self.executor, self._set_impl, attr, value)
+
+    async def _set(self, value: Any):
+        attr = inspect.stack()[2].function
+
+        return await self.loop.run_in_executor(self.executor, self._set_impl, attr, value)
+
+    async def _accessor(self, value: Any = object):
+        # return await self._get(attr) if value == object else await self._set(attr, value)
+        return await self._get() if value == object else await self._set(value)
+    
+    def _get_version_impl(self):
+        with self.conn:
+            return self.conn.execute("SELECT number FROM version").fetchone()[0]
+
+    def _set_version_impl(self, value):
+        with self.conn:
+            return self.conn.execute("UPDATE version SET number = ?", (value,))
+
+    async def dc_id(self, value: int = object):
+        return await self._accessor(value)
+
+    async def api_id(self, value: int = object):
+        return await self._accessor(value)
+
+    async def test_mode(self, value: bool = object):
+        return await self._accessor(value)
+
+    async def auth_key(self, value: bytes = object):
+        return await self._accessor(value)
+
+    async def date(self, value: int = object):
+        return await self._accessor(value)
+
+    async def user_id(self, value: int = object):
+        return await self._accessor(value)
+
+    async def is_bot(self, value: bool = object):
+        return await self._accessor(value)
+
+    async def version(self, value: int = object):
+        if value == object:
+            return await self.loop.run_in_executor(self.executor, self._get_version_impl)
+        else:
+            return await self.loop.run_in_executor(self.executor, self._set_version_impl, value)
diff --git a/pyrogram/storage/storage.py b/pyrogram/storage/storage.py
new file mode 100644
index 0000000000..35b539f64c
--- /dev/null
+++ b/pyrogram/storage/storage.py
@@ -0,0 +1,216 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#  Copyright (C) 2017-present bakatrouble 
+#  Copyright (C) 2017-present cavallium 
+#  Copyright (C) 2017-present andrew-ld 
+#  Copyright (C) 2017-present 01101sam 
+#  Copyright (C) 2017-present KurimuzonAkuma 
+#
+#  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 abc import ABC, abstractmethod
+import base64
+import struct
+from typing import List, Tuple
+
+
+class Storage(ABC):
+    """
+    Abstract class for storage engines.
+
+    Parameters:
+        name (``str``):
+            The name of the session.
+    """
+    OLD_SESSION_STRING_FORMAT = ">B?256sI?"
+    OLD_SESSION_STRING_FORMAT_64 = ">B?256sQ?"
+    SESSION_STRING_SIZE = 351
+    SESSION_STRING_SIZE_64 = 356
+
+    SESSION_STRING_FORMAT = ">BI?256sQ?"
+
+    def __init__(self, name: str):
+        self.name = name
+
+    @abstractmethod
+    async def open(self):
+        """Opens the storage engine."""
+        raise NotImplementedError
+
+    @abstractmethod
+    async def save(self):
+        """Saves the current state of the storage engine."""
+        raise NotImplementedError
+
+    @abstractmethod
+    async def close(self):
+        """Closes the storage engine."""
+        raise NotImplementedError
+
+    @abstractmethod
+    async def delete(self):
+        """Deletes the storage."""
+        raise NotImplementedError
+
+    @abstractmethod
+    async def update_peers(self, peers: List[Tuple[int, int, str, List[str], str]]):
+        """
+        Update the peers table with the provided information.
+
+        Parameters:
+            peers (``List[Tuple[int, int, str, List[str], str]]``): A list of tuples containing the
+                information of the peers to be updated. Each tuple must contain the following
+                information:
+                - ``int``: The peer id.
+                - ``int``: The peer access hash.
+                - ``str``: The peer type (user, chat or channel).
+                - List of ``str``: The peer username (if any).
+                - ``str``: The peer phone number (if any).
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def update_state(self, update_state: Tuple[int, int, int, int, int] = object):
+        """Get or set the update state of the current session.
+
+        Parameters:
+            update_state (``Tuple[int, int, int, int, int]``): A tuple containing the update state to set.
+                Tuple must contain the following information:
+                - ``int``: The id of the entity.
+                - ``int``: The pts.
+                - ``int``: The qts.
+                - ``int``: The date.
+                - ``int``: The seq.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def get_peer_by_id(self, peer_id: int):
+        """Retrieve a peer by its ID.
+
+        Parameters:
+            peer_id (``int``):
+                The ID of the peer to retrieve.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def get_peer_by_username(self, username: str):
+        """Retrieve a peer by its username.
+
+        Parameters:
+            username (``str``):
+                The username of the peer to retrieve.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def get_peer_by_phone_number(self, phone_number: str):
+        """Retrieve a peer by its phone number.
+
+        Parameters:
+            phone_number (``str``):
+                The phone number of the peer to retrieve.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def dc_id(self, value: int = object):
+        """Get or set the DC ID of the current session.
+
+        Parameters:
+            value (``int``, *optional*):
+                The DC ID to set.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def api_id(self, value: int = object):
+        """Get or set the API ID of the current session.
+
+        Parameters:
+            value (``int``, *optional*):
+                The API ID to set.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def test_mode(self, value: bool = object):
+        """Get or set the test mode of the current session.
+
+        Parameters:
+            value (``bool``, *optional*):
+                The test mode to set.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def auth_key(self, value: bytes = object):
+        """Get or set the authorization key of the current session.
+
+        Parameters:
+            value (``bytes``, *optional*):
+                The authorization key to set.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def date(self, value: int = object):
+        """Get or set the date of the current session.
+
+        Parameters:
+            value (``int``, *optional*):
+                The date to set.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def user_id(self, value: int = object):
+        """Get or set the user ID of the current session.
+
+        Parameters:
+            value (``int``, *optional*):
+                The user ID to set.
+        """
+        raise NotImplementedError
+
+    @abstractmethod
+    async def is_bot(self, value: bool = object):
+        """Get or set the bot flag of the current session.
+
+        Parameters:
+            value (``bool``, *optional*):
+                The bot flag to set.
+        """
+        raise NotImplementedError
+
+    async def export_session_string(self):
+        """Exports the session string for the current session.
+
+        Returns:
+            ``str``: The session string for the current session.
+        """
+        packed = struct.pack(
+            self.SESSION_STRING_FORMAT,
+            await self.dc_id(),
+            await self.api_id(),
+            await self.test_mode(),
+            await self.auth_key(),
+            await self.user_id(),
+            await self.is_bot()
+        )
+
+        return base64.urlsafe_b64encode(packed).decode().rstrip("=")
diff --git a/pyrogram/sync.py b/pyrogram/sync.py
new file mode 100644
index 0000000000..94c82a3dd6
--- /dev/null
+++ b/pyrogram/sync.py
@@ -0,0 +1,113 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+import functools
+import inspect
+import threading
+
+from pyrogram import types
+from pyrogram.methods import Methods
+from pyrogram.methods.utilities import idle as idle_module, compose as compose_module
+
+
+def async_to_sync(obj, name):
+    function = getattr(obj, name)
+    main_loop = asyncio.get_event_loop()
+
+    def async_to_sync_gen(agen, loop, is_main_thread):
+        async def anext(agen):
+            try:
+                return await agen.__anext__(), False
+            except StopAsyncIteration:
+                return None, True
+
+        while True:
+            if is_main_thread:
+                item, done = loop.run_until_complete(anext(agen))
+            else:
+                item, done = asyncio.run_coroutine_threadsafe(anext(agen), loop).result()
+
+            if done:
+                break
+
+            yield item
+
+    @functools.wraps(function)
+    def async_to_sync_wrap(*args, **kwargs):
+        coroutine = function(*args, **kwargs)
+
+        try:
+            loop = asyncio.get_event_loop()
+        except RuntimeError:
+            loop = asyncio.new_event_loop()
+            asyncio.set_event_loop(loop)
+
+        if threading.current_thread() is threading.main_thread() or not main_loop.is_running():
+            if loop.is_running():
+                return coroutine
+            else:
+                if inspect.iscoroutine(coroutine):
+                    return loop.run_until_complete(coroutine)
+
+                if inspect.isasyncgen(coroutine):
+                    return async_to_sync_gen(coroutine, loop, True)
+        else:
+            if inspect.iscoroutine(coroutine):
+                if loop.is_running():
+                    async def coro_wrapper():
+                        return await asyncio.wrap_future(asyncio.run_coroutine_threadsafe(coroutine, main_loop))
+
+                    return coro_wrapper()
+                else:
+                    return asyncio.run_coroutine_threadsafe(coroutine, main_loop).result()
+
+            if inspect.isasyncgen(coroutine):
+                if loop.is_running():
+                    return coroutine
+                else:
+                    return async_to_sync_gen(coroutine, main_loop, False)
+
+    setattr(obj, name, async_to_sync_wrap)
+
+
+def wrap(source):
+    for name in dir(source):
+        method = getattr(source, name)
+
+        if not name.startswith("_"):
+            if inspect.iscoroutinefunction(method) or inspect.isasyncgenfunction(method):
+                async_to_sync(source, name)
+
+
+# Wrap all Client's relevant methods
+wrap(Methods)
+
+# Wrap types' bound methods
+for class_name in dir(types):
+    cls = getattr(types, class_name)
+
+    if inspect.isclass(cls):
+        wrap(cls)
+
+# Special case for idle and compose, because they are not inside Methods
+async_to_sync(idle_module, "idle")
+idle = getattr(idle_module, "idle")
+
+async_to_sync(compose_module, "compose")
+compose = getattr(compose_module, "compose")
diff --git a/pyrogram/types/__init__.py b/pyrogram/types/__init__.py
new file mode 100644
index 0000000000..849e32528d
--- /dev/null
+++ b/pyrogram/types/__init__.py
@@ -0,0 +1,32 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+from .list import List
+from .update import *
+from .authorization import *
+from .bots_and_keyboards import *
+from .chat_topics import *
+from .inline_mode import *
+from .input_media import *
+from .input_paid_media import *
+from .input_message_content import *
+from .messages_and_media import *
+from .message_origin import *
+from .business import *
+from .user_and_chats import *
diff --git a/pyrogram/types/authorization/__init__.py b/pyrogram/types/authorization/__init__.py
new file mode 100644
index 0000000000..04a34f2a48
--- /dev/null
+++ b/pyrogram/types/authorization/__init__.py
@@ -0,0 +1,29 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .active_session import ActiveSession
+from .active_sessions import ActiveSessions
+from .sent_code import SentCode
+from .terms_of_service import TermsOfService
+
+__all__ = [
+    "ActiveSession",
+    "ActiveSessions",
+    "SentCode",
+    "TermsOfService",
+]
diff --git a/pyrogram/types/authorization/active_session.py b/pyrogram/types/authorization/active_session.py
new file mode 100644
index 0000000000..2322f78aac
--- /dev/null
+++ b/pyrogram/types/authorization/active_session.py
@@ -0,0 +1,175 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from pyrogram import raw, utils
+
+from ..object import Object
+
+
+class ActiveSession(Object):
+    """Contains information about one session in a Telegram application used by the current user. Sessions must be shown to the user in the returned order.
+
+    Parameters:
+        id (``int``):
+            Session identifier.
+
+        device_model (``str``):
+            Model of the device the application has been run or is running on, as provided by the application.
+
+        platform (``str``):
+            Operating system the application has been run or is running on, as provided by the application.
+
+        system_version (``str``):
+            Version of the operating system the application has been run or is running on, as provided by the application.
+
+        api_id (``int``):
+            Telegram API identifier, as provided by the application.
+
+        application_name (``str``):
+            Name of the application, as provided by the application.
+
+        application_version (``str``):
+            The version of the application, as provided by the application.
+
+        log_in_date (:py:obj:`~datetime.datetime`, *optional*):
+            Point in time (Unix timestamp) when the user has logged in.
+
+        last_active_date (:py:obj:`~datetime.datetime`, *optional*):
+            Point in time (Unix timestamp) when the session was last used.
+
+        ip_address (``str``):
+            IP address from which the session was created, in human-readable format.
+
+        location (``str``):
+            A human-readable description of the location from which the session was created, based on the IP address.
+
+        country (``str``):
+            Country.
+
+        is_current (``bool``):
+            True, if this session is the current session.
+
+        is_password_pending (``bool``):
+            True, if a 2-step verification password is needed to complete authorization of the session.
+
+        is_unconfirmed (``bool``):
+            True, if the session wasn't confirmed from another session.
+
+        can_accept_secret_chats (``bool``):
+            True, if incoming secret chats can be accepted by the session.
+
+        can_accept_calls (``bool``):
+            True, if incoming calls can be accepted by the session.
+
+        is_official_application (``bool``):
+            True, if the application is an official application or uses the api_id of an official application.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        id: int = None,
+        device_model: str = None,
+        platform: str = None,
+        system_version: str = None,
+        api_id: int = None,
+        application_name: str = None,
+        application_version: str = None,
+        log_in_date: datetime = None,
+        last_active_date: datetime = None,
+        ip_address: str = None,
+        location: str = None,
+        country: str = None,
+        is_current: bool = None,
+        is_password_pending: bool = None,
+        is_unconfirmed: bool = None,
+        can_accept_secret_chats: bool = None,
+        can_accept_calls: bool = None,
+        is_official_application: bool = None
+    ):
+        super().__init__()
+
+        self.id = id
+        self.device_model = device_model
+        self.platform = platform
+        self.system_version = system_version
+        self.api_id = api_id
+        self.application_name = application_name
+        self.application_version = application_version
+        self.log_in_date = log_in_date
+        self.last_active_date = last_active_date
+        self.ip_address = ip_address
+        self.location = location
+        self.country = country
+        self.is_current = is_current
+        self.is_password_pending = is_password_pending
+        self.is_unconfirmed = is_unconfirmed
+        self.can_accept_secret_chats = can_accept_secret_chats
+        self.can_accept_calls = can_accept_calls
+        self.is_official_application = is_official_application
+
+    @staticmethod
+    def _parse(session: "raw.types.Authorization") -> "ActiveSession":        
+        return ActiveSession(
+            id=session.hash,
+            device_model=session.device_model,
+            platform=session.platform,
+            system_version=session.system_version,
+            api_id=session.api_id,
+            application_name=session.app_name,
+            application_version=session.app_version,
+            log_in_date=utils.timestamp_to_datetime(session.date_created),
+            last_active_date=utils.timestamp_to_datetime(session.date_active),
+            ip_address=session.ip,
+            location=session.region,
+            country=session.country,
+            is_current=getattr(session, "current", None),
+            is_password_pending=getattr(session, "password_pending", None),
+            is_unconfirmed=getattr(session, "unconfirmed", None),
+            can_accept_secret_chats=not getattr(session, "encrypted_requests_disabled", False),
+            can_accept_calls=not getattr(session, "call_requests_disabled", False),
+            is_official_application=getattr(session, "official_app", None)
+        )
+
+    async def terminate(self):
+        """Bound method *reset* of :obj:`~pyrogram.types.ActiveSession`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.terminate_session(123456789)
+
+        Example:
+
+        .. code-block:: python
+
+            await session.reset()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+
+        """
+
+        return await self._client.terminate_session(self.id)
diff --git a/pyrogram/types/authorization/active_sessions.py b/pyrogram/types/authorization/active_sessions.py
new file mode 100644
index 0000000000..414e3e70b7
--- /dev/null
+++ b/pyrogram/types/authorization/active_sessions.py
@@ -0,0 +1,58 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types, utils
+
+from ..object import Object
+
+
+class ActiveSessions(Object):
+    """Contains a list of sessions
+
+    Parameters:
+        inactive_session_ttl_days (``int``):
+            Number of days of inactivity before sessions will automatically be terminated; 1-366 days.
+
+        active_sessions (List of :obj:`~pyrogram.types.ActiveSession`):
+            List of sessions.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        inactive_session_ttl_days: int = None,
+        active_sessions: List["types.ActiveSession"] = None
+    ):
+        super().__init__()
+
+        self.inactive_session_ttl_days = inactive_session_ttl_days
+        self.active_sessions = active_sessions
+
+    @staticmethod
+    def _parse(authorizations: "raw.types.account.Authorizations") -> "ActiveSessions":        
+        return ActiveSessions(
+            inactive_session_ttl_days=authorizations.authorization_ttl_days,
+            active_sessions=types.List([
+                types.ActiveSession._parse(active)
+                for active in authorizations.authorizations
+            ])
+        )
diff --git a/pyrogram/types/authorization/sent_code.py b/pyrogram/types/authorization/sent_code.py
new file mode 100644
index 0000000000..2b29bb3af4
--- /dev/null
+++ b/pyrogram/types/authorization/sent_code.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, enums
+from ..object import Object
+
+
+class SentCode(Object):
+    """Contains info on a sent confirmation code.
+
+    Parameters:
+        type (:obj:`~pyrogram.enums.SentCodeType`):
+            Type of the current sent code.
+
+        phone_code_hash (``str``):
+            Confirmation code identifier useful for the next authorization steps (either
+            :meth:`~pyrogram.Client.sign_in` or :meth:`~pyrogram.Client.sign_up`).
+
+        next_type (:obj:`~pyrogram.enums.NextCodeType`, *optional*):
+            Type of the next code to be sent with :meth:`~pyrogram.Client.resend_code`.
+
+        timeout (``int``, *optional*):
+            Delay in seconds before calling :meth:`~pyrogram.Client.resend_code`.
+    """
+
+    def __init__(
+        self, *,
+        type: "enums.SentCodeType",
+        phone_code_hash: str,
+        next_type: "enums.NextCodeType" = None,
+        timeout: int = None
+    ):
+        super().__init__()
+
+        self.type = type
+        self.phone_code_hash = phone_code_hash
+        self.next_type = next_type
+        self.timeout = timeout
+
+    @staticmethod
+    def _parse(sent_code: raw.types.auth.SentCode) -> "SentCode":
+        return SentCode(
+            type=enums.SentCodeType(type(sent_code.type)),
+            phone_code_hash=sent_code.phone_code_hash,
+            next_type=enums.NextCodeType(type(sent_code.next_type)) if sent_code.next_type else None,
+            timeout=sent_code.timeout
+        )
diff --git a/pyrogram/types/authorization/terms_of_service.py b/pyrogram/types/authorization/terms_of_service.py
new file mode 100644
index 0000000000..3c5ffa6c6d
--- /dev/null
+++ b/pyrogram/types/authorization/terms_of_service.py
@@ -0,0 +1,56 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+from pyrogram import raw
+from pyrogram import types
+from ..object import Object
+
+
+class TermsOfService(Object):
+    """Telegram's Terms of Service returned by :meth:`~pyrogram.Client.sign_in`.
+
+    Parameters:
+        id (``str``):
+            Terms of Service identifier.
+
+        text (``str``):
+            Terms of Service text.
+
+        entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            Special entities like URLs that appear in the text.
+    """
+
+    def __init__(self, *, id: str, text: str, entities: List["types.MessageEntity"]):
+        super().__init__()
+
+        self.id = id
+        self.text = text
+        self.entities = entities
+
+    @staticmethod
+    def _parse(terms_of_service: "raw.types.help.TermsOfService") -> "TermsOfService":
+        return TermsOfService(
+            id=terms_of_service.id.data,
+            text=terms_of_service.text,
+            entities=[
+                types.MessageEntity._parse(None, entity, {})
+                for entity in terms_of_service.entities
+            ] if terms_of_service.entities else None
+        )
diff --git a/pyrogram/types/bots_and_keyboards/__init__.py b/pyrogram/types/bots_and_keyboards/__init__.py
new file mode 100644
index 0000000000..151d1ee98c
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/__init__.py
@@ -0,0 +1,86 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .bot_command import BotCommand
+from .bot_command_scope import BotCommandScope
+from .bot_command_scope_all_chat_administrators import BotCommandScopeAllChatAdministrators
+from .bot_command_scope_all_group_chats import BotCommandScopeAllGroupChats
+from .bot_command_scope_all_private_chats import BotCommandScopeAllPrivateChats
+from .bot_command_scope_chat import BotCommandScopeChat
+from .bot_command_scope_chat_administrators import BotCommandScopeChatAdministrators
+from .bot_command_scope_chat_member import BotCommandScopeChatMember
+from .bot_command_scope_default import BotCommandScopeDefault
+from .callback_game import CallbackGame
+from .callback_query import CallbackQuery
+from .force_reply import ForceReply
+from .game_high_score import GameHighScore
+from .inline_keyboard_button import InlineKeyboardButton
+from .inline_keyboard_markup import InlineKeyboardMarkup
+from .keyboard_button import KeyboardButton
+from .keyboard_button_poll_type import (
+    KeyboardButtonPollType,
+    KeyboardButtonPollTypeRegular,
+    KeyboardButtonPollTypeQuiz
+)
+from .keyboard_button_request_chat import KeyboardButtonRequestChat
+from .keyboard_button_request_users import KeyboardButtonRequestUsers
+from .login_url import LoginUrl
+from .menu_button import MenuButton
+from .menu_button_commands import MenuButtonCommands
+from .menu_button_default import MenuButtonDefault
+from .menu_button_web_app import MenuButtonWebApp
+from .reply_keyboard_markup import ReplyKeyboardMarkup
+from .reply_keyboard_remove import ReplyKeyboardRemove
+from .sent_web_app_message import SentWebAppMessage
+from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat
+from .web_app_info import WebAppInfo
+
+
+__all__ = [
+    "CallbackGame",
+    "CallbackQuery",
+    "ForceReply",
+    "GameHighScore",
+    "InlineKeyboardButton",
+    "InlineKeyboardMarkup",
+    "KeyboardButton",
+    "KeyboardButtonPollType",
+    "KeyboardButtonPollTypeRegular",
+    "KeyboardButtonPollTypeQuiz",
+    "KeyboardButtonRequestChat",
+    "KeyboardButtonRequestUsers",
+    "ReplyKeyboardMarkup",
+    "ReplyKeyboardRemove",
+    "LoginUrl",
+    "BotCommand",
+    "BotCommandScope",
+    "BotCommandScopeAllChatAdministrators",
+    "BotCommandScopeAllGroupChats",
+    "BotCommandScopeAllPrivateChats",
+    "BotCommandScopeChat",
+    "BotCommandScopeChatAdministrators",
+    "BotCommandScopeChatMember",
+    "BotCommandScopeDefault",
+    "WebAppInfo",
+    "MenuButton",
+    "MenuButtonCommands",
+    "MenuButtonWebApp",
+    "MenuButtonDefault",
+    "SentWebAppMessage",
+    "SwitchInlineQueryChosenChat",
+]
diff --git a/pyrogram/types/bots_and_keyboards/bot_command.py b/pyrogram/types/bots_and_keyboards/bot_command.py
new file mode 100644
index 0000000000..88f459dcc4
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/bot_command.py
@@ -0,0 +1,53 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+from ..object import Object
+
+
+class BotCommand(Object):
+    """A bot command with the standard slash "/" prefix.
+
+    Parameters:
+        command (``str``):
+            Text of the command; 1-32 characters.
+            Can contain only lowercase English letters, digits and underscores.
+
+        description (``str``):
+            Description of the command; 1-256 characters.
+    """
+
+    def __init__(self, command: str, description: str):
+        super().__init__()
+
+        self.command = command
+        self.description = description
+
+    def write(self) -> "raw.types.BotCommand":
+        return raw.types.BotCommand(
+            command=self.command,
+            description=self.description,
+        )
+
+    @staticmethod
+    def read(c: "raw.types.BotCommand") -> "BotCommand":
+        return BotCommand(
+            command=c.command,
+            description=c.description
+        )
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope.py b/pyrogram/types/bots_and_keyboards/bot_command_scope.py
new file mode 100644
index 0000000000..2db638e9a7
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope.py
@@ -0,0 +1,73 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class BotCommandScope(Object):
+    """Represents the scope to which bot commands are applied.
+
+    Currently, the following 7 scopes are supported:
+
+    - :obj:`~pyrogram.types.BotCommandScopeDefault`
+    - :obj:`~pyrogram.types.BotCommandScopeAllPrivateChats`
+    - :obj:`~pyrogram.types.BotCommandScopeAllGroupChats`
+    - :obj:`~pyrogram.types.BotCommandScopeAllChatAdministrators`
+    - :obj:`~pyrogram.types.BotCommandScopeChat`
+    - :obj:`~pyrogram.types.BotCommandScopeChatAdministrators`
+    - :obj:`~pyrogram.types.BotCommandScopeChatMember`
+
+    **Determining list of commands**
+
+    The following algorithm is used to determine the list of commands for a particular user viewing the bot menu.
+    The first list of commands which is set is returned:
+
+    **Commands in the chat with the bot**:
+
+    - BotCommandScopeChat + language_code
+    - BotCommandScopeChat
+    - BotCommandScopeAllPrivateChats + language_code
+    - BotCommandScopeAllPrivateChats
+    - BotCommandScopeDefault + language_code
+    - BotCommandScopeDefault
+
+    **Commands in group and supergroup chats**
+
+    - BotCommandScopeChatMember + language_code
+    - BotCommandScopeChatMember
+    - BotCommandScopeChatAdministrators + language_code (administrators only)
+    - BotCommandScopeChatAdministrators (administrators only)
+    - BotCommandScopeChat + language_code
+    - BotCommandScopeChat
+    - BotCommandScopeAllChatAdministrators + language_code (administrators only)
+    - BotCommandScopeAllChatAdministrators (administrators only)
+    - BotCommandScopeAllGroupChats + language_code
+    - BotCommandScopeAllGroupChats
+    - BotCommandScopeDefault + language_code
+    - BotCommandScopeDefault
+    """
+
+    def __init__(self, type: str):
+        super().__init__()
+
+        self.type = type
+
+    async def write(self, client: "pyrogram.Client") -> "raw.base.BotCommandScope":
+        raise NotImplementedError
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_all_chat_administrators.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_chat_administrators.py
new file mode 100644
index 0000000000..0cc6339c77
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_chat_administrators.py
@@ -0,0 +1,32 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from .bot_command_scope import BotCommandScope
+
+
+class BotCommandScopeAllChatAdministrators(BotCommandScope):
+    """Represents the scope of bot commands, covering all group and supergroup chat administrators.
+    """
+
+    def __init__(self):
+        super().__init__("all_chat_administrators")
+
+    async def write(self, client: "pyrogram.Client") -> "raw.base.BotCommandScope":
+        return raw.types.BotCommandScopeChatAdmins()
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_all_group_chats.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_group_chats.py
new file mode 100644
index 0000000000..5f8457f61d
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_group_chats.py
@@ -0,0 +1,32 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from .bot_command_scope import BotCommandScope
+
+
+class BotCommandScopeAllGroupChats(BotCommandScope):
+    """Represents the scope of bot commands, covering all group and supergroup chats.
+    """
+
+    def __init__(self):
+        super().__init__("all_group_chats")
+
+    async def write(self, client: "pyrogram.Client") -> "raw.base.BotCommandScope":
+        return raw.types.BotCommandScopeChats()
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_all_private_chats.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_private_chats.py
new file mode 100644
index 0000000000..14b80f0dcd
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_private_chats.py
@@ -0,0 +1,32 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from .bot_command_scope import BotCommandScope
+
+
+class BotCommandScopeAllPrivateChats(BotCommandScope):
+    """Represents the scope of bot commands, covering all private chats.
+    """
+
+    def __init__(self):
+        super().__init__("all_private_chats")
+
+    async def write(self, client: "pyrogram.Client") -> "raw.base.BotCommandScope":
+        return raw.types.BotCommandScopeUsers()
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_chat.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_chat.py
new file mode 100644
index 0000000000..28912383b7
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_chat.py
@@ -0,0 +1,43 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from .bot_command_scope import BotCommandScope
+
+
+class BotCommandScopeChat(BotCommandScope):
+    """Represents the scope of bot commands, covering a specific chat.
+
+    Parameters:
+        chat_id (``int`` | ``str``):
+            Unique identifier for the target chat or username of the target supergroup (in the format
+            @supergroupusername).
+    """
+
+    def __init__(self, chat_id: Union[int, str]):
+        super().__init__("chat")
+
+        self.chat_id = chat_id
+
+    async def write(self, client: "pyrogram.Client") -> "raw.base.BotCommandScope":
+        return raw.types.BotCommandScopePeer(
+            peer=await client.resolve_peer(self.chat_id)
+        )
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_administrators.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_administrators.py
new file mode 100644
index 0000000000..6f42a29f2b
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_administrators.py
@@ -0,0 +1,43 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from .bot_command_scope import BotCommandScope
+
+
+class BotCommandScopeChatAdministrators(BotCommandScope):
+    """Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.
+
+    Parameters:
+        chat_id (``int`` | ``str``):
+            Unique identifier for the target chat or username of the target supergroup (in the format
+            @supergroupusername).
+    """
+
+    def __init__(self, chat_id: Union[int, str]):
+        super().__init__("chat_administrators")
+
+        self.chat_id = chat_id
+
+    async def write(self, client: "pyrogram.Client") -> "raw.base.BotCommandScope":
+        return raw.types.BotCommandScopePeerAdmins(
+            peer=await client.resolve_peer(self.chat_id)
+        )
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_member.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_member.py
new file mode 100644
index 0000000000..8d91df1413
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_member.py
@@ -0,0 +1,48 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from .bot_command_scope import BotCommandScope
+
+
+class BotCommandScopeChatMember(BotCommandScope):
+    """Represents the scope of bot commands, covering a specific member of a group or supergroup chat.
+
+    Parameters:
+        chat_id (``int`` | ``str``):
+            Unique identifier for the target chat or username of the target supergroup (in the format
+            @supergroupusername).
+
+        user_id (``int`` | ``str``):
+            Unique identifier of the target user.
+    """
+
+    def __init__(self, chat_id: Union[int, str], user_id: Union[int, str]):
+        super().__init__("chat_member")
+
+        self.chat_id = chat_id
+        self.user_id = user_id
+
+    async def write(self, client: "pyrogram.Client") -> "raw.base.BotCommandScope":
+        return raw.types.BotCommandScopePeerUser(
+            peer=await client.resolve_peer(self.chat_id),
+            user_id=await client.resolve_peer(self.user_id)
+        )
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_default.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_default.py
new file mode 100644
index 0000000000..d11ab012f8
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_default.py
@@ -0,0 +1,33 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from .bot_command_scope import BotCommandScope
+
+
+class BotCommandScopeDefault(BotCommandScope):
+    """Represents the default scope of bot commands.
+    Default commands are used if no commands with a narrower scope are specified for the user.
+    """
+
+    def __init__(self):
+        super().__init__("default")
+
+    async def write(self, client: "pyrogram.Client") -> "raw.base.BotCommandScope":
+        return raw.types.BotCommandScopeDefault()
diff --git a/pyrogram/types/bots_and_keyboards/callback_game.py b/pyrogram/types/bots_and_keyboards/callback_game.py
new file mode 100644
index 0000000000..3bd89270ff
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/callback_game.py
@@ -0,0 +1,29 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 CallbackGame(Object):
+    """Placeholder, currently holds no information.
+
+    Use BotFather to set up your game.
+    """
+
+    def __init__(self):
+        super().__init__()
diff --git a/pyrogram/types/bots_and_keyboards/callback_query.py b/pyrogram/types/bots_and_keyboards/callback_query.py
new file mode 100644
index 0000000000..c745d99d4e
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/callback_query.py
@@ -0,0 +1,368 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Match, Optional
+
+import pyrogram
+from pyrogram import raw, enums, types
+from pyrogram.errors import ChannelPrivate
+from ..object import Object
+from ..update import Update
+from ... import utils
+
+
+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:`~pyrogram.types.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:`~pyrogram.types.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.
+
+        matches (List of regex Matches, *optional*):
+            A list containing all `Match Objects `_ that match
+            the data of this callback query. Only applicable when using :obj:`Filters.regex `.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: str,
+        from_user: "types.User",
+        chat_instance: str,
+        message: "types.Message" = None,
+        inline_message_id: str = None,
+        data: Union[str, bytes] = None,
+        game_short_name: str = None,
+        matches: List[Match] = 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
+        self.matches = matches
+
+    @staticmethod
+    async def _parse(client: "pyrogram.Client", callback_query, users, chats) -> "CallbackQuery":
+        message = None
+        inline_message_id = None
+
+        if isinstance(callback_query, raw.types.UpdateBotCallbackQuery):
+            chat_id = utils.get_peer_id(callback_query.peer)
+            peer_id = utils.get_raw_peer_id(callback_query.peer)
+            message_id = callback_query.msg_id
+
+            message = client.message_cache[(chat_id, message_id)]
+
+            if not message:
+                try:
+                    message = await client.get_messages(
+                        chat_id=chat_id,
+                        message_ids=message_id
+                    )
+                except ChannelPrivate:
+                    channel = chats.get(peer_id, None)
+                    if channel:
+                        message = types.Message(
+                            id=message_id,
+                            date=utils.timestamp_to_datetime(0),
+                            chat=types.Chat._parse_channel_chat(
+                                client,
+                                channel
+                            )
+                        )
+        elif isinstance(callback_query, raw.types.UpdateInlineBotCallbackQuery):
+            inline_message_id = utils.pack_inline_message_id(callback_query.msg_id)
+        elif isinstance(callback_query, raw.types.UpdateBusinessBotCallbackQuery):
+            message = await types.Message._parse(
+                client,
+                callback_query.message,
+                users,
+                chats,
+                is_scheduled=False,
+                replies=0,
+                business_connection_id=callback_query.connection_id,
+                raw_reply_to_message=getattr(callback_query, "reply_to_message", None)
+            )
+        # Try to decode callback query data into string. If that fails, fallback to bytes instead of decoding by
+        # ignoring/replacing errors, this way, button clicks will still work.
+        data = getattr(callback_query, "data", None)
+        if data:
+            try:
+                data = data.decode()
+            except (UnicodeDecodeError, AttributeError):
+                data = data
+
+        return CallbackQuery(
+            id=str(callback_query.query_id),
+            from_user=types.User._parse(client, users[callback_query.user_id]),
+            message=message,
+            inline_message_id=inline_message_id,
+            chat_instance=str(callback_query.chat_instance),
+            data=data,
+            game_short_name=getattr(callback_query, "game_short_name", None),
+            client=client
+        )
+
+    async def answer(self, text: str = None, show_alert: bool = None, url: str = None, cache_time: int = 0):
+        """Bound method *answer* of :obj:`~pyrogram.types.CallbackQuery`.
+
+        Use this method as a shortcut for:
+
+        .. code-block:: python
+
+            await client.answer_callback_query(
+                callback_query.id,
+                text="Hello",
+                show_alert=True
+            )
+
+        Example:
+            .. code-block:: python
+
+                await callback_query.answer("Hello", show_alert=True)
+
+        Parameters:
+            text (``str``, *optional*):
+                Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters.
+
+            show_alert (``bool`` *optional*):
+                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`` *optional*):
+                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`` *optional*):
+                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 await self._client.answer_callback_query(
+            callback_query_id=self.id,
+            text=text,
+            show_alert=show_alert,
+            url=url,
+            cache_time=cache_time
+        )
+
+    async def edit_message_text(
+        self,
+        text: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        entities: List["types.MessageEntity"] = None,
+        link_preview_options: "types.LinkPreviewOptions" = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        disable_web_page_preview: bool = None
+    ) -> Union["types.Message", bool]:
+        """Edit the text of messages attached to callback queries.
+
+        Bound method *edit_message_text* of :obj:`~pyrogram.types.CallbackQuery`.
+
+        Parameters:
+            text (``str``):
+                New text of the message.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in message text, which can be specified instead of *parse_mode*.
+
+            link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*):
+                Link preview generation options for the message
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            :obj:`~pyrogram.types.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 await self._client.edit_message_text(
+                chat_id=self.message.chat.id,
+                message_id=self.message.id,
+                text=text,
+                parse_mode=parse_mode,
+                entities=entities,
+                link_preview_options=link_preview_options,
+                reply_markup=reply_markup,
+                disable_web_page_preview=disable_web_page_preview,
+                business_connection_id=self.message.business_connection_id
+            )
+        else:
+            return await self._client.edit_inline_text(
+                inline_message_id=self.inline_message_id,
+                text=text,
+                parse_mode=parse_mode,
+                entities=entities,
+                link_preview_options=link_preview_options,
+                reply_markup=reply_markup,
+                disable_web_page_preview=disable_web_page_preview
+            )
+
+    async def edit_message_caption(
+        self,
+        caption: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None
+    ) -> Union["types.Message", bool]:
+        """Edit the caption of media messages attached to callback queries.
+
+        Bound method *edit_message_caption* of :obj:`~pyrogram.types.CallbackQuery`.
+
+        Parameters:
+            caption (``str``):
+                New caption of the message.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in message text, which can be specified instead of *parse_mode*.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            :obj:`~pyrogram.types.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 await self.edit_message_text(
+            text=caption,
+            parse_mode=parse_mode,
+            entities=caption_entities,
+            reply_markup=reply_markup
+        )
+
+    async def edit_message_media(
+        self,
+        media: "types.InputMedia",
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        file_name: str = None
+    ) -> Union["types.Message", bool]:
+        """Edit animation, audio, document, photo or video messages attached to callback queries.
+
+        Bound method *edit_message_media* of :obj:`~pyrogram.types.CallbackQuery`.
+
+        Parameters:
+            media (:obj:`~pyrogram.types.InputMedia`):
+                One of the InputMedia objects describing an animation, audio, document, photo or video.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+            file_name (``str``, *optional*):
+                File name of the media to be sent. Not applicable to photos.
+                Defaults to file's path basename.
+
+        Returns:
+            :obj:`~pyrogram.types.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 await self._client.edit_message_media(
+                chat_id=self.message.chat.id,
+                message_id=self.message.id,
+                media=media,
+                reply_markup=reply_markup,
+                file_name=file_name,
+                business_connection_id=self.message.business_connection_id
+            )
+        else:
+            return await self._client.edit_inline_media(
+                inline_message_id=self.inline_message_id,
+                media=media,
+                reply_markup=reply_markup
+            )
+
+    async def edit_message_reply_markup(
+        self,
+        reply_markup: "types.InlineKeyboardMarkup" = None
+    ) -> Union["types.Message", bool]:
+        """Edit only the reply markup of messages attached to callback queries.
+
+        Bound method *edit_message_reply_markup* of :obj:`~pyrogram.types.CallbackQuery`.
+
+        Parameters:
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            :obj:`~pyrogram.types.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 await self._client.edit_message_reply_markup(
+                chat_id=self.message.chat.id,
+                message_id=self.message.id,
+                reply_markup=reply_markup,
+                business_connection_id=self.message.business_connection_id,
+            )
+        else:
+            return await self._client.edit_inline_reply_markup(
+                inline_message_id=self.inline_message_id,
+                reply_markup=reply_markup
+            )
diff --git a/pyrogram/types/bots_and_keyboards/force_reply.py b/pyrogram/types/bots_and_keyboards/force_reply.py
new file mode 100644
index 0000000000..b07c01e506
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/force_reply.py
@@ -0,0 +1,83 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+
+from ..object import Object
+
+log = logging.getLogger(__name__)
+
+
+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.
+
+    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;
+            2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
+
+        input_field_placeholder (``str``, *optional*):
+            The placeholder to be shown in the input field when the reply is active; 1-64 characters.
+    """
+
+    def __init__(
+        self,
+        selective: bool = None,
+        input_field_placeholder: str = None,
+        placeholder: str = None
+    ):
+        if placeholder and input_field_placeholder:
+            raise ValueError(
+                "Parameters `placeholder` and `input_field_placeholder` are mutually exclusive."
+            )
+
+        if placeholder is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use input_field_placeholder instead"
+            )
+            input_field_placeholder = placeholder
+
+        super().__init__()
+
+        self.selective = selective
+        self.input_field_placeholder = input_field_placeholder
+
+    @staticmethod
+    def read(b):
+        return ForceReply(
+            selective=b.selective,
+            input_field_placeholder=b.placeholder
+        )
+
+    async def write(self, _: "pyrogram.Client"):
+        return raw.types.ReplyKeyboardForceReply(
+            single_use=True,
+            selective=self.selective or None,
+            placeholder=self.input_field_placeholder or None
+        )
diff --git a/pyrogram/types/bots_and_keyboards/game_high_score.py b/pyrogram/types/bots_and_keyboards/game_high_score.py
new file mode 100644
index 0000000000..295b83fb23
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/game_high_score.py
@@ -0,0 +1,70 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, utils
+from pyrogram import types
+from ..object import Object
+
+
+class GameHighScore(Object):
+    """One row of the high scores table for a game.
+
+    Parameters:
+        user (:obj:`~pyrogram.types.User`):
+            User.
+
+        score (``int``):
+            Score.
+
+        position (``int``, *optional*):
+            Position in high score table for the game.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        user: "types.User",
+        score: int,
+        position: int = None
+    ):
+        super().__init__(client)
+
+        self.user = user
+        self.score = score
+        self.position = position
+
+    @staticmethod
+    def _parse(client, game_high_score: raw.types.HighScore, users: dict) -> "GameHighScore":
+        users = {i.id: i for i in users}
+
+        return GameHighScore(
+            user=types.User._parse(client, users[game_high_score.user_id]),
+            score=game_high_score.score,
+            position=game_high_score.pos,
+            client=client
+        )
+
+    @staticmethod
+    def _parse_action(client, service: raw.types.MessageService, users: dict):
+        return GameHighScore(
+            user=types.User._parse(client, users[utils.get_raw_peer_id(service.from_id or service.peer_id)]),
+            score=service.action.score,
+            client=client
+        )
diff --git a/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py b/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py
new file mode 100644
index 0000000000..e7b682552d
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py
@@ -0,0 +1,267 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+from ..object import Object
+
+
+class InlineKeyboardButton(Object):
+    """One button of an inline keyboard.
+
+    You must use exactly one of the optional fields.
+
+    Parameters:
+        text (``str``):
+            Label text on the button.
+
+        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*):
+            HTTP url to be opened when button is pressed.
+
+        web_app (:obj:`~pyrogram.types.WebAppInfo`, *optional*):
+            Description of the `Web App `_ that will be launched when the user
+            presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the
+            method :meth:`~pyrogram.Client.answer_web_app_query`. Available only in private chats between a user and the
+            bot.
+
+        login_url (:obj:`~pyrogram.types.LoginUrl`, *optional*):
+             An HTTP URL used to automatically authorize the user. Can be used as a replacement for
+             the `Telegram Login Widget `_.
+
+        user_id (``int``, *optional*):
+            User id, for links to the user profile.
+
+        switch_inline_query (``str``, *optional*):
+            If set, pressing the button will prompt the user to select one of their chats, open that chat and insert
+            the bot's username and the specified inline query in the input field. Can be empty, in which case just
+            the bot's username will be inserted.Note: This offers an easy way for users to start using your bot in
+            inline mode when they are currently in a private chat with it. Especially useful when combined with
+            switch_pm… actions – in this case the user will be automatically returned to the chat they switched from,
+            skipping the chat selection screen.
+
+        switch_inline_query_current_chat (``str``, *optional*):
+            If set, pressing the button will insert the bot's username and the specified inline query in the current
+            chat's input field. Can be empty, in which case only the bot's username will be inserted.This offers a
+            quick way for the user to open your bot in inline mode in the same chat – good for selecting something
+            from multiple options.
+
+        switch_inline_query_chosen_chat (:obj:`~pyrogram.types.SwitchInlineQueryChosenChat`, *optional*):
+            If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field
+
+        callback_game (:obj:`~pyrogram.types.CallbackGame`, *optional*):
+            Description of the game that will be launched when the user presses the button.
+            **NOTE**: This type of button **must** always be the first button in the first row.
+        
+        pay (``bool``, *optional*):
+            Specify True, to send a Pay button. Substrings "⭐" and "XTR" in the buttons's text will be replaced with a Telegram Star icon.
+
+            **NOTE**: This type of button **must** always be the first button in the first row and can only be used in invoice messages.
+
+        callback_data_with_password (``bytes``, *optional*):
+            A button that asks for the 2-step verification password of the current user and then sends a callback query to a bot Data to be sent to the bot via a callback query.
+
+    """
+
+    def __init__(
+        self,
+        text: str,
+        callback_data: Union[str, bytes] = None,
+        url: str = None,
+        web_app: "types.WebAppInfo" = None,
+        login_url: "types.LoginUrl" = None,
+        user_id: int = None,
+        switch_inline_query: str = None,
+        switch_inline_query_current_chat: str = None,
+        switch_inline_query_chosen_chat: "types.SwitchInlineQueryChosenChat" = None,
+        callback_game: "types.CallbackGame" = None,
+        pay: bool = None,
+        callback_data_with_password: bytes = None
+    ):
+        super().__init__()
+
+        self.text = str(text)
+        self.callback_data = callback_data
+        self.url = url
+        self.web_app = web_app
+        self.login_url = login_url
+        self.user_id = user_id
+        self.switch_inline_query = switch_inline_query
+        self.switch_inline_query_current_chat = switch_inline_query_current_chat
+        self.switch_inline_query_chosen_chat = switch_inline_query_chosen_chat
+        self.callback_game = callback_game
+        self.pay = pay
+        self.callback_data_with_password = callback_data_with_password
+
+    @staticmethod
+    def read(b: "raw.base.KeyboardButton"):
+        if isinstance(b, raw.types.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 = b.data.decode()
+            except UnicodeDecodeError:
+                data = b.data
+
+            if getattr(b, "requires_password", None):
+                return InlineKeyboardButton(
+                    text=b.text,
+                    callback_data_with_password=data
+                )
+
+            return InlineKeyboardButton(
+                text=b.text,
+                callback_data=data
+            )
+
+        if isinstance(b, raw.types.KeyboardButtonUrl):
+            return InlineKeyboardButton(
+                text=b.text,
+                url=b.url
+            )
+
+        if isinstance(b, raw.types.KeyboardButtonUrlAuth):
+            return InlineKeyboardButton(
+                text=b.text,
+                login_url=types.LoginUrl.read(b)
+            )
+
+        if isinstance(b, raw.types.KeyboardButtonUserProfile):
+            return InlineKeyboardButton(
+                text=b.text,
+                user_id=b.user_id
+            )
+
+        if isinstance(b, raw.types.KeyboardButtonSwitchInline):
+            if b.same_peer:
+                return InlineKeyboardButton(
+                    text=b.text,
+                    switch_inline_query_current_chat=b.query
+                )
+            elif b.peer_types:
+                return InlineKeyboardButton(
+                    text=b.text,
+                    switch_inline_query_chosen_chat=types.SwitchInlineQueryChosenChat.read(b)
+                )
+            else:
+                return InlineKeyboardButton(
+                    text=b.text,
+                    switch_inline_query=b.query
+                )
+
+        if isinstance(b, raw.types.KeyboardButtonGame):
+            return InlineKeyboardButton(
+                text=b.text,
+                callback_game=types.CallbackGame()
+            )
+
+        if isinstance(b, raw.types.KeyboardButtonWebView):
+            return InlineKeyboardButton(
+                text=b.text,
+                web_app=types.WebAppInfo(
+                    url=b.url
+                )
+            )
+        
+        if isinstance(b, raw.types.KeyboardButtonBuy):
+            return InlineKeyboardButton(
+                text=b.text,
+                pay=True
+            )
+
+    async def write(self, client: "pyrogram.Client"):
+        if self.callback_data_with_password is not None:
+            if isinstance(self.callback_data_with_password, str):
+                raise ValueError(
+                    "This is not supported"
+                )
+            data = self.callback_data_with_password
+            return raw.types.KeyboardButtonCallback(
+                text=self.text,
+                data=data,
+                requires_password=True
+            )
+
+        if self.callback_data is not None:
+            # 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 raw.types.KeyboardButtonCallback(
+                text=self.text,
+                data=data
+            )
+
+        if self.url is not None:
+            return raw.types.KeyboardButtonUrl(
+                text=self.text,
+                url=self.url
+            )
+
+        if self.login_url is not None:
+            return self.login_url.write(
+                text=self.text,
+                bot=await client.resolve_peer(self.login_url.bot_username or "self")
+            )
+
+        if self.user_id is not None:
+            return raw.types.InputKeyboardButtonUserProfile(
+                text=self.text,
+                user_id=await client.resolve_peer(self.user_id)
+            )
+
+        if self.switch_inline_query is not None:
+            return raw.types.KeyboardButtonSwitchInline(
+                text=self.text,
+                query=self.switch_inline_query
+            )
+
+        if self.switch_inline_query_current_chat is not None:
+            return raw.types.KeyboardButtonSwitchInline(
+                text=self.text,
+                query=self.switch_inline_query_current_chat,
+                same_peer=True
+            )
+
+        if self.switch_inline_query_chosen_chat is not None:
+            return self.switch_inline_query_chosen_chat.write(
+                text=self.text
+            )
+
+        if self.callback_game is not None:
+            return raw.types.KeyboardButtonGame(
+                text=self.text
+            )
+
+        if self.web_app is not None:
+            return raw.types.KeyboardButtonWebView(
+                text=self.text,
+                url=self.web_app.url
+            )
+
+        if (
+            self.pay is not None and
+            self.pay
+        ):
+            return raw.types.KeyboardButtonBuy(
+                text=self.text
+            )
diff --git a/pyrogram/types/bots_and_keyboards/inline_keyboard_markup.py b/pyrogram/types/bots_and_keyboards/inline_keyboard_markup.py
new file mode 100644
index 0000000000..e0fd323059
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/inline_keyboard_markup.py
@@ -0,0 +1,76 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+from ..object import Object
+
+
+class InlineKeyboardMarkup(Object):
+    """An inline keyboard that appears right next to the message it belongs to.
+
+    Parameters:
+        inline_keyboard (List of List of :obj:`~pyrogram.types.InlineKeyboardButton`):
+            List of button rows, each represented by a List of InlineKeyboardButton objects.
+    """
+
+    def __init__(self, inline_keyboard: List[List["types.InlineKeyboardButton"]]):
+        super().__init__()
+
+        self.inline_keyboard = inline_keyboard
+
+    @staticmethod
+    def read(o):
+        inline_keyboard = []
+
+        for i in o.rows:
+            row = []
+
+            for j in i.buttons:
+                row.append(types.InlineKeyboardButton.read(j))
+
+            inline_keyboard.append(row)
+
+        return InlineKeyboardMarkup(
+            inline_keyboard=inline_keyboard
+        )
+
+    async def write(self, client: "pyrogram.Client"):
+        rows = []
+
+        for r in self.inline_keyboard:
+            buttons = []
+
+            for b in r:
+                buttons.append(await b.write(client))
+
+            rows.append(raw.types.KeyboardButtonRow(buttons=buttons))
+
+        return raw.types.ReplyInlineMarkup(rows=rows)
+
+        # There seems to be a Python issues with nested async comprehensions.
+        # See: https://bugs.python.org/issue33346
+        #
+        # return raw.types.ReplyInlineMarkup(
+        #     rows=[raw.types.KeyboardButtonRow(
+        #         buttons=[await j.write(client) for j in i]
+        #     ) for i in self.inline_keyboard]
+        # )
diff --git a/pyrogram/types/bots_and_keyboards/keyboard_button.py b/pyrogram/types/bots_and_keyboards/keyboard_button.py
new file mode 100644
index 0000000000..5582d18d1d
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/keyboard_button.py
@@ -0,0 +1,232 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types, enums
+from ..object import Object
+
+
+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.
+
+    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.
+
+        request_contact (``bool``, *optional*):
+            If True, the user's phone number will be sent as a contact when the button is pressed.
+            Available in private chats only.
+
+        request_location (``bool``, *optional*):
+            If True, the user's current location will be sent when the button is pressed.
+            Available in private chats only.
+
+        request_poll (:obj:`~pyrogram.types.KeyboardButtonPollType`, *optional*):
+            If specified, the user will be asked to create a poll and send it to the bot when the button is pressed.
+            Available in private chats only
+
+        web_app (:obj:`~pyrogram.types.WebAppInfo`, *optional*):
+            If specified, the described `Web App `_ will be launched when the
+            button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private
+            chats only.
+
+        request_users (:obj:`~pyrogram.types.KeyboardButtonRequestUsers`, *optional*):
+            If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message.
+            Available in private chats only.
+
+        request_chat (:obj:`~pyrogram.types.KeyboardButtonRequestChat`, *optional*):
+            If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message.
+            Available in private chats only.
+    """
+
+    def __init__(
+        self,
+        text: str,
+        request_contact: bool = None,
+        request_location: bool = None,
+        request_poll: "types.KeyboardButtonPollType" = None,
+        web_app: "types.WebAppInfo" = None,
+        request_users: "types.KeyboardButtonRequestUsers" = None,
+        request_chat: "types.KeyboardButtonRequestChat" = None
+    ):
+        super().__init__()
+
+        self.text = str(text)
+        self.request_contact = request_contact
+        self.request_location = request_location
+        self.request_poll = request_poll
+        self.web_app = web_app
+        self.request_users = request_users
+        self.request_chat = request_chat
+
+    @staticmethod
+    def read(b):
+        if isinstance(b, raw.types.KeyboardButton):
+            return b.text
+
+        if isinstance(b, raw.types.KeyboardButtonRequestPhone):
+            return KeyboardButton(
+                text=b.text,
+                request_contact=True
+            )
+
+        if isinstance(b, raw.types.KeyboardButtonRequestGeoLocation):
+            return KeyboardButton(
+                text=b.text,
+                request_location=True
+            )
+
+        if isinstance(b, raw.types.KeyboardButtonRequestPoll):
+            return KeyboardButton(
+                text=b.text,
+                request_poll=types.KeyboardButtonPollType(
+                    type=enums.PollType.QUIZ if b.quiz else enums.PollType.REGULAR
+                )
+            )
+
+        if isinstance(b, raw.types.KeyboardButtonSimpleWebView):
+            return KeyboardButton(
+                text=b.text,
+                web_app=types.WebAppInfo(
+                    url=b.url
+                )
+            )
+
+        if (
+            isinstance(b, raw.types.KeyboardButtonRequestPeer) or
+            isinstance(b, raw.types.InputKeyboardButtonRequestPeer)
+        ):
+            isFakeChannel = isinstance(b.peer_type, raw.types.RequestPeerTypeBroadcast)
+            isFakeChat = isinstance(b.peer_type, raw.types.RequestPeerTypeChat)
+
+            _nr = getattr(b, "name_requested", None)
+            _ur = getattr(b, "username_requested", None)
+            _pr = getattr(b, "photo_requested", None)
+
+            if isFakeChannel or isFakeChat:
+                user_administrator_rights = types.ChatPrivileges._parse(
+                    getattr(
+                        b.peer_type,
+                        "user_admin_rights",
+                        None
+                    )
+                )
+                bot_administrator_rights = types.ChatPrivileges._parse(
+                    getattr(
+                        b.peer_type,
+                        "bot_admin_rights",
+                        None
+                    )
+                )
+                return KeyboardButton(
+                    text=b.text,
+                    request_chat=types.KeyboardButtonRequestChat(
+                        request_id=b.button_id,
+                        chat_is_channel=isFakeChannel,
+                        chat_is_forum=getattr(b.peer_type, "forum", None),
+                        chat_has_username=getattr(b.peer_type, "has_username", None),
+                        chat_is_created=getattr(b.peer_type, "creator", None),
+                        user_administrator_rights=user_administrator_rights,
+                        bot_administrator_rights=bot_administrator_rights,
+                        bot_is_member=getattr(b.peer_type, "bot_participant", None),
+                        request_title=_nr,
+                        request_username=_ur,
+                        request_photo=_pr
+                    )
+                )
+
+            if isinstance(b.peer_type, raw.types.RequestPeerTypeUser):
+                return KeyboardButton(
+                    text=b.text,
+                    request_users=types.KeyboardButtonRequestUsers(
+                        request_id=b.button_id,
+                        user_is_bot=getattr(b.peer_type, "bot", None),
+                        user_is_premium=getattr(b.peer_type, "premium", None),
+                        max_quantity=b.max_quantity,
+                        request_name=_nr,
+                        request_username=_ur,
+                        request_photo=_pr
+                    )
+                )
+
+
+    def write(self):
+        if self.request_contact:
+            return raw.types.KeyboardButtonRequestPhone(text=self.text)
+        elif self.request_location:
+            return raw.types.KeyboardButtonRequestGeoLocation(text=self.text)
+        elif self.request_poll:
+            return raw.types.KeyboardButtonRequestPoll(
+                text=self.text,
+                quiz=True if self.request_poll.type == enums.PollType.QUIZ else False
+            )
+        elif self.web_app:
+            return raw.types.KeyboardButtonSimpleWebView(text=self.text, url=self.web_app.url)
+        elif self.request_users:
+            return raw.types.InputKeyboardButtonRequestPeer(
+                name_requested=self.request_users.request_name,
+                username_requested=self.request_users.request_username,
+                photo_requested=self.request_users.request_photo,
+                text=self.text,
+                button_id=self.request_users.request_id,
+                peer_type=raw.types.RequestPeerTypeUser(
+                    bot=self.request_users.user_is_bot,
+                    premium=self.request_users.user_is_premium
+                ),
+                max_quantity=self.request_users.max_quantity
+            )
+
+        elif self.request_chat:
+            user_admin_rights = self.request_chat.user_administrator_rights.write() if self.request_chat.user_administrator_rights else None
+            bot_admin_rights = self.request_chat.bot_administrator_rights.write() if self.request_chat.bot_administrator_rights else None
+            if self.request_chat.chat_is_channel:
+                return raw.types.InputKeyboardButtonRequestPeer(
+                    name_requested=self.request_chat.request_title,
+                    username_requested=self.request_chat.request_username,
+                    photo_requested=self.request_chat.request_photo,
+                    text=self.text,
+                    button_id=self.request_chat.request_id,
+                    peer_type=raw.types.RequestPeerTypeBroadcast(
+                        creator=self.request_chat.chat_is_created,
+                        has_username=self.request_chat.chat_has_username,
+                        user_admin_rights=user_admin_rights,
+                        bot_admin_rights=bot_admin_rights
+                    ),
+                    max_quantity=1
+                )
+            else:
+                return raw.types.InputKeyboardButtonRequestPeer(
+                    name_requested=self.request_chat.request_title,
+                    username_requested=self.request_chat.request_username,
+                    photo_requested=self.request_chat.request_photo,
+                    text=self.text,
+                    button_id=self.request_chat.request_id,
+                    peer_type=raw.types.RequestPeerTypeChat(
+                        creator=self.request_chat.chat_is_created,
+                        bot_participant=self.request_chat.bot_is_member,
+                        has_username=self.request_chat.chat_has_username,
+                        forum=self.request_chat.chat_is_forum,
+                        user_admin_rights=user_admin_rights,
+                        bot_admin_rights=bot_admin_rights
+                    ),
+                    max_quantity=1
+                )
+        else:
+            return raw.types.KeyboardButton(text=self.text)
diff --git a/pyrogram/types/bots_and_keyboards/keyboard_button_poll_type.py b/pyrogram/types/bots_and_keyboards/keyboard_button_poll_type.py
new file mode 100644
index 0000000000..d4ce7ce72f
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/keyboard_button_poll_type.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-2021 Dan 
+#
+#  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 import enums
+from ..object import Object
+
+
+class KeyboardButtonPollType(Object):
+    """This object represents type of a poll,
+    which is allowed to be created and sent when the corresponding button is pressed.
+
+    - :obj:`~pyrogram.types.KeyboardButtonPollTypeRegular`
+
+        If regular is passed, only regular polls will be allowed.
+
+    - :obj:`~pyrogram.types.KeyboardButtonPollTypeQuiz`
+
+        If quiz is passed, the user will be allowed to create only polls in the quiz mode.
+
+    Otherwise, the user will be allowed to create a poll of any type.
+    """
+    def __init__(
+        self,
+        type: enums.PollType
+    ):
+        self.type = type
+
+
+class KeyboardButtonPollTypeRegular(KeyboardButtonPollType):
+    def __init__(
+        self
+    ):
+        super().__init__(type=enums.PollType.REGULAR)
+
+
+class KeyboardButtonPollTypeQuiz(KeyboardButtonPollType):
+    def __init__(
+        self
+    ):
+        super().__init__(type=enums.PollType.QUIZ)
diff --git a/pyrogram/types/bots_and_keyboards/keyboard_button_request_chat.py b/pyrogram/types/bots_and_keyboards/keyboard_button_request_chat.py
new file mode 100644
index 0000000000..1c34607ea9
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/keyboard_button_request_chat.py
@@ -0,0 +1,88 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-2021 Dan 
+#
+#  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 import types
+from ..object import Object
+
+
+class KeyboardButtonRequestChat(Object):
+    """This object defines the criteria used to request a suitable chat.
+    Information about the selected chat will be shared with the bot when the corresponding button is pressed.
+    The bot will be granted requested rights in the сhat if appropriate.
+    `More about requesting chats. `_
+
+    Parameters:
+        request_id (``int``):
+            Signed 32-bit identifier of the request, which will be received back in the :obj:`~pyrogram.types.ChatShared` object. Must be unique within the message
+
+        chat_is_channel (``bool``):
+            Pass True to request a channel chat, pass False to request a group or a supergroup chat.
+
+        chat_is_forum (``bool``, *optional*):
+            Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied.
+
+        chat_has_username (``bool``, *optional*):
+            Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied.
+
+        chat_is_created (``bool``, *optional*):
+            Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied.
+
+        user_administrator_rights (:obj:`~pyrogram.types.ChatPrivileges`, *optional*):
+            A object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied.
+
+        bot_administrator_rights (:obj:`~pyrogram.types.ChatPrivileges`, *optional*):
+            A object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied.
+
+        bot_is_member (``bool``, *optional*):
+            Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied.
+
+        request_title (``bool``, *optional*):
+            Pass True to request the chat's title
+
+        request_username (``bool``, *optional*):
+            Pass True to request the chat's username
+
+        request_photo (``bool``, *optional*):
+            Pass True to request the chat's photo
+
+    """
+    def __init__(
+        self,
+        request_id: int,
+        chat_is_channel: bool,
+        chat_is_forum: bool = None,
+        chat_has_username: bool = None,
+        chat_is_created: bool = None,
+        user_administrator_rights: "types.ChatPrivileges" = None,
+        bot_administrator_rights: "types.ChatPrivileges" = None,
+        bot_is_member: bool = None,
+        request_title: bool = None,
+        request_username: bool = None,
+        request_photo: bool = None
+    ):
+        self.request_id = request_id
+        self.chat_is_channel = chat_is_channel
+        self.chat_is_forum = chat_is_forum
+        self.chat_has_username = chat_has_username
+        self.chat_is_created = chat_is_created
+        self.user_administrator_rights = user_administrator_rights
+        self.bot_administrator_rights = bot_administrator_rights
+        self.bot_is_member = bot_is_member
+        self.request_title = request_title
+        self.request_username = request_username
+        self.request_photo = request_photo
diff --git a/pyrogram/types/bots_and_keyboards/keyboard_button_request_users.py b/pyrogram/types/bots_and_keyboards/keyboard_button_request_users.py
new file mode 100644
index 0000000000..2b2741fa54
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/keyboard_button_request_users.py
@@ -0,0 +1,66 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-2021 Dan 
+#
+#  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 KeyboardButtonRequestUsers(Object):
+    """This object defines the criteria used to request suitable users.
+    The identifiers of the selected users will be shared with the bot when the corresponding button is pressed.
+    `More about requesting users. `_
+
+    Parameters:
+        request_id (``int``):
+            Signed 32-bit identifier of the request, which will be received back in the :obj:`~pyrogram.types.UsersShared` object. Must be unique within the message
+
+        user_is_bot (``bool``, *optional*):
+            Pass True to request bots, pass False to request regular users. If not specified, no additional restrictions are applied.
+
+        user_is_premium (``bool``, *optional*):
+            Pass True to request premium users, pass False to request non-premium users. If not specified, no additional restrictions are applied.
+
+        max_quantity (``int``, *optional*):
+            The maximum number of users to be selected; 1-10. Defaults to 1.
+
+        request_name (``bool``, *optional*):
+            Pass True to request the users' first and last name
+
+        request_username (``bool``, *optional*):
+            Pass True to request the users' username
+
+        request_photo (``bool``, *optional*):
+            Pass True to request the users' photo
+
+    """
+    def __init__(
+        self,
+        request_id: int,
+        user_is_bot: bool = None,
+        user_is_premium: bool = None,
+        max_quantity: int = 1,
+        request_name: bool = None,
+        request_username: bool = None,
+        request_photo: bool = None
+    ):
+        self.request_id = request_id
+        self.user_is_bot = user_is_bot
+        self.user_is_premium = user_is_premium
+        self.max_quantity = max_quantity
+        self.request_name = request_name
+        self.request_username = request_username
+        self.request_photo = request_photo
diff --git a/pyrogram/types/bots_and_keyboards/login_url.py b/pyrogram/types/bots_and_keyboards/login_url.py
new file mode 100644
index 0000000000..a0af5a1af0
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/login_url.py
@@ -0,0 +1,90 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+from ..object import Object
+
+
+class LoginUrl(Object):
+    """Represents a parameter of the inline keyboard button used to automatically authorize a user.
+
+    Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram.
+    All the user needs to do is tap/click a button and confirm that they want to log in.
+
+    Parameters:
+        url (``str``):
+            An HTTP URL to be opened with user authorization data added to the query string when the button is pressed.
+            If the user refuses to provide authorization data, the original URL without information about the user will
+            be opened. The data added is the same as described in
+            `Receiving authorization data `.
+
+            **NOTE**: You **must** always check the hash of the received data to verify the authentication and the
+            integrity of the data as described in
+            `Checking authorization `_.
+
+        forward_text (``str``, *optional*):
+            New text of the button in forwarded messages.
+
+        bot_username (``str``, *optional*):
+            Username of a bot, which will be used for user authorization.
+            See `Setting up a bot `_ for more details.
+            If not specified, the current bot's username will be assumed. The url's domain must be the same as the
+            domain linked with the bot.
+            See `Linking your domain to the bot `_
+            for more details.
+
+        request_write_access (``str``, *optional*):
+            Pass True to request the permission for your bot to send messages to the user.
+
+        button_id (``int``):
+            Button identifier.
+    """
+
+    def __init__(
+        self, *,
+        url: str,
+        forward_text: str = None,
+        bot_username: str = None,
+        request_write_access: str = None,
+        button_id: int = None
+    ):
+        super().__init__()
+
+        self.url = url
+        self.forward_text = forward_text
+        self.bot_username = bot_username
+        self.request_write_access = request_write_access
+        self.button_id = button_id
+
+    @staticmethod
+    def read(b: "raw.types.KeyboardButtonUrlAuth") -> "LoginUrl":
+        return LoginUrl(
+            url=b.url,
+            forward_text=b.fwd_text,
+            button_id=b.button_id
+        )
+
+    def write(self, text: str, bot: "raw.types.InputUser"):
+        return raw.types.InputKeyboardButtonUrlAuth(
+            text=text,
+            url=self.url,
+            bot=bot,
+            fwd_text=self.forward_text,
+            request_write_access=self.request_write_access
+        )
diff --git a/pyrogram/types/bots_and_keyboards/menu_button.py b/pyrogram/types/bots_and_keyboards/menu_button.py
new file mode 100644
index 0000000000..e61e7baa29
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/menu_button.py
@@ -0,0 +1,44 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class MenuButton(Object):
+    """Describes the bot's menu button in a private chat.
+
+    It should be one of:
+
+    - :obj:`~pyrogram.types.MenuButtonCommands`
+    - :obj:`~pyrogram.types.MenuButtonWebApp`
+    - :obj:`~pyrogram.types.MenuButtonDefault`
+
+    If a menu button other than :obj:`~pyrogram.types.MenuButtonDefault` is set for a private chat, then it is applied
+    in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot
+    commands.
+    """
+
+    def __init__(self, type: str):
+        super().__init__()
+
+        self.type = type
+
+    async def write(self, client: "pyrogram.Client") -> "raw.base.BotMenuButton":
+        raise NotImplementedError
diff --git a/pyrogram/types/bots_and_keyboards/menu_button_commands.py b/pyrogram/types/bots_and_keyboards/menu_button_commands.py
new file mode 100644
index 0000000000..b2ef77c9de
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/menu_button_commands.py
@@ -0,0 +1,32 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from .menu_button import MenuButton
+
+
+class MenuButtonCommands(MenuButton):
+    """A menu button, which opens the bot's list of commands.
+    """
+
+    def __init__(self):
+        super().__init__("commands")
+
+    async def write(self, client: "pyrogram.Client") -> "raw.types.BotMenuButtonCommands":
+        return raw.types.BotMenuButtonCommands()
diff --git a/pyrogram/types/bots_and_keyboards/menu_button_default.py b/pyrogram/types/bots_and_keyboards/menu_button_default.py
new file mode 100644
index 0000000000..a00e67633e
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/menu_button_default.py
@@ -0,0 +1,32 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from .menu_button import MenuButton
+
+
+class MenuButtonDefault(MenuButton):
+    """Describes that no specific value for the menu button was set.
+    """
+
+    def __init__(self):
+        super().__init__("default")
+
+    async def write(self, client: "pyrogram.Client") -> "raw.types.BotMenuButtonDefault":
+        return raw.types.BotMenuButtonDefault()
diff --git a/pyrogram/types/bots_and_keyboards/menu_button_web_app.py b/pyrogram/types/bots_and_keyboards/menu_button_web_app.py
new file mode 100644
index 0000000000..39806216fb
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/menu_button_web_app.py
@@ -0,0 +1,52 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+from .menu_button import MenuButton
+
+
+class MenuButtonWebApp(MenuButton):
+    """A menu button, which launches a `Web App `_.
+
+    Parameters:
+        text (``str``):
+            Text on the button
+
+        web_app (:obj:`~pyrogram.types.WebAppInfo`):
+            Description of the Web App that will be launched when the user presses the button.
+            The Web App will be able to send an arbitrary message on behalf of the user using the method
+            :meth:`~pyrogram.Client.answer_web_app_query`.
+            Alternatively, a ``t.me`` link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.
+    """
+
+    def __init__(
+        self,
+        text: str,
+        web_app: "types.WebAppInfo"
+    ):
+        super().__init__("web_app")
+
+        self.text = text
+        self.web_app = web_app
+
+    async def write(self, client: "pyrogram.Client") -> "raw.types.BotMenuButton":
+        return raw.types.BotMenuButton(
+            text=self.text,
+            url=self.web_app.url
+        )
diff --git a/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py
new file mode 100644
index 0000000000..9aa2c4a82e
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py
@@ -0,0 +1,127 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 List, Union
+
+import pyrogram
+from pyrogram import raw, types
+from ..object import Object
+
+log = logging.getLogger(__name__)
+
+
+class ReplyKeyboardMarkup(Object):
+    """A custom keyboard with reply options.
+
+    Parameters:
+        keyboard (List of List of :obj:`~pyrogram.types.KeyboardButton`):
+            List of button rows, each represented by a List of KeyboardButton objects.
+
+        is_persistent (``bool``, *optional*):
+            Requests clients to always show the keyboard when the regular keyboard is hidden.
+            Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
+
+        resize_keyboard (``bool``, *optional*):
+            Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if
+            there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of
+            the same height as the app's standard keyboard.
+
+        one_time_keyboard (``bool``, *optional*):
+            Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available,
+            but clients will automatically display the usual letter-keyboard in the chat – the user can press a
+            special button in the input field to see the custom keyboard again. Defaults to false.
+
+        input_field_placeholder (``str``, *optional*):
+            The placeholder to be shown in the input field when the keyboard is active; 1-64 characters.
+
+        selective (``bool``, *optional*):
+            Use this parameter if you want to show the keyboard to specific users only. Targets:
+            1) users that are @mentioned in the text of the Message object;
+            2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
+            Example: A user requests to change the bot's language, bot replies to the request with a keyboard to
+            select the new language. Other users in the group don't see the keyboard.
+    """
+
+    def __init__(
+        self,
+        keyboard: List[List[Union["types.KeyboardButton", str]]],
+        is_persistent: bool = None,
+        resize_keyboard: bool = None,
+        one_time_keyboard: bool = None,
+        input_field_placeholder: str = None,
+        selective: bool = None,
+        placeholder: str = None,
+    ):
+        if placeholder and input_field_placeholder:
+            raise ValueError(
+                "Parameters `placeholder` and `input_field_placeholder` are mutually exclusive."
+            )
+
+        if placeholder is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use input_field_placeholder instead"
+            )
+            input_field_placeholder = placeholder
+
+        super().__init__()
+
+        self.keyboard = keyboard
+        self.is_persistent = is_persistent
+        self.resize_keyboard = resize_keyboard
+        self.one_time_keyboard = one_time_keyboard
+        self.input_field_placeholder = input_field_placeholder
+        self.selective = selective
+
+    @staticmethod
+    def read(kb: "raw.base.ReplyMarkup"):
+        keyboard = []
+
+        for i in kb.rows:
+            row = []
+
+            for j in i.buttons:
+                row.append(types.KeyboardButton.read(j))
+
+            keyboard.append(row)
+
+        return ReplyKeyboardMarkup(
+            keyboard=keyboard,
+            is_persistent=kb.persistent,
+            resize_keyboard=kb.resize,
+            one_time_keyboard=kb.single_use,
+            selective=kb.selective,
+            input_field_placeholder=kb.placeholder
+        )
+
+    async def write(self, _: "pyrogram.Client"):
+        return raw.types.ReplyKeyboardMarkup(
+            rows=[raw.types.KeyboardButtonRow(
+                buttons=[
+                    types.KeyboardButton(j).write()
+                    if isinstance(j, str) else j.write()
+                    for j in i
+                ]
+            ) for i in self.keyboard],
+            resize=self.resize_keyboard or None,
+            single_use=self.one_time_keyboard or None,
+            selective=self.selective or None,
+            persistent=self.is_persistent or None,
+            placeholder=self.input_field_placeholder or None
+        )
diff --git a/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py b/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py
new file mode 100644
index 0000000000..479efe9027
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py
@@ -0,0 +1,58 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class ReplyKeyboardRemove(Object):
+    """Object used to tell clients to remove a bot keyboard.
+
+    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;
+            2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
+            Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the
+            keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet.
+    """
+
+    def __init__(
+        self,
+        selective: bool = None
+    ):
+        super().__init__()
+
+        self.selective = selective
+
+    @staticmethod
+    def read(b):
+        return ReplyKeyboardRemove(
+            selective=b.selective
+        )
+
+    async def write(self, _: "pyrogram.Client"):
+        return raw.types.ReplyKeyboardHide(
+            selective=self.selective or None
+        )
diff --git a/pyrogram/types/bots_and_keyboards/sent_web_app_message.py b/pyrogram/types/bots_and_keyboards/sent_web_app_message.py
new file mode 100644
index 0000000000..ca1506a306
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/sent_web_app_message.py
@@ -0,0 +1,44 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, utils
+from ..object import Object
+
+
+class SentWebAppMessage(Object):
+    """Contains information about an inline message sent by a `Web App `_ on behalf of a user.
+
+    Parameters:
+        inline_message_id (``str``):
+            Identifier of the sent inline message.
+            Available only if there is an inline keyboard attached to the message.
+    """
+
+    def __init__(
+        self, *,
+        inline_message_id: str,
+    ):
+        super().__init__()
+
+        self.inline_message_id = inline_message_id
+
+    @staticmethod
+    def _parse(obj: "raw.types.WebViewMessageSent"):
+        return SentWebAppMessage(
+            inline_message_id=utils.pack_inline_message_id(obj.msg_id)
+        ) if obj.msg_id else None
diff --git a/pyrogram/types/bots_and_keyboards/switch_inline_query_chosen_chat.py b/pyrogram/types/bots_and_keyboards/switch_inline_query_chosen_chat.py
new file mode 100644
index 0000000000..04f1206ed2
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/switch_inline_query_chosen_chat.py
@@ -0,0 +1,113 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+from ..object import Object
+
+
+class SwitchInlineQueryChosenChat(Object):
+    """This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.
+
+    Parameters:
+        query (``str``, *optional*):
+            The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted.
+
+        allow_user_chats (``bool``, *optional*):
+            True, if private chats with users can be chosen.
+        
+        allow_bot_chats (``bool``, *optional*):
+            True, if private chats with bots can be chosen.
+        
+        allow_group_chats (``bool``, *optional*):
+            True, if group and supergroup chats can be chosen.
+        
+        allow_channel_chats (``bool``, *optional*):
+            True, if channel chats can be chosen.
+    """
+
+    def __init__(
+        self, *,
+        query: str = "",
+        allow_user_chats: bool = None,
+        allow_bot_chats: bool = None,
+        allow_group_chats: bool = None,
+        allow_channel_chats: bool = None
+    ):
+        super().__init__()
+
+        self.query = query
+        self.allow_user_chats = allow_user_chats
+        self.allow_bot_chats = allow_bot_chats
+        self.allow_group_chats = allow_group_chats
+        self.allow_channel_chats = allow_channel_chats
+
+    @staticmethod
+    def read(b: "raw.types.KeyboardButtonSwitchInline") -> "SwitchInlineQueryChosenChat":
+        allow_user_chats = None
+        allow_bot_chats = None
+        allow_group_chats = None
+        allow_channel_chats = None
+        for peer_type in b.peer_types:
+            if isinstance(peer_type, raw.types.InlineQueryPeerTypeSameBotPM) or isinstance(peer_type, raw.types.InlineQueryPeerTypeBotPM):
+                allow_bot_chats = True
+            elif isinstance(peer_type, raw.types.InlineQueryPeerTypePM):
+                allow_user_chats = True
+            elif isinstance(peer_type, raw.types.InlineQueryPeerTypeChat):
+                allow_group_chats = True
+            elif isinstance(peer_type, raw.types.InlineQueryPeerTypeMegagroup):
+                allow_group_chats = True
+            elif isinstance(peer_type, raw.types.InlineQueryPeerTypeBroadcast):
+                allow_channel_chats = True
+        return SwitchInlineQueryChosenChat(
+            query=b.query,
+            allow_user_chats=allow_user_chats,
+            allow_bot_chats=allow_bot_chats,
+            allow_group_chats=allow_group_chats,
+            allow_channel_chats=allow_channel_chats
+        )
+
+    def write(self, text: str):
+        peer_types = []
+        if self.allow_bot_chats:
+            peer_types.append(
+                raw.types.InlineQueryPeerTypeSameBotPM()
+            )
+            peer_types.append(
+                raw.types.InlineQueryPeerTypeBotPM()
+            )
+        if self.allow_user_chats:
+            peer_types.append(
+                raw.types.InlineQueryPeerTypePM()
+            )
+        if self.allow_group_chats:
+            peer_types.append(
+                raw.types.InlineQueryPeerTypeChat()
+            )
+            peer_types.append(
+                raw.types.InlineQueryPeerTypeMegagroup()
+            )
+        if self.allow_channel_chats:
+            peer_types.append(
+                raw.types.InlineQueryPeerTypeBroadcast()
+            )
+        return raw.types.KeyboardButtonSwitchInline(
+            text=text,
+            query=self.query,
+            peer_types=peer_types
+        )
diff --git a/pyrogram/types/bots_and_keyboards/web_app_info.py b/pyrogram/types/bots_and_keyboards/web_app_info.py
new file mode 100644
index 0000000000..1dbb0a781c
--- /dev/null
+++ b/pyrogram/types/bots_and_keyboards/web_app_info.py
@@ -0,0 +1,37 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 WebAppInfo(Object):
+    """Contains information about a `Web App `_.
+
+    Parameters:
+        url (``str``):
+            An HTTPS URL of a Web App to be opened with additional data as specified in
+            `Initializing Web Apps `_.
+    """
+
+    def __init__(
+        self, *,
+        url: str,
+    ):
+        super().__init__()
+
+        self.url = url
diff --git a/pyrogram/types/business/__init__.py b/pyrogram/types/business/__init__.py
new file mode 100644
index 0000000000..7f6ab511db
--- /dev/null
+++ b/pyrogram/types/business/__init__.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .business_connection import BusinessConnection
+from .business_intro import BusinessIntro
+from .business_location import BusinessLocation
+from .business_opening_hours import BusinessOpeningHours
+from .business_opening_hours_interval import BusinessOpeningHoursInterval
+from .collectible_item_info import CollectibleItemInfo
+from .invoice import Invoice
+from .labeled_price import LabeledPrice
+from .order_info import OrderInfo
+from .pre_checkout_query import PreCheckoutQuery
+from .shipping_address import ShippingAddress
+from .shipping_option import ShippingOption
+from .shipping_query import ShippingQuery
+from .successful_payment import SuccessfulPayment
+from .refunded_payment import RefundedPayment
+
+__all__ = [
+    "BusinessConnection",
+    "BusinessIntro",
+    "BusinessLocation",
+    "BusinessOpeningHours",
+    "BusinessOpeningHoursInterval",
+    "CollectibleItemInfo",
+    "Invoice",
+    "LabeledPrice",
+    "OrderInfo",
+    "PreCheckoutQuery",
+    "ShippingAddress",
+    "ShippingOption",
+    "ShippingQuery",
+    "SuccessfulPayment",
+    "RefundedPayment",
+]
diff --git a/pyrogram/types/business/business_connection.py b/pyrogram/types/business/business_connection.py
new file mode 100644
index 0000000000..ced610f8fa
--- /dev/null
+++ b/pyrogram/types/business/business_connection.py
@@ -0,0 +1,93 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+import pyrogram
+from pyrogram import raw, types, utils
+
+from ..object import Object
+
+
+class BusinessConnection(Object):
+    """Describes the connection of the bot with a business account.
+
+    Parameters:
+        id (``str``):
+            Unique identifier of the business connection
+        
+        user (:obj:`~pyrogram.types.User`):
+            Business account user that created the business connection
+
+        user_chat_id (``int``):
+            Identifier of a private chat with the user who created the business connection. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
+
+        date (:py:obj:`~datetime.datetime`):
+            Date the connection was established in Unix time
+
+        can_reply (``bool``):
+            True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours
+
+        is_enabled (``bool``):
+            True, if the connection is active
+
+    """
+
+    def __init__(
+        self,
+        *,
+        id: str = None,
+        user: "types.User" = None,
+        user_chat_id: int = None,
+        date: datetime,
+        can_reply: bool = None,
+        is_enabled: bool = None,
+        _raw: "raw.types.UpdateBotBusinessConnect" = None
+    ):
+        super().__init__()
+
+        self.id = id
+        self.user = user
+        self.user_chat_id = user_chat_id
+        self.date = date
+        self.can_reply = can_reply
+        self.is_enabled = is_enabled
+        self._raw = _raw
+
+
+    @staticmethod
+    def _parse(
+        client,
+        business_connect_update: "raw.types.UpdateBotBusinessConnect",
+        users: dict,
+        chats: dict
+    ) -> "BusinessConnection":
+        return BusinessConnection(
+            _raw=business_connect_update,
+            id=business_connect_update.connection.connection_id,
+            user=types.User._parse(
+                client,
+                users[
+                    business_connect_update.connection.user_id
+                ]
+            ),
+            user_chat_id=business_connect_update.connection.user_id,
+            date=utils.timestamp_to_datetime(business_connect_update.connection.date),
+            can_reply=getattr(business_connect_update.connection, "can_reply", False),
+            is_enabled=not bool(getattr(business_connect_update.connection, "disabled", None))
+        )
diff --git a/pyrogram/types/business/business_intro.py b/pyrogram/types/business/business_intro.py
new file mode 100644
index 0000000000..61d3f8db6a
--- /dev/null
+++ b/pyrogram/types/business/business_intro.py
@@ -0,0 +1,77 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+import pyrogram
+from pyrogram import raw, types, utils
+
+from ..object import Object
+
+
+class BusinessIntro(Object):
+    """
+
+    Parameters:
+        title (``str``, *optional*):
+            Title text of the business intro
+        
+        message (``str``, *optional*):
+            Message text of the business intro
+
+        sticker (:obj:`~pyrogram.types.Sticker`, *optional*):
+            Sticker of the business intro
+
+    """
+
+    def __init__(
+        self,
+        *,
+        title: str = None,
+        message: str = None,
+        sticker: "types.Sticker" = None
+    ):
+        super().__init__()
+
+        self.title = title
+        self.message = message
+        self.sticker = sticker
+
+
+    @staticmethod
+    async def _parse(
+        client,
+        business_intro: "raw.types.BusinessIntro"
+    ) -> "BusinessIntro":
+        doc = getattr(business_intro, "sticker", None)
+        sticker = None
+        if (
+            doc and
+            isinstance(doc, raw.types.Document)
+        ):
+            attributes = {type(i): i for i in doc.attributes}
+            sticker = await types.Sticker._parse(
+                client,
+                doc,
+                attributes
+            )
+        return BusinessIntro(
+            title=getattr(business_intro, "title", None),
+            message=getattr(business_intro, "description", None),
+            sticker=sticker
+        )
diff --git a/pyrogram/types/business/business_location.py b/pyrogram/types/business/business_location.py
new file mode 100644
index 0000000000..adb6737e6a
--- /dev/null
+++ b/pyrogram/types/business/business_location.py
@@ -0,0 +1,62 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+import pyrogram
+from pyrogram import raw, types, utils
+
+from ..object import Object
+
+
+class BusinessLocation(Object):
+    """
+
+    Parameters:
+        address (``str``):
+            Address of the business
+
+        location (:obj:`~pyrogram.types.Location`, *optional*):
+            Location of the business
+
+    """
+
+    def __init__(
+        self,
+        *,
+        address: str = None,
+        location: "types.Location" = None
+    ):
+        super().__init__()
+
+        self.address = address
+        self.location = location
+
+
+    @staticmethod
+    def _parse(
+        client,
+        business_location: "raw.types.BusinessLocation"
+    ) -> "BusinessLocation":
+        return BusinessLocation(
+            address=getattr(business_location, "address", None),
+            location=types.Location._parse(
+                client,
+                business_location.geo_point
+            ) if getattr(business_location, "geo_point", None) else None
+        )
diff --git a/pyrogram/types/business/business_opening_hours.py b/pyrogram/types/business/business_opening_hours.py
new file mode 100644
index 0000000000..245a21b7f2
--- /dev/null
+++ b/pyrogram/types/business/business_opening_hours.py
@@ -0,0 +1,69 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+from datetime import datetime
+
+import pyrogram
+from pyrogram import raw, types, utils
+
+from ..object import Object
+
+
+class BusinessOpeningHours(Object):
+    """
+
+    Parameters:
+        time_zone_name (``str``):
+            Unique name of the time zone for which the opening hours are defined
+
+        opening_hours (List of :obj:`~pyrogram.types.BusinessOpeningHoursInterval`):
+            List of time intervals describing business opening hours
+
+    """
+
+    def __init__(
+        self,
+        *,
+        time_zone_name: str = None,
+        opening_hours: List["types.BusinessOpeningHoursInterval"] = None,
+        _raw: "raw.types.BusinessWorkHours" = None
+    ):
+        super().__init__()
+
+        self.time_zone_name = time_zone_name
+        self.opening_hours = opening_hours
+        self._raw = _raw
+
+
+    @staticmethod
+    def _parse(
+        client,
+        business_work_hours: "raw.types.BusinessWorkHours"
+    ) -> "BusinessOpeningHours":
+        return BusinessOpeningHours(
+            time_zone_name=getattr(business_work_hours, "timezone_id", None),
+            opening_hours=types.List(
+                [
+                    types.BusinessOpeningHoursInterval._parse(
+                        weekly_open_
+                    ) for weekly_open_ in business_work_hours.weekly_open
+                ]
+            ) if getattr(business_work_hours, "weekly_open", None) else None,
+            _raw=business_work_hours
+        )
diff --git a/pyrogram/types/business/business_opening_hours_interval.py b/pyrogram/types/business/business_opening_hours_interval.py
new file mode 100644
index 0000000000..e8ff568edb
--- /dev/null
+++ b/pyrogram/types/business/business_opening_hours_interval.py
@@ -0,0 +1,58 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+import pyrogram
+from pyrogram import raw, types, utils
+
+from ..object import Object
+
+
+class BusinessOpeningHoursInterval(Object):
+    """
+
+    Parameters:
+        opening_minute (``int``):
+            The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60
+
+        closing_minute (``int``):
+            The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60
+
+    """
+
+    def __init__(
+        self,
+        *,
+        opening_minute: int = None,
+        closing_minute: int = None
+    ):
+        super().__init__()
+
+        self.opening_minute = opening_minute
+        self.closing_minute = closing_minute
+
+
+    @staticmethod
+    def _parse(
+        weekly_open_: "raw.types.BusinessWeeklyOpen"
+    ) -> "BusinessOpeningHoursInterval":
+        return BusinessOpeningHoursInterval(
+            opening_minute=weekly_open_.start_minute,
+            closing_minute=weekly_open_.end_minute
+        )
diff --git a/pyrogram/types/business/collectible_item_info.py b/pyrogram/types/business/collectible_item_info.py
new file mode 100644
index 0000000000..48608f6267
--- /dev/null
+++ b/pyrogram/types/business/collectible_item_info.py
@@ -0,0 +1,79 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from pyrogram import raw, utils
+from ..object import Object
+
+
+class CollectibleItemInfo(Object):
+    """Contains information about a collectible item and its last purchase.
+
+    Parameters:
+        purchase_date (``datetime``):
+            Point in time (Unix timestamp) when the item was purchased
+
+        currency (``str``):
+            Currency for the paid amount
+
+        amount (``float``):
+            The paid amount, in the smallest units of the currency
+
+        cryptocurrency (``str``):
+            Cryptocurrency used to pay for the item
+
+        cryptocurrency_amount (``float``):
+            The paid amount, in the smallest units of the cryptocurrency
+
+        url (``str``):
+            Individual URL for the item on https://fragment.com
+            
+    """
+
+    def __init__(
+        self,
+        *,
+        purchase_date : datetime,
+        currency : str,
+        amount: float,
+        cryptocurrency: str,
+        cryptocurrency_amount: float,
+        url: str
+    ):
+        super().__init__()
+
+        self.purchase_date = purchase_date
+        self.currency= currency
+        self.amount = amount
+        self.cryptocurrency = cryptocurrency
+        self.cryptocurrency_amount = cryptocurrency_amount
+        self.url = url
+
+    @staticmethod
+    def _parse(
+        collectible_info: "raw.types.fragment.CollectibleInfo"
+    ) -> "CollectibleItemInfo":
+        return CollectibleItemInfo(
+            purchase_date=utils.timestamp_to_datetime(collectible_info.purchase_date),
+            currency=collectible_info.currency,
+            amount=collectible_info.amount,
+            cryptocurrency=collectible_info.crypto_currency,
+            cryptocurrency_amount=collectible_info.crypto_amount,
+            url=collectible_info.url
+        )
diff --git a/pyrogram/types/business/invoice.py b/pyrogram/types/business/invoice.py
new file mode 100644
index 0000000000..baf7ddc4d1
--- /dev/null
+++ b/pyrogram/types/business/invoice.py
@@ -0,0 +1,73 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+from ..object import Object
+
+
+class Invoice(Object):
+    """This object contains basic information about an invoice.
+
+    Parameters:
+        title (``str``):
+            Product name.
+
+        description (``str``):
+            Product description.
+
+        start_parameter (``str``):
+            Unique bot deep-linking parameter that can be used to generate this invoice.
+
+        currency (``str``):
+            Three-letter ISO 4217 `currency `_ code.
+
+        total_amount (``int``):
+            Total price in the smallest units of the currency (integer, **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the exp parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        title: str,
+        description: str,
+        start_parameter: str,
+        currency: str,
+        total_amount: int
+    ):
+        super().__init__(client)
+
+        self.title = title
+        self.description = description
+        self.start_parameter = start_parameter
+        self.currency = currency
+        self.total_amount = total_amount
+
+    @staticmethod
+    def _parse(client, invoice: "raw.types.MessageMediaInvoice") -> "Invoice":
+        return Invoice(
+            title=invoice.title,
+            description=invoice.description,
+            start_parameter=invoice.start_param,
+            currency=invoice.currency,
+            total_amount=invoice.total_amount,
+            # TODO
+            client=client
+        )
diff --git a/pyrogram/types/business/labeled_price.py b/pyrogram/types/business/labeled_price.py
new file mode 100644
index 0000000000..aabb4d9b52
--- /dev/null
+++ b/pyrogram/types/business/labeled_price.py
@@ -0,0 +1,59 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+
+from ..object import Object
+
+
+class LabeledPrice(Object):
+    """This object represents a portion of the price for goods or services.
+
+    Parameters:
+        label (``str``):
+            Portion label.
+
+        amount (``int``):
+            Price of the product in the smallest units of the currency (integer, **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the __exp__ parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
+
+    """
+
+    def __init__(
+        self,
+        label: str,
+        amount: int
+    ):
+        super().__init__()
+
+        self.label = label
+        self.amount = amount
+
+    @staticmethod
+    def _parse(labeled_price: "raw.types.LabeledPrice") -> "LabeledPrice":
+        if isinstance(labeled_price, raw.types.LabeledPrice):
+            return LabeledPrice(
+                label=labeled_price.label,
+                amount=labeled_price.amount
+            )
+
+    def write(self):
+        return raw.types.LabeledPrice(
+            label=self.label,
+            amount=self.amount
+        )
diff --git a/pyrogram/types/business/order_info.py b/pyrogram/types/business/order_info.py
new file mode 100644
index 0000000000..448ee1e313
--- /dev/null
+++ b/pyrogram/types/business/order_info.py
@@ -0,0 +1,53 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 OrderInfo(Object):
+    """This object represents information about an order.
+
+    Parameters:
+        name (``str``, *optional*):
+            User name.
+
+        phone_number (``str``, *optional*):
+            User's phone number.
+
+        email (``str``, *optional*):
+            User email.
+
+        shipping_address (:obj:`~pyrogram.types.ShippingAddress`, *optional*):
+            User shipping address.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        name: str = None,
+        phone_number: str = None,
+        email: str = None,
+        shipping_address: "types.ShippingAddress" = None
+    ):
+        super().__init__()
+
+        self.name = name
+        self.phone_number = phone_number
+        self.email = email
+        self.shipping_address = shipping_address
diff --git a/pyrogram/types/business/pre_checkout_query.py b/pyrogram/types/business/pre_checkout_query.py
new file mode 100644
index 0000000000..c542794a04
--- /dev/null
+++ b/pyrogram/types/business/pre_checkout_query.py
@@ -0,0 +1,149 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional
+
+import pyrogram
+from pyrogram import raw, types
+
+from ..object import Object
+from ..update import Update
+
+
+class PreCheckoutQuery(Object, Update):
+    """This object contains information about an incoming pre-checkout query.
+
+    Parameters:
+        id (``str``):
+            Unique query identifier.
+
+        from_user (:obj:`~pyrogram.types.User`):
+            User who sent the query.
+
+        currency (``str``):
+            Three-letter ISO 4217 `currency `_ code, or ``XTR`` for payments in `Telegram Stars `_.
+
+        total_amount (``int``):
+            Total price in the smallest units of the currency (integer, **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the __exp__ parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
+
+        invoice_payload (``str``):
+            Bot specified invoice payload. Only available to the bot that received the payment.
+
+        shipping_option_id (``str``, *optional*):
+            Identifier of the shipping option chosen by the user. Only available to the bot that received the payment.
+
+        order_info (:obj:`~pyrogram.types.OrderInfo`, *optional*):
+            Order information provided by the user. Only available to the bot that received the payment.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: str,
+        from_user: "types.User",
+        currency: str,
+        total_amount: int,
+        invoice_payload: str,
+        shipping_option_id: str = None,
+        order_info: "types.OrderInfo" = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.from_user = from_user
+        self.currency = currency
+        self.total_amount = total_amount
+        self.invoice_payload = invoice_payload
+        self.shipping_option_id = shipping_option_id
+        self.order_info = order_info
+
+    @staticmethod
+    async def _parse(
+        client: "pyrogram.Client",
+        pre_checkout_query: "raw.types.UpdateBotPrecheckoutQuery",
+        users: dict
+    ) -> "PreCheckoutQuery":
+        # Try to decode pre-checkout query payload into string. If that fails, fallback to bytes instead of decoding by
+        # ignoring/replacing errors, this way, button clicks will still work.
+        try:
+            payload = pre_checkout_query.payload.decode()
+        except (UnicodeDecodeError, AttributeError):
+            payload = pre_checkout_query.payload
+
+        return PreCheckoutQuery(
+            id=str(pre_checkout_query.query_id),
+            from_user=types.User._parse(client, users[pre_checkout_query.user_id]),
+            currency=pre_checkout_query.currency,
+            total_amount=pre_checkout_query.total_amount,
+            invoice_payload=payload,
+            shipping_option_id=pre_checkout_query.shipping_option_id,
+            order_info=types.OrderInfo(
+                name=pre_checkout_query.info.name,
+                phone_number=pre_checkout_query.info.phone,
+                email=pre_checkout_query.info.email,
+                shipping_address=types.ShippingAddress(
+                    country_code=pre_checkout_query.info.shipping_address.country_iso2,
+                    state=pre_checkout_query.info.shipping_address.state,
+                    city=pre_checkout_query.info.shipping_address.city,
+                    street_line1=pre_checkout_query.info.shipping_address.street_line1,
+                    street_line2=pre_checkout_query.info.shipping_address.street_line2,
+                    post_code=pre_checkout_query.info.shipping_address.post_code
+                )
+            ) if pre_checkout_query.info else None,
+            client=client
+        )
+
+    async def answer(
+        self,
+        ok: bool,
+        error_message: str = None
+    ):
+        """Bound method *answer* of :obj:`~pyrogram.types.PreCheckoutQuery`.
+
+        Use this method as a shortcut for:
+
+        .. code-block:: python
+
+            await client.answer_pre_checkout_query(
+                pre_checkout_query.id,
+                ok=True
+            )
+
+        Example:
+            .. code-block:: python
+
+                await pre_checkout_query.answer(ok=True)
+
+        Parameters:
+            ok (``bool``):
+                Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.
+
+            error_message (``str``, *optional*):
+                Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
+
+        Returns:
+            ``bool``: True, on success.
+
+        """
+        return await self._client.answer_pre_checkout_query(
+            pre_checkout_query_id=self.id,
+            ok=ok,
+            error_message=error_message
+        )
diff --git a/pyrogram/types/business/refunded_payment.py b/pyrogram/types/business/refunded_payment.py
new file mode 100644
index 0000000000..f25523f2d6
--- /dev/null
+++ b/pyrogram/types/business/refunded_payment.py
@@ -0,0 +1,88 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+from ..object import Object
+
+
+class RefundedPayment(Object):
+    """This object contains basic information about a refunded payment.
+
+    Parameters:
+        currency (``str``):
+            Three-letter ISO 4217 `currency `_ code, or ``XTR`` for payments in `Telegram Stars `_.
+
+        total_amount (``int``):
+            Total price in the smallest units of the currency (integer, **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the __exp__ parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
+
+        invoice_payload (``str``):
+            Bot specified invoice payload. Only available to the bot that received the payment.
+
+        telegram_payment_charge_id (``str``):
+            Telegram payment identifier. Only available to the bot that received the payment.
+
+        provider_payment_charge_id (``str``):
+            Provider payment identifier. Only available to the bot that received the payment.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        currency: str,
+        total_amount: str,
+        invoice_payload: str,
+        telegram_payment_charge_id: str,
+        provider_payment_charge_id: str
+    ):
+        super().__init__()
+
+        self.currency = currency
+        self.total_amount = total_amount
+        self.invoice_payload = invoice_payload
+        self.telegram_payment_charge_id = telegram_payment_charge_id
+        self.provider_payment_charge_id = provider_payment_charge_id
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        refunded_payment: "raw.types.MessageActionPaymentRefunded"
+    ) -> "RefundedPayment":
+        invoice_payload = None
+
+        # Try to decode invoice payload into string. If that fails, fallback to bytes instead of decoding by
+        # ignoring/replacing errors, this way, button clicks will still work.
+        try:
+            invoice_payload = refunded_payment.payload.decode()
+        except (UnicodeDecodeError, AttributeError):
+            invoice_payload = getattr(refunded_payment, "payload", None)
+
+        telegram_payment_charge_id = refunded_payment.charge.id
+        provider_payment_charge_id = refunded_payment.charge.provider_charge_id
+
+        return RefundedPayment(
+            currency=successful_payment.currency,
+            total_amount=successful_payment.total_amount,
+            invoice_payload=invoice_payload,
+            telegram_payment_charge_id=telegram_payment_charge_id,
+            provider_payment_charge_id=shipping_option_id
+        )
diff --git a/pyrogram/types/business/shipping_address.py b/pyrogram/types/business/shipping_address.py
new file mode 100644
index 0000000000..cd9af47285
--- /dev/null
+++ b/pyrogram/types/business/shipping_address.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 ShippingAddress(Object):
+    """This object represents a shipping address.
+
+    Parameters:
+        country_code (``str``):
+            Two-letter `ISO 3166-1 alpha-2 `_ country code.
+
+        state (``str``):
+            State, if applicable.
+
+        city (``str``):
+            City.
+
+        street_line1 (``str``):
+            First line for the address.
+
+        street_line2 (``str``):
+            Second line for the address.
+
+        post_code (``str``):
+            Address post code.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        country_code: str,
+        state: str,
+        city: str,
+        street_line1: str,
+        street_line2: str,
+        post_code: str
+    ):
+        super().__init__()
+
+        self.country_code = country_code
+        self.state = state
+        self.city = city
+        self.street_line1 = street_line1
+        self.street_line2 = street_line2
+        self.post_code = post_code
diff --git a/pyrogram/types/business/shipping_option.py b/pyrogram/types/business/shipping_option.py
new file mode 100644
index 0000000000..a0fa193494
--- /dev/null
+++ b/pyrogram/types/business/shipping_option.py
@@ -0,0 +1,74 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+from ..object import Object
+
+
+class ShippingOption(Object):
+    """This object represents one shipping option.
+
+    Parameters:
+        id (``str``):
+            Shipping option identifier.
+
+        title (``str``):
+            Option title.
+
+        prices (List of :obj:`~pyrogram.types.LabeledPrice`):
+            List of price portions.
+
+    """
+
+    def __init__(
+        self,
+        id: str,
+        title: str,
+        prices: "types.LabeledPrice"
+    ):
+        super().__init__()
+
+        self.id = id
+        self.title = title
+        self.prices = prices
+
+    @staticmethod
+    def _parse(shipping_option: "raw.types.ShippingOption") -> "ShippingOption":
+        if isinstance(shipping_option, raw.types.ShippingOption):
+            return ShippingOption(
+                id=shipping_option.id,
+                title=shipping_option.title,
+                prices=[
+                    types.LabeledPrice._parse(price)
+                    for price in shipping_option.prices
+                ]
+            )
+
+    def write(self):
+        return raw.types.ShippingOption(
+            id=self.id,
+            title=self.title,
+            prices=[
+                price.write()
+                for price in self.prices
+            ]
+        )
diff --git a/pyrogram/types/business/shipping_query.py b/pyrogram/types/business/shipping_query.py
new file mode 100644
index 0000000000..753bac4a96
--- /dev/null
+++ b/pyrogram/types/business/shipping_query.py
@@ -0,0 +1,131 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional
+
+import pyrogram
+from pyrogram import raw, types
+
+from ..object import Object
+from ..update import Update
+
+
+class ShippingQuery(Object, Update):
+    """This object contains information about an incoming shipping query.
+
+    Parameters:
+        id (``str``):
+            Unique query identifier.
+
+        from_user (:obj:`~pyrogram.types.User`):
+            User who sent the query.
+
+        invoice_payload (``str``):
+            Bot specified invoice payload. Only available to the bot that received the payment.
+
+        shipping_address (:obj:`~pyrogram.types.ShippingAddress`):
+            User specified shipping address. Only available to the bot that received the payment.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: str,
+        from_user: "types.User",
+        invoice_payload: str,
+        shipping_address: "types.ShippingAddress" = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.from_user = from_user
+        self.invoice_payload = invoice_payload
+        self.shipping_address = shipping_address
+
+    @staticmethod
+    async def _parse(
+        client: "pyrogram.Client",
+        shipping_query: "raw.types.updateBotShippingQuery",
+        users: dict
+    ) -> "PreCheckoutQuery":
+        # Try to decode pre-checkout query payload into string. If that fails, fallback to bytes instead of decoding by
+        # ignoring/replacing errors, this way, button clicks will still work.
+        try:
+            payload = shipping_query.payload.decode()
+        except (UnicodeDecodeError, AttributeError):
+            payload = shipping_query.payload
+
+        return PreCheckoutQuery(
+            id=str(shipping_query.query_id),
+            from_user=types.User._parse(client, users[shipping_query.user_id]),
+            invoice_payload=payload,
+            shipping_address=types.ShippingAddress(
+                country_code=shipping_query.shipping_address.country_iso2,
+                state=pshipping_query.shipping_address.state,
+                city=shipping_query.shipping_address.city,
+                street_line1=shipping_query.shipping_address.street_line1,
+                street_line2=shipping_query.shipping_address.street_line2,
+                post_code=shipping_query.shipping_address.post_code
+            ),
+            client=client
+        )
+
+    async def answer(
+        self,
+        ok: bool,
+        shipping_options: "types.ShippingOptions" = None,
+        error_message: str = None
+    ):
+        """Bound method *answer* of :obj:`~pyrogram.types.ShippingQuery`.
+
+        Use this method as a shortcut for:
+
+        .. code-block:: python
+
+            await client.answer_shipping_query(
+                shipping_query.id,
+                ok=True
+            )
+
+        Example:
+            .. code-block:: python
+
+                await shipping_query.answer(ok=True)
+
+        Parameters:
+            ok (``bool``):
+                Pass True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible).
+
+            shipping_options (:obj:`~pyrogram.types.ShippingOptions`, *optional*):
+                Required if ok is True. A JSON-serialized array of available shipping options.
+
+            error_message (``str``, *optional*):
+                Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
+
+        Returns:
+            ``bool``: True, on success.
+
+        """
+        return await self._client.answer_shipping_query(
+            shipping_query_id=self.id,
+            ok=ok,
+            shipping_options=shipping_options,
+            error_message=error_message
+        )
diff --git a/pyrogram/types/business/successful_payment.py b/pyrogram/types/business/successful_payment.py
new file mode 100644
index 0000000000..9ab3bf5d7c
--- /dev/null
+++ b/pyrogram/types/business/successful_payment.py
@@ -0,0 +1,143 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+from ..object import Object
+
+
+class SuccessfulPayment(Object):
+    """This object contains basic information about a successful payment.
+
+    Parameters:
+        currency (``str``):
+            Three-letter ISO 4217 `currency `_ code, or ``XTR`` for payments in `Telegram Stars `_.
+
+        total_amount (``int``):
+            Total price in the smallest units of the currency (integer, **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the __exp__ parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
+
+        invoice_payload (``str``):
+            Bot specified invoice payload. Only available to the bot that received the payment.
+
+        shipping_option_id (``str``, *optional*):
+            Identifier of the shipping option chosen by the user. Only available to the bot that received the payment.
+
+        order_info (:obj:`~pyrogram.types.OrderInfo`, *optional*):
+            Order information provided by the user. Only available to the bot that received the payment.
+
+        telegram_payment_charge_id (``str``):
+            Telegram payment identifier. Only available to the bot that received the payment.
+
+        provider_payment_charge_id (``str``):
+            Provider payment identifier. Only available to the bot that received the payment.
+
+        is_recurring (``bool``, *optional*):
+            True, if this is a recurring payment.
+
+        is_first_recurring (``bool``, *optional*):
+            True, if this is the first recurring payment.
+
+        invoice_name (``str``, *optional*):
+            Name of the invoice; may be empty if unknown
+
+    """
+
+    def __init__(
+        self,
+        *,
+        currency: str,
+        total_amount: str,
+        invoice_payload: str,
+        telegram_payment_charge_id: str,
+        provider_payment_charge_id: str,
+        shipping_option_id: str = None,
+        order_info: "types.OrderInfo" = None,
+        is_recurring: bool = None,
+        is_first_recurring: bool = None,
+        invoice_name: str = None
+    ):
+        super().__init__()
+
+        self.currency = currency
+        self.total_amount = total_amount
+        self.invoice_payload = invoice_payload
+        self.telegram_payment_charge_id = telegram_payment_charge_id
+        self.provider_payment_charge_id = provider_payment_charge_id
+        self.shipping_option_id = shipping_option_id
+        self.order_info = order_info
+        self.is_recurring = is_recurring
+        self.is_first_recurring = is_first_recurring
+        self.invoice_name = invoice_name
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        successful_payment: Union[
+            "raw.types.MessageActionPaymentSent",
+            "raw.types.MessageActionPaymentSentMe"
+        ]
+    ) -> "SuccessfulPayment":
+        invoice_payload = None
+        telegram_payment_charge_id = None
+        provider_payment_charge_id = None
+        shipping_option_id = None
+        order_info = None
+
+        if isinstance(successful_payment, raw.types.MessageActionPaymentSentMe):
+            # Try to decode invoice payload into string. If that fails, fallback to bytes instead of decoding by
+            # ignoring/replacing errors, this way, button clicks will still work.
+            try:
+                invoice_payload = successful_payment.payload.decode()
+            except (UnicodeDecodeError, AttributeError):
+                invoice_payload = successful_payment.payload
+
+            telegram_payment_charge_id = successful_payment.charge.id
+            provider_payment_charge_id = successful_payment.charge.provider_charge_id
+            shipping_option_id = getattr(successful_payment, "shipping_option_id", None)
+
+            if successful_payment.info:
+                payment_info = successful_payment.info
+                order_info = types.OrderInfo(
+                    name=getattr(payment_info, "name", None),
+                    phone_number=getattr(payment_info, "phone", None),
+                    email=getattr(payment_info, "email", None),
+                    shipping_address=types.ShippingAddress(
+                        country_code=payment_info.shipping_address.country_iso2,
+                        state=payment_info.shipping_address.state,
+                        city=payment_info.shipping_address.city,
+                        street_line1=payment_info.shipping_address.street_line1,
+                        street_line2=payment_info.shipping_address.street_line2,
+                        post_code=payment_info.shipping_address.post_code
+                    )
+                )
+
+        return SuccessfulPayment(
+            currency=successful_payment.currency,
+            total_amount=successful_payment.total_amount,
+            invoice_payload=invoice_payload,
+            telegram_payment_charge_id=telegram_payment_charge_id,
+            provider_payment_charge_id=provider_payment_charge_id,
+            shipping_option_id=shipping_option_id,
+            order_info=order_info,
+            is_recurring=getattr(successful_payment, "recurring_used", None),
+            is_first_recurring=getattr(successful_payment, "recurring_init", None),
+            invoice_name=getattr(successful_payment, "invoice_slug", None)
+        )
diff --git a/pyrogram/types/chat_topics/__init__.py b/pyrogram/types/chat_topics/__init__.py
new file mode 100644
index 0000000000..5546352284
--- /dev/null
+++ b/pyrogram/types/chat_topics/__init__.py
@@ -0,0 +1,35 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .forum_topic_created import ForumTopicCreated
+from .forum_topic_closed import ForumTopicClosed
+from .forum_topic_edited import ForumTopicEdited
+from .forum_topic_reopened import ForumTopicReopened
+from .general_forum_topic_hidden import GeneralForumTopicHidden
+from .general_forum_topic_unhidden import GeneralForumTopicUnhidden
+from .forum_topic import ForumTopic
+
+__all__ = [
+    "ForumTopic",
+    "ForumTopicClosed",
+    "ForumTopicCreated",
+    "ForumTopicEdited",
+    "ForumTopicReopened",
+    "GeneralForumTopicHidden",
+    "GeneralForumTopicUnhidden",
+]
diff --git a/pyrogram/types/chat_topics/forum_topic.py b/pyrogram/types/chat_topics/forum_topic.py
new file mode 100644
index 0000000000..970fbd32cc
--- /dev/null
+++ b/pyrogram/types/chat_topics/forum_topic.py
@@ -0,0 +1,188 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Optional, List, Union
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from ..object import Object
+
+
+class ForumTopic(Object):
+    """This object represents a forum topic.
+
+    Parameters:
+        message_thread_id (``int``):
+            Unique identifier of the forum topic
+
+        name (``str``):
+            Name of the topic
+
+        icon_color  (``int``):
+            Color of the topic icon in RGB format
+
+        icon_custom_emoji_id (``str``, *optional*):
+            Unique identifier of the custom emoji shown as the topic icon
+
+        creation_date (:py:obj:`~datetime.datetime`, *optional*):
+            Point in time (Unix timestamp) when the topic was created
+
+        creator (:obj:`~pyrogram.types.Chat`, *optional*):
+            Identifier of the creator of the topic
+        
+        outgoing (``bool``, *optional*):
+            True, if the topic was created by the current user
+
+        is_closed (``bool``, *optional*):
+            True, if the topic is closed
+
+        is_hidden (``bool``, *optional*):
+            True, if the topic is hidden above the topic list and closed; for General topic only
+        
+        is_deleted (``bool``, *optional*):
+            True, if the topic is delete
+
+        last_message (:obj:`~pyrogram.types.Message`, *optional*):
+            Last message in the topic; may be None if unknown
+        
+        is_pinned (``bool``, *optional*):
+            True, if the topic is pinned
+
+        unread_count (``int``, *optional*):
+            Number of unread messages in the topic
+
+        last_read_inbox_message_id (``int``, *optional*):
+            Identifier of the last read incoming message
+
+        last_read_outbox_message_id (``int``, *optional*):
+            Identifier of the last read outgoing message
+
+        unread_mention_count (``int``, *optional*):
+            Number of unread messages with a mention/reply in the topic
+
+        unread_reaction_count (``int``, *optional*):
+            Number of messages with unread reactions in the topic
+
+        is_reduced_version (``bool``, *optional*):
+            True, if this is a reduced version of the full topic information.
+            If needed, full information can be fetched using :meth:`~pyrogram.Client.get_forum_topic`.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        message_thread_id: int,
+        name: str,
+        icon_color: int,
+        icon_custom_emoji_id: str = None,
+        creation_date: datetime = None,
+        creator: "types.Chat" = None,
+        outgoing: bool = None,
+        is_closed: bool = None,
+        is_hidden: bool = None,
+        is_deleted: bool = None,
+        last_message: "types.Message" = None,
+        is_pinned: bool = None,
+        unread_count: int = None,
+        last_read_inbox_message_id: int = None,
+        last_read_outbox_message_id: int = None,
+        unread_mention_count: int = None,
+        unread_reaction_count: int = None,
+
+        is_reduced_version: bool = None
+    ):
+        super().__init__()
+
+        self.message_thread_id = message_thread_id
+        self.name = name
+        self.icon_color = icon_color
+        self.icon_custom_emoji_id = icon_custom_emoji_id
+        self.creation_date = creation_date
+        self.creator = creator
+        self.outgoing = outgoing
+        # self.is_general = is_general
+        self.is_closed = is_closed
+        self.is_hidden = is_hidden
+        self.is_deleted = is_deleted
+        self.last_message = last_message
+        self.is_pinned = is_pinned
+        self.unread_count = unread_count
+        self.last_read_inbox_message_id = last_read_inbox_message_id
+        self.last_read_outbox_message_id = last_read_outbox_message_id
+        self.unread_mention_count = unread_mention_count
+        self.unread_reaction_count = unread_reaction_count
+
+        self.is_reduced_version = is_reduced_version
+
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        forum_topic: "raw.types.ForumTopic",
+        messages: dict, # friendly
+        users: dict, # raw
+        chats: dict, # raw 
+    ) -> "ForumTopic":
+        if isinstance(forum_topic, raw.types.ForumTopicDeleted):
+            return ForumTopic(
+                message_thread_id=forum_topic.id,
+                name=None,
+                icon_color=None,
+                is_deleted=True
+            )
+
+        creator = None
+        peer = getattr(forum_topic, "from_id", None)
+        if peer:
+            peer_id = utils.get_raw_peer_id(peer)
+            if isinstance(peer, raw.types.PeerUser):
+                creator = types.Chat._parse_user_chat(
+                    client, users[peer_id]
+                )
+            else:
+                creator = types.Chat._parse_channel_chat(
+                    client, chats[peer_id]
+                )
+
+        last_message = None
+        top_message_id = getattr(forum_topic, "top_message", None)
+        if top_message_id:
+            last_message = messages.get(top_message_id, None)
+
+        return ForumTopic(
+            message_thread_id=forum_topic.id,
+            name=forum_topic.title,
+            icon_color=forum_topic.icon_color,  # TODO
+            icon_custom_emoji_id=getattr(forum_topic, "icon_emoji_id", None),
+            creation_date=utils.timestamp_to_datetime(forum_topic.date),
+            creator=creator,
+            outgoing=getattr(forum_topic, "my", None),
+            is_closed=getattr(forum_topic, "closed", None),
+            is_hidden=getattr(forum_topic, "hidden", None),
+            last_message=last_message,
+            is_pinned=getattr(forum_topic, "pinned", None),
+            unread_count=getattr(forum_topic, "unread_count", None),
+            last_read_inbox_message_id=getattr(forum_topic, "read_inbox_max_id", None),
+            last_read_outbox_message_id=getattr(forum_topic, "read_outbox_max_id", None),
+            unread_mention_count=getattr(forum_topic, "unread_mentions_count", None),
+            unread_reaction_count=getattr(forum_topic, "unread_reactions_count", None),
+            # TODO: notify_settings: PeerNotifySettings, draft: DraftMessage
+            is_reduced_version=getattr(forum_topic, "short", None)
+        )
diff --git a/pyrogram/types/chat_topics/forum_topic_closed.py b/pyrogram/types/chat_topics/forum_topic_closed.py
new file mode 100644
index 0000000000..fc62bee9c8
--- /dev/null
+++ b/pyrogram/types/chat_topics/forum_topic_closed.py
@@ -0,0 +1,30 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 ForumTopicClosed(Object):
+    """This object represents a service message about a forum topic closed in the chat. Currently holds no information.
+    """
+
+    def __init__(
+        self
+    ):
+        super().__init__()
diff --git a/pyrogram/types/chat_topics/forum_topic_created.py b/pyrogram/types/chat_topics/forum_topic_created.py
new file mode 100644
index 0000000000..0f172d2a0d
--- /dev/null
+++ b/pyrogram/types/chat_topics/forum_topic_created.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from ..object import Object
+
+
+class ForumTopicCreated(Object):
+    """This object represents a service message about a new forum topic created in the chat.
+
+    Parameters:
+        name (``str``):
+            Name of the topic
+
+        icon_color  (``int``):
+            Color of the topic icon in RGB format
+
+        icon_custom_emoji_id (``str``, *optional*):
+            Unique identifier of the custom emoji shown as the topic icon
+
+    """
+
+    def __init__(
+        self,
+        *,
+        name: str,
+        icon_color: int,
+        icon_custom_emoji_id: str = None
+    ):
+        super().__init__()
+
+        self.name = name
+        self.icon_color = icon_color
+        self.icon_custom_emoji_id = icon_custom_emoji_id
+
+
+    @staticmethod
+    def _parse(
+        topic_create_action: "raw.types.MessageActionTopicCreate"
+    ) -> "ForumTopicCreated":
+        return ForumTopicCreated(
+            name=topic_create_action.title,
+            icon_color=topic_create_action.icon_color,  # TODO
+            icon_custom_emoji_id=getattr(topic_create_action, "", None)
+        )
diff --git a/pyrogram/types/chat_topics/forum_topic_edited.py b/pyrogram/types/chat_topics/forum_topic_edited.py
new file mode 100644
index 0000000000..eefb97cc05
--- /dev/null
+++ b/pyrogram/types/chat_topics/forum_topic_edited.py
@@ -0,0 +1,57 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from ..object import Object
+
+
+class ForumTopicEdited(Object):
+    """This object represents a service message about an edited forum topic.
+
+    Parameters:
+        name (``str``, *optional*):
+            New name of the topic, if it was edited
+
+        icon_custom_emoji_id (``str``, *optional*):
+            New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed
+
+    """
+
+    def __init__(
+        self,
+        *,
+        name: str = None,
+        icon_custom_emoji_id: str = None
+    ):
+        super().__init__()
+
+        self.name = name
+        self.icon_custom_emoji_id = icon_custom_emoji_id
+
+
+    @staticmethod
+    def _parse(
+        topic_edit_action: "raw.types.MessageActionTopicEdit"
+    ) -> "ForumTopicEdited":
+        return ForumTopicEdited(
+            name=getattr(topic_edit_action, "title", None),
+            icon_custom_emoji_id=getattr(topic_edit_action, "icon_emoji_id", None)
+        )
diff --git a/pyrogram/types/chat_topics/forum_topic_reopened.py b/pyrogram/types/chat_topics/forum_topic_reopened.py
new file mode 100644
index 0000000000..60d4f31122
--- /dev/null
+++ b/pyrogram/types/chat_topics/forum_topic_reopened.py
@@ -0,0 +1,29 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 ForumTopicReopened(Object):
+    """This object represents a service message about a forum topic reopened in the chat. Currently holds no information.
+    """
+
+    def __init__(
+        self
+    ):
+        super().__init__()
diff --git a/pyrogram/types/chat_topics/general_forum_topic_hidden.py b/pyrogram/types/chat_topics/general_forum_topic_hidden.py
new file mode 100644
index 0000000000..50b313a1c8
--- /dev/null
+++ b/pyrogram/types/chat_topics/general_forum_topic_hidden.py
@@ -0,0 +1,29 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 GeneralForumTopicHidden(Object):
+    """This object represents a service message about General forum topic hidden in the chat. Currently holds no information.
+    """
+
+    def __init__(
+        self
+    ):
+        super().__init__()
diff --git a/pyrogram/types/chat_topics/general_forum_topic_unhidden.py b/pyrogram/types/chat_topics/general_forum_topic_unhidden.py
new file mode 100644
index 0000000000..678be790da
--- /dev/null
+++ b/pyrogram/types/chat_topics/general_forum_topic_unhidden.py
@@ -0,0 +1,29 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 GeneralForumTopicUnhidden(Object):
+    """This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.
+    """
+
+    def __init__(
+        self
+    ):
+        super().__init__()
diff --git a/pyrogram/types/inline_mode/__init__.py b/pyrogram/types/inline_mode/__init__.py
new file mode 100644
index 0000000000..53e883ce9c
--- /dev/null
+++ b/pyrogram/types/inline_mode/__init__.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .chosen_inline_result import ChosenInlineResult
+from .inline_query import InlineQuery
+from .inline_query_result import InlineQueryResult
+from .inline_query_result_animation import InlineQueryResultAnimation
+from .inline_query_result_article import InlineQueryResultArticle
+from .inline_query_result_audio import InlineQueryResultAudio
+from .inline_query_result_cached_animation import InlineQueryResultCachedAnimation
+from .inline_query_result_cached_document import InlineQueryResultCachedDocument
+from .inline_query_result_cached_photo import InlineQueryResultCachedPhoto
+from .inline_query_result_cached_sticker import InlineQueryResultCachedSticker
+from .inline_query_result_cached_video import InlineQueryResultCachedVideo
+from .inline_query_result_cached_voice import InlineQueryResultCachedVoice
+from .inline_query_result_contact import InlineQueryResultContact
+from .inline_query_result_document import InlineQueryResultDocument
+from .inline_query_result_location import InlineQueryResultLocation
+from .inline_query_result_photo import InlineQueryResultPhoto
+from .inline_query_result_venue import InlineQueryResultVenue
+from .inline_query_result_video import InlineQueryResultVideo
+from .inline_query_result_voice import InlineQueryResultVoice
+from .inline_query_result_cached_audio import InlineQueryResultCachedAudio
+
+__all__ = [
+    "ChosenInlineResult",
+    "InlineQuery",
+    "InlineQueryResult",
+    "InlineQueryResultCachedAnimation",
+    "InlineQueryResultCachedAudio",
+    "InlineQueryResultCachedDocument",
+    "InlineQueryResultCachedPhoto",
+    "InlineQueryResultCachedSticker",
+    "InlineQueryResultCachedVideo",
+    "InlineQueryResultCachedVoice",
+    "InlineQueryResultAnimation",
+    "InlineQueryResultAudio",
+    "InlineQueryResultDocument",
+    "InlineQueryResultPhoto",
+    "InlineQueryResultVideo",
+    "InlineQueryResultVoice",
+    "InlineQueryResultArticle",
+    "InlineQueryResultContact",
+    "InlineQueryResultLocation",
+    "InlineQueryResultVenue",
+]
diff --git a/pyrogram/types/inline_mode/chosen_inline_result.py b/pyrogram/types/inline_mode/chosen_inline_result.py
new file mode 100644
index 0000000000..367039e3e7
--- /dev/null
+++ b/pyrogram/types/inline_mode/chosen_inline_result.py
@@ -0,0 +1,87 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types, utils
+from ..object import Object
+from ..update import Update
+
+
+class ChosenInlineResult(Object, Update):
+    """A :doc:`result ` of an inline query chosen by the user and sent to their chat partner.
+
+    .. note::
+
+        In order to receive these updates, your bot must have "inline feedback" enabled. You can enable this feature
+        with `@BotFather `_.
+
+    Parameters:
+        result_id (``str``):
+            The unique identifier for the result that was chosen.
+
+        from_user (:obj:`~pyrogram.types.User`):
+            The user that chose the result.
+
+        query (``str``):
+            The query that was used to obtain the result.
+
+        location (:obj:`~pyrogram.types.Location`, *optional*):
+            Sender location, only for bots that require user location.
+
+        inline_message_id (``str``, *optional*):
+            Identifier of the sent inline message.
+            Available only if there is an :doc:`inline keyboard ` attached to the message.
+            Will be also received in :doc:`callback queries ` and can be used to edit the message.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        result_id: str,
+        from_user: "types.User",
+        query: str,
+        location: "types.Location" = None,
+        inline_message_id: str = None
+    ):
+        super().__init__(client)
+
+        self.result_id = result_id
+        self.from_user = from_user
+        self.query = query
+        self.location = location
+        self.inline_message_id = inline_message_id
+
+    @staticmethod
+    def _parse(client, chosen_inline_result: raw.types.UpdateBotInlineSend, users) -> "ChosenInlineResult":
+        inline_message_id = utils.pack_inline_message_id(
+            chosen_inline_result.msg_id
+        ) if chosen_inline_result.msg_id else None
+
+        return ChosenInlineResult(
+            result_id=str(chosen_inline_result.id),
+            from_user=types.User._parse(client, users[chosen_inline_result.user_id]),
+            query=chosen_inline_result.query,
+            location=types.Location(
+                longitude=chosen_inline_result.geo.long,
+                latitude=chosen_inline_result.geo.lat,
+                client=client
+            ) if chosen_inline_result.geo else None,
+            inline_message_id=inline_message_id
+        )
diff --git a/pyrogram/types/inline_mode/inline_query.py b/pyrogram/types/inline_mode/inline_query.py
new file mode 100644
index 0000000000..a5f0422e72
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query.py
@@ -0,0 +1,181 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Match
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types, enums
+from ..object import Object
+from ..update import Update
+
+
+class InlineQuery(Object, Update):
+    """An incoming inline query.
+
+    When the user sends an empty query, your bot could return some default or trending results.
+
+    Parameters:
+        id (``str``):
+            Unique identifier for this query.
+
+        from_user (:obj:`~pyrogram.types.User`):
+            Sender.
+
+        query (``str``):
+            Text of the query (up to 512 characters).
+
+        offset (``str``):
+            Offset of the results to be returned, can be controlled by the bot.
+
+        chat_type (:obj:`~pyrogram.enums.ChatType`, *optional*):
+            Type of the chat, from which the inline query was sent.
+
+        location (:obj:`~pyrogram.types.Location`. *optional*):
+            Sender location, only for bots that request user location.
+
+        matches (List of regex Matches, *optional*):
+            A list containing all `Match Objects `_ that match
+            the query of this inline query. Only applicable when using :obj:`Filters.regex `.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: str,
+        from_user: "types.User",
+        query: str,
+        offset: str,
+        chat_type: "enums.ChatType",
+        location: "types.Location" = None,
+        matches: List[Match] = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.from_user = from_user
+        self.query = query
+        self.offset = offset
+        self.chat_type = chat_type
+        self.location = location
+        self.matches = matches
+
+    @staticmethod
+    def _parse(client, inline_query: raw.types.UpdateBotInlineQuery, users: dict) -> "InlineQuery":
+        peer_type = inline_query.peer_type
+        chat_type = None
+
+        if isinstance(peer_type, raw.types.InlineQueryPeerTypeSameBotPM):
+            chat_type = enums.ChatType.BOT
+        elif isinstance(peer_type, raw.types.InlineQueryPeerTypePM):
+            chat_type = enums.ChatType.PRIVATE
+        elif isinstance(peer_type, raw.types.InlineQueryPeerTypeChat):
+            chat_type = enums.ChatType.GROUP
+        elif isinstance(peer_type, raw.types.InlineQueryPeerTypeMegagroup):
+            chat_type = enums.ChatType.SUPERGROUP
+        elif isinstance(peer_type, raw.types.InlineQueryPeerTypeBroadcast):
+            chat_type = enums.ChatType.CHANNEL
+
+        return InlineQuery(
+            id=str(inline_query.query_id),
+            from_user=types.User._parse(client, users[inline_query.user_id]),
+            query=inline_query.query,
+            offset=inline_query.offset,
+            chat_type=chat_type,
+            location=types.Location(
+                longitude=inline_query.geo.long,
+                latitude=inline_query.geo.lat,
+                client=client
+            ) if inline_query.geo else None,
+            client=client
+        )
+
+    async def answer(
+        self,
+        results: List["types.InlineQueryResult"],
+        cache_time: int = 300,
+        is_gallery: bool = False,
+        is_personal: bool = False,
+        next_offset: str = "",
+        switch_pm_text: str = "",
+        switch_pm_parameter: str = ""
+    ):
+        """Bound method *answer* of :obj:`~pyrogram.types.InlineQuery`.
+
+        Use this method as a shortcut for:
+
+        .. code-block:: python
+
+            await client.answer_inline_query(
+                inline_query.id,
+                results=[...]
+            )
+
+        Example:
+            .. code-block:: python
+
+                await inline_query.answer([...])
+
+        Parameters:
+            results (List of :obj:`~pyrogram.types.InlineQueryResult`):
+                A list of results for the inline query.
+
+            cache_time (``int``, *optional*):
+                The maximum amount of time in seconds that the result of the inline query may be cached on the server.
+                Defaults to 300.
+
+            is_gallery (``bool``, *optional*):
+                Pass True, if results should be displayed in gallery mode instead of list mode.
+                Defaults to False.
+
+            is_personal (``bool``, *optional*):
+                Pass True, if results may be cached on the server side only for the user that sent the query.
+                By default (False), results may be returned to any user who sends the same query.
+
+            next_offset (``str``, *optional*):
+                Pass the offset that a client should send in the next query with the same text to receive more results.
+                Pass an empty string if there are no more results or if you don‘t support pagination.
+                Offset length can’t exceed 64 bytes.
+
+            switch_pm_text (``str``, *optional*):
+                If passed, clients will display a button with specified text that switches the user to a private chat
+                with the bot and sends the bot a start message with the parameter switch_pm_parameter
+
+            switch_pm_parameter (``str``, *optional*):
+                `Deep-linking `_ parameter for the /start message sent to
+                the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
+
+                Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube
+                account to adapt search results accordingly. To do this, it displays a "Connect your YouTube account"
+                button above the results, or even before showing any. The user presses the button, switches to a private
+                chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth
+                link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat
+                where they wanted to use the bot's inline capabilities.
+        """
+
+        return await self._client.answer_inline_query(
+            inline_query_id=self.id,
+            results=results,
+            cache_time=cache_time,
+            is_gallery=is_gallery,
+            is_personal=is_personal,
+            next_offset=next_offset,
+            switch_pm_text=switch_pm_text,
+            switch_pm_parameter=switch_pm_parameter
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result.py b/pyrogram/types/inline_mode/inline_query_result.py
new file mode 100644
index 0000000000..8548e023c7
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 uuid import uuid4
+
+import pyrogram
+from pyrogram import types
+from ..object import Object
+
+
+class InlineQueryResult(Object):
+    """One result of an inline query.
+
+    - :obj:`~pyrogram.types.InlineQueryResultCachedAudio`
+    - :obj:`~pyrogram.types.InlineQueryResultCachedDocument`
+    - :obj:`~pyrogram.types.InlineQueryResultCachedAnimation`
+    - :obj:`~pyrogram.types.InlineQueryResultCachedPhoto`
+    - :obj:`~pyrogram.types.InlineQueryResultCachedSticker`
+    - :obj:`~pyrogram.types.InlineQueryResultCachedVideo`
+    - :obj:`~pyrogram.types.InlineQueryResultCachedVoice`
+    - :obj:`~pyrogram.types.InlineQueryResultArticle`
+    - :obj:`~pyrogram.types.InlineQueryResultAudio`
+    - :obj:`~pyrogram.types.InlineQueryResultContact`
+    - :obj:`~pyrogram.types.InlineQueryResultDocument`
+    - :obj:`~pyrogram.types.InlineQueryResultAnimation`
+    - :obj:`~pyrogram.types.InlineQueryResultLocation`
+    - :obj:`~pyrogram.types.InlineQueryResultPhoto`
+    - :obj:`~pyrogram.types.InlineQueryResultVenue`
+    - :obj:`~pyrogram.types.InlineQueryResultVideo`
+    - :obj:`~pyrogram.types.InlineQueryResultVoice`
+    """
+
+    def __init__(
+        self,
+        type: str,
+        id: str,
+        input_message_content: "types.InputMessageContent",
+        reply_markup: "types.InlineKeyboardMarkup"
+    ):
+        super().__init__()
+
+        self.type = type
+        self.id = str(uuid4()) if id is None else str(id)
+        self.input_message_content = input_message_content
+        self.reply_markup = reply_markup
+
+    async def write(self, client: "pyrogram.Client"):
+        pass
diff --git a/pyrogram/types/inline_mode/inline_query_result_animation.py b/pyrogram/types/inline_mode/inline_query_result_animation.py
new file mode 100644
index 0000000000..e9843528c5
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_animation.py
@@ -0,0 +1,161 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultAnimation(InlineQueryResult):
+    """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.
+
+    Parameters:
+        animation_url (``str``):
+            A valid URL for the animated GIF file.
+            File size must not exceed 1 MB.
+
+        animation_width (``int``, *optional*)
+            Width of the animation.
+
+        animation_height (``int``, *optional*)
+            Height of the animation.
+
+        animation_duration (``int``, *optional*)
+            Duration of the animation in seconds.
+
+        thumb_url (``str``, *optional*):
+            URL of the static thumbnail for the result (jpeg or gif)
+            Defaults to the value passed in *animation_url*.
+
+        thumb_mime_type (``str``, *optional*)
+            MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4".
+            Defaults to "image/jpeg".
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        title (``str``, *optional*):
+            Title for the result.
+
+        caption (``str``, *optional*):
+            Caption of the animation to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        show_caption_above_media (``bool``, *optional*):
+            Pass True, if the caption must be shown above the message media.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            An InlineKeyboardMarkup object.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the photo.
+    """
+
+    def __init__(
+        self,
+        animation_url: str,
+        animation_width: int = 0,
+        animation_height: int = 0,
+        animation_duration: int = 0,
+        thumb_url: str = None,
+        thumb_mime_type: str = "image/jpeg",
+        id: str = None,
+        title: str = None,
+        description: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("gif", id, input_message_content, reply_markup)
+
+        self.animation_url = animation_url
+        self.animation_width = animation_width
+        self.animation_height = animation_height
+        self.animation_duration = animation_duration
+        self.thumb_url = thumb_url
+        self.thumb_mime_type = thumb_mime_type
+        self.title = title
+        self.description = description
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.show_caption_above_media = show_caption_above_media
+        self.reply_markup = reply_markup
+        self.input_message_content = input_message_content
+
+    async def write(self, client: "pyrogram.Client"):
+        animation = raw.types.InputWebDocument(
+            url=self.animation_url,
+            size=0,
+            mime_type="image/gif",
+            attributes=[
+                raw.types.DocumentAttributeVideo(
+                    w=self.animation_width,
+                    h=self.animation_height,
+                    duration=self.animation_duration
+                )
+            ]
+        )
+
+        if self.thumb_url is None:
+            thumb = animation
+        else:
+            thumb = raw.types.InputWebDocument(
+                url=self.thumb_url,
+                size=0,
+                mime_type=self.thumb_mime_type,
+                attributes=[]
+            )
+
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            thumb=thumb,
+            content=animation,
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities,
+                    invert_media=self.show_caption_above_media
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_article.py b/pyrogram/types/inline_mode/inline_query_result_article.py
new file mode 100644
index 0000000000..096273f15b
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_article.py
@@ -0,0 +1,99 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultArticle(InlineQueryResult):
+    """Link to an article or web page.
+
+    Parameters:
+        title (``str``):
+            Title for the result.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        url (``str``, *optional*):
+            URL of the result.
+
+        description (``str``, *optional*):
+            Short description of the result.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            Inline keyboard attached to the message.
+
+        thumb_url (``str``, *optional*):
+            Url of the thumbnail for the result.
+
+        thumb_width (``int``, *optional*):
+            Thumbnail width.
+
+        thumb_height (``int``, *optional*):
+            Thumbnail height
+    """
+
+    def __init__(
+        self,
+        title: str,
+        input_message_content: "types.InputMessageContent",
+        id: str = None,
+        url: str = None,
+        description: str = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        thumb_url: str = None,
+        thumb_width: int = 0,
+        thumb_height: int = 0
+    ):
+        super().__init__("article", id, input_message_content, reply_markup)
+
+        self.title = title
+        self.url = url
+        self.description = description
+        self.thumb_url = thumb_url
+        self.thumb_width = thumb_width
+        self.thumb_height = thumb_height
+
+    async def write(self, client: "pyrogram.Client"):
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            send_message=await self.input_message_content.write(client, self.reply_markup),
+            title=self.title,
+            description=self.description,
+            url=self.url,
+            thumb=raw.types.InputWebDocument(
+                url=self.thumb_url,
+                size=0,
+                mime_type="image/jpeg",
+                attributes=[
+                    raw.types.DocumentAttributeImageSize(
+                        w=self.thumb_width,
+                        h=self.thumb_height
+                    )
+                ]
+            ) if self.thumb_url else None
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_audio.py b/pyrogram/types/inline_mode/inline_query_result_audio.py
new file mode 100644
index 0000000000..a39021000f
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_audio.py
@@ -0,0 +1,120 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultAudio(InlineQueryResult):
+    """Link to an audio file.
+    
+    By default, this audio 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
+    audio.
+    
+    Parameters:
+        audio_url (``str``):
+            A valid URL for the audio file.
+            
+        title (``str``):
+            Title for the result.
+            
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+            
+        performer (``str``, *optional*):
+            Audio performer.
+            
+        audio_duration (``int``, *optional*):
+            Audio duration in seconds.
+
+        caption (``str``, *optional*):
+            Caption of the audio to be sent, 0-1024 characters.
+            
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+            
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            Inline keyboard attached to the message.
+            
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*):
+            Content of the message to be sent instead of the audio.
+    """
+
+    def __init__(
+        self,
+        audio_url: str,
+        title: str,
+        id: str = None,
+        performer: str = "",
+        audio_duration: int = 0,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("audio", id, input_message_content, reply_markup)
+
+        self.audio_url = audio_url
+        self.title = title
+        self.performer = performer
+        self.audio_duration = audio_duration
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+
+    async def write(self, client: "pyrogram.Client"):
+        audio = raw.types.InputWebDocument(
+            url=self.audio_url,
+            size=0,
+            mime_type="audio/mpeg",
+            attributes=[raw.types.DocumentAttributeAudio(
+                duration=self.audio_duration,
+                title=self.title,
+                performer=self.performer
+            )]
+        )
+
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            content=audio,
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_animation.py b/pyrogram/types/inline_mode/inline_query_result_cached_animation.py
new file mode 100644
index 0000000000..d031db8466
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_animation.py
@@ -0,0 +1,114 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+from ...file_id import FileId
+
+
+class InlineQueryResultCachedAnimation(InlineQueryResult):
+    """A link to an animation file stored on the Telegram servers.
+
+    By default, this animation 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.
+
+    Parameters:
+        animation_file_id (``str``):
+            A valid file identifier for the animation file.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        title (``str``, *optional*):
+            Title for the result.
+
+        caption (``str``, *optional*):
+            Caption of the photo to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        show_caption_above_media (``bool``, *optional*):
+            Pass True, if the caption must be shown above the message media.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            An InlineKeyboardMarkup object.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the photo.
+    """
+
+    def __init__(
+        self,
+        animation_file_id: str,
+        id: str = None,
+        title: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("gif", id, input_message_content, reply_markup)
+
+        self.animation_file_id = animation_file_id
+        self.title = title
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.show_caption_above_media = show_caption_above_media
+        self.reply_markup = reply_markup
+        self.input_message_content = input_message_content
+
+    async def write(self, client: "pyrogram.Client"):
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        file_id = FileId.decode(self.animation_file_id)
+
+        return raw.types.InputBotInlineResultDocument(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            document=raw.types.InputDocument(
+                id=file_id.media_id,
+                access_hash=file_id.access_hash,
+                file_reference=file_id.file_reference,
+            ),
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities,
+                    invert_media=self.show_caption_above_media
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_audio.py b/pyrogram/types/inline_mode/inline_query_result_cached_audio.py
new file mode 100644
index 0000000000..9535f63343
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_audio.py
@@ -0,0 +1,101 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+from ...file_id import FileId
+
+
+class InlineQueryResultCachedAudio(InlineQueryResult):
+    """A link to an MP3 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.
+
+    Parameters:
+        audio_file_id (``str``):
+            A valid file identifier for the audio file.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        caption (``str``, *optional*):
+            Caption of the photo to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            An InlineKeyboardMarkup object.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the photo.
+    """
+
+    def __init__(
+        self,
+        audio_file_id: str,
+        id: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("audio", id, input_message_content, reply_markup)
+
+        self.audio_file_id = audio_file_id
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.reply_markup = reply_markup
+        self.input_message_content = input_message_content
+
+    async def write(self, client: "pyrogram.Client"):
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        file_id = FileId.decode(self.audio_file_id)
+
+        return raw.types.InputBotInlineResultDocument(
+            id=self.id,
+            type=self.type,
+            document=raw.types.InputDocument(
+                id=file_id.media_id,
+                access_hash=file_id.access_hash,
+                file_reference=file_id.file_reference,
+            ),
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_document.py b/pyrogram/types/inline_mode/inline_query_result_cached_document.py
new file mode 100644
index 0000000000..2ab190e7ff
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_document.py
@@ -0,0 +1,113 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+from ...file_id import FileId
+
+
+class InlineQueryResultCachedDocument(InlineQueryResult):
+    """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.
+
+    Parameters:
+        document_file_id (``str``):
+            A valid file identifier for the file.
+
+        title (``str``):
+            Title for the result.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        description (``str``, *optional*):
+            Short description of the result.
+
+        caption (``str``, *optional*):
+            Caption of the photo to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            An InlineKeyboardMarkup object.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the photo.
+    """
+
+    def __init__(
+        self,
+        document_file_id: str,
+        title: str,
+        id: str = None,
+        description: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("file", id, input_message_content, reply_markup)
+
+        self.document_file_id = document_file_id
+        self.title = title
+        self.description = description
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.reply_markup = reply_markup
+        self.input_message_content = input_message_content
+
+    async def write(self, client: "pyrogram.Client"):
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        file_id = FileId.decode(self.document_file_id)
+
+        return raw.types.InputBotInlineResultDocument(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            description=self.description,
+            document=raw.types.InputDocument(
+                id=file_id.media_id,
+                access_hash=file_id.access_hash,
+                file_reference=file_id.file_reference,
+            ),
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_photo.py b/pyrogram/types/inline_mode/inline_query_result_cached_photo.py
new file mode 100644
index 0000000000..c26268de99
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_photo.py
@@ -0,0 +1,117 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+from ...file_id import FileId
+
+
+class InlineQueryResultCachedPhoto(InlineQueryResult):
+    """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.
+
+    Parameters:
+        photo_file_id (``str``):
+            A valid file identifier of the photo.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        title (``str``, *optional*):
+            Title for the result.
+
+        description (``str``, *optional*):
+            Short description of the result.
+
+        caption (``str``, *optional*):
+            Caption of the photo to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        show_caption_above_media (``bool``, *optional*):
+            Pass True, if the caption must be shown above the message media.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            An InlineKeyboardMarkup object.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the photo.
+    """
+
+    def __init__(
+        self,
+        photo_file_id: str,
+        id: str = None,
+        title: str = None,
+        description: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("photo", id, input_message_content, reply_markup)
+
+        self.photo_file_id = photo_file_id
+        self.title = title
+        self.description = description
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.show_caption_above_media = show_caption_above_media
+        self.reply_markup = reply_markup
+        self.input_message_content = input_message_content
+
+    async def write(self, client: "pyrogram.Client"):
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        file_id = FileId.decode(self.photo_file_id)
+
+        return raw.types.InputBotInlineResultPhoto(
+            id=self.id,
+            type=self.type,
+            photo=raw.types.InputPhoto(
+                id=file_id.media_id,
+                access_hash=file_id.access_hash,
+                file_reference=file_id.file_reference,
+            ),
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities,
+                    invert_media=self.show_caption_above_media
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py b/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py
new file mode 100644
index 0000000000..06d012fbe6
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py
@@ -0,0 +1,78 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+from .inline_query_result import InlineQueryResult
+from ...file_id import FileId
+
+
+class InlineQueryResultCachedSticker(InlineQueryResult):
+    """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.
+
+    Parameters:
+        sticker_file_id (``str``):
+            A valid file identifier of the sticker.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            An InlineKeyboardMarkup object.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the photo.
+    """
+
+    def __init__(
+        self,
+        sticker_file_id: str,
+        id: str = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("sticker", id, input_message_content, reply_markup)
+
+        self.sticker_file_id = sticker_file_id
+        self.reply_markup = reply_markup
+        self.input_message_content = input_message_content
+
+    async def write(self, client: "pyrogram.Client"):
+        file_id = FileId.decode(self.sticker_file_id)
+
+        return raw.types.InputBotInlineResultDocument(
+            id=self.id,
+            type=self.type,
+            document=raw.types.InputDocument(
+                id=file_id.media_id,
+                access_hash=file_id.access_hash,
+                file_reference=file_id.file_reference,
+            ),
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message="",
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_video.py b/pyrogram/types/inline_mode/inline_query_result_cached_video.py
new file mode 100644
index 0000000000..f8c76b9c61
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_video.py
@@ -0,0 +1,120 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+from ...file_id import FileId
+
+
+class InlineQueryResultCachedVideo(InlineQueryResult):
+    """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.
+
+    Parameters:
+        video_file_id (``str``):
+            A valid file identifier for the video file.
+
+        title (``str``):
+            Title for the result.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        description (``str``, *optional*):
+            Short description of the result.
+
+        caption (``str``, *optional*):
+            Caption of the photo to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        show_caption_above_media (``bool``, *optional*):
+            Pass True, if the caption must be shown above the message media.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            An InlineKeyboardMarkup object.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the photo.
+    """
+
+    def __init__(
+        self,
+        video_file_id: str,
+        title: str,
+        id: str = None,
+        description: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("video", id, input_message_content, reply_markup)
+
+        self.video_file_id = video_file_id
+        self.title = title
+        self.description = description
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.show_caption_above_media = show_caption_above_media
+        self.reply_markup = reply_markup
+        self.input_message_content = input_message_content
+
+    async def write(self, client: "pyrogram.Client"):
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        file_id = FileId.decode(self.video_file_id)
+
+        return raw.types.InputBotInlineResultDocument(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            description=self.description,
+            document=raw.types.InputDocument(
+                id=file_id.media_id,
+                access_hash=file_id.access_hash,
+                file_reference=file_id.file_reference,
+            ),
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities,
+                    invert_media=self.show_caption_above_media
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_voice.py b/pyrogram/types/inline_mode/inline_query_result_cached_voice.py
new file mode 100644
index 0000000000..cc2bd76855
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_voice.py
@@ -0,0 +1,108 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+from ...file_id import FileId
+
+
+class InlineQueryResultCachedVoice(InlineQueryResult):
+    """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.
+
+    Parameters:
+        voice_file_id (``str``):
+            A valid file identifier for the voice message.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        title (``str``, *optional*):
+            Title for the result.
+
+        caption (``str``, *optional*):
+            Caption of the photo to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            An InlineKeyboardMarkup object.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the photo.
+    """
+
+    def __init__(
+        self,
+        voice_file_id: str,
+        id: str = None,
+        title: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("voice", id, input_message_content, reply_markup)
+
+        self.voice_file_id = voice_file_id
+        self.title = title
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.reply_markup = reply_markup
+        self.input_message_content = input_message_content
+
+    async def write(self, client: "pyrogram.Client"):
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        file_id = FileId.decode(self.voice_file_id)
+
+        return raw.types.InputBotInlineResultDocument(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            document=raw.types.InputDocument(
+                id=file_id.media_id,
+                access_hash=file_id.access_hash,
+                file_reference=file_id.file_reference,
+            ),
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_contact.py b/pyrogram/types/inline_mode/inline_query_result_contact.py
new file mode 100644
index 0000000000..d55a624450
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_contact.py
@@ -0,0 +1,114 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultContact(InlineQueryResult):
+    """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.
+    
+    Parameters:
+        phone_number (``str``):
+            Contact's phone number.
+
+        first_name (``str``):
+            Contact's first name.
+
+        last_name (``str``, *optional*):
+            Contact's last name.
+
+        vcard (``str``, *optional*):
+            Additional data about the contact in the form of a `vCard `_.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            Inline keyboard attached to the message.
+            
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*):
+            Content of the message to be sent instead of the contact.
+
+        thumb_url (``str``, *optional*):
+            Url of the thumbnail for the result.
+
+        thumb_width (``int``, *optional*):
+            Thumbnail width.
+
+        thumb_height (``int``, *optional*):
+            Thumbnail height.
+    """
+
+    def __init__(
+        self,
+        phone_number: str,
+        first_name: str,
+        last_name: str = "",
+        vcard: str = "",
+        id: str = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None,
+        thumb_url: str = None,
+        thumb_width: int = 0,
+        thumb_height: int = 0
+    ):
+        super().__init__("contact", id, input_message_content, reply_markup)
+
+        self.phone_number = phone_number
+        self.first_name = first_name
+        self.last_name = last_name
+        self.vcard = vcard
+        self.thumb_url = thumb_url
+        self.thumb_width = thumb_width
+        self.thumb_height = thumb_height
+
+    async def write(self, client: "pyrogram.Client"):
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            title=self.first_name,
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaContact(
+                    phone_number=self.phone_number,
+                    first_name=self.first_name,
+                    last_name=self.last_name,
+                    vcard=self.vcard,
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                )
+            ),
+            thumb=raw.types.InputWebDocument(
+                url=self.thumb_url,
+                size=0,
+                mime_type="image/jpg",
+                attributes=[
+                    raw.types.DocumentAttributeImageSize(
+                        w=self.thumb_width,
+                        h=self.thumb_height
+                    )
+                ]
+            ) if self.thumb_url else None
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_document.py b/pyrogram/types/inline_mode/inline_query_result_document.py
new file mode 100644
index 0000000000..eac7901b14
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_document.py
@@ -0,0 +1,145 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultDocument(InlineQueryResult):
+    """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.
+
+    Parameters:
+        document_url (``str``):
+            A valid URL for the file.
+
+        title (``str``):
+            Title for the result.
+
+        mime_type (``str``, *optional*):
+            Mime type of the content of the file, either “application/pdf” or “application/zip”.
+            Defaults to "application/zip".
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        caption (``str``, *optional*):
+            Caption of the video to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        description (``str``, *optional*):
+            Short description of the result.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            Inline keyboard attached to the message.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the file.
+
+        thumb_url (``str``, *optional*):
+            Url of the thumbnail for the result.
+
+        thumb_width (``int``, *optional*):
+            Thumbnail width.
+
+        thumb_height (``int``, *optional*):
+            Thumbnail height.
+    """
+
+    def __init__(
+        self,
+        document_url: str,
+        title: str,
+        mime_type: str = "application/zip",
+        id: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        description: str = "",
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None,
+        thumb_url: str = None,
+        thumb_width: int = 0,
+        thumb_height: int = 0
+    ):
+        super().__init__("file", id, input_message_content, reply_markup)
+
+        self.document_url = document_url
+        self.title = title
+        self.mime_type = mime_type
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.description = description
+        self.thumb_url = thumb_url
+        self.thumb_width = thumb_width
+        self.thumb_height = thumb_height
+
+    async def write(self, client: "pyrogram.Client"):
+        document = raw.types.InputWebDocument(
+            url=self.document_url,
+            size=0,
+            mime_type=self.mime_type,
+            attributes=[]
+        )
+
+        thumb = raw.types.InputWebDocument(
+            url=self.thumb_url,
+            size=0,
+            mime_type="image/jpeg",
+            attributes=[
+                raw.types.DocumentAttributeImageSize(
+                    w=self.thumb_width,
+                    h=self.thumb_height
+                )
+            ]
+        ) if self.thumb_url else None
+
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            description=self.description,
+            thumb=thumb,
+            content=document,
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_location.py b/pyrogram/types/inline_mode/inline_query_result_location.py
new file mode 100644
index 0000000000..236f39a624
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_location.py
@@ -0,0 +1,122 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultLocation(InlineQueryResult):
+    """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.
+
+    Parameters:
+        title (``str``):
+            Title for the result.
+
+        latitude (``float``):
+            Location latitude in degrees.
+
+        longitude (``float``):
+            Location longitude in degrees.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        horizontal_accuracy (``float``, *optional*)
+            The radius of uncertainty for the location, measured in meters; 0-1500.
+
+        live_period (``int``, *optional*):
+            Period in seconds for which the location can be updated, should be between 60 and 86400.
+
+        heading (``int``, *optional*):
+            For live locations, a direction in which the user is moving, in degrees.
+            Must be between 1 and 360 if specified.
+
+        proximity_alert_radius (``int``, *optional*):
+            For live locations, a maximum distance for proximity alerts about approaching another chat member,
+            in meters. Must be between 1 and 100000 if specified.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            Inline keyboard attached to the message.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the file.
+
+        thumb_url (``str``, *optional*):
+            Url of the thumbnail for the result.
+
+        thumb_width (``int``, *optional*):
+            Thumbnail width.
+
+        thumb_height (``int``, *optional*):
+            Thumbnail height.
+    """
+
+    def __init__(
+        self,
+        title: str,
+        latitude: float,
+        longitude: float,
+        horizontal_accuracy: float = None,
+        live_period: int = None,
+        heading: int = None,
+        proximity_alert_radius: int = None,
+        id: str = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None,
+        thumb_url: str = None,
+        thumb_width: int = 0,
+        thumb_height: int = 0
+    ):
+        super().__init__("location", id, input_message_content, reply_markup)
+
+        self.title = title
+        self.latitude = latitude
+        self.longitude = longitude
+        self.horizontal_accuracy = horizontal_accuracy
+        self.live_period = live_period
+        self.heading = heading
+        self.proximity_alert_radius = proximity_alert_radius
+        self.thumb_url = thumb_url
+        self.thumb_width = thumb_width
+        self.thumb_height = thumb_height
+
+    async def write(self, client: "pyrogram.Client"):
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaGeo(
+                    geo_point=raw.types.InputGeoPoint(
+                        lat=self.latitude,
+                        long=self.longitude
+                    ),
+                    heading=self.heading,
+                    period=self.live_period,
+                    proximity_notification_radius=self.proximity_alert_radius,
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_photo.py b/pyrogram/types/inline_mode/inline_query_result_photo.py
new file mode 100644
index 0000000000..c30f53857b
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_photo.py
@@ -0,0 +1,153 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultPhoto(InlineQueryResult):
+    """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.
+
+    Parameters:
+        photo_url (``str``):
+            A valid URL of the photo.
+            Photo must be in jpeg format an must not exceed 5 MB.
+
+        thumb_url (``str``, *optional*):
+            URL of the thumbnail for the photo.
+            Defaults to the value passed in *photo_url*.
+
+        photo_width (``int``, *optional*):
+            Width of the photo.
+
+        photo_height (``int``, *optional*):
+            Height of the photo
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        title (``str``, *optional*):
+            Title for the result.
+
+        description (``str``, *optional*):
+            Short description of the result.
+
+        caption (``str``, *optional*):
+            Caption of the photo to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        show_caption_above_media (``bool``, *optional*):
+            Pass True, if the caption must be shown above the message media.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            An InlineKeyboardMarkup object.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the photo.
+    """
+
+    def __init__(
+        self,
+        photo_url: str,
+        thumb_url: str = None,
+        photo_width: int = 0,
+        photo_height: int = 0,
+        id: str = None,
+        title: str = None,
+        description: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("photo", id, input_message_content, reply_markup)
+
+        self.photo_url = photo_url
+        self.thumb_url = thumb_url
+        self.photo_width = photo_width
+        self.photo_height = photo_height
+        self.title = title
+        self.description = description
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.show_caption_above_media = show_caption_above_media
+        self.reply_markup = reply_markup
+        self.input_message_content = input_message_content
+
+    async def write(self, client: "pyrogram.Client"):
+        photo = raw.types.InputWebDocument(
+            url=self.photo_url,
+            size=0,
+            mime_type="image/jpeg",
+            attributes=[
+                raw.types.DocumentAttributeImageSize(
+                    w=self.photo_width,
+                    h=self.photo_height
+                )
+            ]
+        )
+
+        if self.thumb_url is None:
+            thumb = photo
+        else:
+            thumb = raw.types.InputWebDocument(
+                url=self.thumb_url,
+                size=0,
+                mime_type="image/jpeg",
+                attributes=[]
+            )
+
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            description=self.description,
+            thumb=thumb,
+            content=photo,
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities,
+                    invert_media=self.show_caption_above_media
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_venue.py b/pyrogram/types/inline_mode/inline_query_result_venue.py
new file mode 100644
index 0000000000..b3b513a55d
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_venue.py
@@ -0,0 +1,131 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultVenue(InlineQueryResult):
+    """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.
+
+    Parameters:
+        title (``str``):
+            Title for the result.
+
+        address (``str``):
+            Address of the venue.
+
+        latitude (``float``):
+            Location latitude in degrees.
+
+        longitude (``float``):
+            Location longitude in degrees.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        foursquare_id (``str``, *optional*):
+            Foursquare identifier of the venue if known.
+
+        foursquare_type (``str``, *optional*):
+            Foursquare type of the venue, if known.
+
+        google_place_id (``str``, *optional*):
+            Google Places identifier of the venue.
+
+        google_place_type (``str``, *optional*):
+            Google Places type of the venue.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            Inline keyboard attached to the message.
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            Content of the message to be sent instead of the file.
+
+        thumb_url (``str``, *optional*):
+            Url of the thumbnail for the result.
+
+        thumb_width (``int``, *optional*):
+            Thumbnail width.
+
+        thumb_height (``int``, *optional*):
+            Thumbnail height.
+    """
+
+    def __init__(
+        self,
+        title: str,
+        address: str,
+        latitude: float,
+        longitude: float,
+        id: str = None,
+        foursquare_id: str = None,
+        foursquare_type: str = None,
+        google_place_id: str = None,
+        google_place_type: str = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None,
+        thumb_url: str = None,
+        thumb_width: int = 0,
+        thumb_height: int = 0
+    ):
+        super().__init__("venue", id, input_message_content, reply_markup)
+
+        self.title = title
+        self.address = address
+        self.latitude = latitude
+        self.longitude = longitude
+        self.foursquare_id = foursquare_id
+        self.foursquare_type = foursquare_type
+        self.google_place_id = google_place_id
+        self.google_place_type = google_place_type
+        self.thumb_url = thumb_url
+        self.thumb_width = thumb_width
+        self.thumb_height = thumb_height
+
+    async def write(self, client: "pyrogram.Client"):
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaVenue(
+                    geo_point=raw.types.InputGeoPoint(
+                        lat=self.latitude,
+                        long=self.longitude
+                    ),
+                    title=self.title,
+                    address=self.address,
+                    provider=(
+                        "foursquare" if self.foursquare_id or self.foursquare_type
+                        else "google" if self.google_place_id or self.google_place_type
+                        else ""
+                    ),
+                    venue_id=self.foursquare_id or self.google_place_id or "",
+                    venue_type=self.foursquare_type or self.google_place_type or "",
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_video.py b/pyrogram/types/inline_mode/inline_query_result_video.py
new file mode 100644
index 0000000000..801b5e8b68
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_video.py
@@ -0,0 +1,157 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultVideo(InlineQueryResult):
+    """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.
+
+    Parameters:
+        video_url (``str``):
+            A valid URL for the embedded video player or video file.
+
+        thumb_url (``str``):
+            URL of the thumbnail (jpeg only) for the video.
+
+        title (``str``):
+            Title for the result.
+
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+
+        mime_type (``str``):
+            Mime type of the content of video url, "text/html" or "video/mp4".
+            Defaults to "video/mp4".
+
+        video_width (``int``):
+            Video width.
+
+        video_height (``int``):
+            Video height.
+
+        video_duration (``int``):
+            Video duration in seconds.
+
+        description (``str``, *optional*):
+            Short description of the result.
+
+        caption (``str``, *optional*):
+            Caption of the video to be sent, 0-1024 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        show_caption_above_media (``bool``, *optional*):
+            Pass True, if the caption must be shown above the message media.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            Inline keyboard attached to the message
+
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`):
+            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).
+    """
+
+    def __init__(
+        self,
+        video_url: str,
+        thumb_url: str,
+        title: str,
+        id: str = None,
+        mime_type: str = "video/mp4",
+        video_width: int = 0,
+        video_height: int = 0,
+        video_duration: int = 0,
+        description: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("video", id, input_message_content, reply_markup)
+
+        self.video_url = video_url
+        self.thumb_url = thumb_url
+        self.title = title
+        self.video_width = video_width
+        self.video_height = video_height
+        self.video_duration = video_duration
+        self.description = description
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+        self.show_caption_above_media = show_caption_above_media
+        self.mime_type = mime_type
+
+    async def write(self, client: "pyrogram.Client"):
+        video = raw.types.InputWebDocument(
+            url=self.video_url,
+            size=0,
+            mime_type=self.mime_type,
+            attributes=[raw.types.DocumentAttributeVideo(
+                duration=self.video_duration,
+                w=self.video_width,
+                h=self.video_height
+            )]
+        )
+
+        thumb = raw.types.InputWebDocument(
+            url=self.thumb_url,
+            size=0,
+            mime_type="image/jpeg",
+            attributes=[]
+        )
+
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            description=self.description,
+            thumb=thumb,
+            content=video,
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities,
+                    invert_media=self.show_caption_above_media
+                )
+            )
+        )
diff --git a/pyrogram/types/inline_mode/inline_query_result_voice.py b/pyrogram/types/inline_mode/inline_query_result_voice.py
new file mode 100644
index 0000000000..31b422f8d3
--- /dev/null
+++ b/pyrogram/types/inline_mode/inline_query_result_voice.py
@@ -0,0 +1,114 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .inline_query_result import InlineQueryResult
+
+
+class InlineQueryResultVoice(InlineQueryResult):
+    """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
+    voice message.
+    
+    Parameters:
+        voice_url (``str``):
+            A valid URL for the voice recording.
+            
+        title (``str``):
+            Title for the result.
+            
+        id (``str``, *optional*):
+            Unique identifier for this result, 1-64 bytes.
+            Defaults to a randomly generated UUID4.
+            
+        voice_duration (``int``, *optional*):
+            Recording duration in seconds.
+
+        caption (``str``, *optional*):
+            Caption of the audio to be sent, 0-1024 characters.
+            
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+            
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+            Inline keyboard attached to the message.
+            
+        input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*):
+            Content of the message to be sent instead of the audio.
+    """
+
+    def __init__(
+        self,
+        voice_url: str,
+        title: str,
+        id: str = None,
+        voice_duration: int = 0,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        input_message_content: "types.InputMessageContent" = None
+    ):
+        super().__init__("voice", id, input_message_content, reply_markup)
+
+        self.voice_url = voice_url
+        self.title = title
+        self.voice_duration = voice_duration
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
+
+    async def write(self, client: "pyrogram.Client"):
+        audio = raw.types.InputWebDocument(
+            url=self.voice_url,
+            size=0,
+            mime_type="audio/mpeg",
+            attributes=[raw.types.DocumentAttributeAudio(
+                duration=self.voice_duration,
+                title=self.title,
+            )]
+        )
+
+        message, entities = (await utils.parse_text_entities(
+            client, self.caption, self.parse_mode, self.caption_entities
+        )).values()
+
+        return raw.types.InputBotInlineResult(
+            id=self.id,
+            type=self.type,
+            title=self.title,
+            content=audio,
+            send_message=(
+                await self.input_message_content.write(client, self.reply_markup)
+                if self.input_message_content
+                else raw.types.InputBotInlineMessageMediaAuto(
+                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    message=message,
+                    entities=entities
+                )
+            )
+        )
diff --git a/pyrogram/types/input_media/__init__.py b/pyrogram/types/input_media/__init__.py
new file mode 100644
index 0000000000..56b3f71482
--- /dev/null
+++ b/pyrogram/types/input_media/__init__.py
@@ -0,0 +1,37 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .input_media import InputMedia
+from .input_media_animation import InputMediaAnimation
+from .input_media_audio import InputMediaAudio
+from .input_media_document import InputMediaDocument
+from .input_media_photo import InputMediaPhoto
+from .input_media_video import InputMediaVideo
+from .input_phone_contact import InputPhoneContact
+from .link_preview_options import LinkPreviewOptions
+
+__all__ = [
+    "LinkPreviewOptions",
+    "InputMedia",
+    "InputMediaAnimation",
+    "InputMediaAudio",
+    "InputMediaDocument",
+    "InputMediaPhoto",
+    "InputMediaVideo",
+    "InputPhoneContact",
+]
diff --git a/pyrogram/types/input_media/input_media.py b/pyrogram/types/input_media/input_media.py
new file mode 100644
index 0000000000..bd60aeb3e1
--- /dev/null
+++ b/pyrogram/types/input_media/input_media.py
@@ -0,0 +1,49 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, BinaryIO
+
+from ..messages_and_media import MessageEntity
+from ..object import Object
+
+
+class InputMedia(Object):
+    """Content of a media message to be sent.
+
+    It should be one of:
+
+    - :obj:`~pyrogram.types.InputMediaAnimation`
+    - :obj:`~pyrogram.types.InputMediaDocument`
+    - :obj:`~pyrogram.types.InputMediaAudio`
+    - :obj:`~pyrogram.types.InputMediaPhoto`
+    - :obj:`~pyrogram.types.InputMediaVideo`
+    """
+
+    def __init__(
+        self,
+        media: Union[str, BinaryIO],
+        caption: str = "",
+        parse_mode: str = None,
+        caption_entities: List[MessageEntity] = None
+    ):
+        super().__init__()
+
+        self.media = media
+        self.caption = caption
+        self.parse_mode = parse_mode
+        self.caption_entities = caption_entities
diff --git a/pyrogram/types/input_media/input_media_animation.py b/pyrogram/types/input_media/input_media_animation.py
new file mode 100644
index 0000000000..0e1176d7be
--- /dev/null
+++ b/pyrogram/types/input_media/input_media_animation.py
@@ -0,0 +1,90 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union, BinaryIO
+
+from .input_media import InputMedia
+from ..messages_and_media import MessageEntity
+from ... import enums
+
+
+class InputMediaAnimation(InputMedia):
+    """An animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent inside an album.
+
+    Parameters:
+        media (``str`` | ``BinaryIO``):
+            Animation to send.
+            Pass a file_id as string to send a file that exists on the Telegram servers or
+            pass a file path as string to upload a new file that exists on your local machine or
+            pass a binary file-like object with its attribute “.name” set for in-memory uploads or
+            pass an HTTP URL as a string for Telegram to get an animation from the Internet.
+
+        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 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.
+            If not specified, the original caption is kept. Pass "" (empty string) to remove the caption.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        show_caption_above_media (``bool``, *optional*):
+            Pass True, if the caption must be shown above the message media.
+
+        width (``int``, *optional*):
+            Animation width.
+
+        height (``int``, *optional*):
+            Animation height.
+
+        duration (``int``, *optional*):
+            Animation duration.
+
+        has_spoiler (``bool``, *optional*):
+            Pass True if the photo needs to be covered with a spoiler animation.
+    """
+
+    def __init__(
+        self,
+        media: Union[str, BinaryIO],
+        thumb: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List[MessageEntity] = None,
+        show_caption_above_media: bool = None,
+        width: int = 0,
+        height: int = 0,
+        duration: int = 0,
+        has_spoiler: bool = None
+    ):
+        super().__init__(media, caption, parse_mode, caption_entities)
+
+        self.thumb = thumb
+        self.show_caption_above_media = show_caption_above_media
+        self.width = width
+        self.height = height
+        self.duration = duration
+        self.has_spoiler = has_spoiler
diff --git a/pyrogram/types/input_media/input_media_audio.py b/pyrogram/types/input_media/input_media_audio.py
new file mode 100644
index 0000000000..cc91e7bd5c
--- /dev/null
+++ b/pyrogram/types/input_media/input_media_audio.py
@@ -0,0 +1,82 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, BinaryIO, Union
+
+from .input_media import InputMedia
+from ..messages_and_media import MessageEntity
+from ... import enums
+
+
+class InputMediaAudio(InputMedia):
+    """An audio to be sent inside an album.
+
+    It is intended to be used with :meth:`~pyrogram.Client.send_media_group`.
+
+    Parameters:
+        media (``str`` | ``BinaryIO``):
+            Audio to send.
+            Pass a file_id as string to send an audio that exists on the Telegram servers or
+            pass a file path as string to upload a new audio that exists on your local machine or
+            pass a binary file-like object with its attribute “.name” set for in-memory uploads or
+            pass an HTTP URL as a string for Telegram to get an audio file from the Internet.
+
+        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 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.
+            If not specified, the original caption is kept. Pass "" (empty string) to remove the caption.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        duration (``int``, *optional*):
+            Duration of the audio in seconds
+
+        performer (``str``, *optional*):
+            Performer of the audio
+
+        title (``str``, *optional*):
+            Title of the audio
+    """
+
+    def __init__(
+        self,
+        media: Union[str, BinaryIO],
+        thumb: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List[MessageEntity] = None,
+        duration: int = 0,
+        performer: str = "",
+        title: str = ""
+    ):
+        super().__init__(media, caption, parse_mode, caption_entities)
+
+        self.thumb = thumb
+        self.duration = duration
+        self.performer = performer
+        self.title = title
diff --git a/pyrogram/types/input_media/input_media_document.py b/pyrogram/types/input_media/input_media_document.py
new file mode 100644
index 0000000000..3e4d510b95
--- /dev/null
+++ b/pyrogram/types/input_media/input_media_document.py
@@ -0,0 +1,65 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union, BinaryIO
+
+from .input_media import InputMedia
+from ..messages_and_media import MessageEntity
+from ... import enums
+
+
+class InputMediaDocument(InputMedia):
+    """A generic file to be sent inside an album.
+
+    Parameters:
+        media (``str`` | ``BinaryIO``):
+            File to send.
+            Pass a file_id as string to send a file that exists on the Telegram servers or
+            pass a file path as string to upload a new file that exists on your local machine or
+            pass a binary file-like object with its attribute “.name” set for in-memory uploads or
+            pass an HTTP URL as a string for Telegram to get a file from the Internet.
+
+        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 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.
+            If not specified, the original caption is kept. Pass "" (empty string) to remove the caption.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+    """
+
+    def __init__(
+        self,
+        media: Union[str, BinaryIO],
+        thumb: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List[MessageEntity] = None
+    ):
+        super().__init__(media, caption, parse_mode, caption_entities)
+
+        self.thumb = thumb
diff --git a/pyrogram/types/input_media/input_media_photo.py b/pyrogram/types/input_media/input_media_photo.py
new file mode 100644
index 0000000000..184124b152
--- /dev/null
+++ b/pyrogram/types/input_media/input_media_photo.py
@@ -0,0 +1,68 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union, BinaryIO
+
+from .input_media import InputMedia
+from ..messages_and_media import MessageEntity
+from ... import enums
+
+
+class InputMediaPhoto(InputMedia):
+    """A photo to be sent inside an album.
+    It is intended to be used with :obj:`~pyrogram.Client.send_media_group`.
+
+    Parameters:
+        media (``str`` | ``BinaryIO``):
+            Photo to send.
+            Pass a file_id as string to send a photo that exists on the Telegram servers or
+            pass a file path as string to upload a new photo that exists on your local machine or
+            pass a binary file-like object with its attribute “.name” set for in-memory uploads or
+            pass an HTTP URL as a string for Telegram to get a photo from the Internet.
+
+        caption (``str``, *optional*):
+            Caption of the photo to be sent, 0-1024 characters.
+            If not specified, the original caption is kept. Pass "" (empty string) to remove the caption.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        show_caption_above_media (``bool``, *optional*):
+            Pass True, if the caption must be shown above the message media.
+
+        has_spoiler (``bool``, *optional*):
+            Pass True if the photo needs to be covered with a spoiler animation.
+    """
+
+    def __init__(
+        self,
+        media: Union[str, BinaryIO],
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List[MessageEntity] = None,
+        show_caption_above_media: bool = None,
+        has_spoiler: bool = None
+    ):
+        super().__init__(media, caption, parse_mode, caption_entities)
+
+        self.show_caption_above_media = show_caption_above_media
+        self.has_spoiler = has_spoiler
diff --git a/pyrogram/types/input_media/input_media_video.py b/pyrogram/types/input_media/input_media_video.py
new file mode 100644
index 0000000000..56eaa84a08
--- /dev/null
+++ b/pyrogram/types/input_media/input_media_video.py
@@ -0,0 +1,102 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union, BinaryIO
+
+from .input_media import InputMedia
+from ..messages_and_media import MessageEntity
+from ... import enums
+
+
+class InputMediaVideo(InputMedia):
+    """A video to be sent inside an album.
+    It is intended to be used with :obj:`~pyrogram.Client.send_media_group`.
+
+    Parameters:
+        media (``str`` | ``BinaryIO``):
+            Video to send.
+            Pass a file_id as string to send a video that exists on the Telegram servers or
+            pass a file path as string to upload a new video that exists on your local machine or
+            pass a binary file-like object with its attribute “.name” set for in-memory uploads or
+            pass an HTTP URL as a string for Telegram to get a video from the Internet.
+
+        thumb (``str`` | ``BinaryIO``):
+            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 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.
+            If not specified, the original caption is kept. Pass "" (empty string) to remove the caption.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        show_caption_above_media (``bool``, *optional*):
+            Pass True, if the caption must be shown above the message media.
+
+        width (``int``, *optional*):
+            Video width.
+
+        height (``int``, *optional*):
+            Video height.
+
+        duration (``int``, *optional*):
+            Video duration.
+
+        supports_streaming (``bool``, *optional*):
+            Pass True, if the uploaded video is suitable for streaming.
+
+        has_spoiler (``bool``, *optional*):
+            Pass True if the photo needs to be covered with a spoiler animation.
+
+        disable_content_type_detection (``bool``, *optional*):
+            Pass True, if the uploaded video is a video message with no sound.
+            Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album.
+    """
+
+    def __init__(
+        self,
+        media: Union[str, BinaryIO],
+        thumb: Union[str, BinaryIO] = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List[MessageEntity] = None,
+        show_caption_above_media: bool = None,
+        width: int = 0,
+        height: int = 0,
+        duration: int = 0,
+        supports_streaming: bool = True,
+        has_spoiler: bool = None,
+        disable_content_type_detection: bool = None,
+    ):
+        super().__init__(media, caption, parse_mode, caption_entities)
+
+        self.thumb = thumb
+        self.show_caption_above_media = show_caption_above_media
+        self.width = width
+        self.height = height
+        self.duration = duration
+        self.supports_streaming = supports_streaming
+        self.has_spoiler = has_spoiler
+        self.disable_content_type_detection = disable_content_type_detection
diff --git a/pyrogram/types/input_media/input_phone_contact.py b/pyrogram/types/input_media/input_phone_contact.py
new file mode 100644
index 0000000000..0608cf2179
--- /dev/null
+++ b/pyrogram/types/input_media/input_phone_contact.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram.session.internals import MsgId
+from ..object import Object
+
+
+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()`
+
+    Parameters:
+        phone (``str``):
+            Contact's phone number
+
+        first_name (``str``):
+            Contact's first name
+
+        last_name (``str``, *optional*):
+            Contact's last name
+    """
+
+    def __init__(self, phone: str, first_name: str, last_name: str = ""):
+        super().__init__(None)
+
+    def __new__(cls,
+                phone: str,
+                first_name: str,
+                last_name: str = ""):
+        return raw.types.InputPhoneContact(
+            client_id=MsgId(),
+            phone="+" + phone.strip("+"),
+            first_name=first_name,
+            last_name=last_name
+        )
diff --git a/pyrogram/types/input_media/link_preview_options.py b/pyrogram/types/input_media/link_preview_options.py
new file mode 100644
index 0000000000..d2679b950a
--- /dev/null
+++ b/pyrogram/types/input_media/link_preview_options.py
@@ -0,0 +1,99 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, utils
+from ..object import Object
+from typing import Optional
+
+
+class LinkPreviewOptions(Object):
+    """Describes the options used for link preview generation.
+
+    Parameters:
+        is_disabled (``bool``, *optional*):
+            True, if the link preview is disabled
+
+        url (``str``, *optional*):
+            URL to use for the link preview.
+            If empty, then the first URL found in the message text will be used
+
+        prefer_small_media (``bool``, *optional*):
+            True, if the media in the link preview is suppposed to be shrunk;
+            ignored if the URL isn't explicitly specified or media size change isn't supported for the preview
+        
+        prefer_large_media (``bool``, *optional*):
+            True, if the media in the link preview is suppposed to be enlarged;
+            ignored if the URL isn't explicitly specified or media size change isn't supported for the preview
+        
+        show_above_text (``bool``, *optional*):
+            True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text
+        
+        manual (``bool``, *optional*):
+
+        safe (``bool``, *optional*):
+    """
+
+    def __init__(
+        self,
+        *,
+        is_disabled: bool = None,
+        url: str = None,
+        prefer_small_media: bool = None,
+        prefer_large_media: bool = None,
+        show_above_text: bool = None,
+        manual: bool = None,
+        safe: bool = None
+    ):
+        super().__init__()
+
+        self.is_disabled = is_disabled
+        self.url = url
+        self.prefer_small_media = prefer_small_media
+        self.prefer_large_media = prefer_large_media
+        self.show_above_text = show_above_text
+        self.manual = manual
+        self.safe = safe
+
+    @staticmethod
+    def _parse(
+        client,
+        media_webpage: "raw.types.MessageMediaWebPage",
+        media_first_url: str = None,
+        invert_media: bool = False
+    ) -> Optional["LinkPreviewOptions"]:
+        if (
+            media_webpage and
+            isinstance(media_webpage, raw.types.MessageMediaWebPage)
+        ):
+            if media_webpage.webpage:
+                media_first_url = media_webpage.webpage.url
+            return LinkPreviewOptions(
+                is_disabled=False,
+                url=media_first_url,
+                prefer_small_media=getattr(media_webpage, "force_small_media"),
+                prefer_large_media=getattr(media_webpage, "force_large_media"),
+                show_above_text=invert_media,
+                manual=getattr(media_webpage, "manual"),
+                safe=getattr(media_webpage, "safe")
+            )
+        if media_first_url:
+            return LinkPreviewOptions(
+                is_disabled=True,
+                url=media_first_url,
+                show_above_text=invert_media,
+            )
diff --git a/pyrogram/types/input_message_content/__init__.py b/pyrogram/types/input_message_content/__init__.py
new file mode 100644
index 0000000000..1eb7f0775d
--- /dev/null
+++ b/pyrogram/types/input_message_content/__init__.py
@@ -0,0 +1,41 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .input_message_content import InputMessageContent
+from .input_text_message_content import InputTextMessageContent
+from .input_location_message_content import InputLocationMessageContent
+from .input_venue_message_content import InputVenueMessageContent
+from .input_contact_message_content import InputContactMessageContent
+from .input_invoice_message_content import InputInvoiceMessageContent
+from .reply_parameters import ReplyParameters
+from .external_reply_info import ExternalReplyInfo
+from .text_quote import TextQuote
+from .input_poll_option import InputPollOption
+
+__all__ = [
+    "ExternalReplyInfo",
+    "InputMessageContent",
+    "InputPollOption",
+    "InputTextMessageContent",
+    "InputLocationMessageContent",
+    "InputVenueMessageContent",
+    "InputContactMessageContent",
+    "InputInvoiceMessageContent",
+    "ReplyParameters",
+    "TextQuote",
+]
diff --git a/pyrogram/types/input_message_content/external_reply_info.py b/pyrogram/types/input_message_content/external_reply_info.py
new file mode 100644
index 0000000000..8a69f3270b
--- /dev/null
+++ b/pyrogram/types/input_message_content/external_reply_info.py
@@ -0,0 +1,340 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType
+from ..object import Object
+
+
+class ExternalReplyInfo(Object):
+    """This object contains information about a message that is being replied to, which may come from another chat or forum topic.
+
+    Parameters:
+        origin (:obj:`~pyrogram.types.User`, *optional*):
+            Origin of the message replied to by the given message
+
+        chat (:obj:`~pyrogram.types.Chat`, *optional*):
+            Chat the original message belongs to. Available only if the chat is a supergroup or a channel.
+
+        message_id  (``int``, *optional*):
+            Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel.
+
+        link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*):
+            Options used for link preview generation for the original message, if it is a text message
+
+        animation (:obj:`~pyrogram.types.Animation`, *optional*):
+            Message is an animation, information about the animation.
+
+        audio (:obj:`~pyrogram.types.Audio`, *optional*):
+            Message is an audio file, information about the file.
+
+        document (:obj:`~pyrogram.types.Document`, *optional*):
+            Message is a general file, information about the file.
+
+        paid_media (:obj:`~pyrogram.types.PaidMediaInfo`, *optional*):
+            Message contains paid media; information about the paid media.
+
+        photo (:obj:`~pyrogram.types.Photo`, *optional*):
+            Message is a photo, information about the photo.
+
+        sticker (:obj:`~pyrogram.types.Sticker`, *optional*):
+            Message is a sticker, information about the sticker.
+
+        story (:obj:`~pyrogram.types.Story`, *optional*):
+            Message is a forwarded story.
+
+        video (:obj:`~pyrogram.types.Video`, *optional*):
+            Message is a video, information about the video.
+
+        video_note (:obj:`~pyrogram.types.VideoNote`, *optional*):
+            Message is a video note, information about the video message.
+
+        voice (:obj:`~pyrogram.types.Voice`, *optional*):
+            Message is a voice message, information about the file.
+
+        has_media_spoiler (``bool``, *optional*):
+            True, if the message media is covered by a spoiler animation.
+
+        contact (:obj:`~pyrogram.types.Contact`, *optional*):
+            Message is a shared contact, information about the contact.
+
+        dice (:obj:`~pyrogram.types.Dice`, *optional*):
+            A dice containing a value that is randomly generated by Telegram.
+
+        game (:obj:`~pyrogram.types.Game`, *optional*):
+            Message is a game, information about the game.
+        
+        giveaway (:obj:`~pyrogram.types.Giveaway`, *optional*):
+            Message is a scheduled giveaway, information about the giveaway
+
+        giveaway_winners (:obj:`~pyrogram.types.GiveawayWinners`, *optional*):
+            A giveaway with public winners was completed
+
+        invoice (:obj:`~pyrogram.types.Invoice`, *optional*):
+            Message is an invoice for a `payment `_, information about the invoice. `More about payments » `_
+
+        location (:obj:`~pyrogram.types.Location`, *optional*):
+            Message is a shared location, information about the location.
+
+        poll (:obj:`~pyrogram.types.Poll`, *optional*):
+            Message is a native poll, information about the poll.
+
+        venue (:obj:`~pyrogram.types.Venue`, *optional*):
+            Message is a venue, information about the venue.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        origin: "types.MessageOrigin" = None,
+        chat: "types.Chat" = None,
+        message_id: int,
+        link_preview_options: "types.LinkPreviewOptions" = None,
+        animation: "types.Animation" = None,
+        audio: "types.Audio" = None,
+        document: "types.Document" = None,
+        paid_media: "types.PaidMediaInfo" = None,
+        photo: "types.Photo" = None,
+        sticker: "types.Sticker" = None,
+        story: "types.Story" = None,
+        video: "types.Video" = None,
+        video_note: "types.VideoNote" = None,
+        voice: "types.Voice" = None,
+        has_media_spoiler: bool = None,
+        contact: "types.Contact" = None,
+        dice: "types.Dice" = None,
+        game: "types.Game" = None,
+        giveaway: "types.Giveaway" = None,
+        giveaway_winners: "types.GiveawayWinners" = None,
+        invoice: "types.Invoice" = None,
+        location: "types.Location" = None,
+        poll: "types.Poll" = None,
+        venue: "types.Venue" = None,
+    ):
+        super().__init__(client)
+
+        self.origin = origin
+        self.chat = chat
+        self.message_id = message_id
+        self.link_preview_options = link_preview_options
+        self.animation = animation
+        self.audio = audio
+        self.document = document
+        self.paid_media = paid_media
+        self.photo = photo
+        self.sticker = sticker
+        self.story = story
+        self.video = video
+        self.video_note = video_note
+        self.voice = voice
+        self.has_media_spoiler = has_media_spoiler
+        self.contact = contact
+        self.dice = dice
+        self.game = game
+        self.giveaway = giveaway
+        self.giveaway_winners = giveaway_winners
+        self.invoice = invoice
+        self.location = location
+        self.poll = poll
+        self.venue = venue
+
+    @staticmethod
+    async def _parse(
+        client,
+        chats: dict,
+        users: dict,
+        reply_to: "raw.types.MessageReplyHeader"
+    ) -> "ExternalReplyInfo":
+        if not getattr(reply_to, "reply_from", None):
+            # TODO: temp. workaround
+            return None
+
+        if isinstance(reply_to, raw.types.MessageReplyHeader):
+            reply_from = reply_to.reply_from  # raw.types.MessageFwdHeader
+            origin = types.MessageOrigin._parse(
+                client,
+                reply_from,
+                users,
+                chats,
+            )
+
+            chat = None
+            if isinstance(reply_to.reply_to_peer_id, raw.types.PeerChannel):
+                raw_peer_id = utils.get_raw_peer_id(reply_to.reply_to_peer_id)
+                chat = types.Chat._parse_chat(
+                    client,
+                    chats[raw_peer_id],
+                )
+
+            animation = None
+            audio = None
+            document = None
+            paid_media = None
+            photo = None
+            sticker = None
+            story = None
+            video = None
+            video_note = None
+            voice = None
+
+            has_media_spoiler = None
+
+            contact = None
+            dice = None
+            game = None
+            giveaway = None
+            giveaway_winners = None
+            invoice = None
+            location = None
+            poll = None
+            venue = None
+            
+            web_page = None
+            link_preview_options = types.LinkPreviewOptions._parse(
+                client,
+                reply_to.reply_media,
+                None,
+                False
+            )
+
+            media = reply_to.reply_media
+            media_type = None
+            
+            if media:
+                if isinstance(media, raw.types.MessageMediaPhoto):
+                    photo = types.Photo._parse(
+                        client,
+                        media.photo,
+                        media.ttl_seconds,
+                        media.spoiler
+                    )
+                    media_type = enums.MessageMediaType.PHOTO
+                    has_media_spoiler = media.spoiler
+                elif isinstance(media, raw.types.MessageMediaGeo):
+                    location = types.Location._parse(client, media.geo)
+                    media_type = enums.MessageMediaType.LOCATION
+                elif isinstance(media, raw.types.MessageMediaContact):
+                    contact = types.Contact._parse(client, media)
+                    media_type = enums.MessageMediaType.CONTACT
+                elif isinstance(media, raw.types.MessageMediaVenue):
+                    venue = types.Venue._parse(client, media)
+                    media_type = enums.MessageMediaType.VENUE
+                elif isinstance(media, raw.types.MessageMediaGame):
+                    game = types.Game._parse(client, media.game)
+                    media_type = enums.MessageMediaType.GAME
+                elif isinstance(media, raw.types.MessageMediaDocument):
+                    doc = media.document
+
+                    if isinstance(doc, raw.types.Document):
+                        attributes = {type(i): i for i in doc.attributes}
+
+                        file_name = getattr(
+                            attributes.get(
+                                raw.types.DocumentAttributeFilename, None
+                            ), "file_name", None
+                        )
+
+                        if raw.types.DocumentAttributeAnimated in attributes:
+                            video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
+                            animation = types.Animation._parse(client, doc, video_attributes, file_name)
+                            media_type = enums.MessageMediaType.ANIMATION
+                            has_media_spoiler = media.spoiler
+                        elif raw.types.DocumentAttributeSticker in attributes:
+                            sticker = await types.Sticker._parse(client, doc, attributes)
+                            media_type = enums.MessageMediaType.STICKER
+                        elif raw.types.DocumentAttributeVideo in attributes:
+                            video_attributes = attributes[raw.types.DocumentAttributeVideo]
+
+                            if video_attributes.round_message:
+                                video_note = types.VideoNote._parse(client, doc, video_attributes)
+                                media_type = enums.MessageMediaType.VIDEO_NOTE
+                            else:
+                                video = types.Video._parse(client, doc, video_attributes, file_name, media.ttl_seconds)
+                                media_type = enums.MessageMediaType.VIDEO
+                                has_media_spoiler = media.spoiler
+                        elif raw.types.DocumentAttributeAudio in attributes:
+                            audio_attributes = attributes[raw.types.DocumentAttributeAudio]
+
+                            if audio_attributes.voice:
+                                voice = types.Voice._parse(client, doc, audio_attributes)
+                                media_type = enums.MessageMediaType.VOICE
+                            else:
+                                audio = types.Audio._parse(client, doc, audio_attributes, file_name)
+                                media_type = enums.MessageMediaType.AUDIO
+                        else:
+                            document = types.Document._parse(client, doc, file_name)
+                            media_type = enums.MessageMediaType.DOCUMENT
+                elif isinstance(media, raw.types.MessageMediaWebPage):
+                    if isinstance(media.webpage, raw.types.WebPage):
+                        web_page = types.WebPage._parse(client, media.webpage)
+                        media_type = enums.MessageMediaType.WEB_PAGE
+                        web_page_url = media.webpage.url
+                    else:
+                        media = None
+                elif isinstance(media, raw.types.MessageMediaPoll):
+                    poll = types.Poll._parse(client, media)
+                    media_type = enums.MessageMediaType.POLL
+                elif isinstance(media, raw.types.MessageMediaDice):
+                    dice = types.Dice._parse(client, media)
+                    media_type = enums.MessageMediaType.DICE
+                elif isinstance(media, raw.types.MessageMediaStory):
+                    story = await types.Story._parse(client, users, chats, media, None, None, None, None)
+                    media_type = enums.MessageMediaType.STORY
+                elif isinstance(media, raw.types.MessageMediaGiveaway):
+                    giveaway = types.Giveaway._parse(client, chats, media)
+                    media_type = enums.MessageMediaType.GIVEAWAY
+                elif isinstance(media, raw.types.MessageMediaGiveawayResults):
+                    giveaway_winners = types.GiveawayWinners._parse(client, chats, users, media)
+                    media_type = enums.MessageMediaType.GIVEAWAY_WINNERS
+                elif isinstance(media, raw.types.MessageMediaInvoice):
+                    invoice = types.Invoice._parse(client, media)
+                    media_type = enums.MessageMediaType.INVOICE
+                elif isinstance(media, raw.types.MessageMediaPaidMedia):
+                    paid_media = types.PaidMediaInfo._parse(client, media)
+                    media_type = enums.MessageMediaType.PAID_MEDIA
+
+            return ExternalReplyInfo(
+                origin=origin,
+                chat=chat,
+                message_id=reply_to.reply_to_msg_id,
+                link_preview_options=link_preview_options,
+                animation=animation,
+                audio=audio,
+                document=document,
+                paid_media=paid_media,
+                photo=photo,
+                sticker=sticker,
+                story=story,
+                video=video,
+                video_note=video_note,
+                voice=voice,
+                has_media_spoiler=has_media_spoiler,
+                contact=contact,
+                dice=dice,
+                game=game,
+                giveaway=giveaway,
+                giveaway_winners=giveaway_winners,
+                invoice=invoice,
+                location=location,
+                poll=poll,
+                venue=venue
+            )
diff --git a/pyrogram/types/input_message_content/input_contact_message_content.py b/pyrogram/types/input_message_content/input_contact_message_content.py
new file mode 100644
index 0000000000..0566f25d95
--- /dev/null
+++ b/pyrogram/types/input_message_content/input_contact_message_content.py
@@ -0,0 +1,68 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import raw
+from .input_message_content import InputMessageContent
+
+log = logging.getLogger(__name__)
+
+
+class InputContactMessageContent(InputMessageContent):
+    """Content of a contact message to be sent as the result of an inline query.
+
+    Parameters:
+        phone_number (``str``):
+            Contact's phone number.
+
+        first_name (``str``):
+            Contact's first name.
+
+        last_name (``str``, *optional*):
+            Contact's last name.
+
+        vcard (``str``, *optional*):
+            Additional data about the contact in the form of a `vCard `_, 0-2048 bytes.
+
+    """
+
+    def __init__(
+        self,
+        phone_number: str,
+        first_name: str,
+        last_name: Optional[str] = None,
+        vcard: Optional[str] = None
+    ):
+        super().__init__()
+
+        self.phone_number = phone_number
+        self.first_name = first_name
+        self.last_name = last_name
+        self.vcard = vcard
+
+    async def write(self, client: "pyrogram.Client", reply_markup):
+        return raw.types.InputBotInlineMessageMediaContact(
+            phone_number=self.phone_number,
+            first_name=self.first_name,
+            last_name=self.last_name,
+            vcard=self.vcard,
+            reply_markup=await reply_markup.write(client) if reply_markup else None
+        )
diff --git a/pyrogram/types/input_message_content/input_invoice_message_content.py b/pyrogram/types/input_message_content/input_invoice_message_content.py
new file mode 100644
index 0000000000..78bf61244c
--- /dev/null
+++ b/pyrogram/types/input_message_content/input_invoice_message_content.py
@@ -0,0 +1,174 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union
+
+import pyrogram
+from pyrogram import raw, types
+from .input_message_content import InputMessageContent
+
+log = logging.getLogger(__name__)
+
+
+class InputInvoiceMessageContent(InputMessageContent):
+    """Content of an invoice message to be sent as the result of an inline query.
+
+    Parameters:
+        title (``str``):
+            Product name, 1-32 characters.
+
+        description (``str``):
+            Product description, 1-255 characters
+
+        payload (``str`` | ``bytes``):
+            Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
+
+        currency (``str``):
+            Three-letter ISO 4217 currency code, see `more on currencies `_. Pass ``XTR`` for payments in `Telegram Stars `_.
+
+        prices (List of :obj:`~pyrogram.types.LabeledPrice`):
+            Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars `_.
+
+        provider_token (``str``, *optional*):
+            Payment provider token, obtained via `@BotFather `_. Pass an empty string for payments in `Telegram Stars `_.
+
+        max_tip_amount (``int``, *optional*):
+            The maximum accepted amount for tips in the smallest units of the currency (integer, **not** float/double). For example, for a maximum tip of ``US$ 1.45`` pass ``max_tip_amount = 145``. See the exp parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars `_.
+
+        suggested_tip_amounts (List of ``int``, *optional*):
+            An array of suggested amounts of tips in the smallest units of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed ``max_tip_amount``.
+
+        provider_data (``str``, *optional*):
+            JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
+
+        photo_url (``str``, *optional*):
+            URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
+
+        photo_size (``int``, *optional*):
+            Photo size in bytes
+
+        photo_width (``int``, *optional*):
+            Photo width
+
+        photo_height (``int``, *optional*):
+            Photo height
+
+        need_name (``bool``, *optional*):
+            Pass True if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars `_.
+
+        need_phone_number (``bool``, *optional*):
+            Pass True if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars `_.
+
+        need_email (``bool``, *optional*):
+            Pass True if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars `_.
+
+        need_shipping_address (``bool``, *optional*):
+            Pass True if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars `_.
+
+        send_phone_number_to_provider (``bool``, *optional*):
+            Pass True if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars `_.
+
+        send_email_to_provider (``bool``, *optional*):
+            Pass True if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars `_.
+
+        is_flexible (``bool``, *optional*):
+            Pass True if the final price depends on the shipping method. Ignored for payments in `Telegram Stars `_.
+
+    """
+
+    def __init__(
+        self,
+        title: str,
+        description: str,
+        payload: Union[str, bytes],
+        currency: str,
+        prices: List["types.LabeledPrice"],
+        provider_token: Optional[str] = None,
+        max_tip_amount: Optional[int] = None,
+        suggested_tip_amounts: List[int] = None,
+        provider_data: Optional[str] = None,
+        photo_url: Optional[str] = None,
+        photo_size: Optional[int] = None,
+        photo_width: Optional[int] = None,
+        photo_height: Optional[int] = None,
+        need_name: Optional[bool] = None,
+        need_phone_number: Optional[bool] = None,
+        need_email: Optional[bool] = None,
+        need_shipping_address: Optional[bool] = None,
+        send_phone_number_to_provider: Optional[bool] = None,
+        send_email_to_provider: Optional[bool] = None,
+        is_flexible: Optional[bool] = None
+    ):
+        super().__init__()
+
+        self.title = title
+        self.description = description
+        self.payload = payload
+        self.currency = currency
+        self.prices = prices
+        self.provider_token = provider_token
+        self.max_tip_amount = max_tip_amount
+        self.suggested_tip_amounts = suggested_tip_amounts
+        self.provider_data = provider_data
+        self.photo_url = photo_url
+        self.photo_size = photo_size
+        self.photo_width = photo_width
+        self.photo_height = photo_height
+        self.need_name = need_name
+        self.need_phone_number = need_phone_number
+        self.need_email = need_email
+        self.need_shipping_address = need_shipping_address
+        self.send_phone_number_to_provider = send_phone_number_to_provider
+        self.send_email_to_provider = send_email_to_provider
+        self.is_flexible = is_flexible
+
+    async def write(self, client: "pyrogram.Client", reply_markup):
+        return raw.types.InputBotInlineMessageMediaInvoice(
+            title=self.title,
+            description=self.description,
+            photo=raw.types.InputWebDocument(
+                url=self.photo_url,
+                mime_type="image/jpg",
+                size=self.photo_size,
+                attributes=[
+                    raw.types.DocumentAttributeImageSize(
+                        w=self.photo_width,
+                        h=self.photo_height
+                    )
+                ]
+            ) if self.photo_url else None,
+            invoice=raw.types.Invoice(
+                currency=self.currency,
+                prices=[i.write() for i in self.prices],
+                test=client.test_mode,
+                name_requested=self.need_name,
+                phone_requested=self.need_phone_number,
+                email_requested=self.need_email,
+                shipping_address_requested=self.need_shipping_address,
+                flexible=self.is_flexible,
+                phone_to_provider=self.send_phone_number_to_provider,
+                email_to_provider=self.send_email_to_provider
+            ),
+            payload=self.payload.encode() if isinstance(self.payload, str) else self.payload,
+            provider=self.provider_token,
+            provider_data=raw.types.DataJSON(
+                data=self.provider_data if self.provider_data else "{}"
+            ),
+            reply_markup=await reply_markup.write(client) if reply_markup else None
+        )
diff --git a/pyrogram/types/input_message_content/input_location_message_content.py b/pyrogram/types/input_message_content/input_location_message_content.py
new file mode 100644
index 0000000000..b13381e317
--- /dev/null
+++ b/pyrogram/types/input_message_content/input_location_message_content.py
@@ -0,0 +1,82 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import raw
+from .input_message_content import InputMessageContent
+
+log = logging.getLogger(__name__)
+
+
+class InputLocationMessageContent(InputMessageContent):
+    """Content of a location message to be sent as the result of an inline query.
+
+    Parameters:
+        latitude (``float``):
+            Latitude of the location.
+
+        longitude (``float``):
+            Longitude of the location.
+
+        horizontal_accuracy (``float``, *optional*):
+            The radius of uncertainty for the location, measured in meters; 0-1500.
+
+        live_period (``int``, *optional*):
+            Period in seconds during which the location can be updated, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
+
+        heading (``int``, *optional*):
+            For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
+
+        proximity_alert_radius (``int``, *optional*):
+            For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
+
+    """
+
+    def __init__(
+        self,
+        latitude: float,
+        longitude: float,
+        horizontal_accuracy: Optional[float] = None,
+        live_period: Optional[int] = None,
+        heading: Optional[int] = None,
+        proximity_alert_radius: Optional[int] = None
+    ):
+        super().__init__()
+
+        self.latitude = latitude
+        self.longitude = longitude
+        self.horizontal_accuracy = horizontal_accuracy
+        self.live_period = live_period
+        self.heading = heading
+        self.proximity_alert_radius = proximity_alert_radius
+
+    async def write(self, client: "pyrogram.Client", reply_markup):
+        return raw.types.InputBotInlineMessageMediaGeo(
+            geo_point=raw.types.InputGeoPoint(
+                lat=self.latitude,
+                long=self.longitude,
+                accuracy_radius=self.horizontal_accuracy
+            ),
+            heading=self.heading,
+            period=self.live_period,
+            proximity_notification_radius=self.proximity_alert_radius,
+            reply_markup=await reply_markup.write(client) if reply_markup else None
+        )
diff --git a/pyrogram/types/input_message_content/input_message_content.py b/pyrogram/types/input_message_content/input_message_content.py
new file mode 100644
index 0000000000..2061067a78
--- /dev/null
+++ b/pyrogram/types/input_message_content/input_message_content.py
@@ -0,0 +1,41 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 ..object import Object
+
+
+class InputMessageContent(Object):
+    """Content of a message to be sent as a result of an inline query.
+
+    Telegram clients currently support the following 5 types:
+
+    - :obj:`~pyrogram.types.InputTextMessageContent`
+    - :obj:`~pyrogram.types.InputLocationMessageContent`
+    - :obj:`~pyrogram.types.InputVenueMessageContent`
+    - :obj:`~pyrogram.types.InputContactMessageContent`
+    - :obj:`~pyrogram.types.InputInvoiceMessageContent`
+
+    """
+
+    def __init__(self):
+        super().__init__()
+
+    async def write(self, client: "pyrogram.Client", reply_markup):
+        raise NotImplementedError
diff --git a/pyrogram/types/input_message_content/input_poll_option.py b/pyrogram/types/input_message_content/input_poll_option.py
new file mode 100644
index 0000000000..53f6138d40
--- /dev/null
+++ b/pyrogram/types/input_message_content/input_poll_option.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, utils, types, enums
+
+from ..object import Object
+
+
+class InputPollOption(Object):
+    """This object contains information about one answer option in a poll to send.
+
+    Parameters:
+        text (``str``):
+            Option text, 1-100 characters
+
+        text_parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+            Currently, only custom emoji entities are allowed.
+
+        text_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
+            List of special entities that appear in the poll option text, which can be specified instead of *text_parse_mode*.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        text: str,
+        text_parse_mode: "enums.ParseMode" = None,
+        text_entities: List["types.MessageEntity"] = None,
+    ):
+        super().__init__()
+
+        self.text = text
+        self.text_parse_mode = text_parse_mode
+        self.text_entities = text_entities
diff --git a/pyrogram/types/input_message_content/input_text_message_content.py b/pyrogram/types/input_message_content/input_text_message_content.py
new file mode 100644
index 0000000000..88e140eb1f
--- /dev/null
+++ b/pyrogram/types/input_message_content/input_text_message_content.py
@@ -0,0 +1,93 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from .input_message_content import InputMessageContent
+
+log = logging.getLogger(__name__)
+
+
+class InputTextMessageContent(InputMessageContent):
+    """Content of a text message to be sent as the result of an inline query.
+
+    Parameters:
+        message_text (``str``):
+            Text of the message to be sent, 1-4096 characters.
+
+        parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            List of special entities that appear in message text, which can be specified instead of *parse_mode*.
+
+        link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*):
+            Link preview generation options for the message
+    """
+
+    def __init__(
+        self,
+        message_text: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        entities: List["types.MessageEntity"] = None,
+        link_preview_options: "types.LinkPreviewOptions" = None,
+        disable_web_page_preview: bool = None
+    ):
+        if disable_web_page_preview and link_preview_options:
+            raise ValueError(
+                "Parameters `disable_web_page_preview` and `link_preview_options` are mutually "
+                "exclusive."
+            )
+
+        if disable_web_page_preview is not None:
+            log.warning(
+                "This property is deprecated. "
+                "Please use link_preview_options instead"
+            )
+            link_preview_options = types.LinkPreviewOptions(is_disabled=disable_web_page_preview)
+
+        super().__init__()
+
+        self.message_text = message_text
+        self.parse_mode = parse_mode
+        self.entities = entities
+        self.link_preview_options = link_preview_options
+
+    async def write(self, client: "pyrogram.Client", reply_markup):
+        message, entities = (await utils.parse_text_entities(
+            client,
+            self.message_text,
+            # TODO
+            self.parse_mode,
+            self.entities
+        )).values()
+
+        if self.link_preview_options is None:
+            self.link_preview_options = client.link_preview_options
+
+        return raw.types.InputBotInlineMessageText(
+            no_webpage=self.link_preview_options.is_disabled if self.link_preview_options else None,
+            invert_media=self.link_preview_options.show_above_text if self.link_preview_options else None,
+            reply_markup=await reply_markup.write(client) if reply_markup else None,
+            message=message,
+            entities=entities
+        )
diff --git a/pyrogram/types/input_message_content/input_venue_message_content.py b/pyrogram/types/input_message_content/input_venue_message_content.py
new file mode 100644
index 0000000000..baf922ac45
--- /dev/null
+++ b/pyrogram/types/input_message_content/input_venue_message_content.py
@@ -0,0 +1,87 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import raw
+from .input_message_content import InputMessageContent
+
+log = logging.getLogger(__name__)
+
+
+class InputVenueMessageContent(InputMessageContent):
+    """Content of a venue message to be sent as the result of an inline query.
+
+    Parameters:
+        latitude (``float``):
+            Latitude of the location.
+
+        longitude (``float``):
+            Longitude of the location.
+
+        title (``str``):
+            Name of the venue.
+
+        address (``str``):
+            Address of the venue.
+
+        foursquare_id (``str``, *optional*):
+            Foursquare identifier of the venue, if known.
+
+        foursquare_type (``str``, *optional*):
+            Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
+
+    """
+
+    def __init__(
+        self,
+        latitude: float,
+        longitude: float,
+        title: str,
+        address: str,
+        foursquare_id: Optional[str] = None,
+        foursquare_type: Optional[str] = None,
+        google_place_id: Optional[str] = None,
+        google_place_type: Optional[str] = None
+    ):
+        super().__init__()
+
+        self.latitude = latitude
+        self.longitude = longitude
+        self.title = title
+        self.address = address
+        self.foursquare_id = foursquare_id
+        self.foursquare_type = foursquare_type
+        self.google_place_id = google_place_id
+        self.google_place_type = google_place_type
+
+    async def write(self, client: "pyrogram.Client", reply_markup):
+        return raw.types.InputBotInlineMessageMediaVenue(
+            geo_point=raw.types.InputGeoPoint(
+                lat=self.latitude,
+                long=self.longitude
+            ),
+            title=self.title,
+            address=self.address,
+            provider="", # TODO
+            venue_id=self.foursquare_id,
+            venue_type=self.foursquare_type,
+            reply_markup=await reply_markup.write(client) if reply_markup else None
+        )
diff --git a/pyrogram/types/input_message_content/reply_parameters.py b/pyrogram/types/input_message_content/reply_parameters.py
new file mode 100644
index 0000000000..2a224357e3
--- /dev/null
+++ b/pyrogram/types/input_message_content/reply_parameters.py
@@ -0,0 +1,80 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from ..object import Object
+
+
+class ReplyParameters(Object):
+    """Describes reply parameters for the message that is being sent.
+
+    You must use exactly one of ``message_id`` OR ``story_id``.
+
+    Parameters:
+        message_id  (``int``, *optional*):
+            Identifier of the message that will be replied to in the current chat,
+            or in the chat chat_id if it is specified
+
+        story_id  (``int``, *optional*):
+            Unique identifier for the story in the chat
+
+        chat_id (``int`` | ``str``, *optional*):
+            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).
+
+        quote (``str``, *optional*):
+            Quoted part of the message to be replied to; 0-1024 characters after entities parsing.
+            The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities.
+            The message will fail to send if the quote isn't found in the original message.
+
+        quote_parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+            By default, texts are parsed using both Markdown and HTML styles.
+            You can combine both syntaxes together.
+
+        quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
+            List of special entities that appear in message text, which can be specified instead of *quote_parse_mode*.
+
+        quote_position (``int``, *optional*):
+            Position of the quote in the original message in UTF-16 code units
+    """
+
+    def __init__(
+        self,
+        *,
+        message_id: int = None,
+        story_id: int = None,
+        chat_id: Union[int, str] = None,
+        # TODO
+        quote: str = None,
+        quote_parse_mode: Optional["enums.ParseMode"] = None,
+        quote_entities: List["types.MessageEntity"] = None,
+        quote_position: int = None,
+    ):
+        super().__init__()
+
+        self.message_id = message_id
+        self.story_id = story_id
+        self.chat_id = chat_id
+        self.quote = quote
+        self.quote_parse_mode = quote_parse_mode
+        self.quote_entities = quote_entities
+        self.quote_position = quote_position
diff --git a/pyrogram/types/input_message_content/text_quote.py b/pyrogram/types/input_message_content/text_quote.py
new file mode 100644
index 0000000000..fa344df0c3
--- /dev/null
+++ b/pyrogram/types/input_message_content/text_quote.py
@@ -0,0 +1,86 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from ..object import Object
+from ..messages_and_media.message import Str
+
+
+class TextQuote(Object):
+    """This object contains information about the quoted part of a message that is replied to by the given message.
+
+    Parameters:
+        text (``str``):
+            Text of the quoted part of a message that is replied to by the given message
+
+        entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
+            Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes.
+
+        position (``int``):
+            Approximate quote position in the original message in UTF-16 code units as specified by the sender
+
+        is_manual  (``bool``, *optional*):
+            True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        text: str = None,
+        entities: List["types.MessageEntity"] = None,
+        position: int = None,
+        is_manual: bool = None
+    ):
+        super().__init__(client)
+
+        self.text = text
+        self.entities = entities
+        self.position = position
+        self.is_manual = is_manual
+
+    @staticmethod
+    def _parse(
+        client,
+        chats: dict,
+        users: dict,
+        reply_to: "raw.types.MessageReplyHeader"
+    ) -> "TextQuote":
+        if isinstance(reply_to, raw.types.MessageReplyHeader):
+            quote_text = reply_to.quote_text
+            quote_entities = reply_to.quote_entities
+            position = reply_to.quote_offset or 0
+
+            entities = [
+                types.MessageEntity._parse(client, entity, users)
+                for entity in quote_entities
+            ]
+            entities = types.List(
+                filter(lambda x: x is not None, entities)
+            )
+            
+            return TextQuote(
+                text=Str(quote_text).init(entities) or None,
+                entities=entities,
+                position=position,
+                is_manual=bool(reply_to.quote) or None
+            )
diff --git a/pyrogram/types/input_paid_media/__init__.py b/pyrogram/types/input_paid_media/__init__.py
new file mode 100644
index 0000000000..574b78f61c
--- /dev/null
+++ b/pyrogram/types/input_paid_media/__init__.py
@@ -0,0 +1,37 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .input_paid_media import InputPaidMedia
+from .input_paid_media_photo import InputPaidMediaPhoto
+from .input_paid_media_video import InputPaidMediaVideo
+from .paid_media_info import PaidMediaInfo
+from .paid_media import PaidMedia
+from .paid_media_preview import PaidMediaPreview
+from .paid_media_photo import PaidMediaPhoto
+from .paid_media_video import PaidMediaVideo
+
+__all__ = [
+    "InputPaidMedia",
+    "InputPaidMediaPhoto",
+    "InputPaidMediaVideo",
+    "PaidMediaInfo",
+    "PaidMedia",
+    "PaidMediaPreview",
+    "PaidMediaPhoto",
+    "PaidMediaVideo",
+]
diff --git a/pyrogram/types/input_paid_media/input_paid_media.py b/pyrogram/types/input_paid_media/input_paid_media.py
new file mode 100644
index 0000000000..79a627e99b
--- /dev/null
+++ b/pyrogram/types/input_paid_media/input_paid_media.py
@@ -0,0 +1,39 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, BinaryIO
+
+from ..object import Object
+
+
+class InputPaidMedia(Object):
+    """This object describes the paid media to be sent.
+
+    Currently, it can be one of:
+
+    - :obj:`~pyrogram.types.InputPaidMediaPhoto`
+    - :obj:`~pyrogram.types.InputPaidMediaVideo`
+    """
+
+    def __init__(
+        self,
+        media: Union[str, BinaryIO]
+    ):
+        super().__init__()
+
+        self.media = media
diff --git a/pyrogram/types/input_paid_media/input_paid_media_photo.py b/pyrogram/types/input_paid_media/input_paid_media_photo.py
new file mode 100644
index 0000000000..765fd13e26
--- /dev/null
+++ b/pyrogram/types/input_paid_media/input_paid_media_photo.py
@@ -0,0 +1,45 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union, BinaryIO
+
+from .input_paid_media import InputPaidMedia
+from ... import enums
+
+
+class InputPaidMediaPhoto(InputPaidMedia):
+    """The paid media to send is a photo.
+
+    It is intended to be used with :obj:`~pyrogram.Client.send_paid_media`.
+
+    Parameters:
+        media (``str`` | ``BinaryIO``):
+            Photo to send.
+            Pass a file_id as string to send a photo that exists on the Telegram servers or
+            pass a file path as string to upload a new photo that exists on your local machine or
+            pass a binary file-like object with its attribute “.name” set for in-memory uploads or
+            pass an HTTP URL as a string for Telegram to get a photo from the Internet.
+
+    """
+
+    def __init__(
+        self,
+        media: Union[str, BinaryIO]
+    ):
+        super().__init__(media)
+
diff --git a/pyrogram/types/input_paid_media/input_paid_media_video.py b/pyrogram/types/input_paid_media/input_paid_media_video.py
new file mode 100644
index 0000000000..a4e4bce77c
--- /dev/null
+++ b/pyrogram/types/input_paid_media/input_paid_media_video.py
@@ -0,0 +1,73 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List, Union, BinaryIO
+
+from .input_paid_media import InputPaidMedia
+from ... import enums
+
+
+class InputPaidMediaVideo(InputPaidMedia):
+    """The paid media to send is a video.
+
+    It is intended to be used with :obj:`~pyrogram.Client.send_paid_media`.
+
+    Parameters:
+        media (``str`` | ``BinaryIO``):
+            File to send.
+            Pass a file_id as string to send a video that exists on the Telegram servers or
+            pass a file path as string to upload a new video that exists on your local machine or
+            pass a binary file-like object with its attribute “.name” set for in-memory uploads or
+            pass an HTTP URL as a string for Telegram to get a video from the Internet.
+
+        thumbnail (``str`` | ``BinaryIO``):
+            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 320 pixels.
+            Thumbnails can't be reused and can be only uploaded as a new file.
+
+        width (``int``, *optional*):
+            Video width.
+
+        height (``int``, *optional*):
+            Video height.
+
+        duration (``int``, *optional*):
+            Video duration.
+
+        supports_streaming (``bool``, *optional*):
+            Pass True, if the uploaded video is suitable for streaming.
+
+    """
+
+    def __init__(
+        self,
+        media: Union[str, BinaryIO],
+        thumbnail: Union[str, BinaryIO] = None,
+        width: int = 0,
+        height: int = 0,
+        duration: int = 0,
+        supports_streaming: bool = True
+    ):
+        super().__init__(media)
+
+        self.thumbnail = thumbnail
+        self.width = width
+        self.height = height
+        self.duration = duration
+        self.supports_streaming = supports_streaming
diff --git a/pyrogram/types/input_paid_media/paid_media.py b/pyrogram/types/input_paid_media/paid_media.py
new file mode 100644
index 0000000000..f4e5c3b7bf
--- /dev/null
+++ b/pyrogram/types/input_paid_media/paid_media.py
@@ -0,0 +1,94 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+
+from ..object import Object
+
+
+class PaidMedia(Object):
+    """This object describes paid media.
+
+    Currently, it can be one of:
+
+    - :obj:`~pyrogram.types.PaidMediaPreview`
+    - :obj:`~pyrogram.types.PaidMediaPhoto`
+    - :obj:`~pyrogram.types.PaidMediaVideo`
+    """
+
+    def __init__(
+        self
+    ):
+        super().__init__()
+
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        extended_media: Union[
+            "raw.types.MessageExtendedMediaPreview",
+            "raw.types.MessageExtendedMedia"
+        ]
+    ) -> "PaidMedia":
+        if isinstance(extended_media, raw.types.MessageExtendedMediaPreview):
+            return types.PaidMediaPreview(
+                width=getattr(extended_media, "w", None),
+                height=getattr(extended_media, "h", None),
+                duration=getattr(extended_media, "video_duration", None),
+                minithumbnail=types.StrippedThumbnail(
+                    client=client,
+                    data=extended_media.thumb
+                ) if getattr(extended_media, "thumb", None) else None
+            )
+        if isinstance(extended_media, raw.types.MessageExtendedMedia):
+            media = extended_media.media
+
+            has_media_spoiler = getattr(media, "spoiler", None)
+            ttl_seconds = getattr(media, "ttl_seconds", None)
+
+            if isinstance(media, raw.types.MessageMediaPhoto):
+                photo = types.Photo._parse(client, media.photo, ttl_seconds, has_media_spoiler)
+                
+                return types.PaidMediaPhoto(
+                    photo=photo
+                )
+            
+            if isinstance(media, raw.types.MessageMediaDocument):
+                doc = media.document
+
+                if isinstance(doc, raw.types.Document):
+                    attributes = {type(i): i for i in doc.attributes}
+
+                    file_name = getattr(
+                        attributes.get(
+                            raw.types.DocumentAttributeFilename, None
+                        ), "file_name", None
+                    )
+
+                    if raw.types.DocumentAttributeVideo in attributes:
+                        video_attributes = attributes[raw.types.DocumentAttributeVideo]
+
+                        if not video_attributes.round_message:
+                            video = types.Video._parse(client, doc, video_attributes, file_name, ttl_seconds)
+
+                            return types.PaidMediaVideo(
+                                video=video
+                            )
diff --git a/pyrogram/types/input_paid_media/paid_media_info.py b/pyrogram/types/input_paid_media/paid_media_info.py
new file mode 100644
index 0000000000..ef2d9d537c
--- /dev/null
+++ b/pyrogram/types/input_paid_media/paid_media_info.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+from ..object import Object
+
+
+class PaidMediaInfo(Object):
+    """Describes the paid media added to a message.
+
+    Parameters:
+        star_count (``int``):
+            The number of Telegram Stars that must be paid to buy access to the media.
+
+        paid_media  (List of :obj:`~pyrogram.types.PaidMedia`):
+            Information about the paid media.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        star_count: str,
+        paid_media: List["types.PaidMedia"]
+    ):
+        super().__init__()
+
+        self.star_count = star_count
+        self.paid_media = paid_media
+
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        message_paid_media: "raw.types.MessageMediaPaidMedia"
+    ) -> "PaidMediaInfo":
+        return PaidMediaInfo(
+            star_count=message_paid_media.stars_amount,
+            paid_media=[
+                types.PaidMedia._parse(client, em)
+                for em in message_paid_media.extended_media
+            ]
+        )
diff --git a/pyrogram/types/input_paid_media/paid_media_photo.py b/pyrogram/types/input_paid_media/paid_media_photo.py
new file mode 100644
index 0000000000..0f06335743
--- /dev/null
+++ b/pyrogram/types/input_paid_media/paid_media_photo.py
@@ -0,0 +1,42 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import types
+
+from ..object import Object
+from .paid_media import PaidMedia
+
+
+class PaidMediaPhoto(PaidMedia):
+    """The paid media is a photo.
+
+    Parameters:
+        photo (:obj:`~pyrogram.types.Photo`):
+            The photo.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        photo: "types.Photo" = None
+    ):
+        super().__init__()
+
+        self.photo = photo
diff --git a/pyrogram/types/input_paid_media/paid_media_preview.py b/pyrogram/types/input_paid_media/paid_media_preview.py
new file mode 100644
index 0000000000..90cc878cc1
--- /dev/null
+++ b/pyrogram/types/input_paid_media/paid_media_preview.py
@@ -0,0 +1,57 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import types
+
+from ..object import Object
+from .paid_media import PaidMedia
+
+
+class PaidMediaPreview(PaidMedia):
+    """The paid media isn't available before the payment.
+
+    Parameters:
+        width (``int``, *optional*):
+            Media width as defined by the sender.
+
+        height (``int``, *optional*):
+            Media height as defined by the sender.
+
+        duration (``int``, *optional*):
+            Duration of the media in seconds as defined by the sender.
+
+        minithumbnail (:obj:`~pyrogram.types.StrippedThumbnail`, *optional*):
+            Media minithumbnail; may be None.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        width: int = None,
+        height: int = None,
+        duration: int = None,
+        minithumbnail: "types.StrippedThumbnail" = None
+    ):
+        super().__init__()
+
+        self.width = width
+        self.height = height
+        self.duration = duration
+        self.minithumbnail = minithumbnail
diff --git a/pyrogram/types/input_paid_media/paid_media_video.py b/pyrogram/types/input_paid_media/paid_media_video.py
new file mode 100644
index 0000000000..cbdfbcf5c5
--- /dev/null
+++ b/pyrogram/types/input_paid_media/paid_media_video.py
@@ -0,0 +1,42 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import types
+
+from ..object import Object
+from .paid_media import PaidMedia
+
+
+class PaidMediaVideo(PaidMedia):
+    """The paid media is a video.
+
+    Parameters:
+        video (:obj:`~pyrogram.types.Video`):
+            The video.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        video: "types.Video" = None
+    ):
+        super().__init__()
+
+        self.video = video
diff --git a/pyrogram/types/list.py b/pyrogram/types/list.py
new file mode 100644
index 0000000000..da87d5275f
--- /dev/null
+++ b/pyrogram/types/list.py
@@ -0,0 +1,30 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 f"pyrogram.types.List([{','.join(Object.__repr__(i) for i in self)}])"
diff --git a/pyrogram/types/message_origin/__init__.py b/pyrogram/types/message_origin/__init__.py
new file mode 100644
index 0000000000..232d0e4d2e
--- /dev/null
+++ b/pyrogram/types/message_origin/__init__.py
@@ -0,0 +1,33 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .message_origin import MessageOrigin
+from .message_origin_channel import MessageOriginChannel
+from .message_origin_chat import MessageOriginChat
+from .message_origin_hidden_user import MessageOriginHiddenUser
+from .message_origin_user import MessageOriginUser
+from .message_import_info import MessageImportInfo
+
+__all__ = [
+    "MessageImportInfo",
+    "MessageOrigin",
+    "MessageOriginChannel",
+    "MessageOriginChat",
+    "MessageOriginHiddenUser",
+    "MessageOriginUser",
+]
diff --git a/pyrogram/types/message_origin/message_import_info.py b/pyrogram/types/message_origin/message_import_info.py
new file mode 100644
index 0000000000..66b7db6838
--- /dev/null
+++ b/pyrogram/types/message_origin/message_import_info.py
@@ -0,0 +1,50 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from .message_origin import MessageOrigin
+
+import pyrogram
+from pyrogram import types
+
+
+class MessageImportInfo(MessageOrigin):
+    """Contains information about a message created with `importMessages `_.
+
+    Parameters:
+        date (:py:obj:`~datetime.datetime`):
+            Date the message was sent originally in Unix time
+
+        sender_user_name (``str``):
+            Name of the original sender
+
+    """
+
+    def __init__(
+        self,
+        *,
+        date: datetime = None,
+        sender_user_name: str = None
+    ):
+        super().__init__(
+            type="import_info",
+            date=date
+        )
+
+        self.sender_user_name = sender_user_name
diff --git a/pyrogram/types/message_origin/message_origin.py b/pyrogram/types/message_origin/message_origin.py
new file mode 100644
index 0000000000..e4cb8f2da7
--- /dev/null
+++ b/pyrogram/types/message_origin/message_origin.py
@@ -0,0 +1,94 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from ..object import Object
+
+import pyrogram
+from pyrogram import raw, types, utils
+
+
+class MessageOrigin(Object):
+    """This object describes the origin of a message.
+    
+    It can be one of:
+
+    - :obj:`~pyrogram.types.MessageOriginUser`
+    - :obj:`~pyrogram.types.MessageOriginHiddenUser`
+    - :obj:`~pyrogram.types.MessageOriginChat`
+    - :obj:`~pyrogram.types.MessageOriginChannel`
+    """
+
+    def __init__(
+        self,
+        type: str,
+        date: datetime = None
+    ):
+        super().__init__()
+
+        self.type = type
+        self.date = date
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        forward_header: "raw.types.MessageFwdHeader",
+        users: dict, # raw
+        chats: dict, # raw 
+    ) -> "MessageOrigin":
+        if not forward_header:
+            return None
+        forward_date = utils.timestamp_to_datetime(forward_header.date)
+        forward_signature = getattr(forward_header, "post_author", None)
+        if forward_header.from_id:
+            raw_peer_id = utils.get_raw_peer_id(forward_header.from_id)
+            peer_id = utils.get_peer_id(forward_header.from_id)
+            if peer_id > 0:
+                forward_from = types.User._parse(client, users[raw_peer_id])
+                return types.MessageOriginUser(
+                    date=forward_date,
+                    sender_user=forward_from
+                )
+            else:
+                forward_from_chat = types.Chat._parse_channel_chat(client, chats[raw_peer_id])
+                forward_from_message_id = forward_header.channel_post
+                if forward_from_message_id:
+                    return types.MessageOriginChannel(
+                        date=forward_date,
+                        chat=forward_from_chat,
+                        message_id=forward_from_message_id,
+                        author_signature=forward_signature
+                    )
+                else:
+                    return types.MessageOriginChat(
+                        date=forward_date,
+                        sender_chat=forward_from_chat,
+                        author_signature=forward_signature
+                    )
+        elif forward_header.from_name:
+            forward_sender_name = forward_header.from_name
+            return types.MessageOriginHiddenUser(
+                date=forward_date,
+                sender_user_name=forward_sender_name
+            )
+        elif forward_header.imported:
+            return types.MessageImportInfo(
+                date=forward_date,
+                sender_user_name=forward_signature
+            )
diff --git a/pyrogram/types/message_origin/message_origin_channel.py b/pyrogram/types/message_origin/message_origin_channel.py
new file mode 100644
index 0000000000..e6ea5454c8
--- /dev/null
+++ b/pyrogram/types/message_origin/message_origin_channel.py
@@ -0,0 +1,60 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from .message_origin import MessageOrigin
+
+import pyrogram
+from pyrogram import types
+
+
+class MessageOriginChannel(MessageOrigin):
+    """The message was originally sent to a channel chat.
+
+    Parameters:
+        date (:py:obj:`~datetime.datetime`):
+            Date the message was sent originally in Unix time
+
+        chat (:obj:`~pyrogram.types.Chat`):
+            Channel chat to which the message was originally sent
+        
+        message_id (``int``):
+            Unique message identifier inside the chat
+
+        author_signature (``str``, *optional*):
+            Signature of the original post author
+
+    """
+
+    def __init__(
+        self,
+        *,
+        date: datetime = None,
+        chat: "types.Chat" = None,
+        message_id: int = None,
+        author_signature: str = None
+    ):
+        super().__init__(
+            type="channel",
+            date=date
+        )
+
+        self.chat = chat
+        self.message_id = message_id
+        self.author_signature = author_signature
diff --git a/pyrogram/types/message_origin/message_origin_chat.py b/pyrogram/types/message_origin/message_origin_chat.py
new file mode 100644
index 0000000000..599c9130c5
--- /dev/null
+++ b/pyrogram/types/message_origin/message_origin_chat.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from .message_origin import MessageOrigin
+
+import pyrogram
+from pyrogram import types
+
+
+class MessageOriginChat(MessageOrigin):
+    """The message was originally sent on behalf of a chat to a group chat.
+
+    Parameters:
+        date (:py:obj:`~datetime.datetime`):
+            Date the message was sent originally in Unix time
+
+        sender_chat (:obj:`~pyrogram.types.Chat`):
+            Chat that sent the message originally
+        
+        author_signature (``str``, *optional*):
+            For messages originally sent by an anonymous chat administrator, original message author signature
+
+    """
+
+    def __init__(
+        self,
+        *,
+        date: datetime = None,
+        sender_chat: "types.Chat" = None,
+        author_signature: str = None
+    ):
+        super().__init__(
+            type="chat",
+            date=date
+        )
+
+        self.sender_chat = sender_chat
+        self.author_signature = author_signature
diff --git a/pyrogram/types/message_origin/message_origin_hidden_user.py b/pyrogram/types/message_origin/message_origin_hidden_user.py
new file mode 100644
index 0000000000..dc46b6f4d0
--- /dev/null
+++ b/pyrogram/types/message_origin/message_origin_hidden_user.py
@@ -0,0 +1,50 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from .message_origin import MessageOrigin
+
+import pyrogram
+from pyrogram import types
+
+
+class MessageOriginHiddenUser(MessageOrigin):
+    """The message was originally sent by an unknown user.
+
+    Parameters:
+        date (:py:obj:`~datetime.datetime`):
+            Date the message was sent originally in Unix time
+
+        sender_user_name (``str``):
+            Name of the user that sent the message originally
+
+    """
+
+    def __init__(
+        self,
+        *,
+        date: datetime = None,
+        sender_user_name: str = None
+    ):
+        super().__init__(
+            type="hidden_user",
+            date=date
+        )
+
+        self.sender_user_name = sender_user_name
diff --git a/pyrogram/types/message_origin/message_origin_user.py b/pyrogram/types/message_origin/message_origin_user.py
new file mode 100644
index 0000000000..3edc7cf4d3
--- /dev/null
+++ b/pyrogram/types/message_origin/message_origin_user.py
@@ -0,0 +1,50 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from .message_origin import MessageOrigin
+
+import pyrogram
+from pyrogram import types
+
+
+class MessageOriginUser(MessageOrigin):
+    """The message was originally sent by a known user.
+
+    Parameters:
+        date (:py:obj:`~datetime.datetime`):
+            Date the message was sent originally in Unix time
+
+        sender_user (:obj:`~pyrogram.types.User`):
+            User that sent the message originally
+
+    """
+
+    def __init__(
+        self,
+        *,
+        date: datetime = None,
+        sender_user: "types.User" = None
+    ):
+        super().__init__(
+            type="user",
+            date=date
+        )
+
+        self.sender_user = sender_user
diff --git a/pyrogram/types/messages_and_media/__init__.py b/pyrogram/types/messages_and_media/__init__.py
new file mode 100644
index 0000000000..e0e9e766a0
--- /dev/null
+++ b/pyrogram/types/messages_and_media/__init__.py
@@ -0,0 +1,105 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .animation import Animation
+from .audio import Audio
+from .contact import Contact
+from .dice import Dice
+from .document import Document
+from .game import Game
+from .location import Location
+from .message import Message
+from .message_entity import MessageEntity
+from .photo import Photo
+from .poll import Poll
+from .poll_option import PollOption
+from .reaction import (
+    Reaction,
+    ReactionType,
+    ReactionTypeEmoji,
+    ReactionTypeCustomEmoji,
+    ReactionCount
+)
+from .sponsored_message import SponsoredMessage
+from .sticker import Sticker
+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
+from .web_app_data import WebAppData
+from .web_page import WebPage
+from .message_reactions import MessageReactions
+from .message_reaction_updated import MessageReactionUpdated
+from .message_reaction_count_updated import MessageReactionCountUpdated
+from .chat_boost_added import ChatBoostAdded
+from .story import Story
+from .giveaway import Giveaway
+from .giveaway_completed import GiveawayCompleted
+from .giveaway_winners import GiveawayWinners
+from .gift_code import GiftCode
+from .gifted_premium import GiftedPremium
+from .gifted_stars import GiftedStars
+from .message_effect import MessageEffect
+from .translated_text import TranslatedText
+from .message_auto_delete_timer_changed import MessageAutoDeleteTimerChanged
+
+__all__ = [
+    "Animation",
+    "Audio",
+    "ChatBoostAdded",
+    "Contact",
+    "Dice",
+    "Document",
+    "Game",
+    "GiftCode",
+    "GiftedPremium",
+    "GiftedStars",
+    "Giveaway",
+    "GiveawayCompleted",
+    "GiveawayWinners",
+    "Location",
+    "Message",  # TODO
+    "MessageAutoDeleteTimerChanged",
+    "MessageEffect",
+    "MessageEntity",
+    "MessageReactionCountUpdated",
+    "MessageReactionUpdated",
+    "MessageReactions",
+    "Photo",
+    "Reaction",
+    "ReactionCount",
+    "ReactionType",
+    "ReactionTypeEmoji",
+    "ReactionTypeCustomEmoji",
+    "Thumbnail",
+    "StrippedThumbnail",
+    "Poll",
+    "PollOption",
+    "SponsoredMessage",
+    "Sticker",
+    "Story",
+    "Venue",
+    "Video",
+    "VideoNote",
+    "Voice",
+    "WebAppData",
+    "WebPage",
+    "TranslatedText"
+]
diff --git a/pyrogram/types/messages_and_media/animation.py b/pyrogram/types/messages_and_media/animation.py
new file mode 100644
index 0000000000..289a8ba912
--- /dev/null
+++ b/pyrogram/types/messages_and_media/animation.py
@@ -0,0 +1,162 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
+from ..object import Object
+
+
+class Animation(Object):
+    """An animation file (GIF or H.264/MPEG-4 AVC video without sound).
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download or reuse the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        width (``int``):
+            Animation width as defined by sender.
+
+        height (``int``):
+            Animation height as defined by sender.
+
+        duration (``int``, *optional*):
+            Duration of the animation in seconds as defined by sender.
+
+        file_name (``str``, *optional*):
+            Animation file name.
+
+        mime_type (``str``, *optional*):
+            Mime type of a file as defined by sender.
+
+        file_size (``int``, *optional*):
+            File size.
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the animation was sent.
+
+        thumbs (List of :obj:`~pyrogram.types.Thumbnail`, *optional*):
+            Animation thumbnails.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        width: int,
+        height: int,
+        duration: int = None,
+        file_name: str = None,
+        mime_type: str = None,
+        file_size: int = None,
+        date: datetime = None,
+        thumbs: List["types.Thumbnail"] = None
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        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.thumbs = thumbs
+
+    @staticmethod
+    def _parse(
+        client,
+        animation: "raw.types.Document",
+        video_attributes: "raw.types.DocumentAttributeVideo",
+        file_name: str
+    ) -> "Animation":
+        return Animation(
+            file_id=FileId(
+                file_type=FileType.ANIMATION,
+                dc_id=animation.dc_id,
+                media_id=animation.id,
+                access_hash=animation.access_hash,
+                file_reference=animation.file_reference
+            ).encode(),
+            file_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT,
+                media_id=animation.id
+            ).encode(),
+            width=getattr(video_attributes, "w", 0),
+            height=getattr(video_attributes, "h", 0),
+            duration=getattr(video_attributes, "duration", 0),
+            mime_type=animation.mime_type,
+            file_size=animation.size,
+            file_name=file_name,
+            date=utils.timestamp_to_datetime(animation.date),
+            thumbs=types.Thumbnail._parse(client, animation),
+            client=client
+        )
+
+    @staticmethod
+    def _parse_chat_animation(
+        client,
+        video: "raw.types.Photo"
+    ) -> "Animation":
+        if isinstance(video, raw.types.Photo):
+            if not video.video_sizes:
+                return
+            video_sizes: List[raw.types.VideoSize] = []
+            for p in video.video_sizes:
+                if isinstance(p, raw.types.VideoSize):
+                    video_sizes.append(p)
+                # TODO: VideoSizeEmojiMarkup
+            video_sizes.sort(key=lambda p: p.size)
+            video_size = video_sizes[-1]
+            return Animation(
+                file_id=FileId(
+                    file_type=FileType.PHOTO,
+                    dc_id=video.dc_id,
+                    media_id=video.id,
+                    access_hash=video.access_hash,
+                    file_reference=video.file_reference,
+                    thumbnail_source=ThumbnailSource.THUMBNAIL,
+                    thumbnail_file_type=FileType.PHOTO,
+                    thumbnail_size=video_size.type,
+                    volume_id=0,
+                    local_id=0
+                ).encode() if video else None,
+                file_unique_id=FileUniqueId(
+                    file_unique_type=FileUniqueType.DOCUMENT,
+                    media_id=video.id
+                ).encode() if video else None,
+                width=video_size.w,
+                height=video_size.h,
+                file_size=video_size.size,
+                date=utils.timestamp_to_datetime(video.date) if video else None,
+                file_name=f"chat_video_{video.date}_{client.rnd_id()}.mp4",
+                mime_type="video/mp4",
+                client=client
+            )
diff --git a/pyrogram/types/messages_and_media/audio.py b/pyrogram/types/messages_and_media/audio.py
new file mode 100644
index 0000000000..e474282f0b
--- /dev/null
+++ b/pyrogram/types/messages_and_media/audio.py
@@ -0,0 +1,121 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType
+from ..object import Object
+
+
+class Audio(Object):
+    """An audio file to be treated as music by the Telegram clients.
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download or reuse the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        duration (``int``):
+            Duration of the audio in seconds as defined by sender.
+
+        performer (``str``, *optional*):
+            Performer of the audio as defined by sender or by audio tags.
+
+        title (``str``, *optional*):
+            Title of the audio as defined by sender or by audio tags.
+
+        file_name (``str``, *optional*):
+            Audio file name.
+
+        mime_type (``str``, *optional*):
+            MIME type of the file as defined by sender.
+
+        file_size (``int``, *optional*):
+            File size.
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the audio was originally sent.
+
+        thumbs (List of :obj:`~pyrogram.types.Thumbnail`, *optional*):
+            Thumbnails of the music file album cover.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        duration: int,
+        performer: str = None,
+        title: str = None,
+        file_name: str = None,
+        mime_type: str = None,
+        file_size: int = None,
+        date: datetime = None,
+        thumbs: List["types.Thumbnail"] = None
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        self.duration = duration
+        self.performer = performer
+        self.title = title
+        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,
+        audio: "raw.types.Document",
+        audio_attributes: "raw.types.DocumentAttributeAudio",
+        file_name: str
+    ) -> "Audio":
+        return Audio(
+            file_id=FileId(
+                file_type=FileType.AUDIO,
+                dc_id=audio.dc_id,
+                media_id=audio.id,
+                access_hash=audio.access_hash,
+                file_reference=audio.file_reference
+            ).encode(),
+            file_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT,
+                media_id=audio.id
+            ).encode(),
+            duration=audio_attributes.duration,
+            performer=audio_attributes.performer,
+            title=audio_attributes.title,
+            mime_type=audio.mime_type,
+            file_size=audio.size,
+            file_name=file_name,
+            date=utils.timestamp_to_datetime(audio.date),
+            thumbs=types.Thumbnail._parse(client, audio),
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/chat_boost_added.py b/pyrogram/types/messages_and_media/chat_boost_added.py
new file mode 100644
index 0000000000..6a31242056
--- /dev/null
+++ b/pyrogram/types/messages_and_media/chat_boost_added.py
@@ -0,0 +1,45 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class ChatBoostAdded(Object):
+    """This object represents a service message about a user boosting a chat.
+
+    Parameters:
+        boost_count (``int``):
+            Number of boosts added by the user
+
+    """
+
+    def __init__(
+        self,
+        *,
+        boost_count: int,
+    ):
+        super().__init__()
+
+        self.boost_count = boost_count
+
+    @staticmethod
+    def _parse(action: "raw.types.MessageActionBoostApply"):
+        return ChatBoostAdded(
+            boost_count=action.boosts
+        )
diff --git a/pyrogram/types/messages_and_media/contact.py b/pyrogram/types/messages_and_media/contact.py
new file mode 100644
index 0000000000..cec03329a5
--- /dev/null
+++ b/pyrogram/types/messages_and_media/contact.py
@@ -0,0 +1,71 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class Contact(Object):
+    """A phone contact.
+
+    Parameters:
+        phone_number (``str``):
+            Contact's phone number.
+
+        first_name (``str``):
+            Contact's first name.
+
+        last_name (``str``, *optional*):
+            Contact's last name.
+
+        user_id (``int``, *optional*):
+            Contact's user identifier in Telegram.
+
+        vcard (``str``, *optional*):
+            Additional data about the contact in the form of a vCard.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        phone_number: str,
+        first_name: str,
+        last_name: str = None,
+        user_id: int = None,
+        vcard: str = None
+    ):
+        super().__init__(client)
+
+        self.phone_number = phone_number
+        self.first_name = first_name
+        self.last_name = last_name
+        self.user_id = user_id
+        self.vcard = vcard
+
+    @staticmethod
+    def _parse(client: "pyrogram.Client", contact: "raw.types.MessageMediaContact") -> "Contact":
+        return Contact(
+            phone_number=contact.phone_number,
+            first_name=contact.first_name,
+            last_name=contact.last_name or None,
+            vcard=contact.vcard or None,
+            user_id=contact.user_id or None,
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/dice.py b/pyrogram/types/messages_and_media/dice.py
new file mode 100644
index 0000000000..2c683ec828
--- /dev/null
+++ b/pyrogram/types/messages_and_media/dice.py
@@ -0,0 +1,47 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class Dice(Object):
+    """A dice with a random value from 1 to 6 for currently supported base emoji.
+
+    Parameters:
+        emoji (``string``):
+            Emoji on which the dice throw animation is based.
+
+        value (``int``):
+            Value of the dice, 1-6 for currently supported base emoji.
+    """
+
+    def __init__(self, *, client: "pyrogram.Client" = None, emoji: str, value: int):
+        super().__init__(client)
+
+        self.emoji = emoji
+        self.value = value
+
+    @staticmethod
+    def _parse(client, dice: "raw.types.MessageMediaDice") -> "Dice":
+        return Dice(
+            emoji=dice.emoticon,
+            value=dice.value,
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/document.py b/pyrogram/types/messages_and_media/document.py
new file mode 100644
index 0000000000..95ebe3f289
--- /dev/null
+++ b/pyrogram/types/messages_and_media/document.py
@@ -0,0 +1,98 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType
+from ..object import Object
+
+
+class Document(Object):
+    """A generic file (as opposed to photos, voice messages, audio files, ...).
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download or reuse the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        file_name (``str``, *optional*):
+            Original filename as defined by sender.
+
+        mime_type (``str``, *optional*):
+            MIME type of the file as defined by sender.
+
+        file_size (``int``, *optional*):
+            File size.
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the document was sent.
+
+        thumbs (List of :obj:`~pyrogram.types.Thumbnail`, *optional*):
+            Document thumbnails as defined by sender.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        file_name: str = None,
+        mime_type: str = None,
+        file_size: int = None,
+        date: datetime = None,
+        thumbs: List["types.Thumbnail"] = None
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        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: "raw.types.Document", file_name: str) -> "Document":
+        return Document(
+            file_id=FileId(
+                file_type=FileType.DOCUMENT,
+                dc_id=document.dc_id,
+                media_id=document.id,
+                access_hash=document.access_hash,
+                file_reference=document.file_reference
+            ).encode(),
+            file_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT,
+                media_id=document.id
+            ).encode(),
+            file_name=file_name,
+            mime_type=document.mime_type,
+            file_size=document.size,
+            date=utils.timestamp_to_datetime(document.date),
+            thumbs=types.Thumbnail._parse(client, document),
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/game.py b/pyrogram/types/messages_and_media/game.py
new file mode 100644
index 0000000000..89f4fdfbee
--- /dev/null
+++ b/pyrogram/types/messages_and_media/game.py
@@ -0,0 +1,98 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+from ..object import Object
+
+
+class Game(Object):
+    """A game.
+    Use BotFather to create and edit games, their short names will act as unique identifiers.
+
+    Parameters:
+        id (``int``):
+            Unique identifier of the game.
+
+        title (``str``):
+            Title of the game.
+
+        short_name (``str``):
+            Unique short name of the game.
+
+        description (``str``):
+            Description of the game.
+
+        photo (:obj:`~pyrogram.types.Photo`):
+            Photo that will be displayed in the game message in chats.
+
+        animation (:obj:`~pyrogram.types.Animation`, *optional*):
+            Animation that will be displayed in the game message in chats.
+            Upload via BotFather.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: int,
+        title: str,
+        short_name: str,
+        description: str,
+        photo: "types.Photo",
+        animation: "types.Animation" = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.title = title
+        self.short_name = short_name
+        self.description = description
+        self.photo = photo
+        self.animation = animation
+
+    @staticmethod
+    def _parse(client, game: "raw.types.Game") -> "Game":
+        animation = None
+
+        if game.document:
+            attributes = {type(i): i for i in game.document.attributes}
+
+            file_name = getattr(
+                attributes.get(
+                    raw.types.DocumentAttributeFilename, None
+                ), "file_name", None
+            )
+
+            animation = types.Animation._parse(
+                client,
+                game.document,
+                attributes.get(raw.types.DocumentAttributeVideo, None),
+                file_name
+            )
+
+        return Game(
+            id=game.id,
+            title=game.title,
+            short_name=game.short_name,
+            description=game.description,
+            photo=types.Photo._parse(client, game.photo),
+            animation=animation,
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/gift_code.py b/pyrogram/types/messages_and_media/gift_code.py
new file mode 100644
index 0000000000..fd005a4f8a
--- /dev/null
+++ b/pyrogram/types/messages_and_media/gift_code.py
@@ -0,0 +1,88 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types, utils
+from ..object import Object
+
+
+class GiftCode(Object):
+    """Contains gift code data.
+
+    Parameters:
+        via_giveaway (``bool``):
+            True if the gift code is received via giveaway.
+
+        is_unclaimed (``bool``):
+            True, if the winner for the corresponding Telegram Premium subscription wasn't chosen.
+            `The code is received by creator of a chat, which started the giveaway that had less winners than planned. `_
+
+        boosted_chat (:obj:`~pyrogram.types.Chat`):
+            The channel where the gift code was won.
+
+        premium_subscription_month_count (``int``):
+            Number of months of subscription.
+
+        slug (``str``):
+            Identifier of gift code.
+            You can combine it with `t.me/giftcode/{slug}`
+            to get link for this gift.
+
+        link (``str``, *property*):
+            Generate a link to this gift code.
+    """
+
+    def __init__(
+        self,
+        *,
+        via_giveaway: bool,
+        is_unclaimed: bool,
+        boosted_chat: "types.Chat",
+        premium_subscription_month_count: int,
+        slug: str
+    ):
+        super().__init__()
+
+        self.via_giveaway = via_giveaway
+        self.is_unclaimed = is_unclaimed
+        self.boosted_chat = boosted_chat
+        self.premium_subscription_month_count = premium_subscription_month_count
+        self.slug = slug
+
+    @staticmethod
+    def _parse(
+        client,
+        giftcode: "raw.types.MessageActionGiftCode",
+        chats: dict
+    ):
+        peer = chats.get(
+            utils.get_raw_peer_id(giftcode.boost_peer)
+        )
+
+        return GiftCode(
+            via_giveaway=giftcode.via_giveaway,
+            is_unclaimed=giftcode.unclaimed,
+            boosted_chat=types.Chat._parse_chat(
+                client, peer
+            ) if peer else None,
+            premium_subscription_month_count=giftcode.months,
+            slug=giftcode.slug
+        )
+
+    @property
+    def link(self) -> str:
+        return f"https://t.me/giftcode/{self.slug}"
diff --git a/pyrogram/types/messages_and_media/gifted_premium.py b/pyrogram/types/messages_and_media/gifted_premium.py
new file mode 100644
index 0000000000..b742b3351e
--- /dev/null
+++ b/pyrogram/types/messages_and_media/gifted_premium.py
@@ -0,0 +1,92 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 random import choice
+
+from pyrogram import raw, types
+from ..object import Object
+
+
+class GiftedPremium(Object):
+    """Telegram Premium was gifted to the user
+
+    Parameters:
+        gifter_user_id (``int``):
+            The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous
+
+        currency (``str``):
+            Currency for the paid amount
+
+        amount (``int``):
+            The paid amount, in the smallest units of the currency
+
+        cryptocurrency (``str``):
+            Cryptocurrency used to pay for the gift; may be empty if none
+
+        cryptocurrency_amount (``int``):
+            The paid amount, in the smallest units of the cryptocurrency; 0 if none
+
+        month_count (``int``):
+            Number of months the Telegram Premium subscription will be active
+
+        sticker (:obj:`~pyrogram.types.Sticker`):
+            A sticker to be shown in the message; may be null if unknown
+
+    """
+
+    def __init__(
+        self,
+        *,
+        gifter_user_id: int = None,
+        currency: str = None,
+        amount: int = None,
+        cryptocurrency: str = None,
+        cryptocurrency_amount: int = None,
+        month_count: int = None,
+        sticker: "types.Sticker" = None,
+    ):
+        super().__init__()
+
+        self.gifter_user_id = gifter_user_id
+        self.currency = currency
+        self.amount = amount
+        self.cryptocurrency = cryptocurrency
+        self.cryptocurrency_amount = cryptocurrency_amount
+        self.month_count = month_count
+        self.sticker = sticker
+
+    @staticmethod
+    async def _parse(
+        client,
+        gifted_premium: "raw.types.MessageActionGiftPremium",
+        gifter_user_id: int
+    ) -> "GiftedPremium":
+        sticker = None
+        stickers, _ = await client._get_raw_stickers(
+            raw.types.InputStickerSetPremiumGifts()
+        )
+        sticker = choice(stickers)
+        return GiftedPremium(
+            gifter_user_id=gifter_user_id,
+            currency=gifted_premium.currency,
+            amount=gifted_premium.amount,
+            cryptocurrency=getattr(gifted_premium, "crypto_currency", None),
+            cryptocurrency_amount=getattr(gifted_premium, "crypto_amount", None),
+            month_count=gifted_premium.months,
+            sticker=sticker
+        )
diff --git a/pyrogram/types/messages_and_media/gifted_stars.py b/pyrogram/types/messages_and_media/gifted_stars.py
new file mode 100644
index 0000000000..52b13f7856
--- /dev/null
+++ b/pyrogram/types/messages_and_media/gifted_stars.py
@@ -0,0 +1,105 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 random import choice
+
+from pyrogram import raw, types
+from ..object import Object
+
+
+class GiftedStars(Object):
+    """Telegram Stars were gifted to a user
+
+    Parameters:
+        gifter_user_id (``int``):
+            The identifier of a user that gifted Telegram Stars; 0 if the gift was anonymous or is outgoing
+
+        receiver_user_id (``int``):
+            The identifier of a user that received Telegram Stars; 0 if the gift is incoming
+
+        currency (``str``):
+            Currency for the paid amount
+
+        amount (``int``):
+            The paid amount, in the smallest units of the currency
+
+        cryptocurrency (``str``):
+            Cryptocurrency used to pay for the gift; may be empty if none
+
+        cryptocurrency_amount (``int``):
+            The paid amount, in the smallest units of the cryptocurrency; 0 if none
+
+        star_count (``int``):
+            Number of Telegram Stars that were gifted
+
+        transaction_id (``str``):
+            Identifier of the transaction for Telegram Stars purchase; for receiver only
+
+        sticker (:obj:`~pyrogram.types.Sticker`):
+            A sticker to be shown in the message; may be null if unknown
+
+    """
+
+    def __init__(
+        self,
+        *,
+        gifter_user_id: int = None,
+        receiver_user_id: int = None,
+        currency: str = None,
+        amount: int = None,
+        cryptocurrency: str = None,
+        cryptocurrency_amount: int = None,
+        star_count: int = None,
+        transaction_id: str = None,
+        sticker: "types.Sticker" = None,
+    ):
+        super().__init__()
+
+        self.gifter_user_id = gifter_user_id
+        self.receiver_user_id = receiver_user_id
+        self.currency = currency
+        self.amount = amount
+        self.cryptocurrency = cryptocurrency
+        self.cryptocurrency_amount = cryptocurrency_amount
+        self.star_count = star_count
+        self.transaction_id = transaction_id
+        self.sticker = sticker
+
+    @staticmethod
+    async def _parse(
+        client,
+        gifted_stars: "raw.types.MessageActionGiftStars",
+        gifter_user_id: int,
+        receiver_user_id: int
+    ) -> "GiftedStars":
+        sticker = None
+        stickers, _ = await client._get_raw_stickers(
+            raw.types.InputStickerSetPremiumGifts()
+        )
+        sticker = choice(stickers)
+        return GiftedStars(
+            gifter_user_id=gifter_user_id,
+            receiver_user_id=receiver_user_id,
+            currency=gifted_stars.currency,
+            amount=gifted_stars.amount,
+            cryptocurrency=getattr(gifted_stars, "crypto_currency", None),
+            cryptocurrency_amount=getattr(gifted_stars, "crypto_amount", None),
+            star_count=gifted_stars.stars,
+            transaction_id=getattr(gifted_stars, "transaction_id", None),
+            sticker=sticker
+        )
diff --git a/pyrogram/types/messages_and_media/giveaway.py b/pyrogram/types/messages_and_media/giveaway.py
new file mode 100644
index 0000000000..029a45995b
--- /dev/null
+++ b/pyrogram/types/messages_and_media/giveaway.py
@@ -0,0 +1,104 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+
+from pyrogram import raw, types, utils
+from ..object import Object
+
+
+
+class Giveaway(Object):
+    """This object represents a message about a scheduled giveaway.
+
+    Parameters:
+        chats (:obj:`~pyrogram.types.Chat`):
+            The list of chats which the user must join to participate in the giveaway
+
+        winners_selection_date (:py:obj:`~datetime.datetime`):
+            Point in time (Unix timestamp) when winners of the giveaway will be selected
+        
+        winner_count (``int``):
+            The number of users which are supposed to be selected as winners of the giveaway
+        
+        only_new_members (``bool``, *optional*):
+            True, if only users who join the chats after the giveaway started should be eligible to win
+
+        has_public_winners (``bool``, *optional*):
+            True, if the list of giveaway winners will be visible to everyone
+        
+        prize_description (``str``, *optional*):
+            Description of additional giveaway prize
+        
+        country_codes (``str``, *optional*):
+            A list of two-letter `ISO 3166-1 alpha-2 `_ country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways.
+        
+        premium_subscription_month_count (``int``, *optional*):
+            The number of months the Telegram Premium subscription won from the giveaway will be active for
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        chats: List["types.Chat"],
+        winners_selection_date: datetime,
+        winner_count: int,
+        only_new_members: bool = None,
+        has_public_winners: bool = None,
+        prize_description: str = None,
+        country_codes: List[str] = None,
+        premium_subscription_month_count: int = None
+    ):
+        super().__init__(client)
+
+        self.chats = chats
+        self.winners_selection_date = winners_selection_date
+        self.winner_count = winner_count
+        self.only_new_members = only_new_members
+        self.has_public_winners = has_public_winners
+        self.prize_description = prize_description
+        self.country_codes = country_codes
+        self.premium_subscription_month_count = premium_subscription_month_count
+
+
+    @staticmethod
+    def _parse(
+        client,
+        chats: dict,
+        giveaway_media: "raw.types.MessageMediaGiveaway"
+    ) -> "Giveaway":
+        if isinstance(giveaway_media, raw.types.MessageMediaGiveaway):
+            return Giveaway(
+                client=client,
+                chats=types.List(
+                    types.Chat._parse_channel_chat(client, chats.get(channel))
+                    for channel in giveaway_media.channels
+                ),
+                winners_selection_date=utils.timestamp_to_datetime(giveaway_media.until_date),
+                winner_count=giveaway_media.quantity,
+                only_new_members=getattr(giveaway_media, "only_new_subscribers", None),
+                has_public_winners=getattr(giveaway_media, "winners_are_visible", None),
+                prize_description=getattr(giveaway_media, "prize_description", None),
+                country_codes=giveaway_media.countries_iso2 or None,
+                premium_subscription_month_count=giveaway_media.months
+            )
diff --git a/pyrogram/types/messages_and_media/giveaway_completed.py b/pyrogram/types/messages_and_media/giveaway_completed.py
new file mode 100644
index 0000000000..8e1573ef84
--- /dev/null
+++ b/pyrogram/types/messages_and_media/giveaway_completed.py
@@ -0,0 +1,74 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+
+from pyrogram import raw, types
+from ..object import Object
+
+
+
+class GiveawayCompleted(Object):
+    """This object represents a service message about the completion of a giveaway without public winners.
+
+    Parameters:
+        winner_count (``int``):
+            Number of winners in the giveaway
+        
+        unclaimed_prize_count (``int``, *optional*):
+            Number of undistributed prizes
+
+        giveaway_message (:obj:`~pyrogram.types.Message`, *optional*):
+            Message with the giveaway that was completed, if it wasn't deleted
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        winner_count: int,
+        unclaimed_prize_count: int = None,
+        giveaway_message: "types.Message" = None
+    ):
+        super().__init__(client)
+
+        self.winner_count = winner_count
+        self.unclaimed_prize_count = unclaimed_prize_count
+        self.giveaway_message = giveaway_message
+
+
+    @staticmethod
+    def _parse(
+        client,
+        giveaway_results: "raw.types.MessageActionGiveawayResults",
+        message_id: int = None
+    ) -> "GiveawayCompleted":
+        if isinstance(giveaway_results, raw.types.MessageActionGiveawayResults):
+            return GiveawayCompleted(
+                client=client,
+                winner_count=giveaway_results.winners_count,
+                unclaimed_prize_count=getattr(giveaway_results, "unclaimed_count", None),
+                giveaway_message=types.Message(
+                    client=client,
+                    id=message_id
+                ) if message_id else None
+            )
diff --git a/pyrogram/types/messages_and_media/giveaway_winners.py b/pyrogram/types/messages_and_media/giveaway_winners.py
new file mode 100644
index 0000000000..5450562f85
--- /dev/null
+++ b/pyrogram/types/messages_and_media/giveaway_winners.py
@@ -0,0 +1,127 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+
+from pyrogram import raw, types, utils
+from ..object import Object
+
+
+
+class GiveawayWinners(Object):
+    """This object represents a message about the completion of a giveaway with public winners.
+
+    Parameters:
+        chat (:obj:`~pyrogram.types.Chat`):
+            The chat that created the giveaway
+
+        giveaway_message_id (``int``):
+            Identifier of the message with the giveaway in the chat
+
+        winners_selection_date (:py:obj:`~datetime.datetime`):
+            Point in time (Unix timestamp) when winners of the giveaway were selected
+        
+        winner_count (``int``):
+            Total number of winners in the giveaway
+
+        winners (:obj:`~pyrogram.types.User`):
+            List of up to 100 winners of the giveaway
+        
+        additional_chat_count (``int``, *optional*):
+            The number of other chats the user had to join in order to be eligible for the giveaway
+
+        premium_subscription_month_count (``int``, *optional*):
+            The number of months the Telegram Premium subscription won from the giveaway will be active for
+
+        unclaimed_prize_count (``int``, *optional*):
+            Number of undistributed prizes
+
+        only_new_members (``bool``, *optional*):
+            True, if only users who had joined the chats after the giveaway started were eligible to win
+        
+        was_refunded (``bool``, *optional*):
+            True, if the giveaway was canceled because the payment for it was refunded
+        
+        prize_description (``str``, *optional*):
+            Description of additional giveaway prize
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        chat: "types.Chat",
+        giveaway_message_id: int,
+        winners_selection_date: datetime,
+        winner_count: int,
+        winners: List["types.User"],
+        additional_chat_count: int = None,
+        premium_subscription_month_count: int = None,
+        unclaimed_prize_count: int = None,
+        only_new_members: bool = None,
+        was_refunded: bool = None,
+        prize_description: str = None
+    ):
+        super().__init__(client)
+
+        self.chat = chat
+        self.giveaway_message_id = giveaway_message_id
+        self.winners_selection_date = winners_selection_date
+        self.winner_count = winner_count
+        self.winners = winners
+        self.additional_chat_count = additional_chat_count
+        self.premium_subscription_month_count = premium_subscription_month_count
+        self.unclaimed_prize_count = unclaimed_prize_count
+        self.only_new_members = only_new_members
+        self.was_refunded = was_refunded
+        self.prize_description = prize_description
+
+    @staticmethod
+    def _parse(
+        client,
+        chats: dict,
+        users: dict,
+        giveaway_media: "raw.types.MessageMediaGiveawayResults"
+    ) -> "GiveawayWinners":
+        if isinstance(giveaway_media, raw.types.MessageMediaGiveawayResults):
+            return GiveawayWinners(
+                client=client,
+                chat=types.Chat._parse_channel_chat(
+                    client, chats.get(giveaway_media.channel_id)
+                ),
+                giveaway_message_id=giveaway_media.launch_msg_id,
+                winners_selection_date=utils.timestamp_to_datetime(giveaway_media.until_date),
+                winner_count=giveaway_media.winners_count,
+                winners=types.List(
+                    types.User._parse(
+                        client,
+                        users.get(user_id)
+                    )
+                    for user_id in giveaway_media.winners
+                ),
+                additional_chat_count=getattr(giveaway_media, "additional_peers_count", None),
+                premium_subscription_month_count=giveaway_media.months,
+                unclaimed_prize_count=getattr(giveaway_media, "unclaimed_count", None),
+                only_new_members=getattr(giveaway_media, "only_new_subscribers", None),
+                was_refunded=getattr(giveaway_media, "refunded", None),
+                prize_description=getattr(giveaway_media, "prize_description", None)   
+            )
diff --git a/pyrogram/types/messages_and_media/location.py b/pyrogram/types/messages_and_media/location.py
new file mode 100644
index 0000000000..664890cb76
--- /dev/null
+++ b/pyrogram/types/messages_and_media/location.py
@@ -0,0 +1,55 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class Location(Object):
+    """A point on the map.
+
+    Parameters:
+        longitude (``float``):
+            Longitude as defined by sender.
+
+        latitude (``float``):
+            Latitude as defined by sender.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        longitude: float,
+        latitude: float
+    ):
+        super().__init__(client)
+
+        self.longitude = longitude
+        self.latitude = latitude
+
+    @staticmethod
+    def _parse(client, geo_point: "raw.types.GeoPoint") -> "Location":
+        if isinstance(geo_point, raw.types.GeoPoint):
+            return Location(
+                longitude=geo_point.long,
+                latitude=geo_point.lat,
+                client=client
+            )
diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py
new file mode 100644
index 0000000000..fc07df8983
--- /dev/null
+++ b/pyrogram/types/messages_and_media/message.py
@@ -0,0 +1,5203 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from functools import partial
+from typing import List, Match, Union, BinaryIO, Optional, Callable
+
+import pyrogram
+from pyrogram import raw, enums, types, utils
+from pyrogram.errors import MessageIdsEmpty, PeerIdInvalid
+from pyrogram.parser import utils as parser_utils, Parser
+from ..object import Object
+from ..update import Update
+
+log = logging.getLogger(__name__)
+
+
+class Str(str):
+    def __init__(self, *args):
+        super().__init__()
+
+        self.entities: Optional[List["types.MessageEntity"]] = None
+
+    def init(self, entities):
+        self.entities = entities
+
+        return self
+
+    @property
+    def markdown(self):
+        return Parser.unparse(self, self.entities, False)
+
+    @property
+    def html(self):
+        return Parser.unparse(self, self.entities, True)
+
+    def __getitem__(self, item):
+        return parser_utils.remove_surrogates(parser_utils.add_surrogates(self)[item])
+
+
+class Message(Object, Update):
+    """A message.
+
+    Parameters:
+        id (``int``):
+            Unique message identifier inside this chat.
+
+        message_thread_id (``int``, *optional*):
+            Unique identifier of a message thread to which the message belongs; for supergroups only
+
+        from_user (:obj:`~pyrogram.types.User`, *optional*):
+            Sender, empty for messages sent to channels.
+
+        sender_chat (:obj:`~pyrogram.types.Chat`, *optional*):
+            Sender of the message, sent on behalf of a chat.
+            The channel itself for channel messages.
+            The supergroup itself for messages from anonymous group administrators.
+            The linked channel for messages automatically forwarded to the discussion group.
+
+        sender_boost_count (``int``, *optional*):
+            If the sender of the message boosted the chat, the number of boosts added by the user.
+
+        sender_business_bot (:obj:`~pyrogram.types.User`, *optional*):
+            The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account.
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the message was sent.
+
+        business_connection_id (``str``, *optional*):
+            Unique identifier of the business connection from which the message was received.
+            If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
+            This update may at times be triggered by unavailable changes to message fields that are either unavailable or not actively used by the current bot.
+
+        chat (:obj:`~pyrogram.types.Chat`, *optional*):
+            Conversation the message belongs to.
+
+        forward_origin (:obj:`~pyrogram.types.MessageOrigin`, *optional*):
+            Information about the original message for forwarded messages
+
+        is_topic_message (``bool``, *optional*):
+            True, if the message is sent to a forum topic.
+
+        is_automatic_forward (``bool``, *optional*):
+            True, if the message is a channel post that was automatically forwarded to the connected discussion group.
+
+        reply_to_message_id (``int``, *optional*):
+            The id of the message which this message directly replied to.
+
+        reply_to_message (:obj:`~pyrogram.types.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.
+
+        external_reply (:obj:`~pyrogram.types.ExternalReplyInfo`, *optional*):
+            Information about the message that is being replied to, which may come from another chat or forum topic
+
+        quote (:obj:`~pyrogram.types.TextQuote`, *optional*):
+            For replies that quote part of the original message, the quoted part of the message
+
+        reply_to_story (:obj:`~pyrogram.types.Story`, *optional*):
+            For replies to a story, the original story
+
+        via_bot (:obj:`~pyrogram.types.User`):
+            The information of the bot that generated the message from an inline query of a user.
+
+        edit_date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the message was last edited.
+
+        has_protected_content (``bool``, *optional*):
+            True, if the message can't be forwarded.
+
+        is_from_offline (``bool``, *optional*):
+            True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message
+
+        media_group_id (``str``, *optional*):
+            The unique identifier of a media message group this message belongs to.
+
+        author_signature (``str``, *optional*):
+            Signature of the post author for messages in channels, or the custom title of an anonymous group
+            administrator.
+
+        text (``str``, *optional*):
+            For text messages, the actual UTF-8 text of the message, 0-4096 characters.
+            If the message contains entities (bold, italic, ...) you can access *text.markdown* or
+            *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:`~pyrogram.types.MessageEntity`, *optional*):
+            For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.
+
+        link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*):
+            Options used for link preview generation for the message, if it is a text message and link preview options were changed
+
+        effect_id (``str``, *optional*):
+            Unique identifier of the message effect added to the message. Use :meth:`~pyrogram.Client.get_message_effects` to get the list of available message effect ids.
+
+        animation (:obj:`~pyrogram.types.Animation`, *optional*):
+            Message is an animation, information about the animation.
+
+        audio (:obj:`~pyrogram.types.Audio`, *optional*):
+            Message is an audio file, information about the file.
+
+        document (:obj:`~pyrogram.types.Document`, *optional*):
+            Message is a general file, information about the file.
+
+        paid_media (:obj:`~pyrogram.types.PaidMediaInfo`, *optional*):
+            Message contains paid media; information about the paid media.
+
+        photo (:obj:`~pyrogram.types.Photo`, *optional*):
+            Message is a photo, information about the photo.
+
+        sticker (:obj:`~pyrogram.types.Sticker`, *optional*):
+            Message is a sticker, information about the sticker.
+
+        story (:obj:`~pyrogram.types.Story`, *optional*):
+            Message might be a forwarded story.
+
+        video (:obj:`~pyrogram.types.Video`, *optional*):
+            Message is a video, information about the video.
+
+        video_note (:obj:`~pyrogram.types.VideoNote`, *optional*):
+            Message is a video note, information about the video message.
+
+        voice (:obj:`~pyrogram.types.Voice`, *optional*):
+            Message is a voice message, information about the file.
+
+        caption (``str``, *optional*):
+            Caption for the audio, document, photo, video or voice, 0-1024 characters.
+            If the message contains caption entities (bold, italic, ...) you can access *caption.markdown* or
+            *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*.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
+            For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear
+            in the caption.
+
+        show_caption_above_media (``bool``, *optional*):
+            True, if the caption must be shown above the message media.
+
+        has_media_spoiler (``bool``, *optional*):
+            True, if the message media is covered by a spoiler animation.
+
+        contact (:obj:`~pyrogram.types.Contact`, *optional*):
+            Message is a shared contact, information about the contact.
+
+        dice (:obj:`~pyrogram.types.Dice`, *optional*):
+            A dice containing a value that is randomly generated by Telegram.
+
+        game (:obj:`~pyrogram.types.Game`, *optional*):
+            Message is a game, information about the game.
+
+        poll (:obj:`~pyrogram.types.Poll`, *optional*):
+            Message is a native poll, information about the poll.
+
+        venue (:obj:`~pyrogram.types.Venue`, *optional*):
+            Message is a venue, information about the venue.
+
+        location (:obj:`~pyrogram.types.Location`, *optional*):
+            Message is a shared location, information about the location.
+
+        new_chat_members (List of :obj:`~pyrogram.types.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:`~pyrogram.types.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:`~pyrogram.types.Photo`, *optional*):
+            A chat photo was change to this value.
+
+        delete_chat_photo (``bool``, *optional*):
+            Service message: the chat photo was deleted.
+
+        group_chat_created (``bool``, *optional*):
+            Service message: the group has been created.
+
+        supergroup_chat_created (``bool``, *optional*):
+            Service message: the supergroup has been created.
+            This field can't be received in a message coming through updates, because bot can't be a member of a
+            supergroup when it is created. It can only be found in reply_to_message if someone replies to a very
+            first message in a directly created supergroup.
+
+        channel_chat_created (``bool``, *optional*):
+            Service message: the channel has been created.
+            This field can't be received in a message coming through updates, because bot can't be a member of a
+            channel when it is created. It can only be found in reply_to_message if someone replies to a very
+            first message in a channel.
+
+        message_auto_delete_timer_changed (:obj:`~pyrogram.types.MessageAutoDeleteTimerChanged`, *optional*):
+            Service message: auto-delete timer settings changed in the chat.
+
+        migrate_to_chat_id (``int``, *optional*):
+            The group has been migrated to a supergroup with the specified identifier.
+            This number may be greater than 32 bits and some programming languages may have difficulty/silent defects
+            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.
+
+        migrate_from_chat_id (``int``, *optional*):
+            The supergroup has been migrated from a group with the specified identifier.
+            This number may be greater than 32 bits and some programming languages may have difficulty/silent defects
+            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:`~pyrogram.types.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.
+
+        invoice (:obj:`~pyrogram.types.Invoice`, *optional*):
+            Message is an invoice for a `payment `_, information about the invoice. `More about payments » `_
+
+        successful_payment (:obj:`~pyrogram.types.SuccessfulPayment`, *optional*):
+            Message is a service message about a successful payment, information about the payment. `More about payments `_
+
+        refunded_payment (:obj:`~pyrogram.types.RefundedPayment`, *optional*):
+            Message is a service message about a refunded payment, information about the payment. `More about payments `_
+
+        users_shared (:obj:`~pyrogram.types.UsersShared`, *optional*):
+            Service message: users were shared with the bot
+
+        chat_shared (:obj:`~pyrogram.types.ChatShared`, *optional*):
+            Service message: a chat was shared with the bot
+
+        boost_added (:obj:`~pyrogram.types.ChatBoostAdded`, *optional*):
+            Service message: user boosted the chat
+
+        forum_topic_created (:obj:`~pyrogram.types.ForumTopicCreated`, *optional*):
+            Service message: forum topic created
+
+        forum_topic_edited (:obj:`~pyrogram.types.ForumTopicEdited`, *optional*):
+            Service message: forum topic edited
+
+        forum_topic_closed (:obj:`~pyrogram.types.ForumTopicClosed`, *optional*):
+            Service message: forum topic closed
+
+        forum_topic_reopened (:obj:`~pyrogram.types.ForumTopicReopened`, *optional*):
+            Service message: forum topic reopened
+
+        general_forum_topic_hidden (:obj:`~pyrogram.types.GeneralForumTopicHidden`, *optional*):
+            Service message: the 'General' forum topic hidden
+
+        general_forum_topic_unhidden (:obj:`~pyrogram.types.GeneralForumTopicUnhidden`, *optional*):
+            Service message: the 'General' forum topic unhidden
+
+        giveaway_created (``bool``, *optional*):
+            Service message: a scheduled giveaway was created.
+            This object represents a service message about the creation of a scheduled giveaway.
+            Currently holds no information.
+
+        giveaway (:obj:`~pyrogram.types.Giveaway`, *optional*):
+            The message is a scheduled giveaway message
+
+        giveaway_winners (:obj:`~pyrogram.types.GiveawayWinners`, *optional*):
+            A giveaway with public winners was completed        
+
+        giveaway_completed (:obj:`~pyrogram.types.GiveawayCompleted`, *optional*):
+            Service message: a giveaway without public winners was completed
+
+        video_chat_scheduled (:obj:`~pyrogram.types.VideoChatScheduled`, *optional*):
+            Service message: voice chat scheduled.
+
+        video_chat_started (:obj:`~pyrogram.types.VideoChatStarted`, *optional*):
+            Service message: the voice chat started.
+
+        video_chat_ended (:obj:`~pyrogram.types.VideoChatEnded`, *optional*):
+            Service message: the voice chat has ended.
+
+        video_chat_participants_invited (:obj:`~pyrogram.types.VideoChatParticipantsInvited`, *optional*):
+            Service message: new members were invited to the voice chat.
+
+        web_app_data (:obj:`~pyrogram.types.WebAppData`, *optional*):
+            Service message: web app data sent to the bot.
+
+        reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        empty (``bool``, *optional*):
+            The message is empty.
+            A message can be empty in case it was deleted or you tried to retrieve a message that doesn't exist yet.
+
+        mentioned (``bool``, *optional*):
+            The message contains a mention.
+
+        service (:obj:`~pyrogram.enums.MessageServiceType`, *optional*):
+            The message is a service message.
+            This field will contain the enumeration type of the service message.
+            You can use ``service = getattr(message, message.service.value)`` to access the service message.
+
+        media (:obj:`~pyrogram.enums.MessageMediaType`, *optional*):
+            The message is a media message.
+            This field will contain the enumeration type of the media message.
+            You can use ``media = getattr(message, message.media.value)`` to access the media message.
+
+        web_page (:obj:`~pyrogram.types.WebPage`, *optional*):
+            Message was sent with a webpage preview.
+
+        game_high_score (:obj:`~pyrogram.types.GameHighScore`, *optional*):
+            The game score for a user.
+            The reply_to_message field will contain the game Message.
+
+        views (``int``, *optional*):
+            View counter for channel posts.
+
+	    forwards (``int``, *optional*):
+            Forward counter for channel posts.
+
+        outgoing (``bool``, *optional*):
+            Whether the message is incoming or outgoing.
+            Messages received from other chats are incoming (*outgoing* is False).
+            Messages sent from yourself to other chats are outgoing (*outgoing* is True).
+            An exception is made for your own personal chat; messages sent there will be incoming.
+
+        matches (List of regex Matches, *optional*):
+            A list containing all `Match Objects `_ that match
+            the text of this message. Only applicable when using :obj:`Filters.regex `.
+
+        command (List of ``str``, *optional*):
+            A list containing the command and its arguments, if any.
+            E.g.: "/start 1 2 3" would produce ["start", "1", "2", "3"].
+            Only applicable when using :obj:`~pyrogram.filters.command`.
+
+        reactions (List of :obj:`~pyrogram.types.Reaction`):
+            List of the reactions to this message.
+
+        custom_action (``str``, *optional*):
+            Custom action (most likely not supported by the current layer, an upgrade might be needed)
+
+        gift_code (:obj:`~pyrogram.types.GiftCode`, *optional*):
+            Contains a `Telegram Premium giftcode link `_.
+
+        gifted_premium (:obj:`~pyrogram.types.GiftedPremium`, *optional*):
+            Info about a gifted Telegram Premium subscription
+
+        gifted_stars (:obj:`~pyrogram.types.GiftedStars`, *optional*):
+            Info about gifted Telegram Stars
+
+        link (``str``, *property*):
+            Generate a link to this message, only for groups and channels.
+
+    """
+
+    # TODO: Add game missing field. Also connected_website
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: int,
+        message_thread_id: int = None,
+        from_user: "types.User" = None,
+        sender_chat: "types.Chat" = None,
+        sender_boost_count: int = None,
+        sender_business_bot: "types.User" = None,
+        date: datetime = None,
+        business_connection_id: str = None,
+        chat: "types.Chat" = None,
+        forward_origin: "types.MessageOrigin" = None,
+        is_topic_message: bool = None,
+        is_automatic_forward: bool = None,
+        reply_to_message_id: int = None,
+        reply_to_message: "Message" = None,
+        external_reply: "types.ExternalReplyInfo" = None,
+        quote: "types.TextQuote" = None,
+        reply_to_story: "types.Story" = None,
+        via_bot: "types.User" = None,
+        edit_date: datetime = None,
+        has_protected_content: bool = None,
+        is_from_offline: bool = None,
+        media_group_id: str = None,
+        author_signature: str = None,
+        text: Str = None,
+        entities: List["types.MessageEntity"] = None,
+        link_preview_options: "types.LinkPreviewOptions" = None,
+        effect_id: str = None,
+        animation: "types.Animation" = None,
+        audio: "types.Audio" = None,
+        document: "types.Document" = None,
+        paid_media: "types.PaidMediaInfo" = None,
+        photo: "types.Photo" = None,
+        sticker: "types.Sticker" = None,
+        story: "types.Story" = None,
+        video: "types.Video" = None,
+        video_note: "types.VideoNote" = None,
+        voice: "types.Voice" = None,
+        caption: Str = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        has_media_spoiler: bool = None,
+        contact: "types.Contact" = None,
+        dice: "types.Dice" = None,
+        game: "types.Game" = None,
+        poll: "types.Poll" = None,
+        venue: "types.Venue" = None,
+        location: "types.Location" = None,
+        new_chat_members: List["types.User"] = None,
+        left_chat_member: "types.User" = None,
+        new_chat_title: str = None,
+        new_chat_photo: "types.Photo" = None,
+        delete_chat_photo: bool = None,
+        group_chat_created: bool = None,
+        supergroup_chat_created: bool = None,
+        channel_chat_created: bool = None,
+        message_auto_delete_timer_changed: "types.MessageAutoDeleteTimerChanged" = None,
+        migrate_to_chat_id: int = None,
+        migrate_from_chat_id: int = None,
+        pinned_message: "Message" = None,
+        invoice: "types.Invoice" = None,
+        successful_payment: "types.SuccessfulPayment" = None,
+        refunded_payment: "types.RefundedPayment" = None,
+        users_shared: "types.UsersShared" = None,
+        chat_shared: "types.ChatShared" = None,
+
+
+
+
+
+        boost_added: "types.ChatBoostAdded" = None,
+        forum_topic_created: "types.ForumTopicCreated" = None,
+        forum_topic_edited: "types.ForumTopicEdited" = None,
+        forum_topic_closed: "types.ForumTopicClosed" = None,
+        forum_topic_reopened: "types.ForumTopicReopened" = None,
+        general_forum_topic_hidden: "types.GeneralForumTopicHidden" = None,
+        general_forum_topic_unhidden: "types.GeneralForumTopicUnhidden" = None,
+        giveaway_created: bool = None,
+        giveaway: "types.Giveaway" = None,
+        giveaway_winners: "types.GiveawayWinners" = None,
+        giveaway_completed: "types.GiveawayCompleted" = None,
+        video_chat_scheduled: "types.VideoChatScheduled" = None,
+        video_chat_started: "types.VideoChatStarted" = None,
+        video_chat_ended: "types.VideoChatEnded" = None,
+        video_chat_participants_invited: "types.VideoChatParticipantsInvited" = None,
+        web_app_data: "types.WebAppData" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+
+        gift_code: "types.GiftCode" = None,
+        gifted_premium: "types.GiftedPremium" = None,
+        gifted_stars: "types.GiftedStars" = None,
+        empty: bool = None,
+        mentioned: bool = None,
+        service: "enums.MessageServiceType" = None,
+        scheduled: bool = None,
+        from_scheduled: bool = None,
+        media: "enums.MessageMediaType" = None,
+        web_page: "types.WebPage" = None,
+        game_high_score: int = None,
+        views: int = None,
+        forwards: int = None,
+        outgoing: bool = None,
+        matches: List[Match] = None,
+        command: List[str] = None,
+        reactions: List["types.Reaction"] = None,
+        custom_action: str = None,
+
+        _raw = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.from_user = from_user
+        self.sender_chat = sender_chat
+        self.date = date
+        self.chat = chat
+        self.forward_origin = forward_origin
+        self.reply_to_message_id = reply_to_message_id
+        self.message_thread_id = message_thread_id
+        self.reply_to_message = reply_to_message
+        self.mentioned = mentioned
+        self.empty = empty
+        self.service = service
+        self.scheduled = scheduled
+        self.from_scheduled = from_scheduled
+        self.media = media
+        self.edit_date = edit_date
+        self.media_group_id = media_group_id
+        self.author_signature = author_signature
+        self.has_protected_content = has_protected_content
+        self.is_from_offline = is_from_offline
+        self.has_media_spoiler = has_media_spoiler
+        self.text = text
+        self.entities = entities
+        self.caption_entities = caption_entities
+        self.show_caption_above_media = show_caption_above_media
+        self.audio = audio
+        self.document = document
+        self.photo = photo
+        self.sticker = sticker
+        self.animation = animation
+        self.game = game
+        self.video = video
+        self.voice = voice
+        self.video_note = video_note
+        self.caption = caption
+        self.contact = contact
+        self.location = location
+        self.venue = venue
+        self.web_page = web_page
+        self.poll = poll
+        self.dice = dice
+        self.new_chat_members = new_chat_members
+        self.left_chat_member = left_chat_member
+        self.new_chat_title = new_chat_title
+        self.new_chat_photo = new_chat_photo
+        self.delete_chat_photo = delete_chat_photo
+        self.group_chat_created = group_chat_created
+        self.supergroup_chat_created = supergroup_chat_created
+        self.channel_chat_created = channel_chat_created
+        self.message_auto_delete_timer_changed = message_auto_delete_timer_changed
+        self.migrate_to_chat_id = migrate_to_chat_id
+        self.migrate_from_chat_id = migrate_from_chat_id
+        self.pinned_message = pinned_message
+        self.invoice = invoice
+        self.game_high_score = game_high_score
+        self.views = views
+        self.forwards = forwards
+        self.via_bot = via_bot
+        self.outgoing = outgoing
+        self.matches = matches
+        self.command = command
+        self.reply_markup = reply_markup
+        self.video_chat_scheduled = video_chat_scheduled
+        self.video_chat_started = video_chat_started
+        self.video_chat_ended = video_chat_ended
+        self.video_chat_participants_invited = video_chat_participants_invited
+        self.web_app_data = web_app_data
+        self.reactions = reactions
+        self.link_preview_options = link_preview_options
+        self.effect_id = effect_id
+        self.external_reply = external_reply
+        self.is_topic_message = is_topic_message
+        self.is_automatic_forward = is_automatic_forward
+        self.sender_boost_count = sender_boost_count
+        self.boost_added = boost_added
+        self.quote = quote
+        self.story = story
+        self.reply_to_story = reply_to_story
+        self.giveaway = giveaway
+        self.giveaway_created = giveaway_created
+        self.users_shared = users_shared
+        self.chat_shared = chat_shared
+        self.giveaway_completed = giveaway_completed
+        self.giveaway_winners = giveaway_winners
+        self.gift_code = gift_code
+        self.gifted_premium = gifted_premium
+        self.gifted_stars = gifted_stars
+        self.forum_topic_created = forum_topic_created
+        self.forum_topic_edited = forum_topic_edited
+        self.forum_topic_closed = forum_topic_closed
+        self.forum_topic_reopened = forum_topic_reopened
+        self.general_forum_topic_hidden = general_forum_topic_hidden
+        self.general_forum_topic_unhidden = general_forum_topic_unhidden
+        self.custom_action = custom_action
+        self.sender_business_bot = sender_business_bot
+        self.business_connection_id = business_connection_id
+        self.successful_payment = successful_payment
+        self.paid_media = paid_media
+        self.refunded_payment = refunded_payment
+        self._raw = _raw
+
+    @staticmethod
+    async def _parse(
+        client: "pyrogram.Client",
+        message: raw.base.Message,
+        users: dict,
+        chats: dict,
+        is_scheduled: bool = False,
+        replies: int = 1,
+        business_connection_id: str = None,
+        raw_reply_to_message: raw.base.Message = None
+    ):
+        if isinstance(message, raw.types.MessageEmpty):
+            return Message(
+                id=message.id,
+                empty=True,
+                business_connection_id=business_connection_id if business_connection_id else None,
+                client=client,
+                _raw=message
+            )
+
+        from_id = utils.get_raw_peer_id(message.from_id)
+        peer_id = utils.get_raw_peer_id(message.peer_id)
+        user_id = from_id or peer_id
+
+        if isinstance(message.from_id, raw.types.PeerUser) and isinstance(message.peer_id, raw.types.PeerUser):
+            if from_id not in users or peer_id not in users:
+                try:
+                    r = await client.invoke(
+                        raw.functions.users.GetUsers(
+                            id=[
+                                await client.resolve_peer(from_id),
+                                await client.resolve_peer(peer_id)
+                            ]
+                        )
+                    )
+                except PeerIdInvalid:
+                    pass
+                else:
+                    users.update({i.id: i for i in r})
+
+        if isinstance(message, raw.types.MessageService):
+            action = message.action
+
+            chat = types.Chat._parse(client, message, users, chats, is_chat=True)
+            from_user = types.User._parse(client, users.get(user_id, None))
+            sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None
+
+            new_chat_members = None
+            left_chat_member = None
+            new_chat_title = None
+            delete_chat_photo = None
+            migrate_to_chat_id = None
+            migrate_from_chat_id = None
+            group_chat_created = None
+            supergroup_chat_created = None
+            channel_chat_created = None
+            new_chat_photo = None
+            video_chat_scheduled = None
+            video_chat_started = None
+            video_chat_ended = None
+            video_chat_participants_invited = None
+            web_app_data = None
+            gift_code = None
+            gifted_premium = None
+            gifted_stars = None
+            giveaway_created = None
+            users_shared = None
+            chat_shared = None
+            message_auto_delete_timer_changed = None
+            boost_added = None
+            giveaway_completed = None
+            custom_action = None
+
+            forum_topic_created = None
+            forum_topic_edited = None
+            forum_topic_closed = None
+            forum_topic_reopened = None
+            general_forum_topic_hidden = None
+            general_forum_topic_unhidden = None
+            successful_payment = None
+            refunded_payment = None
+
+            service_type = None
+
+            if isinstance(action, raw.types.MessageActionChatAddUser):
+                new_chat_members = [types.User._parse(client, users[i]) for i in action.users]
+                service_type = enums.MessageServiceType.NEW_CHAT_MEMBERS
+            elif isinstance(action, raw.types.MessageActionChatJoinedByLink):
+                new_chat_members = [types.User._parse(client, users[utils.get_raw_peer_id(message.from_id)])]
+                service_type = enums.MessageServiceType.NEW_CHAT_MEMBERS
+            elif isinstance(action, raw.types.MessageActionChatJoinedByRequest):
+                new_chat_members = [types.User._parse(client, users[utils.get_raw_peer_id(message.from_id)])]
+                service_type = enums.MessageServiceType.NEW_CHAT_MEMBERS
+            elif isinstance(action, raw.types.MessageActionChatDeleteUser):
+                left_chat_member = types.User._parse(client, users[action.user_id])
+                service_type = enums.MessageServiceType.LEFT_CHAT_MEMBERS
+            elif isinstance(action, raw.types.MessageActionChatEditTitle):
+                new_chat_title = action.title
+                service_type = enums.MessageServiceType.NEW_CHAT_TITLE
+            elif isinstance(action, raw.types.MessageActionChatDeletePhoto):
+                delete_chat_photo = True
+                service_type = enums.MessageServiceType.DELETE_CHAT_PHOTO
+            elif isinstance(action, raw.types.MessageActionChatMigrateTo):
+                migrate_to_chat_id = action.channel_id
+                service_type = enums.MessageServiceType.MIGRATE_TO_CHAT_ID
+            elif isinstance(action, raw.types.MessageActionChannelMigrateFrom):
+                migrate_from_chat_id = action.chat_id
+                service_type = enums.MessageServiceType.MIGRATE_FROM_CHAT_ID
+            elif isinstance(action, raw.types.MessageActionChatCreate):
+                group_chat_created = True
+                service_type = enums.MessageServiceType.GROUP_CHAT_CREATED
+            elif isinstance(action, raw.types.MessageActionChannelCreate):
+                if chat.type == enums.ChatType.SUPERGROUP:
+                    supergroup_chat_created = True
+                    service_type = enums.MessageServiceType.SUPERGROUP_CHAT_CREATED
+                else:
+                    channel_chat_created = True
+                    service_type = enums.MessageServiceType.CHANNEL_CHAT_CREATED
+            elif isinstance(action, raw.types.MessageActionChatEditPhoto):
+                new_chat_photo = types.Photo._parse(client, action.photo)
+                service_type = enums.MessageServiceType.NEW_CHAT_PHOTO
+            elif isinstance(action, raw.types.MessageActionGroupCallScheduled):
+                video_chat_scheduled = types.VideoChatScheduled._parse(action)
+                service_type = enums.MessageServiceType.VIDEO_CHAT_SCHEDULED
+            elif isinstance(action, raw.types.MessageActionGroupCall):
+                if action.duration:
+                    video_chat_ended = types.VideoChatEnded._parse(action)
+                    service_type = enums.MessageServiceType.VIDEO_CHAT_ENDED
+                else:
+                    video_chat_started = types.VideoChatStarted()
+                    service_type = enums.MessageServiceType.VIDEO_CHAT_STARTED
+            elif isinstance(action, raw.types.MessageActionInviteToGroupCall):
+                video_chat_participants_invited = types.VideoChatParticipantsInvited._parse(client, action, users)
+                service_type = enums.MessageServiceType.VIDEO_CHAT_PARTICIPANTS_INVITED
+            elif isinstance(action, raw.types.MessageActionWebViewDataSentMe):
+                web_app_data = types.WebAppData._parse(action)
+                service_type = enums.MessageServiceType.WEB_APP_DATA
+            elif isinstance(action, raw.types.MessageActionGiveawayLaunch):
+                giveaway_created = True
+                service_type = enums.MessageServiceType.GIVEAWAY_CREATED
+            elif isinstance(action, raw.types.MessageActionGiftCode):
+                gift_code = types.GiftCode._parse(client, action, chats)
+                service_type = enums.MessageServiceType.GIFT_CODE
+            elif isinstance(action, raw.types.MessageActionGiftPremium):
+                gifted_premium = await types.GiftedPremium._parse(client, action, from_user.id)
+                service_type = enums.MessageServiceType.GIFTED_PREMIUM
+            elif isinstance(action, raw.types.MessageActionGiftStars):
+                gifted_stars = await types.GiftedStars._parse(client, action, from_user.id, chat.id)
+                service_type = enums.MessageServiceType.GIFTED_STARS
+
+            elif (
+                isinstance(action, raw.types.MessageActionRequestedPeer) or
+                isinstance(action, raw.types.MessageActionRequestedPeerSentMe)
+            ):
+                _requested_chats = []
+                _requested_users = []
+
+                for requested_peer in action.peers:
+                    if isinstance(requested_peer, raw.types.RequestedPeerUser):
+                        _requested_users.append(
+                            types.Chat(
+                                client=client,
+                                id=requested_peer.user_id,
+                                first_name=requested_peer.first_name,
+                                last_name=requested_peer.last_name,
+                                username=requested_peer.username,
+                                photo=types.Photo._parse(
+                                    client=client,
+                                    photo=getattr(requested_peer, "photo", None)
+                                )
+                            )
+                        )
+                    elif isinstance(requested_peer, raw.types.RequestedPeerChat):
+                        _requested_chats.append(
+                            types.Chat(
+                                client=client,
+                                id=-requested_peer.chat_id,
+                                title=requested_peer.title,
+                                photo=types.Photo._parse(
+                                    client=client,
+                                    photo=getattr(requested_peer, "photo", None)
+                                )
+                            )
+                        )
+                    elif isinstance(requested_peer, raw.types.RequestedPeerChannel):
+                        _requested_chats.append(
+                            types.Chat(
+                                client=client,
+                                id=utils.get_channel_id(
+                                    requested_peer.channel_id
+                                ),
+                                title=requested_peer.title,
+                                username=requested_peer.username,
+                                photo=types.Photo._parse(
+                                    client=client,
+                                    photo=getattr(requested_peer, "photo", None)
+                                )
+                            )
+                        )
+                    else:
+                        raw_peer_id = utils.get_raw_peer_id(requested_peer)
+
+                        if isinstance(requested_peer, raw.types.PeerUser):
+                            _requested_users.append(
+                                types.Chat._parse_user_chat(
+                                    client,
+                                    users.get(raw_peer_id)
+                                )
+                            )
+                        else:
+                            _requested_chats.append(
+                                types.Chat._parse_chat(
+                                    client,
+                                    chats.get(raw_peer_id)
+                                )
+                            )
+
+                if _requested_users:
+                    service_type = enums.MessageServiceType.USERS_SHARED
+                    users_shared = types.UsersShared(
+                        request_id=action.button_id,
+                        users=types.List(_requested_users) or None
+                    )
+                if _requested_chats:
+                    service_type = enums.MessageServiceType.CHAT_SHARED
+                    chat_shared = types.ChatShared(
+                        request_id=action.button_id,
+                        chats=types.List(_requested_chats) or None
+                    )
+
+            elif isinstance(action, raw.types.MessageActionSetMessagesTTL):
+                message_auto_delete_timer_changed = types.MessageAutoDeleteTimerChanged(
+                    message_auto_delete_time=action.period
+                )
+                service_type = enums.MessageServiceType.MESSAGE_AUTO_DELETE_TIMER_CHANGED
+                auto_setting_from = getattr(action, "auto_setting_from", None)
+                if auto_setting_from:
+                    message_auto_delete_timer_changed.from_user = types.User._parse(
+                        client,
+                        users[auto_setting_from]
+                    )
+
+            elif isinstance(action, raw.types.MessageActionBoostApply):
+                service_type = enums.MessageServiceType.CHAT_BOOST_ADDED
+                boost_added = types.ChatBoostAdded._parse(
+                    action
+                )
+
+            elif isinstance(action, raw.types.MessageActionGiveawayResults):
+                service_type = enums.MessageServiceType.GIVEAWAY_COMPLETED
+                giveaway_completed = types.GiveawayCompleted._parse(
+                    client,
+                    action,
+                    getattr(
+                        getattr(
+                            message,
+                            "reply_to",
+                            None
+                        ),
+                        "reply_to_msg_id",
+                        None
+                    )
+                )
+
+            elif isinstance(action, raw.types.MessageActionCustomAction):
+                service_type = enums.MessageServiceType.CUSTOM_ACTION
+                custom_action = action.message
+
+            elif isinstance(action, raw.types.MessageActionTopicCreate):
+                title = action.title
+                icon_color = action.icon_color
+                icon_emoji_id = getattr(action, "icon_emoji_id", None)
+                service_type = enums.MessageServiceType.FORUM_TOPIC_CREATED
+                forum_topic_created = types.ForumTopicCreated._parse(action)
+
+            elif isinstance(action, (raw.types.MessageActionPaymentSent, raw.types.MessageActionPaymentSentMe)):
+                successful_payment = types.SuccessfulPayment._parse(client, action)
+                service_type = enums.MessageServiceType.SUCCESSFUL_PAYMENT
+            
+            elif isinstance(action, raw.types.MessageActionPaymentRefunded):
+                refunded_payment = types.RefundedPayment._parse(client, action)
+                service_type = enums.MessageServiceType.REFUNDED_PAYMENT
+
+            elif isinstance(action, raw.types.MessageActionTopicEdit):
+                title = getattr(action, "title", None)
+                icon_emoji_id = getattr(action, "icon_emoji_id", None)
+                closed = getattr(action, "closed", None)
+                hidden = getattr(action, "hidden", None)
+
+                if title:
+                    forum_topic_edited = types.ForumTopicEdited._parse(action)
+                    service_type = enums.MessageServiceType.FORUM_TOPIC_EDITED
+                elif hidden in {True, False}:
+                    if not bool(message.reply_to):
+                        if action.hidden:
+                            service_type = enums.MessageServiceType.GENERAL_FORUM_TOPIC_HIDDEN
+                            general_forum_topic_hidden = types.GeneralForumTopicHidden()
+                        else:
+                            service_type = enums.MessageServiceType.GENERAL_FORUM_TOPIC_UNHIDDEN
+                            general_forum_topic_unhidden = types.GeneralForumTopicUnhidden()
+                    # else: # TODO
+                elif closed in {True, False}:
+                    if action.closed:
+                        service_type = enums.MessageServiceType.FORUM_TOPIC_CLOSED
+                        forum_topic_closed = types.ForumTopicClosed()
+                    else:
+                        service_type = enums.MessageServiceType.FORUM_TOPIC_REOPENED
+                        forum_topic_reopened = types.ForumTopicReopened()
+
+            parsed_message = Message(
+                id=message.id,
+                date=utils.timestamp_to_datetime(message.date),
+                chat=chat,
+                from_user=from_user,
+                sender_chat=sender_chat,
+                service=service_type,
+                new_chat_members=new_chat_members,
+                left_chat_member=left_chat_member,
+                new_chat_title=new_chat_title,
+                new_chat_photo=new_chat_photo,
+                delete_chat_photo=delete_chat_photo,
+                migrate_to_chat_id=utils.get_channel_id(migrate_to_chat_id) if migrate_to_chat_id else None,
+                migrate_from_chat_id=-migrate_from_chat_id if migrate_from_chat_id else None,
+                group_chat_created=group_chat_created,
+                supergroup_chat_created=supergroup_chat_created,
+                channel_chat_created=channel_chat_created,
+                video_chat_scheduled=video_chat_scheduled,
+                video_chat_started=video_chat_started,
+                video_chat_ended=video_chat_ended,
+                video_chat_participants_invited=video_chat_participants_invited,
+                web_app_data=web_app_data,
+                giveaway_created=giveaway_created,
+                giveaway_completed=giveaway_completed,
+                gift_code=gift_code,
+                gifted_premium=gifted_premium,
+                gifted_stars=gifted_stars,
+                users_shared=users_shared,
+                chat_shared=chat_shared,
+                successful_payment=successful_payment,
+                message_auto_delete_timer_changed=message_auto_delete_timer_changed,
+                boost_added=boost_added,
+                forum_topic_created=forum_topic_created,
+                forum_topic_edited=forum_topic_edited,
+                forum_topic_closed=forum_topic_closed,
+                forum_topic_reopened=forum_topic_reopened,
+                general_forum_topic_hidden=general_forum_topic_hidden,
+                general_forum_topic_unhidden=general_forum_topic_unhidden,
+                custom_action=custom_action,
+                client=client
+            )
+
+            if isinstance(action, raw.types.MessageActionPinMessage):
+                try:
+                    parsed_message.pinned_message = await client.get_messages(
+                        chat_id=parsed_message.chat.id,
+                        reply_to_message_ids=message.id,
+                        replies=0
+                    )
+                    parsed_message.service = enums.MessageServiceType.PINNED_MESSAGE
+                except MessageIdsEmpty:
+                    pass
+
+            if isinstance(action, raw.types.MessageActionGameScore):
+                parsed_message.game_high_score = types.GameHighScore._parse_action(client, message, users)
+
+                if message.reply_to and replies:
+                    try:
+                        parsed_message.reply_to_message = await client.get_messages(
+                            chat_id=parsed_message.chat.id,
+                            reply_to_message_ids=message.id,
+                            replies=0
+                        )
+
+                        parsed_message.service = enums.MessageServiceType.GAME_HIGH_SCORE
+                    except MessageIdsEmpty:
+                        pass
+
+        if isinstance(message, raw.types.Message):
+            entities = [types.MessageEntity._parse(client, entity, users) for entity in message.entities]
+            entities = types.List(filter(lambda x: x is not None, entities))
+
+            forward_origin = None
+            forward_header = message.fwd_from  # type: raw.types.MessageFwdHeader
+
+            if forward_header:
+                forward_origin = types.MessageOrigin._parse(
+                    client,
+                    forward_header,
+                    users,
+                    chats,
+                )
+
+            photo = None
+            location = None
+            contact = None
+            venue = None
+            game = None
+            audio = None
+            voice = None
+            animation = None
+            video = None
+            video_note = None
+            sticker = None
+            story = None
+            document = None
+            web_page = None
+            poll = None
+            dice = None
+            giveaway = None
+            giveaway_winners = None
+            invoice = None
+            paid_media = None
+
+            media = message.media
+            media_type = None
+            has_media_spoiler = None
+
+            link_preview_options = None
+            web_page_url = None
+
+            if media:
+                if isinstance(media, raw.types.MessageMediaPhoto):
+                    photo = types.Photo._parse(client, media.photo, media.ttl_seconds, media.spoiler)
+                    media_type = enums.MessageMediaType.PHOTO
+                    has_media_spoiler = media.spoiler
+                elif isinstance(media, raw.types.MessageMediaGeo):
+                    location = types.Location._parse(client, media.geo)
+                    media_type = enums.MessageMediaType.LOCATION
+                elif isinstance(media, raw.types.MessageMediaContact):
+                    contact = types.Contact._parse(client, media)
+                    media_type = enums.MessageMediaType.CONTACT
+                elif isinstance(media, raw.types.MessageMediaVenue):
+                    venue = types.Venue._parse(client, media)
+                    media_type = enums.MessageMediaType.VENUE
+                elif isinstance(media, raw.types.MessageMediaGame):
+                    game = types.Game._parse(client, media.game)
+                    media_type = enums.MessageMediaType.GAME
+                elif isinstance(media, raw.types.MessageMediaDocument):
+                    doc = media.document
+
+                    if isinstance(doc, raw.types.Document):
+                        attributes = {type(i): i for i in doc.attributes}
+
+                        file_name = getattr(
+                            attributes.get(
+                                raw.types.DocumentAttributeFilename, None
+                            ), "file_name", None
+                        )
+
+                        if raw.types.DocumentAttributeAnimated in attributes:
+                            video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
+                            animation = types.Animation._parse(client, doc, video_attributes, file_name)
+                            media_type = enums.MessageMediaType.ANIMATION
+                            has_media_spoiler = media.spoiler
+                        elif raw.types.DocumentAttributeSticker in attributes:
+                            sticker = await types.Sticker._parse(client, doc, attributes)
+                            media_type = enums.MessageMediaType.STICKER
+                        elif raw.types.DocumentAttributeVideo in attributes:
+                            video_attributes = attributes[raw.types.DocumentAttributeVideo]
+
+                            if video_attributes.round_message:
+                                video_note = types.VideoNote._parse(client, doc, video_attributes, media.ttl_seconds)
+                                media_type = enums.MessageMediaType.VIDEO_NOTE
+                            else:
+                                video = types.Video._parse(client, doc, video_attributes, file_name, media.ttl_seconds)
+                                media_type = enums.MessageMediaType.VIDEO
+                                has_media_spoiler = media.spoiler
+                        elif raw.types.DocumentAttributeAudio in attributes:
+                            audio_attributes = attributes[raw.types.DocumentAttributeAudio]
+
+                            if audio_attributes.voice:
+                                voice = types.Voice._parse(client, doc, audio_attributes, media.ttl_seconds)
+                                media_type = enums.MessageMediaType.VOICE
+                            else:
+                                audio = types.Audio._parse(client, doc, audio_attributes, file_name)
+                                media_type = enums.MessageMediaType.AUDIO
+                        else:
+                            document = types.Document._parse(client, doc, file_name)
+                            media_type = enums.MessageMediaType.DOCUMENT
+
+                    elif doc is None:
+                        has_media_spoiler = media.spoiler
+                        if media.video:
+                            video = types.Video._parse(client, doc, None, None, media.ttl_seconds)
+                            media_type = enums.MessageMediaType.VIDEO
+                        elif media.round:
+                            video_note = types.VideoNote._parse(client, doc, None, media.ttl_seconds)
+                            media_type = enums.MessageMediaType.VIDEO_NOTE
+                        elif media.voice:
+                            voice = types.Voice._parse(client, doc, None, media.ttl_seconds)
+                            media_type = enums.MessageMediaType.VOICE
+
+                elif isinstance(media, raw.types.MessageMediaWebPage):
+                    if isinstance(media.webpage, raw.types.WebPage):
+                        web_page = types.WebPage._parse(client, media.webpage)
+                        media_type = enums.MessageMediaType.WEB_PAGE
+                        web_page_url = media.webpage.url
+                    elif isinstance(media.webpage, raw.types.WebPageEmpty):
+                        media_type = None
+                        web_page_url = getattr(media.webpage, "url", None)
+                    else:
+                        media_type = None
+                        web_page_url = utils.get_first_url(message)
+                    link_preview_options = types.LinkPreviewOptions._parse(
+                        client,
+                        media,
+                        web_page_url,
+                        getattr(message, "invert_media", False)
+                    )
+                    if not web_page:
+                        media = None
+                elif isinstance(media, raw.types.MessageMediaPoll):
+                    poll = types.Poll._parse(client, media)
+                    media_type = enums.MessageMediaType.POLL
+                elif isinstance(media, raw.types.MessageMediaDice):
+                    dice = types.Dice._parse(client, media)
+                    media_type = enums.MessageMediaType.DICE
+                elif isinstance(media, raw.types.MessageMediaStory):
+                    story = await types.Story._parse(client, users, chats, media, None, None, None, None)
+                    media_type = enums.MessageMediaType.STORY
+                elif isinstance(media, raw.types.MessageMediaGiveaway):
+                    giveaway = types.Giveaway._parse(client, chats, media)
+                    media_type = enums.MessageMediaType.GIVEAWAY
+                elif isinstance(media, raw.types.MessageMediaGiveawayResults):
+                    giveaway_winners = types.GiveawayWinners._parse(client, chats, users, media)
+                    media_type = enums.MessageMediaType.GIVEAWAY_WINNERS
+                elif isinstance(media, raw.types.MessageMediaInvoice):
+                    invoice = types.Invoice._parse(client, media)
+                    media_type = enums.MessageMediaType.INVOICE
+                elif isinstance(media, raw.types.MessageMediaPaidMedia):
+                    paid_media = types.PaidMediaInfo._parse(client, media)
+                    media_type = enums.MessageMediaType.PAID_MEDIA
+                else:
+                    media = None
+
+            show_caption_above_media = getattr(message, "invert_media", False)
+            if (
+                not link_preview_options and
+                web_page_url
+            ):
+                link_preview_options = types.LinkPreviewOptions._parse(
+                    client,
+                    None,
+                    web_page_url,
+                    show_caption_above_media
+                )
+
+            reply_markup = message.reply_markup
+
+            if reply_markup:
+                if isinstance(reply_markup, raw.types.ReplyKeyboardForceReply):
+                    reply_markup = types.ForceReply.read(reply_markup)
+                elif isinstance(reply_markup, raw.types.ReplyKeyboardMarkup):
+                    reply_markup = types.ReplyKeyboardMarkup.read(reply_markup)
+                elif isinstance(reply_markup, raw.types.ReplyInlineMarkup):
+                    reply_markup = types.InlineKeyboardMarkup.read(reply_markup)
+                elif isinstance(reply_markup, raw.types.ReplyKeyboardHide):
+                    reply_markup = types.ReplyKeyboardRemove.read(reply_markup)
+                else:
+                    reply_markup = None
+
+            from_user = types.User._parse(client, users.get(user_id, None))
+            sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None
+
+            reactions = types.MessageReactions._parse(client, message.reactions)
+
+            parsed_message = Message(
+                id=message.id,
+                date=utils.timestamp_to_datetime(message.date),
+                chat=types.Chat._parse(client, message, users, chats, is_chat=True),
+                from_user=from_user,
+                sender_chat=sender_chat,
+                text=(
+                    Str(message.message).init(entities) or None
+                    if media is None or web_page is not None
+                    else None
+                ),
+                caption=(
+                    Str(message.message).init(entities) or None
+                    if media is not None and web_page is None
+                    else None
+                ),
+                entities=(
+                    entities or None
+                    if media is None or web_page is not None
+                    else None
+                ),
+                caption_entities=(
+                    entities or None
+                    if media is not None and web_page is None
+                    else None
+                ),
+                author_signature=message.post_author,
+                has_protected_content=message.noforwards,
+                has_media_spoiler=has_media_spoiler,
+                forward_origin=forward_origin,
+                mentioned=message.mentioned,
+                scheduled=is_scheduled,
+                from_scheduled=message.from_scheduled,
+                media=media_type,
+                edit_date=utils.timestamp_to_datetime(message.edit_date),
+                media_group_id=message.grouped_id,
+                photo=photo,
+                location=location,
+                contact=contact,
+                venue=venue,
+                audio=audio,
+                voice=voice,
+                animation=animation,
+                game=game,
+                video=video,
+                video_note=video_note,
+                sticker=sticker,
+                story=story,
+                document=document,
+                web_page=web_page,
+                poll=poll,
+                dice=dice,
+                giveaway=giveaway,
+                giveaway_winners=giveaway_winners,
+                invoice=invoice,
+                views=message.views,
+                forwards=message.forwards,
+                via_bot=types.User._parse(client, users.get(message.via_bot_id, None)),
+                outgoing=message.out,
+                reply_markup=reply_markup,
+                reactions=reactions,
+                client=client,
+                link_preview_options=link_preview_options,
+                effect_id=getattr(message, "effect", None),
+                show_caption_above_media=show_caption_above_media,
+                paid_media=paid_media
+            )
+
+            parsed_message.external_reply = await types.ExternalReplyInfo._parse(
+                client,
+                chats,
+                users,
+                message.reply_to
+            )
+            parsed_message.sender_boost_count = getattr(message, "from_boosts_applied", None)
+
+            if getattr(message, "via_business_bot_id", None):
+                parsed_message.sender_business_bot = types.User._parse(client, users.get(message.via_business_bot_id, None))
+
+            parsed_message.is_from_offline = getattr(message, "offline", None)
+
+            if (
+                forward_header and
+                forward_header.saved_from_peer and
+                forward_header.saved_from_msg_id
+            ):
+                saved_from_peer_id = utils.get_raw_peer_id(forward_header.saved_from_peer)
+                saved_from_peer_chat = chats.get(saved_from_peer_id)
+                if (
+                    isinstance(saved_from_peer_chat, raw.types.Channel) and
+                    not saved_from_peer_chat.megagroup
+                ):
+                    parsed_message.is_automatic_forward = True
+
+        if getattr(message, "reply_to", None):
+            parsed_message.reply_to_message_id = None
+            parsed_message.message_thread_id = None
+            if isinstance(message.reply_to, raw.types.MessageReplyHeader):
+                parsed_message.reply_to_message_id = message.reply_to.reply_to_msg_id
+                parsed_message.message_thread_id = message.reply_to.reply_to_top_id
+                if message.reply_to.forum_topic:
+                    parsed_message.is_topic_message = True
+                    if message.reply_to.reply_to_top_id:
+                        parsed_message.message_thread_id = message.reply_to.reply_to_top_id
+                    else:
+                        parsed_message.message_thread_id = message.reply_to.reply_to_msg_id
+                if getattr(message.reply_to, "quote", False):
+                    parsed_message.quote = types.TextQuote._parse(
+                        client,
+                        chats,
+                        users,
+                        message.reply_to
+                    )
+
+            if isinstance(message.reply_to, raw.types.MessageReplyStoryHeader):
+                parsed_message.reply_to_story = await types.Story._parse(client, users, chats, None, message.reply_to, None, None, None)
+
+            if replies:
+                try:
+                    key = (parsed_message.chat.id, parsed_message.reply_to_message_id)
+                    reply_to_message = client.message_cache[key]
+
+                    if not reply_to_message:
+                        reply_to_message = await client.get_messages(
+                            chat_id=parsed_message.chat.id,
+                            reply_to_message_ids=message.id,
+                            replies=replies - 1
+                        )
+
+                    parsed_message.reply_to_message = reply_to_message
+                except MessageIdsEmpty:
+                    pass
+
+        if business_connection_id:
+            parsed_message.business_connection_id = business_connection_id
+        if raw_reply_to_message:
+            parsed_message.reply_to_message = await types.Message._parse(
+                client,
+                raw_reply_to_message,
+                users,
+                chats,
+                business_connection_id=business_connection_id,
+                replies=0
+            )
+
+        if not parsed_message.poll:  # Do not cache poll messages
+            client.message_cache[(parsed_message.chat.id, parsed_message.id)] = parsed_message
+
+        parsed_message._raw = message
+
+        return parsed_message
+
+    @property
+    def link(self) -> str:
+        if (
+            self.chat.type in (
+                enums.ChatType.SUPERGROUP,
+                enums.ChatType.CHANNEL
+            )
+        ):
+            return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}{f'/{self.message_thread_id}' if self.message_thread_id else ''}/{self.id}"
+        raise ValueError("This message-chat type does not have a link")
+
+    async def get_media_group(self) -> List["types.Message"]:
+        """Bound method *get_media_group* of :obj:`~pyrogram.types.Message`.
+        
+        Use as a shortcut for:
+        
+        .. code-block:: python
+
+            await client.get_media_group(
+                chat_id=message.chat.id,
+                message_id=message.id
+            )
+            
+        Example:
+            .. code-block:: python
+
+                await message.get_media_group()
+                
+        Returns:
+            List of :obj:`~pyrogram.types.Message`: On success, a list of messages of the media group is returned.
+            
+        Raises:
+            ValueError: In case the passed message id doesn't belong to a media group.
+        """
+
+        return await self._client.get_media_group(
+            chat_id=self.chat.id,
+            message_id=self.id
+        )
+
+    async def reply_text(
+        self,
+        text: str = None,
+        quote: bool = None,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        entities: List["types.MessageEntity"] = None,
+        link_preview_options: "types.LinkPreviewOptions" = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        schedule_date: datetime = None,
+        disable_web_page_preview: bool = None,
+        reply_to_message_id: int = None
+    ) -> "Message":
+        """Bound method *reply_text* of :obj:`~pyrogram.types.Message`.
+
+        An alias exists as *reply*.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_message(
+                chat_id=message.chat.id,
+                text="hello",
+                reply_parameters=ReplyParameter(
+                    message_id=message_id
+                )
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_text(text="hello", quote=True)
+
+        Parameters:
+            text (``str``):
+                Text of the message to be sent.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_parameters* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in message text, which can be specified instead of *parse_mode*.
+
+            link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*):
+                Link preview generation options for the message
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+        Returns:
+            On success, the sent Message is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_message(
+            chat_id=self.chat.id,
+            text=text,
+            parse_mode=parse_mode,
+            entities=entities,
+            link_preview_options=link_preview_options,
+            disable_notification=disable_notification,
+            protect_content=protect_content,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            reply_markup=reply_markup,
+            schedule_date=schedule_date,
+            disable_web_page_preview=disable_web_page_preview,
+            reply_to_message_id=reply_to_message_id
+        )
+
+    reply = reply_text
+
+    async def reply_animation(
+        self,
+        animation: Union[str, BinaryIO],
+        quote: bool = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        unsave: bool = False,
+        has_spoiler: bool = None,
+        duration: int = 0,
+        width: int = 0,
+        height: int = 0,
+        thumb: str = None,
+        file_name: str = None,
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        ttl_seconds: int = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> "Message":
+        """Bound method *reply_animation* :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_animation(
+                chat_id=message.chat.id,
+                animation=animation
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_animation(animation)
+
+        Parameters:
+            animation (``str``):
+                Animation to send.
+                Pass a file_id as string to send an animation that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get an animation from the Internet, or
+                pass a file path as string to upload a new animation that exists on your local machine.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_parameters* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            caption (``str``, *optional*):
+                Animation caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media.
+
+            unsave (``bool``, *optional*):
+                By default, the server will save into your own collection any new animation you send.
+                Pass True to automatically unsave the sent animation. Defaults to False.
+
+            has_spoiler (``bool``, *optional*):
+                Pass True if the animation needs to be covered with a spoiler animation.
+
+            duration (``int``, *optional*):
+                Duration of sent animation in seconds.
+
+            width (``int``, *optional*):
+                Animation width.
+
+            height (``int``, *optional*):
+                Animation height.
+
+            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 320 pixels.
+                Thumbnails can't be reused and can be only uploaded as a new file.
+
+            file_name (``str``, *optional*):
+                File name of the animation sent.
+                Defaults to file's path basename.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the animation will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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 file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned
+            instead.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_animation(
+            chat_id=self.chat.id,
+            animation=animation,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            show_caption_above_media=show_caption_above_media,
+            unsave=unsave,
+            has_spoiler=has_spoiler,
+            duration=duration,
+            width=width,
+            height=height,
+            thumb=thumb,
+            file_name=file_name,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            protect_content=protect_content,
+            ttl_seconds=ttl_seconds,
+            reply_markup=reply_markup,
+            reply_to_message_id=reply_to_message_id,
+            progress=progress,
+            progress_args=progress_args
+        )
+
+    async def reply_audio(
+        self,
+        audio: Union[str, BinaryIO],
+        quote: bool = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        duration: int = 0,
+        performer: str = None,
+        title: str = None,
+        thumb: str = None,
+        file_name: str = None,
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> "Message":
+        """Bound method *reply_audio* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_audio(
+                chat_id=message.chat.id,
+                audio=audio
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_audio(audio)
+
+        Parameters:
+            audio (``str``):
+                Audio file to send.
+                Pass a file_id as string to send an audio file that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get an audio file from the Internet, or
+                pass a file path as string to upload a new audio file that exists on your local machine.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            caption (``str``, *optional*):
+                Audio caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            duration (``int``, *optional*):
+                Duration of the audio in seconds.
+
+            performer (``str``, *optional*):
+                Performer.
+
+            title (``str``, *optional*):
+                Track name.
+
+            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 320 pixels.
+                Thumbnails can't be reused and can be only uploaded as a new file.
+
+            file_name (``str``, *optional*):
+                File name of the audio sent.
+                Defaults to file's path basename.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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 file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned
+            instead.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_audio(
+            chat_id=self.chat.id,
+            audio=audio,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            duration=duration,
+            performer=performer,
+            title=title,
+            thumb=thumb,
+            file_name=file_name,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            protect_content=protect_content,
+            reply_markup=reply_markup,
+            reply_to_message_id=reply_to_message_id,
+            progress=progress,
+            progress_args=progress_args
+        )
+
+    async def reply_cached_media(
+        self,
+        file_id: str,
+        quote: bool = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "Message":
+        """Bound method *reply_cached_media* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_cached_media(
+                chat_id=message.chat.id,
+                file_id=file_id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_cached_media(file_id)
+
+        Parameters:
+            file_id (``str``):
+                Media to send.
+                Pass a file_id as string to send a media that exists on the Telegram servers.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            caption (``bool``, *optional*):
+                Media caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_cached_media(
+            chat_id=self.chat.id,
+            file_id=file_id,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            show_caption_above_media=show_caption_above_media,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            protect_content=self.has_protected_content,
+            has_spoiler=self.has_media_spoiler,
+            reply_markup=reply_markup,
+            reply_to_message_id=reply_to_message_id
+        )
+
+    async def reply_chat_action(
+        self,
+        action: "enums.ChatAction",
+        progress: int = 0,
+        emoji: str = None,
+        emoji_message_id: int = None,
+        emoji_message_interaction: "raw.types.DataJSON" = None
+    ) -> bool:
+        """Bound method *reply_chat_action* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            from pyrogram import enums
+
+            await client.send_chat_action(
+                chat_id=message.chat.id,
+                action=enums.ChatAction.TYPING
+            )
+
+        Example:
+            .. code-block:: python
+
+                from pyrogram import enums
+
+                await message.reply_chat_action(enums.ChatAction.TYPING)
+
+        Parameters:
+            action (:obj:`~pyrogram.enums.ChatAction`):
+                Type of action to broadcast.
+
+            progress (``int``, *optional*):
+                Upload progress, as a percentage.
+
+            emoji (``str``, *optional*):
+                The animated emoji. Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION` and :obj:`~pyrogram.enums.ChatAction.WATCH_EMOJI_ANIMATION`.
+
+            emoji_message_id (``int``, *optional*):
+                Message identifier of the message containing the animated emoji. Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION`.
+
+            emoji_message_interaction (:obj:`raw.types.DataJSON`, *optional*):
+                Only supported for :obj:`~pyrogram.enums.ChatAction.TRIGGER_EMOJI_ANIMATION`.
+
+        Returns:
+            ``bool``: On success, True is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+            ValueError: In case the provided string is not a valid chat action.
+        """
+        return await self._client.send_chat_action(
+            chat_id=self.chat.id,
+            action=action,
+            progress=progress,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            emoji=emoji,
+            emoji_message_id=emoji_message_id,
+            emoji_message_interaction=emoji_message_interaction
+        )
+
+    async def reply_contact(
+        self,
+        phone_number: str,
+        first_name: str,
+        quote: bool = None,
+        last_name: str = "",
+        vcard: str = "",
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "Message":
+        """Bound method *reply_contact* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_contact(
+                chat_id=message.chat.id,
+                phone_number=phone_number,
+                first_name=first_name
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_contact("+1-123-456-7890", "Name")
+
+        Parameters:
+            phone_number (``str``):
+                Contact's phone number.
+
+            first_name (``str``):
+                Contact's first name.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            last_name (``str``, *optional*):
+                Contact's last name.
+
+            vcard (``str``, *optional*):
+                Additional data about the contact in the form of a vCard, 0-2048 bytes
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_contact(
+            chat_id=self.chat.id,
+            phone_number=phone_number,
+            first_name=first_name,
+            last_name=last_name,
+            vcard=vcard,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            protect_content=protect_content,
+            reply_markup=reply_markup,
+            reply_to_message_id=reply_to_message_id
+        )
+
+    async def reply_document(
+        self,
+        document: Union[str, BinaryIO],
+        quote: bool = None,
+        thumb: str = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        file_name: str = None,
+        disable_content_type_detection: bool = None,
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None,
+        force_document: bool = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> "Message":
+        """Bound method *reply_document* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_document(
+                chat_id=message.chat.id,
+                document=document
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_document(document)
+
+        Parameters:
+            document (``str``):
+                File to send.
+                Pass a file_id as string to send a file that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get a file from the Internet, or
+                pass a file path as string to upload a new file that exists on your local machine.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            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 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 (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+            
+            file_name (``str``, *optional*):
+                File name of the document sent.
+                Defaults to file's path basename.
+
+            disable_content_type_detection (``bool``, *optional*):
+                Disables automatic server-side content type detection for files uploaded using multipart/form-data.
+                Pass True to force sending files as document. Useful for video files that need to be sent as
+                document messages instead of video messages.
+                Defaults to False.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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 file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned
+            instead.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_document(
+            chat_id=self.chat.id,
+            document=document,
+            thumb=thumb,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            file_name=file_name,
+            disable_content_type_detection=disable_content_type_detection,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            protect_content=protect_content,
+            reply_markup=reply_markup,
+            reply_to_message_id=reply_to_message_id,
+            force_document=force_document,
+            progress=progress,
+            progress_args=progress_args
+        )
+
+    async def reply_game(
+        self,
+        game_short_name: str,
+        quote: bool = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "Message":
+        """Bound method *reply_game* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_game(
+                chat_id=message.chat.id,
+                game_short_name="lumberjack"
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_game("lumberjack")
+
+        Parameters:
+            game_short_name (``str``):
+                Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown automatically.
+                If not empty, the first button must launch the game.
+
+        Returns:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_game(
+            chat_id=self.chat.id,
+            game_short_name=game_short_name,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            protect_content=protect_content,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            reply_markup=reply_markup,
+            reply_to_message_id=reply_to_message_id
+        )
+
+    async def reply_inline_bot_result(
+        self,
+        query_id: int,
+        result_id: str,
+        quote: bool = None,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_to_message_id: int = None
+    ) -> "Message":
+        """Bound method *reply_inline_bot_result* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_inline_bot_result(
+                chat_id=message.chat.id,
+                query_id=query_id,
+                result_id=result_id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_inline_bot_result(query_id, result_id)
+
+        Parameters:
+            query_id (``int``):
+                Unique identifier for the answered query.
+
+            result_id (``str``):
+                Unique identifier for the result that was chosen.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+        Returns:
+            On success, the sent Message is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_inline_bot_result(
+            chat_id=self.chat.id,
+            query_id=query_id,
+            result_id=result_id,
+            disable_notification=disable_notification,
+            reply_parameters=reply_parameters,
+            reply_to_message_id=reply_to_message_id
+        )
+
+    async def reply_location(
+        self,
+        latitude: float,
+        longitude: float,
+        quote: bool = None,
+        horizontal_accuracy: float = None,
+        # TODO
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "Message":
+        """Bound method *reply_location* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_location(
+                chat_id=message.chat.id,
+                latitude=latitude,
+                longitude=longitude
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_location(latitude, longitude)
+
+        Parameters:
+            latitude (``float``):
+                Latitude of the location.
+
+            longitude (``float``):
+                Longitude of the location.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            horizontal_accuracy (``float``, *optional*):
+                The radius of uncertainty for the location, measured in meters; 0-1500.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_location(
+            chat_id=self.chat.id,
+            latitude=latitude,
+            longitude=longitude,
+            horizontal_accuracy=horizontal_accuracy,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            protect_content=protect_content,
+            reply_markup=reply_markup,
+            reply_to_message_id=reply_to_message_id
+        )
+
+    async def reply_media_group(
+        self,
+        media: List[Union["types.InputMediaPhoto", "types.InputMediaVideo"]],
+        quote: bool = None,
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        reply_to_message_id: int = None
+    ) -> List["types.Message"]:
+        """Bound method *reply_media_group* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_media_group(
+                chat_id=message.chat.id,
+                media=list_of_media
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_media_group(list_of_media)
+
+        Parameters:
+            media (``list``):
+                A list containing either :obj:`~pyrogram.types.InputMediaPhoto` or
+                :obj:`~pyrogram.types.InputMediaVideo` objects
+                describing photos and videos to be sent, must include 2–10 items.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+        Returns:
+            On success, a :obj:`~pyrogram.types.Messages` object is returned containing all the
+            single messages sent.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_media_group(
+            chat_id=self.chat.id,
+            media=media,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            protect_content=protect_content,
+            reply_to_message_id=reply_to_message_id
+        )
+
+    async def reply_photo(
+        self,
+        photo: Union[str, BinaryIO],
+        quote: bool = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        has_spoiler: bool = None,
+        ttl_seconds: int = None,
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        view_once: bool = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> "Message":
+        """Bound method *reply_photo* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_photo(
+                chat_id=message.chat.id,
+                photo=photo
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_photo(photo)
+
+        Parameters:
+            photo (``str``):
+                Photo to send.
+                Pass a file_id as string to send a photo that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get a photo from the Internet, or
+                pass a file path as string to upload a new photo that exists on your local machine.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            caption (``str``, *optional*):
+                Photo caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media.
+
+            has_spoiler (``bool``, *optional*):
+                Pass True if the photo needs to be covered with a spoiler animation.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the photo will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            view_once (``bool``, *optional*):
+                Pass True if the photo should be viewable only once.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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 file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned
+            instead.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_photo(
+            chat_id=self.chat.id,
+            photo=photo,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            show_caption_above_media=show_caption_above_media,
+            has_spoiler=has_spoiler,
+            ttl_seconds=ttl_seconds,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            protect_content=protect_content,
+            view_once=view_once,
+            reply_markup=reply_markup,
+            reply_to_message_id=reply_to_message_id,
+            progress=progress,
+            progress_args=progress_args
+        )
+
+    async def reply_poll(
+        self,
+        question: str,
+        options: List[str],
+        question_parse_mode: "enums.ParseMode" = None,
+        question_entities: List["types.MessageEntity"] = None,
+        is_anonymous: bool = True,
+        type: "enums.PollType" = enums.PollType.REGULAR,
+        allows_multiple_answers: bool = None,
+        correct_option_id: int = None,
+        explanation: str = None,
+        explanation_parse_mode: "enums.ParseMode" = None,
+        explanation_entities: List["types.MessageEntity"] = None,
+        open_period: int = None,
+        close_date: datetime = None,
+        is_closed: bool = None,
+        quote: bool = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "Message":
+        """Bound method *reply_poll* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_poll(
+                chat_id=message.chat.id,
+                question="This is a poll",
+                options=["A", "B", "C]
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_poll("This is a poll", ["A", "B", "C"])
+
+        Parameters:
+            question (``str``):
+                Poll question, 1-255 characters.
+
+            options (List of ``str``):
+                List of answer options, 2-10 strings 1-100 characters each.
+
+            question_parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            question_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the poll question, which can be specified instead of *question_parse_mode*.
+
+            is_anonymous (``bool``, *optional*):
+                True, if the poll needs to be anonymous.
+                Defaults to True.
+
+            type (:obj:`~pyrogram.enums.PollType`, *optional*):
+                Poll type, :obj:`~pyrogram.enums.PollType.QUIZ` or :obj:`~pyrogram.enums.PollType.REGULAR`.
+                Defaults to :obj:`~pyrogram.enums.PollType.REGULAR`.
+
+            allows_multiple_answers (``bool``, *optional*):
+                True, if the poll allows multiple answers, ignored for polls in quiz mode.
+                Defaults to False.
+
+            correct_option_id (``int``, *optional*):
+                0-based identifier of the correct answer option, required for polls in quiz mode.
+
+            explanation (``str``, *optional*):
+                Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style
+                poll, 0-200 characters with at most 2 line feeds after entities parsing.
+
+            explanation_parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            explanation_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the poll explanation, which can be specified instead of
+                *parse_mode*.
+
+            open_period (``int``, *optional*):
+                Amount of time in seconds the poll will be active after creation, 5-600.
+                Can't be used together with *close_date*.
+
+            close_date (:py:obj:`~datetime.datetime`, *optional*):
+                Point in time when the poll will be automatically closed.
+                Must be at least 5 and no more than 600 seconds in the future.
+                Can't be used together with *open_period*.
+
+            is_closed (``bool``, *optional*):
+                Pass True, if the poll needs to be immediately closed.
+                This can be useful for poll preview.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_poll(
+            chat_id=self.chat.id,
+            question=question,
+            options=options,
+            is_anonymous=is_anonymous,
+            type=type,
+            allows_multiple_answers=allows_multiple_answers,
+            correct_option_id=correct_option_id,
+            explanation=explanation,
+            explanation_parse_mode=explanation_parse_mode,
+            explanation_entities=explanation_entities,
+            open_period=open_period,
+            close_date=close_date,
+            is_closed=is_closed,
+            disable_notification=disable_notification,
+            protect_content=protect_content,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            reply_to_message_id=reply_to_message_id,
+            reply_markup=reply_markup
+        )
+
+    async def reply_sticker(
+        self,
+        sticker: Union[str, BinaryIO],
+        quote: bool = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        schedule_date: datetime = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> "Message":
+        """Bound method *reply_sticker* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_sticker(
+                chat_id=message.chat.id,
+                sticker=sticker
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_sticker(sticker)
+
+        Parameters:
+            sticker (``str``):
+                Sticker to send.
+                Pass a file_id as string to send a sticker that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get a .webp sticker file from the Internet, or
+                pass a file path as string to upload a new sticker that exists on your local machine.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned
+            instead.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_sticker(
+            chat_id=self.chat.id,
+            sticker=sticker,
+            disable_notification=disable_notification,
+            protect_content=protect_content,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            reply_markup=reply_markup,
+            schedule_date=schedule_date,
+            reply_to_message_id=reply_to_message_id,
+            progress=progress,
+            progress_args=progress_args
+        )
+
+    async def reply_venue(
+        self,
+        latitude: float,
+        longitude: float,
+        title: str,
+        address: str,
+        quote: bool = None,
+        foursquare_id: str = "",
+        foursquare_type: str = "",
+        # TODO
+        disable_notification: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        schedule_date: datetime = None,
+        protect_content: bool = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        reply_to_message_id: int = None
+    ) -> "Message":
+        """Bound method *reply_venue* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_venue(
+                chat_id=message.chat.id,
+                latitude=latitude,
+                longitude=longitude,
+                title="Venue title",
+                address="Venue address"
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_venue(latitude, longitude, "Venue title", "Venue address")
+
+        Parameters:
+            latitude (``float``):
+                Latitude of the venue.
+
+            longitude (``float``):
+                Longitude of the venue.
+
+            title (``str``):
+                Name of the venue.
+
+            address (``str``):
+                Address of the venue.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            foursquare_id (``str``, *optional*):
+                Foursquare identifier of the venue.
+
+            foursquare_type (``str``, *optional*):
+                Foursquare type of the venue, if known.
+                (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+        Returns:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_venue(
+            chat_id=self.chat.id,
+            latitude=latitude,
+            longitude=longitude,
+            title=title,
+            address=address,
+            foursquare_id=foursquare_id,
+            foursquare_type=foursquare_type,
+            disable_notification=disable_notification,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            schedule_date=schedule_date,
+            protect_content=protect_content,
+            reply_to_message_id=reply_to_message_id,
+            reply_markup=reply_markup
+        )
+
+    async def reply_video(
+        self,
+        video: Union[str, BinaryIO],
+        quote: bool = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        duration: int = 0,
+        width: int = 0,
+        height: int = 0,
+        thumb: str = None,
+        has_spoiler: bool = None,
+        supports_streaming: bool = True,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        ttl_seconds: int = None,
+        view_once: bool = None,
+        file_name: str = None,
+        schedule_date: datetime = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> "Message":
+        """Bound method *reply_video* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_video(
+                chat_id=message.chat.id,
+                video=video
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_video(video)
+
+        Parameters:
+            video (``str``):
+                Video to send.
+                Pass a file_id as string to send a video that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get a video from the Internet, or
+                pass a file path as string to upload a new video that exists on your local machine.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            caption (``str``, *optional*):
+                Video caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media.
+
+            duration (``int``, *optional*):
+                Duration of sent video in seconds.
+
+            width (``int``, *optional*):
+                Video width.
+
+            height (``int``, *optional*):
+                Video height.
+
+            thumb (``str`` | ``BinaryIO``, *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 320 pixels.
+                Thumbnails can't be reused and can be only uploaded as a new file.
+
+            has_spoiler (``bool``, *optional*):
+                Pass True if the video needs to be covered with a spoiler animation.
+
+            supports_streaming (``bool``, *optional*):
+                Pass True, if the uploaded video is suitable for streaming.
+                Defaults to True.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the video will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            view_once (``bool``, *optional*):
+                Pass True if the photo should be viewable only once.
+
+            file_name (``str``, *optional*):
+                File name of the video sent.
+                Defaults to file's path basename.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned
+            instead.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_video(
+            chat_id=self.chat.id,
+            video=video,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            show_caption_above_media=show_caption_above_media,
+            duration=duration,
+            width=width,
+            height=height,
+            thumb=thumb,
+            has_spoiler=has_spoiler,
+            supports_streaming=supports_streaming,
+            disable_notification=disable_notification,
+            protect_content=protect_content,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            reply_markup=reply_markup,
+            ttl_seconds=ttl_seconds,
+            view_once=view_once,
+            file_name=file_name,
+            schedule_date=schedule_date,
+            reply_to_message_id=reply_to_message_id,
+            progress=progress,
+            progress_args=progress_args
+        )
+
+    async def reply_video_note(
+        self,
+        video_note: Union[str, BinaryIO],
+        quote: bool = None,
+        duration: int = 0,
+        length: int = 1,
+        thumb: str = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        schedule_date: datetime = None,
+        ttl_seconds: int = None,
+        view_once: bool = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> "Message":
+        """Bound method *reply_video_note* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_video_note(
+                chat_id=message.chat.id,
+                video_note=video_note
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_video_note(video_note)
+
+        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
+                pass a file path as string to upload a new video note that exists on your local machine.
+                Sending video notes by a URL is currently unsupported.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            duration (``int``, *optional*):
+                Duration of sent video in seconds.
+
+            length (``int``, *optional*):
+                Video width and height.
+
+            thumb (``str``, *optional*):
+                Thumbnail of the video sent.
+                The thumbnail should be in JPEG format and less than 200 KB in size.
+                A thumbnail's width and height should not exceed 320 pixels.
+                Thumbnails can't be reused and can be only uploaded as a new file.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            caption (``str``, *optional*):
+                Video caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the video note will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            view_once (``bool``, *optional*):
+                Pass True if the photo should be viewable only once.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned
+            instead.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_video_note(
+            chat_id=self.chat.id,
+            video_note=video_note,
+            duration=duration,
+            length=length,
+            thumb=thumb,
+            disable_notification=disable_notification,
+            protect_content=protect_content,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            reply_markup=reply_markup,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            schedule_date=schedule_date,
+            ttl_seconds=ttl_seconds,
+            view_once=view_once,
+            reply_to_message_id=reply_to_message_id,
+            progress=progress,
+            progress_args=progress_args
+        )
+
+    async def reply_voice(
+        self,
+        voice: Union[str, BinaryIO],
+        quote: bool = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        duration: int = 0,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        schedule_date: datetime = None,
+        ttl_seconds: int = None,
+        view_once: bool = None,
+        waveform: bytes = None,
+        reply_to_message_id: int = None,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> "Message":
+        """Bound method *reply_voice* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.send_voice(
+                chat_id=message.chat.id,
+                voice=voice
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.reply_voice(voice)
+
+        Parameters:
+            voice (``str``):
+                Audio file to send.
+                Pass a file_id as string to send an audio that exists on the Telegram servers,
+                pass an HTTP URL as a string for Telegram to get an audio from the Internet, or
+                pass a file path as string to upload a new audio that exists on your local machine.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            caption (``str``, *optional*):
+                Voice message caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            duration (``int``, *optional*):
+                Duration of the voice message in seconds.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            ttl_seconds (``int``, *optional*):
+                Self-Destruct Timer.
+                If you set a timer, the voice message will self-destruct in *ttl_seconds*
+                seconds after it was viewed.
+
+            view_once (``bool``, *optional*):
+                Pass True if the photo should be viewable only once.
+
+            waveform (``bytes``, *optional*):
+                no docs!
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+            In case the upload is deliberately stopped with :meth:`~pyrogram.Client.stop_transmission`, None is returned
+            instead.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_voice(
+            chat_id=self.chat.id,
+            voice=voice,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            duration=duration,
+            disable_notification=disable_notification,
+            protect_content=protect_content,
+            message_thread_id=self.message_thread_id,
+            business_connection_id=self.business_connection_id,
+            message_effect_id=message_effect_id,
+            reply_parameters=reply_parameters,
+            reply_markup=reply_markup,
+            schedule_date=schedule_date,
+            ttl_seconds=ttl_seconds,
+            view_once=view_once,
+            waveform=waveform,
+            reply_to_message_id=reply_to_message_id,
+            progress=progress,
+            progress_args=progress_args
+        )
+
+    async def reply_invoice(
+        self,
+        title: str,
+        description: str,
+        payload: Union[str, bytes],
+        currency: str,
+        prices: List["types.LabeledPrice"],
+        message_thread_id: int = None,
+        quote: bool = None,
+        provider_token: str = None,
+        max_tip_amount: int = None,
+        suggested_tip_amounts: List[int] = None,
+        start_parameter: str = None,
+        provider_data: str = None,
+        photo_url: str = "",
+        photo_size: int = None,
+        photo_width: int = None,
+        photo_height: int = None,
+        need_name: bool = None,
+        need_phone_number: bool = None,
+        need_email: bool = None,
+        need_shipping_address: bool = None,
+        send_phone_number_to_provider: bool = None,
+        send_email_to_provider: bool = None,
+        is_flexible: bool = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        message_effect_id: int = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = None,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None
+    ) -> "Message":
+        """Bound method *reply_invoice* of :obj:`~pyrogram.types.Message`.
+
+        Parameters:
+            title (``str``):
+                Product name, 1-32 characters.
+
+            description (``str``):
+                Product description, 1-255 characters
+
+            payload (``str`` | ``bytes``):
+                Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
+
+            currency (``str``):
+                Three-letter ISO 4217 currency code, see `more on currencies `_. Pass ``XTR`` for payments in `Telegram Stars `_.
+
+            prices (List of :obj:`~pyrogram.types.LabeledPrice`):
+                Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars `_.
+
+            message_thread_id (``int``, *optional*):
+                If the message is in a thread, ID of the original message.
+
+            quote (``bool``, *optional*):
+                If ``True``, the message will be sent as a reply to this message.
+                If *reply_to_message_id* is passed, this parameter will be ignored.
+                Defaults to ``True`` in group chats and ``False`` in private chats.
+
+            provider_token (``str``, *optional*):
+                Payment provider token, obtained via `@BotFather `_. Pass an empty string for payments in `Telegram Stars `_.
+
+            max_tip_amount (``int``, *optional*):
+                The maximum accepted amount for tips in the smallest units of the currency (integer, **not** float/double). For example, for a maximum tip of ``US$ 1.45`` pass ``max_tip_amount = 145``. See the exp parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars `_.
+
+            suggested_tip_amounts (List of ``int``, *optional*):
+                An array of suggested amounts of tips in the smallest units of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed ``max_tip_amount``.
+
+            start_parameter (``str``, *optional*):
+                Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter.
+
+            provider_data (``str``, *optional*):
+                JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
+
+            photo_url (``str``, *optional*):
+                URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
+
+            photo_size (``int``, *optional*):
+                Photo size in bytes
+
+            photo_width (``int``, *optional*):
+                Photo width
+
+            photo_height (``int``, *optional*):
+                Photo height
+
+            need_name (``bool``, *optional*):
+                Pass True if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            need_phone_number (``bool``, *optional*):
+                Pass True if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            need_email (``bool``, *optional*):
+                Pass True if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            need_shipping_address (``bool``, *optional*):
+                Pass True if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars `_.
+
+            send_phone_number_to_provider (``bool``, *optional*):
+                Pass True if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars `_.
+
+            send_email_to_provider (``bool``, *optional*):
+                Pass True if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars `_.
+
+            is_flexible (``bool``, *optional*):
+                Pass True if the final price depends on the shipping method. Ignored for payments in `Telegram Stars `_.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_effect_id (``int`` ``64-bit``, *optional*):
+                Unique identifier of the message effect to be added to the message; for private chats only.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+
+            caption (``str``, *optional*):
+                Document caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+        Returns:
+            On success, the sent :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if quote is None:
+            quote = self.chat.type != enums.ChatType.PRIVATE
+
+        if not reply_parameters and quote:
+            reply_parameters = types.ReplyParameters(
+                message_id=self.id
+            )
+
+        return await self._client.send_invoice(
+            chat_id=self.chat.id,
+            title=title,
+            description=description,
+            payload=payload,
+            currency=currency,
+            prices=prices,
+            message_thread_id=self.message_thread_id if message_thread_id is None else message_thread_id,
+            provider_token=provider_token,
+            max_tip_amount=max_tip_amount,
+            suggested_tip_amounts=suggested_tip_amounts,
+            start_parameter=start_parameter,
+            provider_data=provider_data,
+            photo_url=photo_url,
+            photo_size=photo_size,
+            photo_width=photo_width,
+            photo_height=photo_height,
+            need_name=need_name,
+            need_phone_number=need_phone_number,
+            need_email=need_email,
+            need_shipping_address=need_shipping_address,
+            send_phone_number_to_provider=send_phone_number_to_provider,
+            send_email_to_provider=send_email_to_provider,
+            is_flexible=is_flexible,
+            disable_notification=disable_notification,
+            protect_content=self.has_protected_content if protect_content is None else protect_content,
+            message_effect_id=message_effect_id or self.effect_id,
+            reply_parameters=reply_parameters,
+            reply_markup=reply_markup,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities
+        )
+
+    async def edit_text(
+        self,
+        text: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        entities: List["types.MessageEntity"] = None,
+        link_preview_options: "types.LinkPreviewOptions" = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        disable_web_page_preview: bool = None
+    ) -> "Message":
+        """Bound method *edit_text* of :obj:`~pyrogram.types.Message`.
+
+        An alias exists as *edit*.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.edit_message_text(
+                chat_id=message.chat.id,
+                message_id=message.id,
+                text="hello"
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.edit_text("hello")
+
+        Parameters:
+            text (``str``):
+                New text of the message.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in message text, which can be specified instead of *parse_mode*.
+
+            link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*):
+                Link preview generation options for the message
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            On success, the edited :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.edit_message_text(
+            chat_id=self.chat.id,
+            message_id=self.id,
+            schedule_date=self.date if self.scheduled else None,
+            text=text,
+            parse_mode=parse_mode,
+            entities=entities,
+            link_preview_options=link_preview_options,
+            reply_markup=reply_markup,
+            business_connection_id=self.business_connection_id,
+            disable_web_page_preview=disable_web_page_preview
+        )
+
+    edit = edit_text
+
+    async def edit_caption(
+        self,
+        caption: str,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None
+    ) -> "Message":
+        """Bound method *edit_caption* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.edit_message_caption(
+                chat_id=message.chat.id,
+                message_id=message.id,
+                caption="hello"
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.edit_caption("hello")
+
+        Parameters:
+            caption (``str``):
+                New caption of the message.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            On success, the edited :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.edit_message_caption(
+            chat_id=self.chat.id,
+            message_id=self.id,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            reply_markup=reply_markup,
+            schedule_date=self.date if self.scheduled else None
+        )
+
+    async def edit_media(
+        self,
+        media: "types.InputMedia",
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        file_name: str = None
+    ) -> "Message":
+        """Bound method *edit_media* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.edit_message_media(
+                chat_id=message.chat.id,
+                message_id=message.id,
+                media=media
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.edit_media(media)
+
+        Parameters:
+            media (:obj:`~pyrogram.types.InputMedia`):
+                One of the InputMedia objects describing an animation, audio, document, photo or video.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+            file_name (``str``, *optional*):
+                File name of the media to be sent. Not applicable to photos.
+                Defaults to file's path basename.
+
+        Returns:
+            On success, the edited :obj:`~pyrogram.types.Message` is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.edit_message_media(
+            chat_id=self.chat.id,
+            message_id=self.id,
+            media=media,
+            reply_markup=reply_markup,
+            file_name=file_name,
+            schedule_date=self.date if self.scheduled else None,
+            business_connection_id=self.business_connection_id
+        )
+
+    async def edit_reply_markup(self, reply_markup: "types.InlineKeyboardMarkup" = None) -> "Message":
+        """Bound method *edit_reply_markup* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.edit_message_reply_markup(
+                chat_id=message.chat.id,
+                message_id=message.id,
+                reply_markup=inline_reply_markup
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.edit_reply_markup(inline_reply_markup)
+
+        Parameters:
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            On success, if edited message is sent by the bot, the edited
+            :obj:`~pyrogram.types.Message` is returned, otherwise True is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.edit_message_reply_markup(
+            chat_id=self.chat.id,
+            message_id=self.id,
+            reply_markup=reply_markup,
+            business_connection_id=self.business_connection_id
+        )
+
+    async def edit_cached_media(
+        file_id: str,
+        caption: str = "",
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        schedule_date: datetime = None,
+        has_spoiler: bool = None,
+        reply_markup: "types.InlineKeyboardMarkup" = None
+    ) -> "Message":
+        """Edit a 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 editing media using a file_id, thus saving you from the
+        hassle of using the correct :obj:`~pyrogram.types.InputMedia` for the media the file_id is pointing to.
+
+        .. include:: /_includes/usable-by/users-bots.rst
+
+        Parameters:
+            file_id (``str``):
+                Media to send.
+                Pass a file_id as string to send a media that exists on the Telegram servers.
+
+            caption (``str``, *optional*):
+                Media caption, 0-1024 characters.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            has_spoiler (``bool``, *optional*):
+                True, if the message media is covered by a spoiler animation.
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the edited media message is returned.
+
+        Example:
+            .. code-block:: python
+
+                await message.edit_cached_media(file_id)
+        """
+        return await self._client.edit_cached_media(
+            chat_id=self.chat.id,
+            message_id=self.id,
+            file_id=file_id,
+            caption=caption,
+            parse_mode=parse_mode,
+            caption_entities=caption_entities,
+            schedule_date=schedule_date,
+            has_spoiler=has_spoiler,
+            reply_markup=reply_markup
+        )
+
+    async def forward(
+        self,
+        chat_id: Union[int, str],
+        message_thread_id: int = None,
+        disable_notification: bool = None,
+        protect_content: bool = None,
+        drop_author: bool = None,
+        drop_media_captions: bool = None,
+        schedule_date: datetime = None
+    ) -> Union["types.Message", List["types.Message"]]:
+        """Bound method *forward* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.forward_messages(
+                chat_id=chat_id,
+                from_chat_id=message.chat.id,
+                message_ids=message.id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.forward(chat_id)
+
+        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_thread_id (``int``, *optional*):
+                Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            drop_author (``bool``, *optional*):
+                Whether to forward messages without quoting the original author.
+
+            drop_media_captions (``bool``, *optional*):
+                Whether to strip captions from media.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+        Returns:
+            On success, the forwarded Message is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.forward_messages(
+            from_chat_id=self.chat.id,
+            message_ids=self.id,
+            chat_id=chat_id,
+            message_thread_id=message_thread_id,
+            disable_notification=disable_notification,
+            protect_content=protect_content,
+            drop_author=drop_author,
+            drop_media_captions=drop_media_captions,
+            schedule_date=schedule_date
+        )
+
+    async def copy(
+        self,
+        chat_id: Union[int, str],
+        caption: str = None,
+        parse_mode: Optional["enums.ParseMode"] = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        show_caption_above_media: bool = None,
+        disable_notification: bool = None,
+        reply_parameters: "types.ReplyParameters" = None,
+        reply_markup: Union[
+            "types.InlineKeyboardMarkup",
+            "types.ReplyKeyboardMarkup",
+            "types.ReplyKeyboardRemove",
+            "types.ForceReply"
+        ] = object,
+        schedule_date: datetime = None,
+        business_connection_id: str = None,
+        protect_content: bool = None,
+        message_thread_id: int = None,
+        reply_to_message_id: int = None
+    ) -> Union["types.Message", List["types.Message"]]:
+        """Bound method *copy* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.copy_message(
+                chat_id=chat_id,
+                from_chat_id=message.chat.id,
+                message_id=message.id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.copy(chat_id)
+
+        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).
+
+            caption (``string``, *optional*):
+                New caption for media, 0-1024 characters after entities parsing.
+                If not specified, the original caption is kept.
+                Pass "" (empty string) to remove the caption.
+
+            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
+                By default, texts are parsed using both Markdown and HTML styles.
+                You can combine both syntaxes together.
+
+            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+                List of special entities that appear in the new caption, which can be specified instead of *parse_mode*.
+
+            show_caption_above_media (``bool``, *optional*):
+                Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified.
+
+            disable_notification (``bool``, *optional*):
+                Sends the message silently.
+                Users will receive a notification with no sound.
+
+            reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
+                Description of the message to reply to
+
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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.
+                If not specified, the original reply markup is kept.
+                Pass None to remove the reply markup.
+
+            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the message will be automatically sent.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message will be sent
+
+            protect_content (``bool``, *optional*):
+                Pass True if the content of the message must be protected from forwarding and saving; for bots only.
+
+            message_thread_id (``int``, *optional*):
+                Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the copied message is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        if self.service:
+            log.warning("Service messages cannot be copied. chat_id: %s, message_id: %s",
+                        self.chat.id, self.id)
+        elif self.game and not self._client.me.is_bot:
+            log.warning("Users cannot send messages with Game media type. chat_id: %s, message_id: %s",
+                        self.chat.id, self.id)
+        elif self.empty:
+            log.warning("Empty messages cannot be copied.")
+        elif self.text:
+            return await self._client.send_message(
+                chat_id=chat_id,
+                message_thread_id=self.message_thread_id if message_thread_id is None else message_thread_id,
+                business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id,
+                text=self.text,
+                parse_mode=enums.ParseMode.DISABLED,
+                entities=self.entities,
+                link_preview_options=self.link_preview_options,
+                disable_notification=disable_notification,
+                protect_content=self.has_protected_content if protect_content is None else protect_content,
+                message_effect_id=self.effect_id,
+                reply_parameters=reply_parameters,
+                reply_markup=self.reply_markup if reply_markup is object else reply_markup,
+                reply_to_message_id=reply_to_message_id,
+                schedule_date=schedule_date
+            )
+        elif self.media:
+            send_media = partial(
+                self._client.send_cached_media,
+                chat_id=chat_id,
+                disable_notification=disable_notification,
+                message_effect_id=self.effect_id,
+                show_caption_above_media=show_caption_above_media or self.show_caption_above_media,
+                reply_parameters=reply_parameters,
+                message_thread_id=self.message_thread_id if message_thread_id is None else message_thread_id,
+                business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id,
+                schedule_date=schedule_date,
+                protect_content=self.has_protected_content if protect_content is None else protect_content,
+                has_spoiler=self.has_media_spoiler,
+                reply_to_message_id=reply_to_message_id,
+                reply_markup=self.reply_markup if reply_markup is object else reply_markup
+            )
+
+            if self.photo:
+                file_id = self.photo.file_id
+            elif self.audio:
+                file_id = self.audio.file_id
+            elif self.document:
+                file_id = self.document.file_id
+            elif self.video:
+                file_id = self.video.file_id
+            elif self.animation:
+                file_id = self.animation.file_id
+            elif self.voice:
+                file_id = self.voice.file_id
+            elif self.sticker:
+                file_id = self.sticker.file_id
+            elif self.video_note:
+                file_id = self.video_note.file_id
+            elif self.contact:
+                return await self._client.send_contact(
+                    chat_id,
+                    phone_number=self.contact.phone_number,
+                    first_name=self.contact.first_name,
+                    last_name=self.contact.last_name,
+                    vcard=self.contact.vcard,
+                    disable_notification=disable_notification,
+                    message_effect_id=self.effect_id,
+                    reply_parameters=reply_parameters,
+                    message_thread_id=self.message_thread_id if message_thread_id is None else message_thread_id,
+                    business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id,
+                    schedule_date=schedule_date,
+                    protect_content=self.has_protected_content if protect_content is None else protect_content,
+                    reply_to_message_id=reply_to_message_id,
+                    reply_markup=self.reply_markup if reply_markup is object else reply_markup
+                )
+            elif self.location:
+                return await self._client.send_location(
+                    chat_id,
+                    latitude=self.location.latitude,
+                    longitude=self.location.longitude,
+                    disable_notification=disable_notification,
+                    message_effect_id=self.effect_id,
+                    reply_parameters=reply_parameters,
+                    message_thread_id=self.message_thread_id if message_thread_id is None else message_thread_id,
+                    business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id,
+                    schedule_date=schedule_date,
+                    protect_content=self.has_protected_content if protect_content is None else protect_content,
+                    reply_to_message_id=reply_to_message_id,
+                    reply_markup=self.reply_markup if reply_markup is object else reply_markup
+                )
+            elif self.venue:
+                return await self._client.send_venue(
+                    chat_id,
+                    latitude=self.venue.location.latitude,
+                    longitude=self.venue.location.longitude,
+                    title=self.venue.title,
+                    address=self.venue.address,
+                    foursquare_id=self.venue.foursquare_id,
+                    foursquare_type=self.venue.foursquare_type,
+                    disable_notification=disable_notification,
+                    message_effect_id=self.effect_id,
+                    reply_parameters=reply_parameters,
+                    message_thread_id=self.message_thread_id if message_thread_id is None else message_thread_id,
+                    business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id,
+                    schedule_date=schedule_date,
+                    protect_content=self.has_protected_content if protect_content is None else protect_content,
+                    reply_to_message_id=reply_to_message_id,
+                    reply_markup=self.reply_markup if reply_markup is object else reply_markup
+                )
+            elif self.poll:
+                return await self._client.send_poll(
+                    chat_id,
+                    question=self.poll.question,
+                    question_entities=self.poll.question_entities,
+                    options=[
+                        types.InputPollOption(
+                            text=opt.text,
+                            text_entities=opt.text_entities
+                        ) for opt in self.poll.options
+                    ],
+                    is_anonymous=self.poll.is_anonymous,
+                    type=self.poll.type,
+                    allows_multiple_answers=self.poll.allows_multiple_answers,
+                    correct_option_id=self.poll.correct_option_id,
+                    explanation=self.poll.explanation,
+                    explanation_entities=self.poll.explanation_entities,
+                    open_period=self.poll.open_period,
+                    close_date=self.poll.close_date,
+                    disable_notification=disable_notification,
+                    protect_content=self.has_protected_content if protect_content is None else protect_content,
+                    message_effect_id=self.effect_id,
+                    reply_parameters=reply_parameters,
+                    message_thread_id=self.message_thread_id if message_thread_id is None else message_thread_id,
+                    business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id,
+                    schedule_date=schedule_date,
+                    reply_to_message_id=reply_to_message_id,
+                    reply_markup=self.reply_markup if reply_markup is object else reply_markup
+                )
+            elif self.game:
+                return await self._client.send_game(
+                    chat_id,
+                    game_short_name=self.game.short_name,
+                    disable_notification=disable_notification,
+                    protect_content=self.has_protected_content if protect_content is None else protect_content,
+                    message_thread_id=self.message_thread_id if message_thread_id is None else message_thread_id,
+                    business_connection_id=self.business_connection_id if business_connection_id is None else business_connection_id,
+                    message_effect_id=self.effect_id,
+                    reply_parameters=reply_parameters,
+                    reply_to_message_id=reply_to_message_id,
+                    reply_markup=self.reply_markup if reply_markup is object else reply_markup
+                )
+            else:
+                raise ValueError("Unknown media type")
+
+            if caption is None:
+                caption = self.caption or ""
+                caption_entities = self.caption_entities
+
+            return await send_media(
+                file_id=file_id,
+                caption=caption,
+                parse_mode=parse_mode,
+                caption_entities=caption_entities
+            )
+        else:
+            raise ValueError("Can't copy this message")
+
+    async def delete(self, revoke: bool = True):
+        """Bound method *delete* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.delete_messages(
+                chat_id=chat_id,
+                message_ids=message.id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.delete()
+
+        Parameters:
+            revoke (``bool``, *optional*):
+                Deletes messages on both parts.
+                This is only for private cloud chats and normal groups, messages on
+                channels and supergroups are always revoked (i.e.: deleted for everyone).
+                Defaults to True.
+
+        Returns:
+            ``int``: Amount of affected messages
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.delete_messages(
+            chat_id=self.chat.id,
+            message_ids=self.id,
+            revoke=revoke,
+            is_scheduled=self.scheduled
+        )
+
+    async def click(
+        self,
+        x: Union[int, str] = 0,
+        y: int = None,
+        quote: bool = None,
+        timeout: int = 10,
+        request_write_access: bool = True,
+        password: str = None
+    ):
+        """Bound method *click* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for clicking a button attached to the message instead of:
+
+        - Clicking inline buttons:
+
+        .. code-block:: python
+
+            await client.request_callback_answer(
+                chat_id=message.chat.id,
+                message_id=message.id,
+                callback_data=message.reply_markup[i][j].callback_data
+            )
+
+        - Clicking normal buttons:
+
+        .. code-block:: python
+
+            await client.send_message(
+                chat_id=message.chat.id,
+                text=message.reply_markup[i][j].text
+            )
+
+        Example:
+            This method can be used in three different ways:
+
+            1.  Pass one integer argument only (e.g.: ``.click(2)``, to click a button at index 2).
+                Buttons are counted left to right, starting from the top.
+
+            2.  Pass two integer arguments (e.g.: ``.click(1, 0)``, to click a button at position (1, 0)).
+                The origin (0, 0) is top-left.
+
+            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.
+
+        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).
+
+            quote (``bool``, *optional*):
+                Useful for normal buttons only, where pressing it will result in a new message sent.
+                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.
+
+            request_write_access (``bool``, *optional*):
+                Only used in case of :obj:`~pyrogram.types.LoginUrl` button.
+                True, if the bot can send messages to the user.
+                Defaults to ``True``.
+
+            password (``str``, *optional*):
+                When clicking certain buttons (such as BotFather's confirmation button to transfer ownership), if your account has 2FA enabled, you need to provide your account's password. 
+                The 2-step verification password for the current user. Only applicable, if the :obj:`~pyrogram.types.InlineKeyboardButton` contains ``callback_data_with_password``.
+
+        Returns:
+            -   The result of :meth:`~pyrogram.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.
+            -   A string URL with the user details, in case of a LoginUrl button.
+            -   A :obj:`~pyrogram.types.SwitchInlineQueryChosenChat` object in case of a ``switch_inline_query_chosen_chat``.
+            -   A :obj:`~pyrogram.types.User` object in case of a ``KeyboardButtonUserProfile`` button.
+
+        Raises:
+            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, types.ReplyKeyboardMarkup):
+            keyboard = self.reply_markup.keyboard
+            is_inline = False
+        elif isinstance(self.reply_markup, types.InlineKeyboardMarkup):
+            keyboard = self.reply_markup.inline_keyboard
+            is_inline = True
+        else:
+            raise ValueError("The message doesn't contain any keyboard")
+
+        if isinstance(x, int) and y is None:
+            try:
+                button = [
+                    button
+                    for row in keyboard
+                    for button in row
+                ][x]
+            except IndexError:
+                raise ValueError(f"The button at index {x} doesn't exist")
+        elif isinstance(x, int) and isinstance(y, int):
+            try:
+                button = keyboard[y][x]
+            except IndexError:
+                raise ValueError(f"The button at position ({x}, {y}) doesn't exist")
+        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(f"The button with label '{x}' doesn't exists")
+        else:
+            raise ValueError("Invalid arguments")
+
+        if is_inline:
+            if button.callback_data:
+                return await self._client.request_callback_answer(
+                    chat_id=self.chat.id,
+                    message_id=self.id,
+                    callback_data=button.callback_data,
+                    timeout=timeout
+                )
+            elif button.callback_data_with_password:
+                if password is None:
+                    raise ValueError(
+                        "Invalid argument passed"
+                    )
+                return await self._client.request_callback_answer(
+                    chat_id=self.chat.id,
+                    message_id=self.id,
+                    callback_data=button.callback_data_with_password,
+                    password=password,
+                    timeout=timeout
+                )
+            elif button.url:
+                return button.url
+            elif button.login_url:
+                tlu = button.login_url
+                rieep = await self._client.resolve_peer(
+                    self.chat.id
+                )
+                okduit = await self._client.invoke(
+                    raw.functions.messages.RequestUrlAuth(
+                        peer=rieep,
+                        msg_id=self.id,
+                        button_id=tlu.button_id,
+                        url=tlu.url
+                    )
+                )
+                tiudko = await self._client.invoke(
+                    raw.functions.messages.AcceptUrlAuth(
+                        write_allowed=request_write_access,
+                        peer=rieep,
+                        msg_id=self.id,
+                        button_id=tlu.button_id,
+                        url=tlu.url
+                    )
+                )
+                return tiudko.url
+            elif button.web_app:
+                tlu = button.web_app
+                whichbotchat = (
+                    self.via_bot and
+                    self.via_bot.id
+                ) or (
+                    self.from_user and
+                    self.from_user.is_bot and
+                    self.from_user.id
+                ) or None
+                if not whichbotchat:
+                    raise ValueError(
+                        "Invalid ChatBotType"
+                    )
+                rieep = await self._client.resolve_peer(
+                    self.chat.id
+                )
+                ieepr = await self._client.resolve_peer(
+                    whichbotchat
+                )
+                okduit = await self._client.invoke(
+                    raw.functions.messages.RequestWebView(
+                        peer=rieep,
+                        bot=ieepr,
+                        url=tlu.url,
+                        platform=self._client.client_platform.value,
+                        # TODO
+                    )
+                )
+                return okduit.url
+            elif button.user_id:
+                return await self._client.get_chat(
+                    button.user_id,
+                    False
+                )
+            elif button.switch_inline_query:
+                return button.switch_inline_query
+            elif button.switch_inline_query_current_chat:
+                return button.switch_inline_query_current_chat
+            elif button.switch_inline_query_chosen_chat:
+                return button.switch_inline_query_chosen_chat
+            else:
+                raise ValueError("This button is not supported yet")
+        else:
+            await self.reply(text=button, quote=quote)
+
+    async def react(
+        self,
+        reaction: Union[
+            int,
+            str,
+            List[Union[int, str, "types.ReactionType"]]
+        ] = None,
+        is_big: bool = False,
+        add_to_recent: bool = True
+    ) -> "types.MessageReactions":
+        """Bound method *react* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.set_reaction(
+                chat_id=chat_id,
+                message_id=message.id,
+                reaction=[ReactionTypeEmoji(emoji="👍")]
+            )
+
+        Example:
+            .. code-block:: python
+
+                # Send a reaction
+                await message.react([ReactionTypeEmoji(emoji="👍")])
+
+                # Retract a reaction
+                await message.react()
+
+        Parameters:
+            reaction (``int`` | ``str`` | List of ``int`` OR ``str`` | List of :obj:`~pyrogram.types.ReactionType`, *optional*):
+                New list of reaction types to set on the message.
+                Pass None as emoji (default) to retract the reaction.
+
+            is_big (``bool``, *optional*):
+                Pass True to set the reaction with a big animation.
+                Defaults to False.
+            
+            add_to_recent (``bool``, *optional*):
+                Pass True if the reaction should appear in the recently used reactions.
+                This option is applicable only for users.
+                Defaults to True.
+        Returns:
+            On success, :obj:`~pyrogram.types.MessageReactions`: is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        sr = None
+
+        if isinstance(reaction, List):
+            sr = []
+            for i in reaction:
+                if isinstance(i, types.ReactionType):
+                    sr.append(i)
+                elif isinstance(i, int):
+                    sr.append(types.ReactionTypeCustomEmoji(
+                        custom_emoji_id=str(i)
+                    ))
+                else:
+                    sr.append(types.ReactionTypeEmoji(
+                        emoji=i
+                    ))
+
+        elif isinstance(reaction, int):
+            sr = [
+                types.ReactionTypeCustomEmoji(
+                    custom_emoji_id=str(reaction)
+                )
+            ]
+
+        elif isinstance(reaction, str):
+            sr = [
+                types.ReactionTypeEmoji(
+                    emoji=reaction
+                )
+            ]
+
+        return await self._client.set_reaction(
+            chat_id=self.chat.id,
+            message_id=self.id,
+            reaction=sr,
+            is_big=is_big,
+            add_to_recent=add_to_recent
+        )
+
+    async def retract_vote(
+        self,
+    ) -> "types.Poll":
+        """Bound method *retract_vote* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.retract_vote(
+                chat_id=message.chat.id,
+                message_id=message_id,
+            )
+
+        Example:
+            .. code-block:: python
+
+                message.retract_vote()
+
+        Returns:
+            :obj:`~pyrogram.types.Poll`: On success, the poll with the retracted vote is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.retract_vote(
+            chat_id=self.chat.id,
+            message_id=self.id
+        )
+
+    async def download(
+        self,
+        file_name: str = "",
+        in_memory: bool = False,
+        block: bool = True,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> str:
+        """Bound method *download* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.download_media(message)
+
+        Example:
+            .. code-block:: python
+
+                await message.download()
+
+        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.
+                You can also specify a path for downloading files in a custom location: paths that end with "/"
+                are considered directories. All non-existent folders will be created automatically.
+
+            in_memory (``bool``, *optional*):
+                Pass True to download the media in-memory.
+                A binary file-like object with its attribute ".name" set will be returned.
+                Defaults to False.
+
+            block (``bool``, *optional*):
+                Blocks the code execution until the file has been downloaded.
+                Defaults to True.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the absolute path of the downloaded file as string is returned, None otherwise.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+            ``ValueError``: If the message doesn't contain any downloadable media
+        """
+        return await self._client.download_media(
+            message=self,
+            file_name=file_name,
+            in_memory=in_memory,
+            block=block,
+            progress=progress,
+            progress_args=progress_args,
+        )
+
+    async def vote(
+        self,
+        option: int,
+    ) -> "types.Poll":
+        """Bound method *vote* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.vote_poll(
+                chat_id=message.chat.id,
+                message_id=message.id,
+                option=1
+            )
+
+        Example:
+            .. code-block:: python
+
+                message.vote(6)
+
+        Parameters:
+            option (``int``):
+                Index of the poll option you want to vote for (0 to 9).
+
+        Returns:
+            :obj:`~pyrogram.types.Poll`: On success, the poll with the chosen option is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.vote_poll(
+            chat_id=self.chat.id,
+            message_id=self.id,
+            options=option
+        )
+
+    async def pin(self, disable_notification: bool = False, both_sides: bool = False) -> "types.Message":
+        """Bound method *pin* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.pin_chat_message(
+                chat_id=message.chat.id,
+                message_id=message_id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.pin()
+
+        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.
+
+            both_sides (``bool``, *optional*):
+                Pass True to pin the message for both sides (you and recipient).
+                Applicable to private chats only. Defaults to False.
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the service message is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.pin_chat_message(
+            chat_id=self.chat.id,
+            message_id=self.id,
+            disable_notification=disable_notification,
+            both_sides=both_sides
+        )
+
+    async def unpin(self) -> bool:
+        """Bound method *unpin* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.unpin_chat_message(
+                chat_id=message.chat.id,
+                message_id=message_id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.unpin()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.unpin_chat_message(
+            chat_id=self.chat.id,
+            message_id=self.id
+        )
+
+    # BEGIN: the below properties were removed in `BOT API 7.0 `_
+
+    @property
+    def forward_from(self) -> "types.User":
+        log.warning(
+            "This property is deprecated. "
+            "Please use forward_origin instead"
+        )
+        return getattr(self.forward_origin, "sender_user", None)
+    
+    @property
+    def forward_sender_name(self) -> str:
+        log.warning(
+            "This property is deprecated. "
+            "Please use forward_origin instead"
+        )
+        return getattr(self.forward_origin, "sender_user_name", None)
+
+    @property
+    def forward_from_chat(self) -> "types.Chat":
+        log.warning(
+            "This property is deprecated. "
+            "Please use forward_origin instead"
+        )
+        return getattr(
+            self.forward_origin,
+            "chat",
+            getattr(
+                self.forward_origin,
+                "sender_chat",
+                None
+            )
+        )
+
+    @property
+    def forward_from_message_id(self) -> int:
+        log.warning(
+            "This property is deprecated. "
+            "Please use forward_origin instead"
+        )
+        return getattr(self.forward_origin, "message_id", None)
+
+    @property
+    def forward_signature(self) -> str:
+        log.warning(
+            "This property is deprecated. "
+            "Please use forward_origin instead"
+        )
+        return getattr(self.forward_origin, "author_signature", None)
+        
+    @property
+    def forward_date(self) -> datetime:
+        log.warning(
+            "This property is deprecated. "
+            "Please use forward_origin instead"
+        )
+        return getattr(self.forward_origin, "date", None)
+
+    # END: the below properties were removed in `BOT API 7.0 `_
+
+    async def read(self) -> bool:
+        """Bound method *read* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.read_chat_history(
+                chat_id=message.chat.id,
+                max_id=message_id
+            )
+
+        Example:
+
+            .. code-block:: python
+
+                await message.read()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+
+        """
+        return await self._client.read_chat_history(
+            chat_id=self.chat.id,
+            max_id=self.id
+        )
+
+    async def view(self, force_read: bool = True) -> bool:
+        """Bound method *view* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.view_messages(
+                chat_id=message.chat.id,
+                message_ids=message_id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.view()
+
+        Parameters:
+            force_read (``bool``, *optional*):
+                Pass True to mark as read the specified messages and also increment the view counter.
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+
+        """
+        return await self._client.view_messages(
+            chat_id=self.chat.id,
+            message_ids=self.id,
+            force_read=force_read
+        )
+
+    async def translate(
+        self,
+        to_language_code: str
+    ) -> "types.TranslatedText":
+        """Bound method *translate* of :obj:`~pyrogram.types.Message`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.translate_message_text(
+                chat_id=message.chat.id,
+                message_ids=message_id,
+                to_language_code="en"
+            )
+
+        Example:
+            .. code-block:: python
+
+                await message.translate("en")
+
+        Parameters:
+            to_language_code (``str``):
+                Language code of the language to which the message is translated.
+                Must be one of "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", "st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu".
+
+        Returns:
+            :obj:`~pyrogram.types.TranslatedText`: The translated result is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+
+        """
+        return await self._client.translate_message_text(
+            chat_id=self.chat.id,
+            message_ids=self.id,
+            to_language_code=to_language_code
+        )
diff --git a/pyrogram/types/messages_and_media/message_auto_delete_timer_changed.py b/pyrogram/types/messages_and_media/message_auto_delete_timer_changed.py
new file mode 100644
index 0000000000..e7c9e27d5f
--- /dev/null
+++ b/pyrogram/types/messages_and_media/message_auto_delete_timer_changed.py
@@ -0,0 +1,46 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import types
+from ..object import Object
+
+
+class MessageAutoDeleteTimerChanged(Object):
+    """This object represents a service message about a change in auto-delete timer settings.
+
+    Parameters:
+        message_auto_delete_time (``int``):
+            New auto-delete time for messages in the chat; in seconds.
+        
+        from_user (:obj:`~pyrogram.types.User`, *optional*):
+            If set, the chat TTL setting was set not due to a manual change by one of participants, but automatically because one of the participants has the default TTL settings enabled.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        message_auto_delete_time: int = None,
+        from_user: "types.User" = None
+    ):
+        super().__init__()
+
+        self.message_auto_delete_time = message_auto_delete_time
+        self.from_user = from_user
diff --git a/pyrogram/types/messages_and_media/message_effect.py b/pyrogram/types/messages_and_media/message_effect.py
new file mode 100644
index 0000000000..8ae3f7a740
--- /dev/null
+++ b/pyrogram/types/messages_and_media/message_effect.py
@@ -0,0 +1,119 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+from pyrogram import raw, types
+from ..object import Object
+
+
+class MessageEffect(Object):
+    """Contains information about an effect added to a message.
+
+    Parameters:
+        id (``int`` ``64-bit``, *optional*):
+            Unique identifier of the effect.
+
+        emoji (``str``):
+            Emoji that represents the effect.
+
+        static_icon (:obj:`~pyrogram.types.Sticker`, *optional*):
+            Static icon for the effect in WEBP format; may be null if none
+
+        effect_animation (:obj:`~pyrogram.types.Document`, *optional*):
+            Effect animation for the effect in TGS format.
+
+        select_animation (:obj:`~pyrogram.types.Document`, *optional*):
+            Select animation for the effect in TGS format.
+
+        is_premium (``bool``, *optional*):
+            True, if Telegram Premium subscription is required to use the effect.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        id: int,
+        emoji: str,
+        static_icon: Optional["types.Sticker"] = None,
+        effect_animation: Optional["types.Document"] = None,
+        select_animation: Optional["types.Document"] = None,
+        is_premium: Optional[bool] = None
+    ):
+        super().__init__()
+
+        self.id = id
+        self.emoji = emoji
+        self.static_icon = static_icon
+        self.effect_animation = effect_animation
+        self.select_animation = select_animation
+        self.is_premium = is_premium
+
+    @staticmethod
+    async def _parse(
+        client,
+        effect: "raw.types.AvailableEffect",
+        effect_animation_document: "raw.types.Document" = None,
+        static_icon_document: "raw.types.Document" = None,
+        select_animation_document: "raw.types.Document" = None
+    ) -> "MessageEffect":
+        effect_animation = None
+        static_icon = None
+        select_animation = None
+
+        effect_sticker_id = effect.effect_sticker_id
+        static_icon_id = getattr(effect, "static_icon_id", None)
+        effect_animation_id = getattr(effect, "effect_animation_id", None)
+
+        if effect_animation_document:
+            effect_animation = await types.Sticker._parse(
+                client,
+                effect_animation_document,
+                {type(i): i for i in effect_animation_document.attributes}
+            )
+        # TODO: FIXME!
+        if static_icon_document:
+            document_attributes = {
+                type(i): i for i in static_icon_document.attributes
+            }
+            file_name = getattr(document_attributes.get(raw.types.DocumentAttributeFilename, None), "file_name", None)
+            static_icon = types.Document._parse(
+                client,
+                static_icon_document,
+                file_name
+            )
+        if select_animation_document:
+            document_attributes = {
+                type(i): i for i in select_animation_document.attributes
+            }
+            file_name = getattr(document_attributes.get(raw.types.DocumentAttributeFilename, None), "file_name", None)
+            select_animation = types.Document._parse(
+                client,
+                select_animation_document,
+                file_name
+            )
+
+        return MessageEffect(
+            id=effect.id,
+            emoji=effect.emoticon,
+            static_icon=static_icon,
+            effect_animation=effect_animation,  # TODO: FIXME!
+            select_animation=select_animation,  # TODO: FIXME!
+            is_premium=getattr(effect, "premium_required", None)
+        )
diff --git a/pyrogram/types/messages_and_media/message_entity.py b/pyrogram/types/messages_and_media/message_entity.py
new file mode 100644
index 0000000000..33e295e41a
--- /dev/null
+++ b/pyrogram/types/messages_and_media/message_entity.py
@@ -0,0 +1,137 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import raw, enums, types
+from ..object import Object
+
+
+class MessageEntity(Object):
+    """One special entity in a text message.
+    
+    For example, hashtags, usernames, URLs, etc.
+
+    Parameters:
+        type (:obj:`~pyrogram.enums.MessageEntityType`):
+            Type of the entity.
+
+        offset (``int``):
+            Offset in UTF-16 code units to the start of the entity.
+
+        length (``int``):
+            Length of the entity in UTF-16 code units.
+
+        url (``str``, *optional*):
+            For :obj:`~pyrogram.enums.MessageEntityType.TEXT_LINK` only, url that will be opened after user taps on the text.
+
+        user (:obj:`~pyrogram.types.User`, *optional*):
+            For :obj:`~pyrogram.enums.MessageEntityType.TEXT_MENTION` only, the mentioned user.
+
+        language (``str``, *optional*):
+            For "pre" only, the programming language of the entity text.
+
+        custom_emoji_id (``int``, *optional*):
+            For :obj:`~pyrogram.enums.MessageEntityType.CUSTOM_EMOJI` only, unique identifier of the custom emoji.
+            Use :meth:`~pyrogram.Client.get_custom_emoji_stickers` to get full information about the sticker.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        type: "enums.MessageEntityType",
+        offset: int,
+        length: int,
+        url: str = None,
+        user: "types.User" = None,
+        language: str = None,
+        custom_emoji_id: int = None
+    ):
+        super().__init__(client)
+
+        self.type = type
+        self.offset = offset
+        self.length = length
+        self.url = url
+        self.user = user
+        self.language = language
+        self.custom_emoji_id = custom_emoji_id
+
+    @staticmethod
+    def _parse(client, entity: "raw.base.MessageEntity", users: dict) -> Optional["MessageEntity"]:
+        # Special case for InputMessageEntityMentionName -> MessageEntityType.TEXT_MENTION
+        # This happens in case of UpdateShortSentMessage inside send_message() where entities are parsed from the input
+        if isinstance(entity, raw.types.InputMessageEntityMentionName):
+            entity_type = enums.MessageEntityType.TEXT_MENTION
+            user_id = entity.user_id.user_id
+        elif isinstance(entity, raw.types.MessageEntityBlockquote):
+            if entity.collapsed:
+                entity_type = enums.MessageEntityType.EXPANDABLE_BLOCKQUOTE
+            else:
+                entity_type = enums.MessageEntityType.BLOCKQUOTE
+            user_id = None
+        else:
+            entity_type = enums.MessageEntityType(entity.__class__)
+            user_id = getattr(entity, "user_id", None)
+
+        return MessageEntity(
+            type=entity_type,
+            offset=entity.offset,
+            length=entity.length,
+            url=getattr(entity, "url", None),
+            user=types.User._parse(client, users.get(user_id, None)),
+            language=getattr(entity, "language", None),
+            custom_emoji_id=getattr(entity, "document_id", None),
+            client=client
+        )
+
+    async def write(self):
+        args = self.__dict__.copy()
+
+        for arg in ("_client", "type", "user"):
+            args.pop(arg)
+
+        if self.user:
+            args["user_id"] = await self._client.resolve_peer(self.user.id)
+
+        if not self.url:
+            args.pop("url")
+
+        if self.language is None:
+            args.pop("language")
+
+        args.pop("custom_emoji_id")
+        if self.custom_emoji_id is not None:
+            args["document_id"] = self.custom_emoji_id
+
+        if self.type == enums.MessageEntityType.EXPANDABLE_BLOCKQUOTE:
+            args["collapsed"] = True
+
+        entity = self.type.value
+
+        if entity is raw.types.MessageEntityMentionName:
+            entity = raw.types.InputMessageEntityMentionName
+        elif self.type in (
+            enums.MessageEntityType.BLOCKQUOTE,
+            enums.MessageEntityType.EXPANDABLE_BLOCKQUOTE,
+        ):
+            entity = raw.types.MessageEntityBlockquote
+
+        return entity(**args)
diff --git a/pyrogram/types/messages_and_media/message_reaction_count_updated.py b/pyrogram/types/messages_and_media/message_reaction_count_updated.py
new file mode 100644
index 0000000000..b410ffe8e6
--- /dev/null
+++ b/pyrogram/types/messages_and_media/message_reaction_count_updated.py
@@ -0,0 +1,89 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Optional, Dict, List
+
+import pyrogram
+from pyrogram import raw, types, utils
+from ..object import Object
+from ..update import Update
+
+
+class MessageReactionCountUpdated(Object, Update):
+    """Reactions to a message with anonymous reactions were changed.
+
+    These updates are heavy and their changes may be delayed by a few minutes.
+
+    Parameters:
+        chat (:obj:`~pyrogram.types.Chat`):
+            The chat containing the message the user reacted to
+
+        message_id (``int``):
+            Unique identifier of the message inside the chat
+
+        date (:py:obj:`~datetime.datetime`):
+            Date of change of the reaction
+
+        reactions (:obj:`~pyrogram.types.ReactionCount`):
+            List of reactions that are present on the message
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        chat: "types.Chat",
+        message_id: int,
+        date: datetime,
+        reactions: List["types.ReactionCount"]
+    ):
+        super().__init__(client)
+
+        self.chat = chat
+        self.message_id = message_id
+        self.date = date
+        self.reactions = reactions
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        update: "raw.types.UpdateBotMessageReactions",
+        users: Dict[int, "raw.types.User"],
+        chats: Dict[int, "raw.types.Chat"]
+    ) -> "MessageReactionUpdated":
+        chat = None
+        peer_id = utils.get_peer_id(update.peer)
+        raw_peer_id = utils.get_raw_peer_id(update.peer)
+        if peer_id > 0:
+            chat = types.Chat._parse_user_chat(client, users[raw_peer_id])
+        else:
+            chat = types.Chat._parse_chat(client, chats[raw_peer_id])
+
+        return MessageReactionCountUpdated(
+            client=client,
+            chat=chat,
+            message_id=update.msg_id,
+            date=utils.timestamp_to_datetime(update.date),
+            reactions=[
+                types.ReactionCount._parse(
+                    client,
+                    rt
+                ) for rt in update.reactions
+            ]
+        )
diff --git a/pyrogram/types/messages_and_media/message_reaction_updated.py b/pyrogram/types/messages_and_media/message_reaction_updated.py
new file mode 100644
index 0000000000..dd8cacef92
--- /dev/null
+++ b/pyrogram/types/messages_and_media/message_reaction_updated.py
@@ -0,0 +1,126 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Optional, Dict, List
+
+import pyrogram
+from pyrogram import raw, types, utils
+from ..object import Object
+from ..update import Update
+
+
+class MessageReactionUpdated(Object, Update):
+    """This object represents a change of a reaction on a message performed by a user.
+    A reaction to a message was changed by a user.
+    The update isn't received for reactions set by bots.
+
+    These updates are heavy and their changes may be delayed by a few minutes.
+
+    Parameters:
+        chat (:obj:`~pyrogram.types.Chat`):
+            The chat containing the message the user reacted to
+
+        message_id (``int``):
+            Unique identifier of the message inside the chat
+
+        user (:obj:`~pyrogram.types.User`, *optional*):
+            The user that changed the reaction, if the user isn't anonymous
+
+        actor_chat (:obj:`~pyrogram.types.Chat`, *optional*):
+            The chat on behalf of which the reaction was changed, if the user is anonymous
+
+        date (:py:obj:`~datetime.datetime`):
+            Date of change of the reaction
+
+        old_reaction (:obj:`~pyrogram.types.ReactionType`):
+            Previous list of reaction types that were set by the user
+
+        new_reaction (:obj:`~pyrogram.types.ReactionType`):
+            New list of reaction types that have been set by the user
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        chat: "types.Chat",
+        message_id: int,
+        user: "types.User",
+        actor_chat: "types.Chat",
+        date: datetime,
+        old_reaction: List["types.ReactionType"],
+        new_reaction: List["types.ReactionType"]
+    ):
+        super().__init__(client)
+
+        self.chat = chat
+        self.message_id = message_id
+        self.user = user
+        self.actor_chat = actor_chat
+        self.date = date
+        self.old_reaction = old_reaction
+        self.new_reaction = new_reaction
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        update: "raw.types.UpdateBotMessageReaction",
+        users: Dict[int, "raw.types.User"],
+        chats: Dict[int, "raw.types.Chat"]
+    ) -> "MessageReactionUpdated":
+        chat = None
+        peer_id = utils.get_peer_id(update.peer)
+        raw_peer_id = utils.get_raw_peer_id(update.peer)
+        if peer_id > 0:
+            chat = types.Chat._parse_user_chat(client, users[raw_peer_id])
+        else:
+            chat = types.Chat._parse_chat(client, chats[raw_peer_id])
+
+        user = None
+        actor_chat = None
+
+        raw_actor_peer_id = utils.get_raw_peer_id(update.actor)
+        actor_peer_id = utils.get_peer_id(update.actor)
+
+        if actor_peer_id > 0:
+            user = types.User._parse(client, users[raw_actor_peer_id])
+        else:
+            actor_chat = types.Chat._parse_channel_chat(client, chats[raw_actor_peer_id])
+
+        return MessageReactionUpdated(
+            client=client,
+            chat=chat,
+            message_id=update.msg_id,
+            user=user,
+            actor_chat=actor_chat,
+            date=utils.timestamp_to_datetime(update.date),
+            old_reaction=[
+                types.ReactionType._parse(
+                    client,
+                    rt
+                ) for rt in update.old_reactions
+            ],
+            new_reaction=[
+                types.ReactionType._parse(
+                    client,
+                    rt
+                ) for rt in update.new_reactions
+            ]
+        )
diff --git a/pyrogram/types/messages_and_media/message_reactions.py b/pyrogram/types/messages_and_media/message_reactions.py
new file mode 100644
index 0000000000..b2b2778935
--- /dev/null
+++ b/pyrogram/types/messages_and_media/message_reactions.py
@@ -0,0 +1,58 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types
+from ..object import Object
+
+
+class MessageReactions(Object):
+    """Contains information about a message reactions.
+
+    Parameters:
+        reactions (List of :obj:`~pyrogram.types.Reaction`):
+            Reactions list.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        reactions: Optional[List["types.Reaction"]] = None,
+    ):
+        super().__init__(client)
+
+        self.reactions = reactions
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        message_reactions: Optional["raw.base.MessageReactions"] = None
+    ) -> Optional["MessageReactions"]:
+        if not message_reactions:
+            return None
+
+        return MessageReactions(
+            client=client,
+            reactions=[
+                types.Reaction._parse_count(client, reaction)
+                for reaction in message_reactions.results
+            ]
+        )
diff --git a/pyrogram/types/messages_and_media/photo.py b/pyrogram/types/messages_and_media/photo.py
new file mode 100644
index 0000000000..0a518daf27
--- /dev/null
+++ b/pyrogram/types/messages_and_media/photo.py
@@ -0,0 +1,138 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
+from ..object import Object
+
+
+class Photo(Object):
+    """A Photo.
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download or reuse the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        width (``int``):
+            Photo width.
+
+        height (``int``):
+            Photo height.
+
+        file_size (``int``):
+            File size.
+
+        date (:py:obj:`~datetime.datetime`):
+            Date the photo was sent.
+
+        ttl_seconds (``int``, *optional*):
+            Time-to-live seconds, for secret photos.
+
+        thumbs (List of :obj:`~pyrogram.types.Thumbnail`, *optional*):
+            Available thumbnails of this photo.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        width: int,
+        height: int,
+        file_size: int,
+        date: datetime,
+        ttl_seconds: int = None,
+        has_spoiler: bool = None,
+        thumbs: List["types.Thumbnail"] = None
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        self.width = width
+        self.height = height
+        self.file_size = file_size
+        self.date = date
+        self.ttl_seconds = ttl_seconds
+        self.has_spoiler = has_spoiler
+        self.thumbs = thumbs
+
+    @staticmethod
+    def _parse(
+        client,
+        photo: "raw.types.Photo",
+        ttl_seconds: int = None,
+        has_spoiler: bool = None,
+    ) -> "Photo":
+        if isinstance(photo, raw.types.Photo):
+            photos: List[raw.types.PhotoSize] = []
+
+            for p in photo.sizes:
+                if isinstance(p, raw.types.PhotoSize):
+                    photos.append(p)
+
+                if isinstance(p, raw.types.PhotoSizeProgressive):
+                    photos.append(
+                        raw.types.PhotoSize(
+                            type=p.type,
+                            w=p.w,
+                            h=p.h,
+                            size=max(p.sizes)
+                        )
+                    )
+
+            photos.sort(key=lambda p: p.size)
+
+            main = photos[-1]
+
+            return Photo(
+                file_id=FileId(
+                    file_type=FileType.PHOTO,
+                    dc_id=photo.dc_id,
+                    media_id=photo.id,
+                    access_hash=photo.access_hash,
+                    file_reference=photo.file_reference,
+                    thumbnail_source=ThumbnailSource.THUMBNAIL,
+                    thumbnail_file_type=FileType.PHOTO,
+                    thumbnail_size=main.type,
+                    volume_id=0,
+                    local_id=0
+                ).encode(),
+                file_unique_id=FileUniqueId(
+                    file_unique_type=FileUniqueType.DOCUMENT,
+                    media_id=photo.id
+                ).encode(),
+                width=main.w,
+                height=main.h,
+                file_size=main.size,
+                date=utils.timestamp_to_datetime(photo.date),
+                ttl_seconds=ttl_seconds,
+                has_spoiler=has_spoiler,
+                thumbs=types.Thumbnail._parse(client, photo),
+                client=client
+            )
diff --git a/pyrogram/types/messages_and_media/poll.py b/pyrogram/types/messages_and_media/poll.py
new file mode 100644
index 0000000000..188fab38e1
--- /dev/null
+++ b/pyrogram/types/messages_and_media/poll.py
@@ -0,0 +1,275 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List, Union, Optional
+
+import pyrogram
+from pyrogram import enums, raw, types, utils
+from ..object import Object
+from ..update import Update
+from .message import Str
+
+
+class Poll(Object, Update):
+    """A Poll.
+
+    Parameters:
+        id (``str``):
+            Unique poll identifier.
+
+        question (``str``):
+            Poll question, 1-255 characters.
+
+        question_entities (List of :obj:`~pyrogram.types.MessageEntity`):
+            Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions.
+
+        options (List of :obj:`~pyrogram.types.PollOption`):
+            List of poll options.
+
+        total_voter_count (``int``):
+            Total number of users that voted in the poll.
+
+        is_closed (``bool``):
+            True, if the poll is closed.
+
+        is_anonymous (``bool``, *optional*):
+            True, if the poll is anonymous
+
+        type (:obj:`~pyrogram.enums.PollType`, *optional*):
+            Poll type.
+
+        allows_multiple_answers (``bool``, *optional*):
+            True, if the poll allows multiple answers.
+
+        chosen_option_id (``int``, *optional*):
+            0-based index of the chosen option), None in case of no vote yet.
+
+        correct_option_id (``int``, *optional*):
+            0-based identifier of the correct answer option.
+            Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to
+            the private chat with the bot.
+
+        explanation (``str``, *optional*):
+            Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll,
+            0-200 characters.
+
+        explanation_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
+            Special entities like usernames, URLs, bot commands, etc. that appear in the explanation.
+
+        open_period (``int``, *optional*):
+            Amount of time in seconds the poll will be active after creation.
+
+        close_date (:py:obj:`~datetime.datetime`, *optional*):
+            Point in time when the poll will be automatically closed.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: str,
+        question: str,
+        options: List["types.PollOption"],
+        question_entities: List["types.MessageEntity"] = None,
+        total_voter_count: int,
+        is_closed: bool,
+        is_anonymous: bool = None,
+        type: "enums.PollType" = None,
+        allows_multiple_answers: bool = None,
+        chosen_option_id: Optional[int] = None,
+        correct_option_id: Optional[int] = None,
+        explanation: Optional[str] = None,
+        explanation_entities: Optional[List["types.MessageEntity"]] = None,
+        open_period: Optional[int] = None,
+        close_date: Optional[datetime] = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.question = question
+        self.options = options
+        self.question_entities = question_entities
+        self.total_voter_count = total_voter_count
+        self.is_closed = is_closed
+        self.is_anonymous = is_anonymous
+        self.type = type
+        self.allows_multiple_answers = allows_multiple_answers
+        self.chosen_option_id = chosen_option_id
+        self.correct_option_id = correct_option_id
+        self.explanation = explanation
+        self.explanation_entities = explanation_entities
+        self.open_period = open_period
+        self.close_date = close_date
+
+    @staticmethod
+    def _parse(client, media_poll: Union["raw.types.MessageMediaPoll", "raw.types.UpdateMessagePoll"]) -> "Poll":
+        poll: raw.types.Poll = media_poll.poll
+        poll_results: raw.types.PollResults = media_poll.results
+        results: List[raw.types.PollAnswerVoters] = poll_results.results
+
+        chosen_option_id = None
+        correct_option_id = None
+        options = []
+
+        for i, answer in enumerate(poll.answers):
+            voter_count = 0
+
+            if results:
+                result = results[i]
+                voter_count = result.voters
+
+                if result.chosen:
+                    chosen_option_id = i
+
+                if result.correct:
+                    correct_option_id = i
+
+            entities = [
+                types.MessageEntity._parse(
+                    client,
+                    entity,
+                    {}  # there isn't a TEXT_MENTION entity available yet
+                )
+                for entity in (answer.text.entities or [])
+            ]
+            entities = types.List(filter(lambda x: x is not None, entities))
+
+            options.append(
+                types.PollOption(
+                    text=Str(answer.text.text).init(entities),
+                    text_entities=entities,
+                    voter_count=voter_count,
+                    data=answer.option,
+                    client=client
+                )
+            )
+
+        entities = [
+            types.MessageEntity._parse(
+                client,
+                entity,
+                {}  # there isn't a TEXT_MENTION entity available yet
+            )
+            for entity in (poll.question.entities or [])
+        ]
+        entities = types.List(filter(lambda x: x is not None, entities))
+
+        return Poll(
+            id=str(poll.id),
+            question=Str(poll.question.text).init(entities),
+            options=options,
+            question_entities=entities,
+            total_voter_count=media_poll.results.total_voters,
+            is_closed=poll.closed,
+            is_anonymous=not poll.public_voters,
+            type=enums.PollType.QUIZ if poll.quiz else enums.PollType.REGULAR,
+            allows_multiple_answers=poll.multiple_choice,
+            chosen_option_id=chosen_option_id,
+            correct_option_id=correct_option_id,
+            explanation=poll_results.solution,
+            explanation_entities=[
+                types.MessageEntity._parse(client, i, {})
+                for i in poll_results.solution_entities
+            ] if poll_results.solution_entities else None,
+            open_period=poll.close_period,
+            close_date=utils.timestamp_to_datetime(poll.close_date),
+            client=client
+        )
+
+    @staticmethod
+    def _parse_update(client, update: "raw.types.UpdateMessagePoll"):
+        if update.poll is not None:
+            return Poll._parse(client, update)
+
+        # TODO: FIXME!
+        results = update.results.results
+        chosen_option_id = None
+        correct_option_id = None
+        options = []
+        question = ""
+
+        for i, result in enumerate(results):
+            if result.chosen:
+                chosen_option_id = i
+
+            if result.correct:
+                correct_option_id = i
+
+            options.append(
+                types.PollOption(
+                    text="",
+                    text_entities=[],
+                    voter_count=result.voters,
+                    data=result.option,
+                    client=client
+                )
+            )
+
+        return Poll(
+            id=str(update.poll_id),
+            question=question,
+            options=options,
+            total_voter_count=update.results.total_voters,
+            is_closed=False,
+            chosen_option_id=chosen_option_id,
+            correct_option_id=correct_option_id,
+            client=client
+        )
+
+    async def stop(
+        self,
+        reply_markup: "types.InlineKeyboardMarkup" = None,
+        business_connection_id: str = None
+    ) -> "types.Poll":
+        """Bound method *stop* of :obj:`~pyrogram.types.Poll`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.stop_poll(
+                chat_id=message.chat.id,
+                message_id=message_id,
+            )
+
+        Parameters:
+            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
+                An InlineKeyboardMarkup object.
+
+            business_connection_id (``str``, *optional*):
+                Unique identifier of the business connection on behalf of which the message to be edited was sent
+
+        Example:
+            .. code-block:: python
+
+                message.poll.stop()
+
+        Returns:
+            :obj:`~pyrogram.types.Poll`: On success, the stopped poll with the final results is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.stop_poll(
+            chat_id=self.chat.id,
+            message_id=self.message_id,
+            reply_markup=reply_markup,
+            business_connection_id=business_connection_id
+        )
diff --git a/pyrogram/types/messages_and_media/poll_option.py b/pyrogram/types/messages_and_media/poll_option.py
new file mode 100644
index 0000000000..0f5464b56f
--- /dev/null
+++ b/pyrogram/types/messages_and_media/poll_option.py
@@ -0,0 +1,59 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import types
+
+from ..object import Object
+
+
+class PollOption(Object):
+    """Contains information about one answer option in a poll.
+
+    Parameters:
+        text (``str``):
+            Option text, 1-100 characters.
+        
+        text_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
+            Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts.
+
+        voter_count (``int``):
+            Number of users that voted for this option.
+            Equals to 0 until you vote.
+
+        data (``bytes``):
+            The data this poll option is holding.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        text: str,
+        text_entities: List["types.MessageEntity"],
+        voter_count: int,
+        data: bytes
+    ):
+        super().__init__(client)
+
+        self.text = text
+        self.text_entities = text_entities
+        self.voter_count = voter_count
+        self.data = data
diff --git a/pyrogram/types/messages_and_media/reaction.py b/pyrogram/types/messages_and_media/reaction.py
new file mode 100644
index 0000000000..dd9a213461
--- /dev/null
+++ b/pyrogram/types/messages_and_media/reaction.py
@@ -0,0 +1,215 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional
+
+import pyrogram
+from pyrogram import raw
+from ..object import Object
+
+
+class Reaction(Object):
+    """Contains information about a reaction.
+
+    Parameters:
+        emoji (``str``, *optional*):
+            Reaction emoji.
+
+        custom_emoji_id (``int``, *optional*):
+            Custom emoji id.
+
+        count (``int``, *optional*):
+            Reaction count.
+
+        chosen_order (``int``, *optional*):
+            Chosen reaction order.
+            Available for chosen reactions.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        emoji: Optional[str] = None,
+        custom_emoji_id: Optional[int] = None,
+        count: Optional[int] = None,
+        chosen_order: Optional[int] = None
+    ):
+        super().__init__(client)
+
+        self.emoji = emoji
+        self.custom_emoji_id = custom_emoji_id
+        self.count = count
+        self.chosen_order = chosen_order
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        reaction: "raw.base.Reaction"
+    ) -> "Reaction":
+        if isinstance(reaction, raw.types.ReactionEmoji):
+            return Reaction(
+                client=client,
+                emoji=reaction.emoticon
+            )
+
+        if isinstance(reaction, raw.types.ReactionCustomEmoji):
+            return Reaction(
+                client=client,
+                custom_emoji_id=reaction.document_id
+            )
+
+    @staticmethod
+    def _parse_count(
+        client: "pyrogram.Client",
+        reaction_count: "raw.base.ReactionCount"
+    ) -> "Reaction":
+        reaction = Reaction._parse(client, reaction_count.reaction)
+        reaction.count = reaction_count.count
+        reaction.chosen_order = reaction_count.chosen_order
+
+        return reaction
+
+
+class ReactionType(Object):
+    """This object describes the type of a reaction. Currently, it can be one of
+
+    - :obj:`~pyrogram.types.ReactionTypeEmoji`
+    - :obj:`~pyrogram.types.ReactionTypeCustomEmoji`
+    """
+
+    def __init__(
+        self,
+        *,
+        type: str = None,
+        emoji: str = None,
+        custom_emoji_id: str = None
+    ):
+        super().__init__()
+        self.type = type
+        self.emoji = emoji
+        self.custom_emoji_id = custom_emoji_id
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        update: "raw.types.Reaction",
+    ) -> Optional["ReactionType"]:
+        if isinstance(update, raw.types.ReactionEmpty):
+            return None
+        elif isinstance(update, raw.types.ReactionEmoji):
+            return ReactionTypeEmoji(
+                emoji=update.emoticon
+            )
+        elif isinstance(update, raw.types.ReactionCustomEmoji):
+            return ReactionTypeCustomEmoji(
+                custom_emoji_id=update.document_id
+            )
+
+    def write(self, client: "pyrogram.Client"):
+        raise NotImplementedError
+
+
+class ReactionTypeEmoji(ReactionType):
+    """The reaction is based on an emoji.
+
+    Parameters:
+        emoji (``str``, *optional*):
+            Reaction emoji.
+    """
+
+    def __init__(
+        self,
+        *,
+        emoji: str = None
+    ):
+        super().__init__(
+            type="emoji",
+            emoji=emoji
+        )
+
+    def write(self, client: "pyrogram.Client") -> "raw.base.Reaction":
+        return raw.types.ReactionEmoji(
+            emoticon=self.emoji
+        )
+        
+
+class ReactionTypeCustomEmoji(ReactionType):
+    """The reaction is based on a custom emoji.
+
+    Parameters:
+        custom_emoji_id (``str``, *optional*):
+            Custom emoji id.
+    """
+
+    def __init__(
+        self,
+        *,
+        custom_emoji_id: str = None
+    ):
+        super().__init__(
+            type="custom_emoji",
+            custom_emoji_id=custom_emoji_id
+        )
+    
+    def write(self, client: "pyrogram.Client") -> "raw.base.Reaction":
+        return raw.types.ReactionCustomEmoji(
+            document_id=self.custom_emoji_id
+        )
+
+
+class ReactionCount(Object):
+    """Represents a reaction added to a message along with the number of times it was added.
+
+    Parameters:
+        type (:obj:`~pyrogram.types.ReactionType`):
+            Type of the reaction
+
+        total_count (``int``):
+            Reaction count.
+
+        chosen_order (``int``):
+            Chosen reaction order.
+            Available for chosen reactions.
+    """
+
+    def __init__(
+        self,
+        *,
+        type: ReactionType,
+        total_count: int,
+        chosen_order: int
+    ):
+        super().__init__()
+        self.type = type
+        self.total_count = total_count
+        self.chosen_order = chosen_order
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        update: "raw.types.ReactionCount",
+    ) -> Optional["ReactionCount"]:
+        return ReactionCount(
+            type=ReactionType._parse(
+                client,
+                update.reaction
+            ),
+            total_count=update.count,
+            chosen_order=update.chosen_order
+        )
diff --git a/pyrogram/types/messages_and_media/sponsored_message.py b/pyrogram/types/messages_and_media/sponsored_message.py
new file mode 100644
index 0000000000..002d18b1bc
--- /dev/null
+++ b/pyrogram/types/messages_and_media/sponsored_message.py
@@ -0,0 +1,124 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+from ..object import Object
+from .message import Str
+
+class SponsoredMessage(Object):
+    """Describes a sponsored message.
+
+    Parameters:
+        random_id (``bytes``):
+            Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages.
+
+        url (``str``):
+            ad url
+
+        title (``str``):
+            Title of the sponsored message.
+        
+        content (``str``):
+            sponsored message.
+
+        button_text (``str``):
+            Text for the message action button.
+
+        entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
+            special entities that appear in the text.
+
+        photo (:obj:`~pyrogram.types.Photo`, *optional*):
+            sponsored message photo
+
+        is_recommended (``bool``, *optional*):
+            True, if the message needs to be labeled as "recommended" instead of "sponsored".
+
+        can_be_reported (``bool``, *optional*):
+            True, if the message can be reported to Telegram moderators through :meth:`~pyrogram.Client.report_chat_sponsored_message`.
+
+        color (:obj:`~pyrogram.types.ChatColor`, *optional*):
+            Identifier of the accent color for title, button text and message background.
+
+        sponsor_info (``str``, *optional*):
+            Information about the sponsor of the message.
+
+        additional_info (``str``, *optional*):
+            If non-empty, additional information about the sponsored message to be shown along with the message.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        random_id: bytes,
+        url: str,
+        title: str,
+        content: str,
+        button_text: str,
+        entities: List["types.MessageEntity"] = None,
+        photo: "types.Photo" = None,
+        is_recommended: bool = None,
+        can_be_reported: bool = None,
+        color: "types.ChatColor" = None,
+        sponsor_info: str = None,
+        additional_info: str = None
+    ):
+        super().__init__(client)
+
+        self.random_id = random_id
+        self.url = url
+        self.title = title
+        self.content = content
+        self.button_text = button_text
+        self.entities = entities
+        self.photo = photo
+        self.is_recommended = is_recommended
+        self.can_be_reported = can_be_reported
+        self.color = color
+        self.sponsor_info = sponsor_info
+        self.additional_info = additional_info
+
+    @staticmethod
+    def _parse(client, sponsored_message: "raw.types.SponsoredMessage"):
+        entities = [
+            types.MessageEntity._parse(client, entity, users)
+            for entity in getattr(sponsored_message, "entities", [])
+        ]
+        entities = types.List(
+            filter(lambda x: x is not None, entities)
+        )
+        return SponsoredMessage(
+            random_id=sponsored_message.random_id,
+            url=sponsored_message.url,
+            title=sponsored_message.title,
+            content=Str(sponsored_message.message).init(entities),
+            button_text=sponsored_message.button_text,
+            photo=types.Photo._parse(client, sponsored_message.photo) if sponsored_message.photo else None,
+            is_recommended=sponsored_message.recommended,
+            can_be_reported=sponsored_message.can_report,
+            entities=entities,
+            color=types.ChatColor._parse(sponsored_message.color) if sponsored_message.color else None,
+            sponsor_info=getattr(sponsored_message, "sponsor_info", None),
+            additional_info=getattr(sponsored_message, "additional_info", None),
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/sticker.py b/pyrogram/types/messages_and_media/sticker.py
new file mode 100644
index 0000000000..25e0029758
--- /dev/null
+++ b/pyrogram/types/messages_and_media/sticker.py
@@ -0,0 +1,209 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List, Dict, Type
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from pyrogram.errors import StickersetInvalid
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType
+from ..object import Object
+
+
+class Sticker(Object):
+    """A sticker.
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download or reuse the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        width (``int``):
+            Sticker width.
+
+        height (``int``):
+            Sticker height.
+
+        is_animated (``bool``):
+            True, if the sticker is animated
+
+        is_video (``bool``):
+            True, if the sticker is a video sticker
+
+        file_name (``str``, *optional*):
+            Sticker file name.
+
+        mime_type (``str``, *optional*):
+            MIME type of the file as defined by sender.
+
+        file_size (``int``, *optional*):
+            File size.
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the sticker was sent.
+
+        emoji (``str``, *optional*):
+            Emoji associated with the sticker.
+
+        set_name (``str``, *optional*):
+            Name of the sticker set to which the sticker belongs.
+
+        thumbs (List of :obj:`~pyrogram.types.Thumbnail`, *optional*):
+            Sticker thumbnails in the .webp or .jpg format.
+    """
+
+    # TODO: Add mask position
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        width: int,
+        height: int,
+        is_animated: bool,
+        is_video: bool,
+        file_name: str = None,
+        mime_type: str = None,
+        file_size: int = None,
+        date: datetime = None,
+        emoji: str = None,
+        set_name: str = None,
+        thumbs: List["types.Thumbnail"] = None
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        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.is_animated = is_animated
+        self.is_video = is_video
+        self.emoji = emoji
+        self.set_name = set_name
+        self.thumbs = thumbs
+        # self.mask_position = mask_position
+
+    cache = {}
+
+    @staticmethod
+    async def _get_sticker_set_name(invoke, input_sticker_set_id):
+        try:
+            set_id = input_sticker_set_id[0]
+            set_access_hash = input_sticker_set_id[1]
+
+            name = Sticker.cache.get((set_id, set_access_hash), None)
+
+            if name is not None:
+                return name
+
+            name = (
+                await invoke(
+                    raw.functions.messages.GetStickerSet(
+                        stickerset=raw.types.InputStickerSetID(
+                            id=set_id,
+                            access_hash=set_access_hash
+                        ),
+                        hash=0
+                    )
+                )
+            ).set.short_name
+
+            Sticker.cache[(set_id, set_access_hash)] = name
+
+            if len(Sticker.cache) > 250:
+                for i in range(50):
+                    Sticker.cache.pop(next(iter(Sticker.cache)))
+
+            return name
+        except StickersetInvalid:
+            return None
+
+    @staticmethod
+    async def _parse(
+        client,
+        sticker: "raw.types.Document",
+        document_attributes: Dict[Type["raw.base.DocumentAttribute"], "raw.base.DocumentAttribute"],
+    ) -> "Sticker":
+        sticker_attributes = (
+            document_attributes[raw.types.DocumentAttributeSticker]
+            if raw.types.DocumentAttributeSticker in document_attributes
+            else document_attributes[raw.types.DocumentAttributeCustomEmoji]
+        )
+
+        image_size_attributes = document_attributes.get(raw.types.DocumentAttributeImageSize, None)
+        file_name = getattr(document_attributes.get(raw.types.DocumentAttributeFilename, None), "file_name", None)
+        video_attributes = document_attributes.get(raw.types.DocumentAttributeVideo, None)
+
+        sticker_set = sticker_attributes.stickerset
+
+        if isinstance(sticker_set, raw.types.InputStickerSetID):
+            input_sticker_set_id = (sticker_set.id, sticker_set.access_hash)
+            # TODO: FIXME!
+            set_name = await Sticker._get_sticker_set_name(client.invoke, input_sticker_set_id)
+        else:
+            set_name = None
+
+        return Sticker(
+            file_id=FileId(
+                file_type=FileType.STICKER,
+                dc_id=sticker.dc_id,
+                media_id=sticker.id,
+                access_hash=sticker.access_hash,
+                file_reference=sticker.file_reference
+            ).encode(),
+            file_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT,
+                media_id=sticker.id
+            ).encode(),
+            width=(
+                image_size_attributes.w
+                if image_size_attributes
+                else video_attributes.w
+                if video_attributes
+                else 512
+            ),
+            height=(
+                image_size_attributes.h
+                if image_size_attributes
+                else video_attributes.h
+                if video_attributes
+                else 512
+            ),
+            is_animated=sticker.mime_type == "application/x-tgsticker",
+            is_video=sticker.mime_type == "video/webm",
+            # TODO: mask_position
+            set_name=set_name,
+            emoji=sticker_attributes.alt or None,
+            file_size=sticker.size,
+            mime_type=sticker.mime_type,
+            file_name=file_name,
+            date=utils.timestamp_to_datetime(sticker.date),
+            thumbs=types.Thumbnail._parse(client, sticker),
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/story.py b/pyrogram/types/messages_and_media/story.py
new file mode 100644
index 0000000000..3a44359c91
--- /dev/null
+++ b/pyrogram/types/messages_and_media/story.py
@@ -0,0 +1,518 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List, Union, Callable
+
+import pyrogram
+from pyrogram import raw, utils, types, enums
+from ..object import Object
+from ..update import Update
+from .message import Str
+from pyrogram.errors import RPCError
+
+
+class Story(Object, Update):
+    """This object represents a story.
+
+    Parameters:
+        chat (:obj:`~pyrogram.types.Chat`):
+            Chat that posted the story.
+        
+        id (``int``):
+            Unique identifier for the story in the chat.
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the story was sent.
+        
+        expire_date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the story will be expired.
+        
+        media (:obj:`~pyrogram.enums.MessageMediaType`, *optional*):
+            The media type of the Story.
+            This field will contain the enumeration type of the media message.
+            You can use ``media = getattr(story, story.media.value)`` to access the media message.
+
+        has_protected_content (``bool``, *optional*):
+            True, if the story can't be forwarded.
+
+        photo (:obj:`~pyrogram.types.Photo`, *optional*):
+            Story is a photo, information about the photo.
+
+        video (:obj:`~pyrogram.types.Video`, *optional*):
+            Story is a video, information about the video.
+
+        edited (``bool``, *optional*):
+           True, if the Story has been edited.
+
+        pinned (``bool``, *optional*):
+           True, if the Story is pinned.
+
+        caption (``str``, *optional*):
+            Caption for the Story, 0-1024 characters.
+
+        caption_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
+            For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the caption.
+
+        views (``int``, *optional*):
+            Stories views.
+
+        forwards (``int``, *optional*):
+            Stories forwards.
+
+        reactions (List of :obj:`~pyrogram.types.Reaction`):
+            List of the reactions to this story.
+
+        skipped (``bool``, *optional*):
+            The story is skipped.
+            A story can be skipped in case it was skipped.
+
+        deleted (``bool``, *optional*):
+            The story is deleted.
+            A story can be deleted in case it was deleted or you tried to retrieve a story that doesn't exist yet.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        chat: "types.Chat" = None,
+        id: int = None,
+        date: datetime = None,
+        expire_date: datetime = None,
+        media: "enums.MessageMediaType" = None,
+        has_protected_content: bool = None,
+        photo: "types.Photo" = None,
+        video: "types.Video" = None,
+        edited: bool = None,
+        pinned: bool = None,
+        caption: Str = None,
+        caption_entities: List["types.MessageEntity"] = None,
+        views: int = None,
+        forwards: int = None,
+        reactions: List["types.Reaction"] = None,
+        skipped: bool = None,
+        deleted: bool = None,
+        _raw = None
+    ):
+        super().__init__(client)
+
+        self.chat = chat
+        self.id = id
+        self.date = date
+        self.expire_date = expire_date
+        self.media = media
+        self.has_protected_content = has_protected_content
+        self.photo = photo
+        self.video = video
+        self.edited = edited
+        self.pinned = pinned
+        self.caption = caption
+        self.caption_entities = caption_entities
+        self.views = views
+        self.forwards = forwards
+        self.reactions = reactions
+        self.skipped = skipped
+        self.deleted = deleted
+        self._raw = _raw
+
+    @staticmethod
+    def _parse_story_item(
+        client,
+        story_item: "raw.types.StoryItem"
+    ):
+        date = None
+        expire_date = None
+        media = None
+        has_protected_content = None
+        photo = None
+        video = None
+        edited = None
+        pinned = None
+        caption = None
+        caption_entities = None
+        views = None
+        forwards = None
+        reactions = None
+        skipped = None
+        deleted = None
+
+        if isinstance(story_item, raw.types.StoryItemDeleted):
+            deleted = True
+        elif isinstance(story_item, raw.types.StoryItemSkipped):
+            skipped = True
+        else:
+            date = utils.timestamp_to_datetime(story_item.date)
+            expire_date = utils.timestamp_to_datetime(story_item.expire_date)
+            if isinstance(story_item.media, raw.types.MessageMediaPhoto):
+                photo = types.Photo._parse(client, story_item.media.photo, story_item.media.ttl_seconds)
+                media = enums.MessageMediaType.PHOTO
+            elif isinstance(story_item.media, raw.types.MessageMediaDocument):
+                doc = story_item.media.document
+                attributes = {type(i): i for i in doc.attributes}
+                video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
+                video = types.Video._parse(client, doc, video_attributes, None)
+                media = enums.MessageMediaType.VIDEO
+            has_protected_content = story_item.noforwards
+            edited = story_item.edited
+            pinned = story_item.pinned
+            entities = [e for e in (types.MessageEntity._parse(client, entity, {}) for entity in story_item.entities) if e]
+            caption = Str(story_item.caption or "").init(entities) or None
+            caption_entities = entities or None
+            if story_item.views:
+                views = getattr(story_item.views, "views_count", None)
+                forwards = getattr(story_item.views, "forwards_count", None)
+                reactions = [
+                    types.Reaction._parse_count(client, reaction)
+                    for reaction in getattr(story_item.views, "reactions", [])
+                ] or None
+        return (
+            date,
+            expire_date,
+            media,
+            has_protected_content,
+            photo,
+            video,
+            edited,
+            pinned,
+            caption,
+            caption_entities,
+            views,
+            forwards,
+            reactions,
+            skipped,
+            deleted
+        )
+
+    @staticmethod
+    async def _parse(
+        client,
+        users: dict,
+        chats: dict,
+        story_media: "raw.types.MessageMediaStory",
+        reply_story: "raw.types.MessageReplyStoryHeader",
+        story_update: "raw.types.UpdateStory",
+        story_item: "raw.types.StoryItem",
+        peer: "raw.base.peer"
+    ) -> "Story":
+        story_id = None
+        chat = None
+
+        rawupdate = None
+
+        date = None
+        expire_date = None
+        media = None
+        has_protected_content = None
+        photo = None
+        video = None
+        edited = None
+        pinned = None
+        caption = None
+        caption_entities = None
+        views = None
+        forwards = None
+        reactions = None
+        skipped = None
+        deleted = None
+
+        if story_media:
+            rawupdate = story_media
+
+            if story_media.peer:
+                raw_peer_id = utils.get_raw_peer_id(story_media.peer)
+                if isinstance(story_media.peer, raw.types.PeerUser):
+                    chat = types.Chat._parse_chat(client, users.get(raw_peer_id))
+                else:
+                    chat = types.Chat._parse_chat(client, chats.get(raw_peer_id))
+            story_id = getattr(story_media, "id", None)
+        
+        if reply_story:
+            rawupdate = reply_story
+
+            if reply_story.peer:
+                raw_peer_id = utils.get_raw_peer_id(reply_story.peer)
+                if isinstance(reply_story.peer, raw.types.PeerUser):
+                    chat = types.Chat._parse_chat(client, users.get(raw_peer_id))
+                else:
+                    chat = types.Chat._parse_chat(client, chats.get(raw_peer_id))
+            story_id = getattr(reply_story, "story_id", None)
+        
+        if story_id and not client.me.is_bot:
+            try:
+                story_item = (
+                    await client.invoke(
+                        raw.functions.stories.GetStoriesByID(
+                            peer=await client.resolve_peer(raw_peer_id),
+                            id=[story_id]
+                        )
+                    )
+                ).stories[0]
+            except (RPCError, IndexError):
+                pass
+            else:
+                (
+                    date,
+                    expire_date,
+                    media,
+                    has_protected_content,
+                    photo,
+                    video,
+                    edited,
+                    pinned,
+                    caption,
+                    caption_entities,
+                    views,
+                    forwards,
+                    reactions,
+                    skipped,
+                    deleted
+                ) = Story._parse_story_item(client, story_item)
+        
+        if story_update:
+            rawupdate = story_update
+
+            raw_peer_id = utils.get_raw_peer_id(story_update.peer)
+            if isinstance(story_update.peer, raw.types.PeerUser):
+                chat = types.Chat._parse_chat(client, users.get(raw_peer_id))
+            else:
+                chat = types.Chat._parse_chat(client, chats.get(raw_peer_id))
+            
+            story_id = getattr(story_update.story, "id", None)
+            (
+                date,
+                expire_date,
+                media,
+                has_protected_content,
+                photo,
+                video,
+                edited,
+                pinned,
+                caption,
+                caption_entities,
+                views,
+                forwards,
+                reactions,
+                skipped,
+                deleted
+            ) = Story._parse_story_item(client, story_update.story)
+
+        if peer:
+            raw_peer_id = utils.get_raw_peer_id(peer)
+            if isinstance(peer, raw.types.PeerUser):
+                chat = types.Chat._parse_chat(client, users.get(raw_peer_id))
+            else:
+                chat = types.Chat._parse_chat(client, chats.get(raw_peer_id))
+            
+        if story_item:
+            story_id = getattr(story_item, "id", None)
+            (
+                date,
+                expire_date,
+                media,
+                has_protected_content,
+                photo,
+                video,
+                edited,
+                pinned,
+                caption,
+                caption_entities,
+                views,
+                forwards,
+                reactions,
+                skipped,
+                deleted
+            ) = Story._parse_story_item(client, story_item)
+
+        return Story(
+            client=client,
+            _raw=rawupdate,
+            id=story_id,
+            chat=chat,
+            date=date,
+            expire_date=expire_date,
+            media=media,
+            has_protected_content=has_protected_content,
+            photo=photo,
+            video=video,
+            edited=edited,
+            pinned=pinned,
+            caption=caption,
+            caption_entities=caption_entities,
+            views=views,
+            forwards=forwards,
+            reactions=reactions,
+            skipped=skipped,
+            deleted=deleted
+        )
+
+    async def react(
+        self,
+        reaction: Union[
+            int,
+            str
+        ] = None,
+        add_to_recent: bool = True
+    ) -> "types.MessageReactions":
+        """Bound method *react* of :obj:`~pyrogram.types.Story`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.set_reaction(
+                chat_id=chat_id,
+                story_id=message.id,
+                reaction=[ReactionTypeEmoji(emoji="👍")]
+            )
+
+        Example:
+            .. code-block:: python
+
+                # Send a reaction
+                await story.react([ReactionTypeEmoji(emoji="👍")])
+
+                # Retract a reaction
+                await story.react()
+
+        Parameters:
+            reaction (``int`` | ``str``, *optional*):
+                New list of reaction types to set on the message.
+                Pass None as emoji (default) to retract the reaction.
+
+            add_to_recent (``bool``, *optional*):
+                Pass True if the reaction should appear in the recently used reactions.
+                This option is applicable only for users.
+                Defaults to True.
+        Returns:
+            On success, :obj:`~pyrogram.types.MessageReactions`: is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        sr = None
+
+        if isinstance(reaction, List):
+            sr = []
+            for i in reaction:
+                if isinstance(i, types.ReactionType):
+                    sr.append(i)
+                elif isinstance(i, int):
+                    sr.append(types.ReactionTypeCustomEmoji(
+                        custom_emoji_id=str(i)
+                    ))
+                else:
+                    sr.append(types.ReactionTypeEmoji(
+                        emoji=i
+                    ))
+
+        elif isinstance(reaction, int):
+            sr = [
+                types.ReactionTypeCustomEmoji(
+                    custom_emoji_id=str(reaction)
+                )
+            ]
+
+        elif isinstance(reaction, str):
+            sr = [
+                types.ReactionTypeEmoji(
+                    emoji=reaction
+                )
+            ]
+
+        return await self._client.set_reaction(
+            chat_id=self.chat.id,
+            story_id=self.id,
+            reaction=sr,
+            add_to_recent=add_to_recent
+        )
+
+    async def download(
+        self,
+        file_name: str = "",
+        in_memory: bool = False,
+        block: bool = True,
+        progress: Callable = None,
+        progress_args: tuple = ()
+    ) -> str:
+        """Bound method *download* of :obj:`~pyrogram.types.Story`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.download_media(story)
+
+        Example:
+            .. code-block:: python
+
+                await story.download()
+
+        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.
+                You can also specify a path for downloading files in a custom location: paths that end with "/"
+                are considered directories. All non-existent folders will be created automatically.
+
+            in_memory (``bool``, *optional*):
+                Pass True to download the media in-memory.
+                A binary file-like object with its attribute ".name" set will be returned.
+                Defaults to False.
+
+            block (``bool``, *optional*):
+                Blocks the code execution until the file has been downloaded.
+                Defaults to True.
+
+            progress (``Callable``, *optional*):
+                Pass a callback function to view the file transmission progress.
+                The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
+                detailed description) and will be called back each time a new file chunk has been successfully
+                transmitted.
+
+            progress_args (``tuple``, *optional*):
+                Extra custom arguments for the progress callback function.
+                You can pass anything you need to be available in the progress callback scope; for example, a Message
+                object or a Client instance in order to edit the message with the updated progress status.
+
+        Other Parameters:
+            current (``int``):
+                The amount of bytes transmitted so far.
+
+            total (``int``):
+                The total 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:
+            On success, the absolute path of the downloaded file as string is returned, None otherwise.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+            ``ValueError``: If the message doesn't contain any downloadable media
+        """
+        return await self._client.download_media(
+            message=self,
+            file_name=file_name,
+            in_memory=in_memory,
+            block=block,
+            progress=progress,
+            progress_args=progress_args,
+        )
diff --git a/pyrogram/types/messages_and_media/stripped_thumbnail.py b/pyrogram/types/messages_and_media/stripped_thumbnail.py
new file mode 100644
index 0000000000..e9756607b9
--- /dev/null
+++ b/pyrogram/types/messages_and_media/stripped_thumbnail.py
@@ -0,0 +1,47 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class StrippedThumbnail(Object):
+    """A stripped thumbnail
+
+    Parameters:
+        data (``bytes``):
+            Thumbnail data
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        data: bytes
+    ):
+        super().__init__(client)
+
+        self.data = data
+
+    @staticmethod
+    def _parse(client, stripped_thumbnail: "raw.types.PhotoStrippedSize") -> "StrippedThumbnail":
+        return StrippedThumbnail(
+            data=stripped_thumbnail.bytes,
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/thumbnail.py b/pyrogram/types/messages_and_media/thumbnail.py
new file mode 100644
index 0000000000..b9cb93e127
--- /dev/null
+++ b/pyrogram/types/messages_and_media/thumbnail.py
@@ -0,0 +1,111 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Optional, Union
+
+import pyrogram
+from pyrogram import raw
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
+from ..object import Object
+
+
+class Thumbnail(Object):
+    """One size of a photo or a file/sticker thumbnail.
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download or reuse the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        width (``int``):
+            Photo width.
+
+        height (``int``):
+            Photo height.
+
+        file_size (``int``):
+            File size.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        width: int,
+        height: int,
+        file_size: int
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        self.width = width
+        self.height = height
+        self.file_size = file_size
+
+    @staticmethod
+    def _parse(client, media: Union["raw.types.Photo", "raw.types.Document"]) -> Optional[List["Thumbnail"]]:
+        if isinstance(media, raw.types.Photo):
+            raw_thumbs = [i for i in media.sizes if isinstance(i, raw.types.PhotoSize)]
+            raw_thumbs.sort(key=lambda p: p.size)
+            raw_thumbs = raw_thumbs[:-1]
+
+            file_type = FileType.PHOTO
+        elif isinstance(media, raw.types.Document):
+            raw_thumbs = media.thumbs
+            file_type = FileType.THUMBNAIL
+        else:
+            return
+
+        parsed_thumbs = []
+
+        for thumb in raw_thumbs:
+            if not isinstance(thumb, raw.types.PhotoSize):
+                continue
+
+            parsed_thumbs.append(
+                Thumbnail(
+                    file_id=FileId(
+                        file_type=file_type,
+                        dc_id=media.dc_id,
+                        media_id=media.id,
+                        access_hash=media.access_hash,
+                        file_reference=media.file_reference,
+                        thumbnail_file_type=file_type,
+                        thumbnail_source=ThumbnailSource.THUMBNAIL,
+                        thumbnail_size=thumb.type,
+                        volume_id=0,
+                        local_id=0
+                    ).encode(),
+                    file_unique_id=FileUniqueId(
+                        file_unique_type=FileUniqueType.DOCUMENT,
+                        media_id=media.id
+                    ).encode(),
+                    width=thumb.w,
+                    height=thumb.h,
+                    file_size=thumb.size,
+                    client=client
+                )
+            )
+
+        return parsed_thumbs or None
diff --git a/pyrogram/types/messages_and_media/translated_text.py b/pyrogram/types/messages_and_media/translated_text.py
new file mode 100644
index 0000000000..e6e3f6bd80
--- /dev/null
+++ b/pyrogram/types/messages_and_media/translated_text.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw, types
+
+from ..object import Object
+from .message import Str
+
+
+class TranslatedText(Object):
+    """A translated text with entities.
+
+    Parameters:
+        text (``str``):
+            Translated text.
+
+        entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
+            Entities of the text.
+    """
+
+    def __init__(
+        self,
+        *,
+        text: str,
+        entities: List["types.MessageEntity"] = None
+    ):
+        self.text = text
+        self.entities = entities
+
+    @staticmethod
+    def _parse(
+        client,
+        translate_result: "raw.types.TextWithEntities"
+    ) -> "TranslatedText":
+        entities = [
+            types.MessageEntity._parse(client, entity, {})
+            for entity in translate_result.entities
+        ]
+        entities = types.List(filter(lambda x: x is not None, entities))
+
+        return TranslatedText(
+            text=Str(translate_result.text).init(entities) or None, entities=entities or None
+        )
diff --git a/pyrogram/types/messages_and_media/venue.py b/pyrogram/types/messages_and_media/venue.py
new file mode 100644
index 0000000000..8a26f60061
--- /dev/null
+++ b/pyrogram/types/messages_and_media/venue.py
@@ -0,0 +1,74 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+from ..object import Object
+
+
+class Venue(Object):
+    """A venue.
+
+    Parameters:
+        location (:obj:`~pyrogram.types.Location`):
+            Venue location.
+
+        title (``str``):
+            Name of the venue.
+
+        address (``str``):
+            Address of the venue.
+
+        foursquare_id (``str``, *optional*):
+            Foursquare identifier of the venue.
+
+        foursquare_type (``str``, *optional*):
+            Foursquare type of the venue.
+            (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        location: "types.Location",
+        title: str,
+        address: str,
+        foursquare_id: str = None,
+        foursquare_type: str = None
+    ):
+        super().__init__(client)
+
+        self.location = location
+        self.title = title
+        self.address = address
+        self.foursquare_id = foursquare_id
+        self.foursquare_type = foursquare_type
+
+    @staticmethod
+    def _parse(client, venue: "raw.types.MessageMediaVenue"):
+        return Venue(
+            location=types.Location._parse(client, venue.geo),
+            title=venue.title,
+            address=venue.address,
+            foursquare_id=venue.venue_id or None,
+            foursquare_type=venue.venue_type,
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/video.py b/pyrogram/types/messages_and_media/video.py
new file mode 100644
index 0000000000..11ed1559e5
--- /dev/null
+++ b/pyrogram/types/messages_and_media/video.py
@@ -0,0 +1,134 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
+from ..object import Object
+
+
+class Video(Object):
+    """A video file.
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download or reuse the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        width (``int``):
+            Video width as defined by sender.
+
+        height (``int``):
+            Video height as defined by sender.
+
+        duration (``int``):
+            Duration of the video in seconds as defined by sender.
+
+        file_name (``str``, *optional*):
+            Video file name.
+
+        mime_type (``str``, *optional*):
+            Mime type of a file as defined by sender.
+
+        file_size (``int``, *optional*):
+            File size.
+
+        supports_streaming (``bool``, *optional*):
+            True, if the video was uploaded with streaming support.
+
+        ttl_seconds (``int``. *optional*):
+            Time-to-live seconds, for secret photos.
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the video was sent.
+
+        thumbs (List of :obj:`~pyrogram.types.Thumbnail`, *optional*):
+            Video thumbnails.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        width: int,
+        height: int,
+        duration: int,
+        file_name: str = None,
+        mime_type: str = None,
+        file_size: int = None,
+        supports_streaming: bool = None,
+        ttl_seconds: int = None,
+        date: datetime = None,
+        thumbs: List["types.Thumbnail"] = None
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        self.width = width
+        self.height = height
+        self.duration = duration
+        self.file_name = file_name
+        self.mime_type = mime_type
+        self.file_size = file_size
+        self.supports_streaming = supports_streaming
+        self.ttl_seconds = ttl_seconds
+        self.date = date
+        self.thumbs = thumbs
+
+    @staticmethod
+    def _parse(
+        client,
+        video: "raw.types.Document",
+        video_attributes: "raw.types.DocumentAttributeVideo",
+        file_name: str,
+        ttl_seconds: int = None
+    ) -> "Video":
+        return Video(
+            file_id=FileId(
+                file_type=FileType.VIDEO,
+                dc_id=video.dc_id,
+                media_id=video.id,
+                access_hash=video.access_hash,
+                file_reference=video.file_reference
+            ).encode() if video else None,
+            file_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT,
+                media_id=video.id
+            ).encode() if video else None,
+            width=video_attributes.w if video_attributes else None,
+            height=video_attributes.h if video_attributes else None,
+            duration=video_attributes.duration if video_attributes else None,
+            file_name=file_name,
+            mime_type=video.mime_type if video else None,
+            supports_streaming=video_attributes.supports_streaming if video_attributes else None,
+            file_size=video.size if video else None,
+            date=utils.timestamp_to_datetime(video.date) if video else None,
+            ttl_seconds=ttl_seconds,
+            thumbs=types.Thumbnail._parse(client, video) if video else None,
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/video_note.py b/pyrogram/types/messages_and_media/video_note.py
new file mode 100644
index 0000000000..e438484bdd
--- /dev/null
+++ b/pyrogram/types/messages_and_media/video_note.py
@@ -0,0 +1,115 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType
+from ..object import Object
+
+
+class VideoNote(Object):
+    """A video note.
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download or reuse the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        length (``int``):
+            Video width and height as defined by sender.
+
+        duration (``int``):
+            Duration of the video in seconds as defined by sender.
+
+        mime_type (``str``, *optional*):
+            MIME type of the file as defined by sender.
+
+        file_size (``int``, *optional*):
+            File size.
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the video note was sent.
+
+        ttl_seconds (``int``, *optional*):
+            Time-to-live seconds, for one-time media.
+
+        thumbs (List of :obj:`~pyrogram.types.Thumbnail`, *optional*):
+            Video thumbnails.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        length: int,
+        duration: int,
+        thumbs: List["types.Thumbnail"] = None,
+        mime_type: str = None,
+        file_size: int = None,
+        date: datetime = None,
+        ttl_seconds: int = None
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        self.mime_type = mime_type
+        self.file_size = file_size
+        self.date = date
+        self.ttl_seconds = ttl_seconds
+        self.length = length
+        self.duration = duration
+        self.thumbs = thumbs
+
+    @staticmethod
+    def _parse(
+        client,
+        video_note: "raw.types.Document",
+        video_attributes: "raw.types.DocumentAttributeVideo",
+        ttl_seconds: int = None
+    ) -> "VideoNote":
+        return VideoNote(
+            file_id=FileId(
+                file_type=FileType.VIDEO_NOTE,
+                dc_id=video_note.dc_id,
+                media_id=video_note.id,
+                access_hash=video_note.access_hash,
+                file_reference=video_note.file_reference
+            ).encode() if video_note else None,
+            file_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT,
+                media_id=video_note.id
+            ).encode() if video_note else None,
+            length=video_attributes.w if video_attributes else None,
+            duration=video_attributes.duration if video_attributes else None,
+            file_size=video_note.size if video_note else None,
+            mime_type=video_note.mime_type if video_note else None,
+            date=utils.timestamp_to_datetime(video_note.date) if video_note else None,
+            ttl_seconds=ttl_seconds,
+            thumbs=types.Thumbnail._parse(client, video_note) if video_note else None,
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/voice.py b/pyrogram/types/messages_and_media/voice.py
new file mode 100644
index 0000000000..65f2c850d3
--- /dev/null
+++ b/pyrogram/types/messages_and_media/voice.py
@@ -0,0 +1,102 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType
+from ..object import Object
+
+
+class Voice(Object):
+    """A voice note.
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download or reuse the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        duration (``int``):
+            Duration of the audio in seconds as defined by sender.
+
+        waveform (``bytes``, *optional*):
+            Voice waveform.
+
+        mime_type (``str``, *optional*):
+            MIME type of the file as defined by sender.
+
+        file_size (``int``, *optional*):
+            File size.
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date the voice was sent.
+
+        ttl_seconds (``int``, *optional*):
+            Time-to-live seconds, for one-time media.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        duration: int,
+        waveform: bytes = None,
+        mime_type: str = None,
+        file_size: int = None,
+        date: datetime = None,
+        ttl_seconds: int = None
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        self.duration = duration
+        self.waveform = waveform
+        self.mime_type = mime_type
+        self.file_size = file_size
+        self.date = date
+        self.ttl_seconds = ttl_seconds
+
+    @staticmethod
+    def _parse(client, voice: "raw.types.Document", attributes: "raw.types.DocumentAttributeAudio", ttl_seconds: int = None) -> "Voice":
+        return Voice(
+            file_id=FileId(
+                file_type=FileType.VOICE,
+                dc_id=voice.dc_id,
+                media_id=voice.id,
+                access_hash=voice.access_hash,
+                file_reference=voice.file_reference
+            ).encode() if voice else None,
+            file_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT,
+                media_id=voice.id
+            ).encode() if voice else None,
+            duration=attributes.duration if attributes else None,
+            mime_type=voice.mime_type if voice else None,
+            file_size=voice.size if voice else None,
+            waveform=attributes.waveform if attributes else None,
+            date=utils.timestamp_to_datetime(voice.date) if voice else None,
+            ttl_seconds=ttl_seconds,
+            client=client
+        )
diff --git a/pyrogram/types/messages_and_media/web_app_data.py b/pyrogram/types/messages_and_media/web_app_data.py
new file mode 100644
index 0000000000..b9a471fd89
--- /dev/null
+++ b/pyrogram/types/messages_and_media/web_app_data.py
@@ -0,0 +1,51 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class WebAppData(Object):
+    """Contains data sent from a `Web App `_ to the bot.
+
+    Parameters:
+        data (``str``):
+            The data.
+
+        button_text (``str``):
+            Text of the *web_app* keyboard button, from which the Web App was opened.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        data: str,
+        button_text: str,
+    ):
+        super().__init__()
+
+        self.data = data
+        self.button_text = button_text
+
+    @staticmethod
+    def _parse(action: "raw.types.MessageActionWebViewDataSentMe"):
+        return WebAppData(
+            data=action.data,
+            button_text=action.text
+        )
diff --git a/pyrogram/types/messages_and_media/web_page.py b/pyrogram/types/messages_and_media/web_page.py
new file mode 100644
index 0000000000..34e51d88cc
--- /dev/null
+++ b/pyrogram/types/messages_and_media/web_page.py
@@ -0,0 +1,187 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+from ..object import Object
+
+
+class WebPage(Object):
+    # TODO: hash, cached_page
+    """A webpage preview
+
+    Parameters:
+        id (``str``):
+            Unique identifier for this webpage.
+
+        url (``str``):
+            Full URL for this webpage.
+
+        display_url (``str``):
+            Display URL for this webpage.
+
+        type (``str``, *optional*):
+            Type of webpage preview, known types (at the time of writing) are:
+            *"article"*, *"photo"*, *"gif"*, *"video"* and *"document"*,
+            *"telegram_user"*, *"telegram_bot"*, *"telegram_channel"*, *"telegram_megagroup"*.
+
+        site_name (``str``, *optional*):
+            Webpage site name.
+
+        title (``str``, *optional*):
+            Title of this webpage.
+
+        description (``str``, *optional*):
+            Description of this webpage.
+
+        audio (:obj:`~pyrogram.types.Audio`, *optional*):
+            Webpage preview is an audio file, information about the file.
+
+        document (:obj:`~pyrogram.types.Document`, *optional*):
+            Webpage preview is a general file, information about the file.
+
+        photo (:obj:`~pyrogram.types.Photo`, *optional*):
+            Webpage preview is a photo, information about the photo.
+
+        animation (:obj:`~pyrogram.types.Animation`, *optional*):
+            Webpage preview is an animation, information about the animation.
+
+        video (:obj:`~pyrogram.types.Video`, *optional*):
+            Webpage preview is a video, information about the video.
+
+        embed_url (``str``, *optional*):
+            Embedded content URL.
+
+        embed_type (``str``, *optional*):
+            Embedded content type, like `iframe`
+
+        embed_width (``int``, *optional*):
+            Embedded content width.
+
+        embed_height (``int``, *optional*):
+            Embedded content height.
+
+        duration (``int``, *optional*):
+            Unknown at the time of writing.
+
+        author (``str``, *optional*):
+            Author of the webpage, eg the Twitter user for a tweet, or the author in an article.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: str,
+        url: str,
+        display_url: str,
+        type: str = None,
+        site_name: str = None,
+        title: str = None,
+        description: str = None,
+        audio: "types.Audio" = None,
+        document: "types.Document" = None,
+        photo: "types.Photo" = None,
+        animation: "types.Animation" = None,
+        video: "types.Video" = None,
+        embed_url: str = None,
+        embed_type: str = None,
+        embed_width: int = None,
+        embed_height: int = None,
+        duration: int = None,
+        author: str = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.url = url
+        self.display_url = display_url
+        self.type = type
+        self.site_name = site_name
+        self.title = title
+        self.description = description
+        self.audio = audio
+        self.document = document
+        self.photo = photo
+        self.animation = animation
+        self.video = video
+        self.embed_url = embed_url
+        self.embed_type = embed_type
+        self.embed_width = embed_width
+        self.embed_height = embed_height
+        self.duration = duration
+        self.author = author
+
+    @staticmethod
+    def _parse(client, webpage: "raw.types.WebPage") -> "WebPage":
+        audio = None
+        document = None
+        photo = None
+        animation = None
+        video = None
+
+        if isinstance(webpage.photo, raw.types.Photo):
+            photo = types.Photo._parse(client, webpage.photo)
+
+        doc = webpage.document
+
+        if isinstance(doc, raw.types.Document):
+            attributes = {type(i): i for i in doc.attributes}
+
+            file_name = getattr(
+                attributes.get(
+                    raw.types.DocumentAttributeFilename, None
+                ), "file_name", None
+            )
+
+            if raw.types.DocumentAttributeAudio in attributes:
+                audio_attributes = attributes[raw.types.DocumentAttributeAudio]
+                audio = types.Audio._parse(client, doc, audio_attributes, file_name)
+
+            elif raw.types.DocumentAttributeAnimated in attributes:
+                video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
+                animation = types.Animation._parse(client, doc, video_attributes, file_name)
+
+            elif raw.types.DocumentAttributeVideo in attributes:
+                video_attributes = attributes[raw.types.DocumentAttributeVideo]
+                video = types.Video._parse(client, doc, video_attributes, file_name)
+
+            else:
+                document = types.Document._parse(client, doc, file_name)
+
+        return WebPage(
+            id=str(webpage.id),
+            url=webpage.url,
+            display_url=webpage.display_url,
+            type=webpage.type,
+            site_name=webpage.site_name,
+            title=webpage.title,
+            description=webpage.description,
+            audio=audio,
+            document=document,
+            photo=photo,
+            animation=animation,
+            video=video,
+            embed_url=webpage.embed_url,
+            embed_type=webpage.embed_type,
+            embed_width=webpage.embed_width,
+            embed_height=webpage.embed_height,
+            duration=webpage.duration,
+            author=webpage.author
+        )
diff --git a/pyrogram/types/object.py b/pyrogram/types/object.py
new file mode 100644
index 0000000000..2371babd33
--- /dev/null
+++ b/pyrogram/types/object.py
@@ -0,0 +1,125 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 typing
+from datetime import datetime
+from enum import Enum
+from json import dumps
+
+import pyrogram
+
+
+class Object:
+    def __init__(self, client: "pyrogram.Client" = None):
+        self._client = client
+
+    def bind(self, client: "pyrogram.Client"):
+        """Bind a Client instance to this and to all nested Pyrogram objects.
+
+        Parameters:
+            client (:obj:`~pyrogram.types.Client`):
+                The Client instance to bind this object with. Useful to re-enable bound methods after serializing and
+                deserializing Pyrogram objects with ``repr`` and ``eval``.
+        """
+        self._client = client
+
+        for i in self.__dict__:
+            o = getattr(self, i)
+
+            if isinstance(o, Object):
+                o.bind(client)
+
+    @staticmethod
+    def default(obj: "Object"):
+        if isinstance(obj, bytes):
+            return repr(obj)
+
+        # https://t.me/pyrogramchat/167281
+        # Instead of re.Match, which breaks for python <=3.6
+        if isinstance(obj, typing.Match):
+            return repr(obj)
+
+        if isinstance(obj, Enum):
+            return str(obj)
+
+        if isinstance(obj, datetime):
+            return str(obj)
+
+        # TODO: #20
+        if not hasattr(obj, "__dict__"):
+            return obj.__class__.__name__
+
+        return {
+            "_": obj.__class__.__name__,
+            **{
+                attr: (
+                    "*" * 9 if attr == "phone_number" else
+                    getattr(obj, attr)
+                )
+                for attr in filter(lambda x: not x.startswith("_"), obj.__dict__)
+                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.types.{}({})".format(
+            self.__class__.__name__,
+            ", ".join(
+                f"{attr}={repr(getattr(self, attr))}"
+                for attr in filter(lambda x: not x.startswith("_"), self.__dict__)
+                if getattr(self, attr) is not None
+            )
+        )
+
+    def __eq__(self, other: "Object") -> bool:
+        for attr in self.__dict__:
+            try:
+                if attr.startswith("_"):
+                    continue
+
+                if getattr(self, attr) != getattr(other, attr):
+                    return False
+            except AttributeError:
+                return False
+
+        return True
+
+    def __setstate__(self, state):
+        for attr in state:
+            obj = state[attr]
+
+            # Maybe a better alternative would be https://docs.python.org/3/library/inspect.html#inspect.signature
+            if isinstance(obj, tuple) and len(obj) == 2 and obj[0] == "dt":
+                state[attr] = datetime.fromtimestamp(obj[1])
+
+        self.__dict__ = state
+
+    def __getstate__(self):
+        state = self.__dict__.copy()
+        state.pop("_client", None)
+
+        for attr in state:
+            obj = state[attr]
+
+            if isinstance(obj, datetime):
+                state[attr] = ("dt", obj.timestamp())
+
+        return state
diff --git a/pyrogram/types/update.py b/pyrogram/types/update.py
new file mode 100644
index 0000000000..d3e45b4abd
--- /dev/null
+++ b/pyrogram/types/update.py
@@ -0,0 +1,27 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+
+class Update:
+    def stop_propagation(self):
+        raise pyrogram.StopPropagation
+
+    def continue_propagation(self):
+        raise pyrogram.ContinuePropagation
diff --git a/pyrogram/types/user_and_chats/__init__.py b/pyrogram/types/user_and_chats/__init__.py
new file mode 100644
index 0000000000..a20c2d1866
--- /dev/null
+++ b/pyrogram/types/user_and_chats/__init__.py
@@ -0,0 +1,81 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .birthdate import Birthdate
+from .chat import Chat
+from .chat_admin_with_invite_links import ChatAdminWithInviteLinks
+from .chat_color import ChatColor
+from .chat_event import ChatEvent
+from .chat_event_filter import ChatEventFilter
+from .chat_invite_link import ChatInviteLink
+from .chat_join_request import ChatJoinRequest
+from .chat_joiner import ChatJoiner
+from .chat_member import ChatMember
+from .chat_member_updated import ChatMemberUpdated
+from .chat_permissions import ChatPermissions
+from .chat_photo import ChatPhoto
+from .chat_privileges import ChatPrivileges
+from .chat_reactions import ChatReactions
+from .chat_shared import ChatShared
+from .dialog import Dialog
+from .emoji_status import EmojiStatus
+from .group_call_participant import GroupCallParticipant
+from .invite_link_importer import InviteLinkImporter
+from .restriction import Restriction
+from .user import User
+from .username import Username
+from .users_shared import UsersShared
+from .video_chat_ended import VideoChatEnded
+from .video_chat_participants_invited import VideoChatParticipantsInvited
+from .video_chat_scheduled import VideoChatScheduled
+from .video_chat_started import VideoChatStarted
+from .rtmp_url import RtmpUrl
+from .chat_background import ChatBackground
+
+__all__ = [
+    "Birthdate",
+    "Chat",
+    "ChatAdminWithInviteLinks",
+    "ChatColor",
+    "ChatEvent",
+    "ChatEventFilter",
+    "ChatInviteLink",
+    "ChatJoiner",
+    "ChatJoinRequest",
+    "ChatMember",
+    "ChatMemberUpdated",
+    "ChatPermissions",
+    "ChatPhoto",
+    "ChatPrivileges",
+    "ChatReactions",
+    "ChatShared",
+    "Dialog",
+    "EmojiStatus",
+    "GroupCallParticipant",
+    "InviteLinkImporter",
+    "Restriction",
+    "User",
+    "Username",
+    "UsersShared",
+    "VideoChatEnded",
+    "VideoChatParticipantsInvited",
+    "VideoChatScheduled",
+    "VideoChatStarted",
+    "RtmpUrl",
+    "ChatBackground"
+]
diff --git a/pyrogram/types/user_and_chats/birthdate.py b/pyrogram/types/user_and_chats/birthdate.py
new file mode 100644
index 0000000000..e348795f00
--- /dev/null
+++ b/pyrogram/types/user_and_chats/birthdate.py
@@ -0,0 +1,67 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import types, raw
+from ..object import Object
+
+
+class Birthdate(Object):
+    """
+
+    Parameters:
+        day (``int``):
+            Day of the user's birth; 1-31
+
+        month (``int``):
+            Month of the user's birth; 1-12
+
+        year (``int``, *optional*):
+            Year of the user's birth
+
+    """
+
+    def __init__(
+        self,
+        *,
+        day: int,
+        month: int,
+        year: int = None
+    ):
+        super().__init__()
+
+        self.day = day
+        self.month = month
+        self.year = year
+
+    @staticmethod
+    def _parse(
+        birthday: "raw.types.Birthday"
+    ) -> "Birthdate":
+        return Birthdate(
+            day=birthday.day,
+            month=birthday.month,
+            year=getattr(birthday, "year", None)
+        )
+
+    def write(self):
+        return raw.types.Birthday(
+            day=self.day,
+            month=self.month,
+            year=self.year
+        )
diff --git a/pyrogram/types/user_and_chats/chat.py b/pyrogram/types/user_and_chats/chat.py
new file mode 100644
index 0000000000..4ca40c7226
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat.py
@@ -0,0 +1,1374 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, List, Optional, AsyncGenerator, BinaryIO
+
+import pyrogram
+from pyrogram import raw, enums
+from pyrogram import types
+from pyrogram import utils
+from pyrogram.errors import MessageIdsEmpty
+from ..object import Object
+
+
+class Chat(Object):
+    """A chat.
+
+    Parameters:
+        id (``int``, *optional*):
+            Unique identifier for this chat.
+
+        type (:obj:`~pyrogram.enums.ChatType`, *optional*):
+            Type of chat.
+
+        title (``str``, *optional*):
+            Title, for supergroups, channels and basic group chats.
+
+        username (``str``, *optional*):
+            Username, for private chats, bots, supergroups and channels if available.
+        
+        first_name (``str``, *optional*):
+            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, for private chats.
+
+        is_forum (``bool``, *optional*):
+            True, if the supergroup chat is a forum
+
+        max_reaction_count (``int``):
+            The maximum number of reactions that can be set on a message in the chat
+
+        photo (:obj:`~pyrogram.types.ChatPhoto`, *optional*):
+            Chat photo. Suitable for downloads only.
+
+        active_usernames (List of :obj:`~pyrogram.types.Username`, *optional*):
+            If non-empty, the list of all `active chat usernames `_; for private chats, supergroups and channels.
+
+        birthdate (:obj:`~pyrogram.types.Birthdate`, *optional*):
+            For private chats, the date of birth of the user.
+
+        business_intro (:obj:`~pyrogram.types.BusinessIntro`, *optional*):
+            For private chats with business accounts, the intro of the business.
+
+        business_location (:obj:`~pyrogram.types.BusinessLocation`, *optional*):
+            For private chats with business accounts, the location of the business.
+
+        business_opening_hours (:obj:`~pyrogram.types.BusinessOpeningHours`, *optional*):
+            For private chats with business accounts, the opening hours of the business.
+
+        personal_chat (:obj:`~pyrogram.types.Chat`, *optional*):
+            For private chats, the personal channel of the user.
+
+        personal_chat_message (:obj:`~pyrogram.types.Message`, *optional*):
+            **TEMPORARY**: For private chats, the personal message_id in the ``personal_chat``.
+
+        available_reactions (:obj:`~pyrogram.types.ChatReactions`, *optional*):
+            Available reactions in the chat.
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+
+        accent_color (:obj:`~pyrogram.types.ChatColor`, *optional*):
+            Chat accent color.
+
+        profile_color (:obj:`~pyrogram.types.ChatColor`, *optional*):
+            Chat profile color.
+
+        emoji_status (:obj:`~pyrogram.types.EmojiStatus`, *optional*):
+            Emoji status.
+
+        background (:obj:`~pyrogram.types.ChatBackground`, *optional*):
+            A chat background.
+
+        bio (``str``, *optional*):
+            Bio of the other party in a private chat.
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+        
+        join_by_request (``bool``, *optional*):
+            True, if all users directly joining the supergroup need to be approved by supergroup administrators.
+
+        description (``str``, *optional*):
+            Description, for groups, supergroups and channel chats.
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+
+        invite_link (``str``, *optional*):
+            Chat invite link, for groups, supergroups and channels.
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+
+        pinned_message (:obj:`~pyrogram.types.Message`, *optional*):
+            Pinned message, for groups, supergroups channels and own chat.
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+
+        permissions (:obj:`~pyrogram.types.ChatPermissions` *optional*):
+            Default chat member permissions, for groups and supergroups.
+
+        can_send_paid_media (``bool``, *optional*):
+            True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.
+
+        slowmode_next_send_date (:py:obj:`~datetime.datetime`, *optional*):
+            Indicates when the user will be allowed to send another message in the chat. For supergroups only.
+
+        slow_mode_delay (``int``, *optional*):
+            For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds.
+
+        unrestrict_boost_count (``int``, *optional*):
+            For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions.
+
+        message_auto_delete_time (``int``, *optional*):
+            The time after which all messages sent to the chat will be automatically deleted; in seconds.
+
+        has_aggressive_anti_spam_enabled (``bool``, *optional*):
+            True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators.
+
+        has_hidden_members (``bool``, *optional*):
+            True, if non-administrators can only get the list of bots and administrators in the chat.
+
+        has_protected_content (``bool``, *optional*):
+            True, if messages from the chat can't be forwarded to other chats.
+
+        has_visible_history (``bool``, *optional*):
+            True, if new chat members will have access to old messages; available only to chat administrators.
+
+        sticker_set_name (``str``, *optional*):
+            For supergroups, name of group sticker set.
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+
+        can_set_sticker_set (``bool``, *optional*):
+            True, if the group sticker set can be changed by you.
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+
+        custom_emoji_sticker_set_name (``str``, *optional*):
+            For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group.
+
+        linked_chat (:obj:`~pyrogram.types.Chat`, *optional*):
+            The linked discussion group (in case of channels) or the linked channel (in case of supergroups).
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+
+        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_creator (``bool``, *optional*):
+            True, if this chat owner is the current user. Supergroups, channels and groups only.
+
+        is_scam (``bool``, *optional*):
+            True, if this chat has been flagged for scam.
+
+        is_fake (``bool``, *optional*):
+            True, if this chat has been flagged for impersonation.
+
+        is_support (``bool``, *optional*):
+            True, if this chat is part of the Telegram support team. Users and bots only.
+
+        is_public (``bool``, *optional*):
+            True, if this chat is public.
+
+        is_banned (``bool``, *optional*):
+            True, if you are banned in this chat.
+
+        dc_id (``int``, *optional*):
+            The chat assigned DC (data center). Available only in case the chat has a photo.
+            Note that this information is approximate; it is based on where Telegram stores the current chat photo.
+            It is accurate only in case the owner has set the chat photo, otherwise the dc_id will be the one assigned
+            to the administrator who set the current chat photo.
+
+        members (List of :obj:`~pyrogram.types.User`, *optional*):
+            Preview of some of the chat members.
+
+        members_count (``int``, *optional*):
+            Chat members count, for groups, supergroups and channels only.
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+
+        restrictions (List of :obj:`~pyrogram.types.Restriction`, *optional*):
+            The list of reasons why this chat might be unavailable to some users.
+            This field is available only in case *is_restricted* is True.
+
+        distance (``int``, *optional*):
+            Distance in meters of this group chat from your location.
+            Returned only in :meth:`~pyrogram.Client.get_nearby_chats`.
+
+        send_as_chat (:obj:`~pyrogram.types.Chat`, *optional*):
+            The default "send_as" chat.
+            Returned only in :meth:`~pyrogram.Client.get_chat`.
+        
+        is_peak_preview (``bool``, *optional*):
+            True, if this is a peak preview.
+
+        banned_until_date (:py:obj:`~datetime.datetime`, *optional*):
+            Date when the current user will be unbanned.
+
+        pending_join_request_count (``int``, *optional*):
+            Number of pending join requests in the current chat.
+
+        full_name (``str``, *property*):
+            Full name of the other party in a private chat, for private chats and bots.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: int = None,
+        type: "enums.ChatType" = None,
+        is_verified: bool = None,
+        is_restricted: bool = None,
+        is_creator: bool = None,
+        is_scam: bool = None,
+        is_fake: bool = None,
+        is_support: bool = None,
+        is_public: bool = None,
+        is_banned: bool = None,
+        banned_until_date: datetime = None,
+        title: str = None,
+        username: str = None,
+        first_name: str = None,
+        last_name: str = None,
+        photo: "types.ChatPhoto" = None,
+        active_usernames: List["types.Username"] = None,
+        birthdate: "types.Birthdate" = None,
+        business_intro: "types.BusinessIntro" = None,
+        business_location: "types.BusinessLocation" = None,
+        business_opening_hours: "types.BusinessOpeningHours" = None,
+        bio: str = None,
+        join_by_request: bool = None,
+        description: str = None,
+        dc_id: int = None,
+        has_protected_content: bool = None,
+        invite_link: str = None,
+        pinned_message=None,
+        sticker_set_name: str = None,
+        custom_emoji_sticker_set_name: str = None,
+        can_set_sticker_set: bool = None,
+        members: List["types.User"] = None,
+        members_count: int = None,
+        restrictions: List["types.Restriction"] = None,
+        permissions: "types.ChatPermissions" = None,
+        distance: int = None,
+        linked_chat: "types.Chat" = None,
+        send_as_chat: "types.Chat" = None,
+        personal_chat: "types.Chat" = None,
+        personal_chat_message: "types.Message" = None,
+        available_reactions: Optional["types.ChatReactions"] = None,
+        accent_color: "types.ChatColor" = None,
+        profile_color: "types.ChatColor" = None,
+        emoji_status: "types.EmojiStatus" = None,
+        background: "types.ChatBackground" = None,
+        has_visible_history: bool = None,
+        has_hidden_members: bool = None,
+        has_aggressive_anti_spam_enabled: bool = None,
+        message_auto_delete_time: int = None,
+        slow_mode_delay: int = None,
+        slowmode_next_send_date: datetime = None,
+        unrestrict_boost_count: int = None,
+        is_forum: bool = None,
+        is_peak_preview: bool = None,
+        max_reaction_count: int = None,
+        can_send_paid_media: bool = None,
+        pending_join_request_count: int = None,
+        _raw: Union[
+            "raw.types.ChatInvite",
+            "raw.types.Channel",
+            "raw.types.Chat",
+            "raw.types.User",
+            "raw.types.messages.ChatFull",
+            "raw.types.users.UserFull"
+        ] = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.type = type
+        self.is_verified = is_verified
+        self.is_restricted = is_restricted
+        self.is_creator = is_creator
+        self.is_scam = is_scam
+        self.is_fake = is_fake
+        self.is_support = is_support
+        self.title = title
+        self.username = username
+        self.first_name = first_name
+        self.last_name = last_name
+        self.photo = photo
+        self.bio = bio
+        self.description = description
+        self.dc_id = dc_id
+        self.has_protected_content = has_protected_content
+        self.invite_link = invite_link
+        self.pinned_message = pinned_message
+        self.sticker_set_name = sticker_set_name
+        self.custom_emoji_sticker_set_name = custom_emoji_sticker_set_name
+        self.can_set_sticker_set = can_set_sticker_set
+        self.members = members
+        self.members_count = members_count
+        self.restrictions = restrictions
+        self.permissions = permissions
+        self.distance = distance
+        self.linked_chat = linked_chat
+        self.send_as_chat = send_as_chat
+        self.available_reactions = available_reactions
+        self.accent_color = accent_color
+        self.profile_color = profile_color
+        self.emoji_status = emoji_status
+        self.background = background
+        self.has_visible_history = has_visible_history
+        self.has_hidden_members = has_hidden_members
+        self.has_aggressive_anti_spam_enabled = has_aggressive_anti_spam_enabled
+        self.message_auto_delete_time = message_auto_delete_time
+        self.slow_mode_delay = slow_mode_delay
+        self.slowmode_next_send_date = slowmode_next_send_date
+        self.is_forum = is_forum
+        self.unrestrict_boost_count = unrestrict_boost_count
+        self.is_public = is_public
+        self.is_banned = is_banned
+        self.banned_until_date = banned_until_date
+        self.join_by_request = join_by_request
+        self.is_peak_preview = is_peak_preview
+        self.personal_chat = personal_chat
+        self.personal_chat_message = personal_chat_message
+        self.birthdate = birthdate
+        self.business_intro = business_intro
+        self.business_location = business_location
+        self.business_opening_hours = business_opening_hours
+        self.active_usernames = active_usernames
+        self.max_reaction_count = max_reaction_count
+        self.can_send_paid_media = can_send_paid_media
+        self.pending_join_request_count = pending_join_request_count
+        self._raw = _raw
+
+    @staticmethod
+    def _parse_user_chat(client, user: raw.types.User) -> "Chat":
+        peer_id = user.id
+
+        if isinstance(user, raw.types.UserEmpty):
+            return Chat(
+                id=peer_id,
+                client=client,
+                _raw=user
+            )
+
+        active_usernames = types.List(
+            [
+                types.Username._parse(u)
+                for u in getattr(user, "usernames", [])
+            ]
+        ) or None
+        _tmp_username = None
+        if (
+            active_usernames and
+            len(active_usernames) > 0
+        ):
+            _tmp_username = active_usernames[0].username
+
+        return Chat(
+            id=peer_id,
+            type=enums.ChatType.BOT if user.bot else enums.ChatType.PRIVATE,
+            is_verified=getattr(user, "verified", None),
+            is_restricted=getattr(user, "restricted", None),
+            is_scam=getattr(user, "scam", None),
+            is_fake=getattr(user, "fake", None),
+            is_support=getattr(user, "support", None),
+            username=user.username or _tmp_username,
+            first_name=user.first_name,
+            last_name=user.last_name,
+            photo=types.ChatPhoto._parse(client, user.photo, peer_id, user.access_hash),
+            restrictions=types.List([types.Restriction._parse(r) for r in user.restriction_reason]) or None,
+            dc_id=getattr(getattr(user, "photo", None), "dc_id", None),
+            client=client,
+            active_usernames=active_usernames,
+            accent_color=types.ChatColor._parse(getattr(user, "color", None)),
+            profile_color=types.ChatColor._parse_profile_color(getattr(user, "profile_color", None)),
+            emoji_status=types.EmojiStatus._parse(client, user.emoji_status),
+            _raw=user
+        )
+
+    @staticmethod
+    def _parse_chat_chat(client, chat: raw.types.Chat) -> "Chat":
+        peer_id = -chat.id
+
+        if isinstance(chat, raw.types.ChatEmpty):
+            return Chat(
+                id=peer_id,
+                type=enums.ChatType.GROUP,
+                client=client,
+                _raw=chat
+            )
+
+        if isinstance(chat, raw.types.ChatForbidden):
+            return Chat(
+                id=peer_id,
+                type=enums.ChatType.GROUP,
+                title=chat.title,
+                client=client,
+                is_banned=True,
+                _raw=chat
+            )
+
+        return Chat(
+            id=peer_id,
+            type=enums.ChatType.GROUP,
+            title=chat.title,
+            is_creator=getattr(chat, "creator", None),
+            photo=types.ChatPhoto._parse(client, getattr(chat, "photo", None), peer_id, 0),
+            permissions=types.ChatPermissions._parse(getattr(chat, "default_banned_rights", None)),
+            members_count=getattr(chat, "participants_count", 0),
+            dc_id=getattr(getattr(chat, "photo", None), "dc_id", None),
+            has_protected_content=getattr(chat, "noforwards", None),
+            client=client,
+            _raw=chat
+        )
+
+    @staticmethod
+    def _parse_channel_chat(client, channel: raw.types.Channel) -> "Chat":
+        peer_id = utils.get_channel_id(channel.id)
+
+        if isinstance(channel, raw.types.ChannelForbidden):
+            return Chat(
+                id=peer_id,
+                type=enums.ChatType.SUPERGROUP if channel.megagroup else enums.ChatType.CHANNEL,
+                title=channel.title,
+                client=client,
+                is_banned=True,
+                banned_until_date=utils.timestamp_to_datetime(getattr(channel, "until_date", None)),
+                _raw=channel
+            )
+
+        active_usernames = types.List(
+            [
+                types.Username._parse(u)
+                for u in getattr(channel, "usernames", [])
+            ]
+        ) or None
+        _tmp_username = None
+        if (
+            active_usernames and
+            len(active_usernames) > 0
+        ):
+            _tmp_username = active_usernames[0].username
+
+        return Chat(
+            id=peer_id,
+            type=enums.ChatType.SUPERGROUP if channel.megagroup else enums.ChatType.CHANNEL,
+            is_verified=channel.verified,
+            is_restricted=channel.restricted,
+            is_creator=channel.creator,
+            is_scam=channel.scam,
+            is_fake=channel.fake,
+            title=channel.title,
+            username=channel.username or _tmp_username,
+            photo=types.ChatPhoto._parse(
+                client,
+                getattr(channel, "photo", None),
+                peer_id,
+                getattr(channel, "access_hash", 0)
+            ),
+            restrictions=types.List(
+                [
+                    types.Restriction._parse(r)
+                    for r in getattr(channel, "restriction_reason", None)
+                ]
+            ) or None,
+            permissions=types.ChatPermissions._parse(getattr(channel, "default_banned_rights", None)),
+            members_count=getattr(channel, "participants_count", 0),
+            dc_id=getattr(getattr(channel, "photo", None), "dc_id", None),
+            has_protected_content=getattr(channel, "noforwards", None),
+            is_forum=getattr(channel, "forum", None),
+            client=client,
+            active_usernames=active_usernames,
+            accent_color=types.ChatColor._parse(getattr(channel, "color", None)),
+            profile_color=types.ChatColor._parse_profile_color(getattr(channel, "profile_color", None)),
+            emoji_status=types.EmojiStatus._parse(client, channel.emoji_status),
+            _raw=channel
+        )
+
+    @staticmethod
+    def _parse(
+        client,
+        message: Union[raw.types.Message, raw.types.MessageService],
+        users: dict,
+        chats: dict,
+        is_chat: bool
+    ) -> "Chat":
+        from_id = utils.get_raw_peer_id(message.from_id)
+        peer_id = utils.get_raw_peer_id(message.peer_id)
+        chat_id = (peer_id or from_id) if is_chat else (from_id or peer_id)
+
+        if isinstance(message.peer_id, raw.types.PeerUser):
+            return Chat._parse_user_chat(client, users[chat_id])
+
+        if isinstance(message.peer_id, raw.types.PeerChat):
+            return Chat._parse_chat_chat(client, chats[chat_id])
+
+        return Chat._parse_channel_chat(client, chats[chat_id])
+
+    @staticmethod
+    def _parse_dialog(client, peer, users: dict, chats: dict):
+        if isinstance(peer, raw.types.PeerUser):
+            return Chat._parse_user_chat(client, users[peer.user_id])
+        elif isinstance(peer, raw.types.PeerChat):
+            return Chat._parse_chat_chat(client, chats[peer.chat_id])
+        else:
+            return Chat._parse_channel_chat(client, chats[peer.channel_id])
+
+    @staticmethod
+    async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.types.users.UserFull]) -> "Chat":
+        users = {u.id: u for u in chat_full.users}
+        chats = {c.id: c for c in chat_full.chats}
+
+        personal_chat = None
+        personal_chat_message = None
+
+        if isinstance(chat_full, raw.types.users.UserFull):
+            full_user = chat_full.full_user
+
+            parsed_chat = Chat._parse_user_chat(client, users[full_user.id])
+            parsed_chat.bio = full_user.about
+
+            if getattr(full_user, "personal_channel_id", None):
+                personal_chat = Chat._parse_channel_chat(
+                    client,
+                    chats[full_user.personal_channel_id]
+                )
+            # TODO:?|
+            if getattr(full_user, "personal_channel_message", None):
+                personal_chat_message = types.Message(
+                    client=client,
+                    id=full_user.personal_channel_message
+                )
+
+            if full_user.pinned_msg_id:
+                try:
+                    parsed_chat.pinned_message = await client.get_messages(
+                        chat_id=parsed_chat.id,
+                        message_ids=full_user.pinned_msg_id
+                    )
+                except MessageIdsEmpty:
+                    parsed_chat.pinned_message = types.Message(
+                        id=full_user.pinned_msg_id,
+                        empty=True,
+                        client=client
+                    )
+
+            if getattr(full_user, "birthday", None):
+                parsed_chat.birthdate = types.Birthdate._parse(
+                    full_user.birthday
+                )
+            
+            if getattr(full_user, "business_intro", None):
+                parsed_chat.business_intro = await types.BusinessIntro._parse(
+                    client,
+                    full_user.business_intro
+                )
+            if getattr(full_user, "business_location", None):
+                parsed_chat.business_location = types.BusinessLocation._parse(
+                    client,
+                    full_user.business_location
+                )
+            if getattr(full_user, "business_work_hours", None):
+                parsed_chat.business_opening_hours = types.BusinessOpeningHours._parse(
+                    client,
+                    full_user.business_work_hours
+                )
+
+            if getattr(full_user, "wallpaper", None):
+                parsed_chat.background = types.ChatBackground._parse(client, full_user.wallpaper)
+        else:
+            full_chat = chat_full.full_chat
+            chat_raw = chats[full_chat.id]
+
+            if isinstance(full_chat, raw.types.ChatFull):
+                parsed_chat = Chat._parse_chat_chat(client, chat_raw)
+                parsed_chat.description = full_chat.about or None
+
+                if isinstance(full_chat.participants, raw.types.ChatParticipants):
+                    parsed_chat.members_count = len(full_chat.participants.participants)
+            else:
+                parsed_chat = Chat._parse_channel_chat(client, chat_raw)
+                parsed_chat.members_count = full_chat.participants_count
+                parsed_chat.description = full_chat.about or None
+                # TODO: Add StickerSet type
+                parsed_chat.can_set_sticker_set = full_chat.can_set_stickers
+                parsed_chat.sticker_set_name = getattr(full_chat.stickerset, "short_name", None)
+
+                linked_chat_raw = chats.get(full_chat.linked_chat_id, None)
+
+                if linked_chat_raw:
+                    parsed_chat.linked_chat = Chat._parse_channel_chat(client, linked_chat_raw)
+
+                default_send_as = full_chat.default_send_as
+
+                if default_send_as:
+                    if isinstance(default_send_as, raw.types.PeerUser):
+                        send_as_raw = users[default_send_as.user_id]
+                    else:
+                        send_as_raw = chats[default_send_as.channel_id]
+
+                    parsed_chat.send_as_chat = Chat._parse_chat(client, send_as_raw)
+
+                parsed_chat.members_count = getattr(full_chat, "participants_count", 0)                
+                parsed_chat.has_visible_history = not getattr(full_chat, "hidden_prehistory", False)
+                parsed_chat.has_hidden_members = not getattr(full_chat, "participants_hidden", True)
+                parsed_chat.has_aggressive_anti_spam_enabled = getattr(full_chat, "antispam", False)
+
+                parsed_chat.slow_mode_delay = getattr(full_chat, "slowmode_seconds")
+                parsed_chat.slowmode_next_send_date = utils.timestamp_to_datetime(
+                    getattr(full_chat, "slowmode_next_send_date")
+                )
+
+                parsed_chat.unrestrict_boost_count = getattr(full_chat, "boosts_unrestrict", None)
+                # TODO: Add EmojieStickerSet type
+                parsed_chat.custom_emoji_sticker_set_name = getattr(full_chat.emojiset, "short_name", None)
+
+                parsed_chat.can_send_paid_media = getattr(full_chat, "paid_media_allowed", None)
+
+            parsed_chat.message_auto_delete_time = getattr(full_chat, "ttl_period")
+
+            if full_chat.pinned_msg_id:
+                try:
+                    parsed_chat.pinned_message = await client.get_messages(
+                        chat_id=parsed_chat.id,
+                        message_ids=full_chat.pinned_msg_id
+                    )
+                except MessageIdsEmpty:
+                    parsed_chat.pinned_message = types.Message(
+                        id=full_chat.pinned_msg_id,
+                        empty=True,
+                        client=client
+                    )
+
+            if isinstance(full_chat.exported_invite, raw.types.ChatInviteExported):
+                parsed_chat.invite_link = full_chat.exported_invite.link
+
+            parsed_chat.available_reactions = types.ChatReactions._parse(
+                client,
+                full_chat.available_reactions,
+                reactions_limit=getattr(full_chat, "reactions_limit", None)
+            )
+            parsed_chat.max_reaction_count = getattr(full_chat, "reactions_limit", 11)
+            parsed_chat.pending_join_request_count = getattr(full_chat, "requests_pending", None)
+
+            if getattr(full_chat, "wallpaper", None):
+                parsed_chat.background = types.ChatBackground._parse(client, full_chat.wallpaper)
+
+        parsed_chat.personal_chat = personal_chat
+        parsed_chat.personal_chat_message = personal_chat_message
+        parsed_chat._raw = chat_full
+
+        return parsed_chat
+
+    @staticmethod
+    def _parse_chat(client, chat: Union[raw.types.Chat, raw.types.User, raw.types.Channel]) -> "Chat":
+        if (
+            isinstance(chat, raw.types.Chat) or
+            isinstance(chat, raw.types.ChatForbidden) or
+            isinstance(chat, raw.types.ChatEmpty)
+        ):
+            return Chat._parse_chat_chat(client, chat)
+        elif (
+            isinstance(chat, raw.types.User) or
+            isinstance(chat, raw.types.UserEmpty)
+        ):
+            return Chat._parse_user_chat(client, chat)
+        else:
+            return Chat._parse_channel_chat(client, chat)
+
+    @staticmethod
+    def _parse_chat_preview(client, chat_invite: "raw.types.ChatInvite") -> "Chat":
+        return Chat(
+            _raw=chat_invite,
+            title=chat_invite.title,
+            type=(
+                enums.ChatType.GROUP if not chat_invite.channel else
+                enums.ChatType.CHANNEL if chat_invite.broadcast else
+                enums.ChatType.SUPERGROUP
+            ),
+            members_count=chat_invite.participants_count,
+            photo=types.Photo._parse(client, chat_invite.photo),
+            members=[
+                types.User._parse(client, user)
+                for user in chat_invite.participants
+            ] or None,
+            description=getattr(chat_invite, "about", None),
+            is_verified=getattr(chat_invite, "verified", None),
+            is_scam=getattr(chat_invite, "scam", None),
+            is_fake=getattr(chat_invite, "fake", None),
+            is_public=getattr(chat_invite, "public", None),
+            join_by_request=getattr(chat_invite, "request_needed", None),
+            is_peak_preview=True,
+            client=client
+        )
+
+    @property
+    def full_name(self) -> str:
+        return " ".join(
+            filter(
+                None,
+                [
+                    self.first_name,
+                    self.last_name
+                ]
+            )
+        ) or None
+
+    async def archive(self):
+        """Bound method *archive* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.archive_chats(-100123456789)
+
+        Example:
+            .. code-block:: python
+
+                await chat.archive()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.archive_chats(self.id)
+
+    async def unarchive(self):
+        """Bound method *unarchive* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.unarchive_chats(-100123456789)
+
+        Example:
+            .. code-block:: python
+
+                await chat.unarchive()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.unarchive_chats(self.id)
+
+    # TODO: Remove notes about "All Members Are Admins" for basic groups, the attribute doesn't exist anymore
+    async def set_title(self, title: str) -> bool:
+        """Bound method *set_title* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.set_chat_title(
+                chat_id=chat_id,
+                title=title
+            )
+
+        Example:
+            .. code-block:: python
+
+                await chat.set_title("Lounge")
+
+        Note:
+            In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
+            setting is off.
+
+        Parameters:
+            title (``str``):
+                New chat title, 1-255 characters.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            RPCError: In case of Telegram RPC error.
+            ValueError: In case a chat_id belongs to user.
+        """
+
+        return await self._client.set_chat_title(
+            chat_id=self.id,
+            title=title
+        )
+
+    async def set_description(self, description: str) -> bool:
+        """Bound method *set_description* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.set_chat_description(
+                chat_id=chat_id,
+                description=description
+            )
+
+        Example:
+            .. code-block:: python
+
+                await chat.set_chat_description("Don't spam!")
+
+        Parameters:
+            description (``str``):
+                New chat description, 0-255 characters.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            RPCError: In case of Telegram RPC error.
+            ValueError: If a chat_id doesn't belong to a supergroup or a channel.
+        """
+
+        return await self._client.set_chat_description(
+            chat_id=self.id,
+            description=description
+        )
+
+    async def set_photo(
+        self,
+        *,
+        photo: Union[str, BinaryIO] = None,
+        video: Union[str, BinaryIO] = None,
+        video_start_ts: float = None,
+    ) -> bool:
+        """Bound method *set_photo* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.set_chat_photo(
+                chat_id=chat_id,
+                photo=photo
+            )
+
+        Example:
+            .. code-block:: python
+
+                # Set chat photo using a local file
+                await chat.set_photo(photo="photo.jpg")
+
+                # Set chat photo using an existing Photo file_id
+                await chat.set_photo(photo=photo.file_id)
+
+
+                # Set chat video using a local file
+                await chat.set_photo(video="video.mp4")
+
+                # Set chat photo using an existing Video file_id
+                await chat.set_photo(video=video.file_id)
+
+        Parameters:
+            photo (``str`` | ``BinaryIO``, *optional*):
+                New chat photo. You can pass a :obj:`~pyrogram.types.Photo` file_id, a file path to upload a new photo
+                from your local machine or a binary file-like object with its attribute
+                ".name" set for in-memory uploads.
+
+            video (``str`` | ``BinaryIO``, *optional*):
+                New chat video. You can pass a :obj:`~pyrogram.types.Video` file_id, a file path to upload a new video
+                from your local machine or a binary file-like object with its attribute
+                ".name" set for in-memory uploads.
+
+            video_start_ts (``float``, *optional*):
+                The timestamp in seconds of the video frame to use as photo profile preview.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+            ValueError: if a chat_id belongs to user.
+        """
+
+        return await self._client.set_chat_photo(
+            chat_id=self.id,
+            photo=photo,
+            video=video,
+            video_start_ts=video_start_ts
+        )
+
+    async def set_message_auto_delete_time(self, message_auto_delete_time: int) -> "types.Message":
+        """Bound method *set_message_auto_delete_time* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.set_chat_message_auto_delete_time(
+                chat_id=chat_id,
+                message_auto_delete_time=ttl_seconds
+            )
+
+        Parameters:
+            message_auto_delete_time (``int``):
+                New time value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically.
+
+        Example:
+            .. code-block:: python
+
+                await chat.set_message_auto_delete_time(86400)
+
+        Returns:
+            :obj:`~pyrogram.types.Message`: On success, the generated service message is returned.
+
+        """
+        return await self._client.set_chat_message_auto_delete_time(
+            chat_id=self.id,
+            message_auto_delete_time=message_auto_delete_time
+        )
+
+    async def ban_member(
+        self,
+        user_id: Union[int, str],
+        until_date: datetime = utils.zero_datetime(),
+        revoke_messages: bool = None
+    ) -> Union["types.Message", bool]:
+        """Bound method *ban_member* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.ban_chat_member(
+                chat_id=chat_id,
+                user_id=user_id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await chat.ban_member(123456789)
+
+        Note:
+            In regular groups (non-supergroups), this method will only work if the "All Members Are Admins" setting is
+            off in the target group. Otherwise members may only be removed by the group's creator or by the member
+            that added them.
+
+        Parameters:
+            user_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target user.
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            until_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the user will be unbanned.
+                If user is banned for more than 366 days or less than 30 seconds from the current time they are
+                considered to be banned forever. Defaults to epoch (ban forever).
+
+            revoke_messages (``bool``, *optional*):
+                Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed.
+                Always True for supergroups and channels.
+
+        Returns:
+            :obj:`~pyrogram.types.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:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.ban_chat_member(
+            chat_id=self.id,
+            user_id=user_id,
+            until_date=until_date,
+            revoke_messages=revoke_messages
+        )
+
+    async def unban_member(
+        self,
+        user_id: Union[int, str]
+    ) -> bool:
+        """Bound method *unban_member* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.unban_chat_member(
+                chat_id=chat_id,
+                user_id=user_id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await chat.unban_member(123456789)
+
+        Parameters:
+            user_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target user.
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.unban_chat_member(
+            chat_id=self.id,
+            user_id=user_id,
+        )
+
+    async def restrict_member(
+        self,
+        user_id: Union[int, str],
+        permissions: "types.ChatPermissions",
+        use_independent_chat_permissions: bool = False,
+        until_date: datetime = utils.zero_datetime(),
+    ) -> "types.Chat":
+        """Bound method *unban_member* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.restrict_chat_member(
+                chat_id=chat_id,
+                user_id=user_id,
+                permissions=ChatPermissions()
+            )
+
+        Example:
+            .. code-block:: python
+
+                await chat.restrict_member(user_id, ChatPermissions())
+
+        Parameters:
+            user_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target user.
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            permissions (:obj:`~pyrogram.types.ChatPermissions`):
+                New user permissions.
+
+            use_independent_chat_permissions (``bool``, *optional*):
+                Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
+
+            until_date (:py:obj:`~datetime.datetime`, *optional*):
+                Date when the user will be unbanned.
+                If user is banned for more than 366 days or less than 30 seconds from the current time they are
+                considered to be banned forever. Defaults to epoch (ban forever).
+
+        Returns:
+            :obj:`~pyrogram.types.Chat`: On success, a chat object is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.restrict_chat_member(
+            chat_id=self.id,
+            user_id=user_id,
+            permissions=permissions,
+            use_independent_chat_permissions=use_independent_chat_permissions,
+            until_date=until_date,
+        )
+
+    # Set None as privileges default due to issues with partially initialized module, because at the time Chat
+    # is being initialized, ChatPrivileges would be required here, but was not initialized yet.
+    async def promote_member(
+        self,
+        user_id: Union[int, str],
+        privileges: "types.ChatPrivileges" = None
+    ) -> bool:
+        """Bound method *promote_member* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.promote_chat_member(
+                chat_id=chat_id,
+                user_id=user_id
+            )
+
+        Example:
+
+            .. code-block:: python
+
+                await chat.promote_member(123456789)
+
+        Parameters:
+            user_id (``int`` | ``str``):
+                Unique identifier (int) or username (str) of the target user.
+                For a contact that exists in your Telegram address book you can use his phone number (str).
+
+            privileges (:obj:`~pyrogram.types.ChatPrivileges`, *optional*):
+                New user privileges.
+
+        Returns:
+            ``bool``: True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.promote_chat_member(
+            chat_id=self.id,
+            user_id=user_id,
+            privileges=privileges
+        )
+
+    async def join(self):
+        """Bound method *join* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.join_chat(123456789)
+
+        Example:
+            .. code-block:: python
+
+                await chat.join()
+
+        Note:
+            This only works for public groups, channels that have set a username or linked chats.
+
+        Returns:
+            :obj:`~pyrogram.types.Chat`: On success, a chat object is returned.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.join_chat(self.username or self.id)
+
+    async def leave(self):
+        """Bound method *leave* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.leave_chat(123456789)
+
+        Example:
+            .. code-block:: python
+
+                await chat.leave()
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.leave_chat(self.id)
+
+    async def export_invite_link(self):
+        """Bound method *export_invite_link* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.export_chat_invite_link(123456789)
+
+        Example:
+            .. code-block:: python
+
+                chat.export_invite_link()
+
+        Returns:
+            ``str``: On success, the exported invite link is returned.
+
+        Raises:
+            ValueError: In case the chat_id belongs to a user.
+        """
+
+        return await self._client.export_chat_invite_link(self.id)
+
+    async def get_member(
+        self,
+        user_id: Union[int, str],
+    ) -> "types.ChatMember":
+        """Bound method *get_member* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.get_chat_member(
+                chat_id=chat_id,
+                user_id=user_id
+            )
+
+        Example:
+            .. code-block:: python
+
+                await chat.get_member(user_id)
+
+        Returns:
+            :obj:`~pyrogram.types.ChatMember`: On success, a chat member is returned.
+        """
+
+        return await self._client.get_chat_member(
+            self.id,
+            user_id=user_id
+        )
+
+    def get_members(
+        self,
+        query: str = "",
+        limit: int = 0,
+        filter: "enums.ChatMembersFilter" = enums.ChatMembersFilter.SEARCH
+    ) -> Optional[AsyncGenerator["types.ChatMember", None]]:
+        """Bound method *get_members* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            async for member in client.get_chat_members(chat_id):
+                print(member)
+
+        Example:
+            .. code-block:: python
+
+                async for member in chat.get_members():
+                    print(member)
+
+        Parameters:
+            query (``str``, *optional*):
+                Query string to filter members based on their display names and usernames.
+                Only applicable to supergroups and channels. Defaults to "" (empty string).
+                A query string is applicable only for :obj:`~pyrogram.enums.ChatMembersFilter.SEARCH`,
+                :obj:`~pyrogram.enums.ChatMembersFilter.BANNED` and :obj:`~pyrogram.enums.ChatMembersFilter.RESTRICTED`
+                filters only.
+
+            limit (``int``, *optional*):
+                Limits the number of members to be retrieved.
+
+            filter (:obj:`~pyrogram.enums.ChatMembersFilter`, *optional*):
+                Filter used to select the kind of members you want to retrieve. Only applicable for supergroups
+                and channels.
+
+        Returns:
+            ``Generator``: On success, a generator yielding :obj:`~pyrogram.types.ChatMember` objects is returned.
+        """
+
+        return self._client.get_chat_members(
+            self.id,
+            query=query,
+            limit=limit,
+            filter=filter
+        )
+
+    async def add_members(
+        self,
+        user_ids: Union[Union[int, str], List[Union[int, str]]],
+        forward_limit: int = 100
+    ) -> bool:
+        """Bound method *add_members* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.add_chat_members(chat_id, user_id)
+
+        Example:
+            .. code-block:: python
+
+                await chat.add_members(user_id)
+
+        Returns:
+            ``bool``: On success, True is returned.
+        """
+
+        return await self._client.add_chat_members(
+            self.id,
+            user_ids=user_ids,
+            forward_limit=forward_limit
+        )
+
+    async def mark_unread(self, ) -> bool:
+        """Bound method *mark_unread* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.mark_unread(chat_id)
+
+        Example:
+            .. code-block:: python
+
+                await chat.mark_unread()
+
+        Returns:
+            ``bool``: On success, True is returned.
+        """
+
+        return await self._client.mark_chat_unread(self.id)
+
+    async def set_protected_content(self, enabled: bool) -> bool:
+        """Bound method *set_protected_content* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.set_chat_protected_content(chat_id, enabled)
+
+        Parameters:
+            enabled (``bool``):
+                Pass True to enable the protected content setting, False to disable.
+
+        Example:
+            .. code-block:: python
+
+                await chat.set_protected_content(enabled)
+
+        Returns:
+            ``bool``: On success, True is returned.
+        """
+
+        return await self._client.set_chat_protected_content(
+            self.id,
+            enabled=enabled
+        )
+
+    async def unpin_all_messages(self) -> bool:
+        """Bound method *unpin_all_messages* of :obj:`~pyrogram.types.Chat`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.unpin_all_chat_messages(chat_id)
+
+        Example:
+            .. code-block:: python
+
+                chat.unpin_all_messages()
+
+        Returns:
+            ``bool``: On success, True is returned.
+        """
+
+        return await self._client.unpin_all_chat_messages(self.id)
diff --git a/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py b/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py
new file mode 100644
index 0000000000..385a38da43
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Dict
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types
+from ..object import Object
+
+
+class ChatAdminWithInviteLinks(Object):
+    """Represents a chat administrator that has created invite links in a chat.
+
+    Parameters:
+        admin (:obj:`~pyrogram.types.User`):
+            The administrator.
+
+        chat_invite_links_count (``int``):
+            The number of valid chat invite links created by this administrator.
+
+        revoked_chat_invite_links_count (``int``):
+            The number of revoked chat invite links created by this administrator.
+    """
+
+    def __init__(
+        self, *,
+        admin: "types.User",
+        chat_invite_links_count: int,
+        revoked_chat_invite_links_count: int = None
+    ):
+        super().__init__()
+
+        self.admin = admin
+        self.chat_invite_links_count = chat_invite_links_count
+        self.revoked_chat_invite_links_count = revoked_chat_invite_links_count
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        admin: "raw.types.ChatAdminWithInvites",
+        users: Dict[int, "raw.types.User"] = None
+    ) -> "ChatAdminWithInviteLinks":
+        return ChatAdminWithInviteLinks(
+            admin=types.User._parse(client, users[admin.admin_id]),
+            chat_invite_links_count=admin.invites_count,
+            revoked_chat_invite_links_count=admin.revoked_invites_count
+        )
diff --git a/pyrogram/types/user_and_chats/chat_background.py b/pyrogram/types/user_and_chats/chat_background.py
new file mode 100644
index 0000000000..a4b2d2ab54
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_background.py
@@ -0,0 +1,113 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from pyrogram.file_id import (
+    FileId,
+    FileType,
+    FileUniqueId,
+    FileUniqueType,
+    ThumbnailSource,
+)
+from ..object import Object
+
+
+class ChatBackground(Object):
+    """Describes a background set for a specific chat.
+
+    Parameters:
+        file_id (``str``):
+            Identifier for this file, which can be used to download the file.
+
+        file_unique_id (``str``):
+            Unique identifier for this file, which is supposed to be the same over time and for different accounts.
+            Can't be used to download or reuse the file.
+
+        file_size (``int``):
+            File size.
+
+        date (:py:obj:`~datetime.datetime`):
+            Date the background was setted.
+
+        slug (``str``):
+            Identifier of the background code.
+            You can combine it with `https://t.me/bg/{slug}`
+            to get link for this background.
+
+        thumbs (List of :obj:`~pyrogram.types.Thumbnail`, *optional*):
+            Available thumbnails of this background.
+
+        link (``str``, *property*):
+            Generate a link to this background code.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        file_id: str,
+        file_unique_id: str,
+        file_size: int,
+        date: datetime,
+        slug: str,
+        thumbs: List["types.Thumbnail"] = None,
+    ):
+        super().__init__(client)
+
+        self.file_id = file_id
+        self.file_unique_id = file_unique_id
+        self.file_size = file_size
+        self.date = date
+        self.slug = slug
+        self.thumbs = thumbs
+
+    @property
+    def link(self) -> str:
+        return f"https://t.me/bg/{self.slug}"
+
+    @staticmethod
+    def _parse(
+        client,
+        wallpaper: "raw.types.Wallpaper",
+    ) -> "ChatBackground":
+        return ChatBackground(
+            file_id=FileId(
+                dc_id=wallpaper.document.dc_id,
+                file_reference=wallpaper.document.file_reference,
+                access_hash=wallpaper.document.access_hash,
+                file_type=FileType.BACKGROUND,
+                media_id=wallpaper.document.id,
+                volume_id=0,
+                local_id=0,
+                thumbnail_source=ThumbnailSource.THUMBNAIL,
+                thumbnail_file_type=FileType.BACKGROUND,
+            ).encode(),
+            file_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=wallpaper.document.id
+            ).encode(),
+            file_size=wallpaper.document.size,
+            slug=wallpaper.slug,
+            date=utils.timestamp_to_datetime(wallpaper.document.date),
+            thumbs=types.Thumbnail._parse(client, wallpaper.document),
+            client=client,
+        )
diff --git a/pyrogram/types/user_and_chats/chat_color.py b/pyrogram/types/user_and_chats/chat_color.py
new file mode 100644
index 0000000000..b4695afeb3
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_color.py
@@ -0,0 +1,63 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, Union
+
+from pyrogram import raw, enums
+from ..object import Object
+
+
+class ChatColor(Object):
+    """Accent or profile color status.
+
+    Parameters:
+        color (:obj:`~pyrogram.enums.AccentColor` | :obj:`~pyrogram.enums.ProfileColor`, *optional*):
+            Color type.
+
+        background_emoji_id (``int``, *optional*):
+            Unique identifier of the custom emoji.
+    """
+
+    def __init__(
+        self,
+        *,
+        color: Union["enums.AccentColor", "enums.ProfileColor"] = None,
+        background_emoji_id: int = None
+    ):
+        self.color = color
+        self.background_emoji_id = background_emoji_id
+
+    @staticmethod
+    def _parse(color: "raw.types.PeerColor" = None) -> Optional["ChatColor"]:
+        if not color:
+            return None
+
+        return ChatColor(
+            color=enums.AccentColor(color.color) if getattr(color, "color", None) else None,
+            background_emoji_id=getattr(color, "background_emoji_id", None)
+        )
+
+    @staticmethod
+    def _parse_profile_color(color: "raw.types.PeerColor" = None) -> Optional["ChatColor"]:
+        if not color:
+            return None
+
+        return ChatColor(
+            color=enums.ProfileColor(color.color) if getattr(color, "color", None) else None,
+            background_emoji_id=getattr(color, "background_emoji_id", None)
+        )
diff --git a/pyrogram/types/user_and_chats/chat_event.py b/pyrogram/types/user_and_chats/chat_event.py
new file mode 100644
index 0000000000..cdffb562f9
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_event.py
@@ -0,0 +1,505 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import List, Optional
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import types, utils, enums
+from ..object import Object
+
+
+class ChatEvent(Object):
+    """A chat event from the recent actions log (also known as admin log).
+
+    See ``action`` to know which kind of event this is and the relative attributes to get the event content.
+
+    Parameters:
+        id (``int``):
+            Chat event identifier.
+
+        date (:py:obj:`~datetime.datetime`):
+            Date of the event.
+
+        action (:obj:`~pyrogram.enums.ChatEventAction`):
+            Event action.
+
+        user (:obj:`~pyrogram.types.User`):
+            User that triggered the event.
+
+        old_description, new_description (``str``, *optional*):
+            Previous and new chat description.
+            For :obj:`~pyrogram.enums.ChatEventAction.DESCRIPTION_CHANGED` action only.
+
+        old_history_ttl, new_history_ttl (``int``, *optional*):
+            Previous and new chat history TTL.
+            For :obj:`~pyrogram.enums.ChatEventAction.HISTORY_TTL_CHANGED` action only.
+
+        old_linked_chat, new_linked_chat (:obj:`~pyrogram.types.Chat`, *optional*):
+            Previous and new linked chat.
+            For :obj:`~pyrogram.enums.ChatEventAction.LINKED_CHAT_CHANGED` action only.
+
+        old_photo, new_photo (:obj:`~pyrogram.types.Photo`, *optional*):
+            Previous and new chat photo.
+            For :obj:`~pyrogram.enums.ChatEventAction.PHOTO_CHANGED` action only.
+
+        old_title, new_title (``str``, *optional*):
+            Previous and new chat title.
+            For :obj:`~pyrogram.enums.ChatEventAction.TITLE_CHANGED` action only.
+
+        old_username, new_username (``str``, *optional*):
+            Previous and new chat username.
+            For :obj:`~pyrogram.enums.ChatEventAction.USERNAME_CHANGED` action only.
+
+        old_chat_permissions, new_chat_permissions (:obj:`~pyrogram.types.ChatPermissions`, *optional*):
+            Previous and new default chat permissions.
+            For :obj:`~pyrogram.enums.ChatEventAction.CHAT_PERMISSIONS_CHANGED` action only.
+
+        deleted_message (:obj:`~pyrogram.types.Message`, *optional*):
+            Deleted message.
+            For :obj:`~pyrogram.enums.ChatEventAction.MESSAGE_DELETED` action only.
+
+        old_message, new_message (:obj:`~pyrogram.types.Message`, *optional*):
+            Previous and new message before it has been edited.
+            For :obj:`~pyrogram.enums.ChatEventAction.MESSAGE_EDITED` action only.
+
+        invited_member (:obj:`~pyrogram.types.ChatMember`, *optional*):
+            New invited chat member.
+            For :obj:`~pyrogram.enums.ChatEventAction.MEMBER_INVITED` action only.
+
+        old_administrator_privileges, new_administrator_privileges (:obj:`~pyrogram.types.ChatMember`, *optional*):
+            Previous and new administrator privileges.
+            For :obj:`~pyrogram.enums.ChatEventAction.ADMINISTRATOR_PRIVILEGES_CHANGED` action only.
+
+        old_member_permissions, new_member_permissions (:obj:`~pyrogram.types.ChatMember`, *optional*):
+            Previous and new member permissions.
+            For :obj:`~pyrogram.enums.ChatEventAction.MEMBER_PERMISSIONS_CHANGED` action only.
+
+        stopped_poll (:obj:`~pyrogram.types.Message`, *optional*):
+            Message containing the stopped poll.
+            For :obj:`~pyrogram.enums.ChatEventAction.POLL_STOPPED` action only.
+
+        invites_enabled (``bool``, *optional*):
+            If chat invites were enabled (True) or disabled (False).
+            For :obj:`~pyrogram.enums.ChatEventAction.INVITES_ENABLED` action only.
+
+        history_hidden (``bool``, *optional*):
+            If chat history has been hidden (True) or unhidden (False).
+            For :obj:`~pyrogram.enums.ChatEventAction.HISTORY_HIDDEN` action only.
+
+        signatures_enabled (``bool``, *optional*):
+            If message signatures were enabled (True) or disabled (False).
+            For :obj:`~pyrogram.enums.ChatEventAction.SIGNATURES_ENABLED` action only.
+
+        old_slow_mode, new_slow_mode (``int``, *optional*):
+            Previous and new slow mode value in seconds.
+            For :obj:`~pyrogram.enums.ChatEventAction.SLOW_MODE_CHANGED` action only.
+
+        pinned_message (:obj:`~pyrogram.types.Message`, *optional*):
+            Pinned message.
+            For :obj:`~pyrogram.enums.ChatEventAction.MESSAGE_PINNED` action only.
+
+        unpinned_message (:obj:`~pyrogram.types.Message`, *optional*):
+            Unpinned message.
+            For :obj:`~pyrogram.enums.ChatEventAction.MESSAGE_UNPINNED` action only.
+
+        old_invite_link, new_invite_link (:obj:`~pyrogram.types.ChatInviteLink`, *optional*):
+            Previous and new edited invite link.
+            For :obj:`~pyrogram.enums.ChatEventAction.INVITE_LINK_EDITED` action only.
+
+        revoked_invite_link (:obj:`~pyrogram.types.ChatInviteLink`, *optional*):
+            Revoked invite link.
+            For :obj:`~pyrogram.enums.ChatEventAction.INVITE_LINK_REVOKED` action only.
+
+        deleted_invite_link (:obj:`~pyrogram.types.ChatInviteLink`, *optional*):
+            Deleted invite link.
+            For :obj:`~pyrogram.enums.ChatEventAction.INVITE_LINK_DELETED` action only.
+    """
+
+    def __init__(
+        self, *,
+        id: int,
+        date: datetime,
+        user: "types.User",
+        action: str,
+
+        old_description: str = None,
+        new_description: str = None,
+
+        old_history_ttl: int = None,
+        new_history_ttl: int = None,
+
+        old_linked_chat: "types.Chat" = None,
+        new_linked_chat: "types.Chat" = None,
+
+        old_photo: "types.Photo" = None,
+        new_photo: "types.Photo" = None,
+
+        old_title: str = None,
+        new_title: str = None,
+
+        old_username: str = None,
+        new_username: str = None,
+
+        old_chat_permissions: "types.ChatPermissions" = None,
+        new_chat_permissions: "types.ChatPermissions" = None,
+
+        deleted_message: "types.Message" = None,
+
+        old_message: "types.Message" = None,
+        new_message: "types.Message" = None,
+
+        invited_member: "types.ChatMember" = None,
+
+        old_administrator_privileges: "types.ChatMember" = None,
+        new_administrator_privileges: "types.ChatMember" = None,
+
+        old_member_permissions: "types.ChatMember" = None,
+        new_member_permissions: "types.ChatMember" = None,
+
+        stopped_poll: "types.Message" = None,
+
+        invites_enabled: "types.ChatMember" = None,
+
+        history_hidden: bool = None,
+
+        signatures_enabled: bool = None,
+
+        old_slow_mode: int = None,
+        new_slow_mode: int = None,
+
+        pinned_message: "types.Message" = None,
+        unpinned_message: "types.Message" = None,
+
+        old_invite_link: "types.ChatInviteLink" = None,
+        new_invite_link: "types.ChatInviteLink" = None,
+        revoked_invite_link: "types.ChatInviteLink" = None,
+        deleted_invite_link: "types.ChatInviteLink" = None
+    ):
+        super().__init__()
+
+        self.id = id
+        self.date = date
+        self.action = action
+        self.user = user
+
+        self.old_description = old_description
+        self.new_description = new_description
+
+        self.old_history_ttl = old_history_ttl
+        self.new_history_ttl = new_history_ttl
+
+        self.old_linked_chat = old_linked_chat
+        self.new_linked_chat = new_linked_chat
+
+        self.old_photo = old_photo
+        self.new_photo = new_photo
+
+        self.old_title = old_title
+        self.new_title = new_title
+
+        self.old_username = old_username
+        self.new_username = new_username
+
+        self.old_chat_permissions = old_chat_permissions
+        self.new_chat_permissions = new_chat_permissions
+
+        self.deleted_message = deleted_message
+
+        self.old_message = old_message
+        self.new_message = new_message
+
+        self.invited_member = invited_member
+
+        self.old_administrator_privileges = old_administrator_privileges
+        self.new_administrator_privileges = new_administrator_privileges
+
+        self.old_member_permissions = old_member_permissions
+        self.new_member_permissions = new_member_permissions
+
+        self.stopped_poll = stopped_poll
+
+        self.invites_enabled = invites_enabled
+
+        self.history_hidden = history_hidden
+
+        self.signatures_enabled = signatures_enabled
+
+        self.old_slow_mode = old_slow_mode
+        self.new_slow_mode = new_slow_mode
+
+        self.pinned_message = pinned_message
+        self.unpinned_message = unpinned_message
+
+        self.old_invite_link = old_invite_link
+        self.new_invite_link = new_invite_link
+        self.revoked_invite_link = revoked_invite_link
+        self.deleted_invite_link = deleted_invite_link
+
+    @staticmethod
+    async def _parse(
+        client: "pyrogram.Client",
+        event: "raw.base.ChannelAdminLogEvent",
+        users: List["raw.base.User"],
+        chats: List["raw.base.Chat"]
+    ):
+        users = {i.id: i for i in users}
+        chats = {i.id: i for i in chats}
+
+        user = types.User._parse(client, users[event.user_id])
+        action = event.action
+
+        old_description: Optional[str] = None
+        new_description: Optional[str] = None
+
+        old_history_ttl: Optional[int] = None
+        new_history_ttl: Optional[int] = None
+
+        old_linked_chat: Optional[types.Chat] = None
+        new_linked_chat: Optional[types.Chat] = None
+
+        old_photo: Optional[types.Photo] = None
+        new_photo: Optional[types.Photo] = None
+
+        old_title: Optional[str] = None
+        new_title: Optional[str] = None
+
+        old_username: Optional[str] = None
+        new_username: Optional[str] = None
+
+        old_chat_permissions: Optional[types.ChatPermissions] = None
+        new_chat_permissions: Optional[types.ChatPermissions] = None
+
+        deleted_message: Optional[types.Message] = None
+
+        old_message: Optional[types.Message] = None
+        new_message: Optional[types.Message] = None
+
+        invited_member: Optional[types.ChatMember] = None
+
+        old_administrator_privileges: Optional[types.ChatMember] = None
+        new_administrator_privileges: Optional[types.ChatMember] = None
+
+        old_member_permissions: Optional[types.ChatMember] = None
+        new_member_permissions: Optional[types.ChatMember] = None
+
+        stopped_poll: Optional[types.Message] = None
+
+        invites_enabled: Optional[bool] = None
+
+        history_hidden: Optional[bool] = None
+
+        signatures_enabled: Optional[bool] = None
+
+        old_slow_mode: Optional[int] = None
+        new_slow_mode: Optional[int] = None
+
+        pinned_message: Optional[types.Message] = None
+        unpinned_message: Optional[types.Message] = None
+
+        old_invite_link: Optional[types.ChatInviteLink] = None
+        new_invite_link: Optional[types.ChatInviteLink] = None
+        revoked_invite_link: Optional[types.ChatInviteLink] = None
+        deleted_invite_link: Optional[types.ChatInviteLink] = None
+
+        if isinstance(action, raw.types.ChannelAdminLogEventActionChangeAbout):
+            old_description = action.prev_value
+            new_description = action.new_value
+            action = enums.ChatEventAction.DESCRIPTION_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionChangeHistoryTTL):
+            old_history_ttl = action.prev_value
+            new_history_ttl = action.new_value
+            action = enums.ChatEventAction.HISTORY_TTL_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionChangeLinkedChat):
+            old_linked_chat = types.Chat._parse_chat(client, chats[action.prev_value])
+            new_linked_chat = types.Chat._parse_chat(client, chats[action.new_value])
+            action = enums.ChatEventAction.LINKED_CHAT_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionChangePhoto):
+            old_photo = types.Photo._parse(client, action.prev_photo)
+            new_photo = types.Photo._parse(client, action.new_photo)
+            action = enums.ChatEventAction.PHOTO_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionChangeTitle):
+            old_title = action.prev_value
+            new_title = action.new_value
+            action = enums.ChatEventAction.TITLE_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionChangeUsername):
+            old_username = action.prev_value
+            new_username = action.new_value
+            action = enums.ChatEventAction.USERNAME_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionDefaultBannedRights):
+            old_chat_permissions = types.ChatPermissions._parse(action.prev_banned_rights)
+            new_chat_permissions = types.ChatPermissions._parse(action.new_banned_rights)
+            action = enums.ChatEventAction.CHAT_PERMISSIONS_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionDeleteMessage):
+            deleted_message = await types.Message._parse(
+                client,
+                action.message,
+                users,
+                chats
+            )
+            action = enums.ChatEventAction.MESSAGE_DELETED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionEditMessage):
+            old_message = await types.Message._parse(
+                client, action.prev_message, users, chats
+            )
+            new_message = await types.Message._parse(
+                client, action.new_message, users, chats
+            )
+            action = enums.ChatEventAction.MESSAGE_EDITED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionParticipantInvite):
+            invited_member = types.ChatMember._parse(client, action.participant, users, chats)
+            action = enums.ChatEventAction.MEMBER_INVITED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionParticipantToggleAdmin):
+            old_administrator_privileges = types.ChatMember._parse(client, action.prev_participant, users, chats)
+            new_administrator_privileges = types.ChatMember._parse(client, action.new_participant, users, chats)
+            action = enums.ChatEventAction.ADMINISTRATOR_PRIVILEGES_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionParticipantToggleBan):
+            old_member_permissions = types.ChatMember._parse(client, action.prev_participant, users, chats)
+            new_member_permissions = types.ChatMember._parse(client, action.new_participant, users, chats)
+            action = enums.ChatEventAction.MEMBER_PERMISSIONS_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionStopPoll):
+            stopped_poll = await types.Message._parse(
+                client, action.message, users, chats
+            )
+            action = enums.ChatEventAction.POLL_STOPPED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionParticipantJoin):
+            action = enums.ChatEventAction.MEMBER_JOINED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionParticipantLeave):
+            action = enums.ChatEventAction.MEMBER_LEFT
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionToggleInvites):
+            invites_enabled = action.new_value
+            action = enums.ChatEventAction.INVITES_ENABLED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionTogglePreHistoryHidden):
+            history_hidden = action.new_value
+            action = enums.ChatEventAction.HISTORY_HIDDEN
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionToggleSignatures):
+            signatures_enabled = action.new_value
+            action = enums.ChatEventAction.SIGNATURES_ENABLED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionToggleSlowMode):
+            old_slow_mode = action.prev_value
+            new_slow_mode = action.new_value
+            action = enums.ChatEventAction.SLOW_MODE_CHANGED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionUpdatePinned):
+            message = action.message
+
+            if isinstance(action.message, raw.types.Message):
+                if message.pinned:
+                    pinned_message = await types.Message._parse(
+                        client, message, users, chats
+                    )
+                    action = enums.ChatEventAction.MESSAGE_PINNED
+                else:
+                    unpinned_message = await types.Message._parse(
+                        client, message, users, chats
+                    )
+                    action = enums.ChatEventAction.MESSAGE_UNPINNED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionExportedInviteEdit):
+            old_invite_link = types.ChatInviteLink._parse(client, action.prev_invite, users)
+            new_invite_link = types.ChatInviteLink._parse(client, action.new_invite, users)
+            action = enums.ChatEventAction.INVITE_LINK_EDITED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionExportedInviteRevoke):
+            revoked_invite_link = types.ChatInviteLink._parse(client, action.invite, users)
+            action = enums.ChatEventAction.INVITE_LINK_REVOKED
+
+        elif isinstance(action, raw.types.ChannelAdminLogEventActionExportedInviteDelete):
+            deleted_invite_link = types.ChatInviteLink._parse(client, action.invite, users)
+            action = enums.ChatEventAction.INVITE_LINK_DELETED
+
+        else:
+            action = f"{enums.ChatEventAction.UNKNOWN}-{action.QUALNAME}"
+
+        return ChatEvent(
+            id=event.id,
+            date=utils.timestamp_to_datetime(event.date),
+            user=user,
+            action=action,
+            old_description=old_description,
+            new_description=new_description,
+
+            old_history_ttl=old_history_ttl,
+            new_history_ttl=new_history_ttl,
+
+            old_linked_chat=old_linked_chat,
+            new_linked_chat=new_linked_chat,
+
+            old_photo=old_photo,
+            new_photo=new_photo,
+
+            old_title=old_title,
+            new_title=new_title,
+
+            old_username=old_username,
+            new_username=new_username,
+
+            old_chat_permissions=old_chat_permissions,
+            new_chat_permissions=new_chat_permissions,
+
+            deleted_message=deleted_message,
+
+            old_message=old_message,
+            new_message=new_message,
+
+            invited_member=invited_member,
+
+            old_administrator_privileges=old_administrator_privileges,
+            new_administrator_privileges=new_administrator_privileges,
+
+            old_member_permissions=old_member_permissions,
+            new_member_permissions=new_member_permissions,
+
+            stopped_poll=stopped_poll,
+
+            invites_enabled=invites_enabled,
+
+            history_hidden=history_hidden,
+
+            signatures_enabled=signatures_enabled,
+
+            old_slow_mode=old_slow_mode,
+            new_slow_mode=new_slow_mode,
+
+            pinned_message=pinned_message,
+            unpinned_message=unpinned_message,
+
+            old_invite_link=old_invite_link,
+            new_invite_link=new_invite_link,
+            revoked_invite_link=revoked_invite_link,
+            deleted_invite_link=deleted_invite_link
+        )
diff --git a/pyrogram/types/user_and_chats/chat_event_filter.py b/pyrogram/types/user_and_chats/chat_event_filter.py
new file mode 100644
index 0000000000..92298ea3be
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_event_filter.py
@@ -0,0 +1,175 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class ChatEventFilter(Object):
+    """Set of filters used to obtain a chat event log.
+
+    Parameters:
+        new_restrictions (``bool``, *optional*):
+            True, if member restricted/unrestricted/banned/unbanned events should be returned.
+            Defaults to False.
+
+        new_privileges (``bool``, *optional*):
+            True, if member promotion/demotion events should be returned.
+            Defaults to False.
+
+        new_members (``bool``, *optional*):
+            True, if members joining events should be returned.
+            Defaults to False.
+
+        chat_info (``bool``, *optional*):
+            True, if chat info changes should be returned. That is, when description, linked chat, location, photo,
+            sticker set, title or username have been modified.
+            Defaults to False.
+
+        chat_settings (``bool``, *optional*):
+            True, if chat settings changes should be returned. That is, when invites, hidden history, message
+            signatures, default chat permissions have been modified.
+            Defaults to False.
+
+        invite_links (``bool``, *optional*):
+            True, if invite links events (edit, revoke, delete) should be returned.
+            Defaults to False.
+
+        deleted_messages (``bool``, *optional*):
+            True, if deleted messages events should be returned.
+            Defaults to False.
+
+        edited_messages (``bool``, *optional*):
+            True, if edited messages events, including closed polls, should be returned.
+            Defaults to False.
+
+        pinned_messages (``bool``, *optional*):
+            True, if pinned/unpinned messages events should be returned.
+            Defaults to False.
+
+        leaving_members (``bool``, *optional*):
+            True, if members leaving events should be returned.
+            Defaults to False.
+
+        video_chats (``bool``, *optional*):
+            True, if video chats events should be returned.
+            Defaults to False.
+    """
+
+    def __init__(
+        self, *,
+        new_restrictions: bool = False,
+        new_privileges: bool = False,
+        new_members: bool = False,
+        chat_info: bool = False,
+        chat_settings: bool = False,
+        invite_links: bool = False,
+        deleted_messages: bool = False,
+        edited_messages: bool = False,
+        pinned_messages: bool = False,
+        leaving_members: bool = False,
+        video_chats: bool = False
+    ):
+        super().__init__()
+
+        self.new_restrictions = new_restrictions
+        self.new_privileges = new_privileges
+        self.new_members = new_members
+        self.chat_info = chat_info
+        self.chat_settings = chat_settings
+        self.invite_links = invite_links
+        self.deleted_messages = deleted_messages
+        self.edited_messages = edited_messages
+        self.pinned_messages = pinned_messages
+        self.leaving_members = leaving_members
+        self.video_chats = video_chats
+
+    def write(self) -> "raw.base.ChannelAdminLogEventsFilter":
+        join = False
+        leave = False
+        invite = False
+        ban = False
+        unban = False
+        kick = False
+        unkick = False
+        promote = False
+        demote = False
+        info = False
+        settings = False
+        pinned = False
+        edit = False
+        delete = False
+        group_call = False
+        invites = False
+
+        if self.new_restrictions:
+            ban = True
+            unban = True
+            kick = True
+            unkick = True
+
+        if self.new_privileges:
+            promote = True
+            demote = True
+
+        if self.new_members:
+            join = True
+            invite = True
+
+        if self.chat_info:
+            info = True
+
+        if self.chat_settings:
+            settings = True
+
+        if self.invite_links:
+            invites = True
+
+        if self.deleted_messages:
+            delete = True
+
+        if self.edited_messages:
+            edit = True
+
+        if self.pinned_messages:
+            pinned = True
+
+        if self.leaving_members:
+            leave = True
+
+        if self.video_chats:
+            group_call = True
+
+        return raw.types.ChannelAdminLogEventsFilter(
+            join=join,
+            leave=leave,
+            invite=invite,
+            ban=ban,
+            unban=unban,
+            kick=kick,
+            unkick=unkick,
+            promote=promote,
+            demote=demote,
+            info=info,
+            settings=settings,
+            pinned=pinned,
+            edit=edit,
+            delete=delete,
+            group_call=group_call,
+            invites=invites
+        )
diff --git a/pyrogram/types/user_and_chats/chat_invite_link.py b/pyrogram/types/user_and_chats/chat_invite_link.py
new file mode 100644
index 0000000000..59f6315ba5
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_invite_link.py
@@ -0,0 +1,130 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Dict
+from typing import Optional
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from ..object import Object
+
+
+class ChatInviteLink(Object):
+    """An invite link for a chat.
+
+    Parameters:
+        invite_link (``str``):
+            The invite link. If the link was created by another chat administrator, then the second part of the
+            link will be replaced with "...".
+
+        date (:py:obj:`~datetime.datetime`):
+            The date when the link was created.
+
+        is_primary (``bool``):
+            True, if the link is primary.
+
+        is_revoked (``bool``):
+            True, if the link is revoked.
+
+        creator (:obj:`~pyrogram.types.User`, *optional*):
+            Creator of the link.
+
+        name (``str``, *optional*):
+            Invite link name
+
+        creates_join_request (``bool``, *optional*):
+            True, if users joining the chat via the link need to be approved by chat administrators.
+
+        start_date (:py:obj:`~datetime.datetime`, *optional*):
+            Point in time when the link has been edited.
+
+        expire_date (:py:obj:`~datetime.datetime`, *optional*):
+            Point in time when the link will expire or has been expired.
+
+        member_limit (``int``, *optional*):
+            Maximum number of users that can be members of the chat simultaneously after joining the chat via this
+            invite link; 1-99999.
+
+        member_count (``int``, *optional*):
+            Number of users that joined via this link and are currently member of the chat.
+
+        pending_join_request_count (``int``, *optional*):
+            Number of pending join requests created using this link
+    """
+
+    def __init__(
+        self, *,
+        invite_link: str,
+        date: datetime,
+        is_primary: bool = None,
+        is_revoked: bool = None,
+        creator: "types.User" = None,
+        name: str = None,
+        creates_join_request: bool = None,
+        start_date: datetime = None,
+        expire_date: datetime = None,
+        member_limit: int = None,
+        member_count: int = None,
+        pending_join_request_count: int = None
+    ):
+        super().__init__()
+
+        self.invite_link = invite_link
+        self.date = date
+        self.is_primary = is_primary
+        self.is_revoked = is_revoked
+        self.creator = creator
+        self.name = name
+        self.creates_join_request = creates_join_request
+        self.start_date = start_date
+        self.expire_date = expire_date
+        self.member_limit = member_limit
+        self.member_count = member_count
+        self.pending_join_request_count = pending_join_request_count
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        invite: "raw.base.ExportedChatInvite",
+        users: Dict[int, "raw.types.User"] = None
+    ) -> Optional["ChatInviteLink"]:
+        if not isinstance(invite, raw.types.ChatInviteExported):
+            return None
+
+        creator = (
+            types.User._parse(client, users[invite.admin_id])
+            if users is not None
+            else None
+        )
+
+        return ChatInviteLink(
+            invite_link=invite.link,
+            date=utils.timestamp_to_datetime(invite.date),
+            is_primary=invite.permanent,
+            is_revoked=invite.revoked,
+            creator=creator,
+            name=invite.title,
+            creates_join_request=invite.request_needed,
+            start_date=utils.timestamp_to_datetime(invite.start_date),
+            expire_date=utils.timestamp_to_datetime(invite.expire_date),
+            member_limit=invite.usage_limit,
+            member_count=invite.usage,
+            pending_join_request_count=invite.requested
+        )
diff --git a/pyrogram/types/user_and_chats/chat_join_request.py b/pyrogram/types/user_and_chats/chat_join_request.py
new file mode 100644
index 0000000000..8db6505918
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_join_request.py
@@ -0,0 +1,146 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Dict
+
+import pyrogram
+from pyrogram import raw, utils
+from pyrogram import types
+from ..object import Object
+from ..update import Update
+
+
+class ChatJoinRequest(Object, Update):
+    """Represents a join request sent to a chat.
+
+    Parameters:
+        chat (:obj:`~pyrogram.types.Chat`):
+            Chat to which the request was sent.
+
+        from_user (:obj:`~pyrogram.types.User`):
+            User that sent the join request.
+
+        user_chat_id (``int``):
+            Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.
+
+        date (:py:obj:`~datetime.datetime`):
+            Date the request was sent.
+
+        bio (``str``, *optional*):
+            Bio of the user.
+
+        invite_link (:obj:`~pyrogram.types.ChatInviteLink`, *optional*):
+            Chat invite link that was used by the user to send the join request.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        chat: "types.Chat",
+        from_user: "types.User",
+        user_chat_id: int,
+        date: datetime,
+        bio: str = None,
+        invite_link: "types.ChatInviteLink" = None
+    ):
+        super().__init__(client)
+
+        self.chat = chat
+        self.from_user = from_user
+        self.user_chat_id = user_chat_id
+        self.date = date
+        self.bio = bio
+        self.invite_link = invite_link
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        update: "raw.types.UpdateBotChatInviteRequester",
+        users: Dict[int, "raw.types.User"],
+        chats: Dict[int, "raw.types.Chat"]
+    ) -> "ChatJoinRequest":
+        chat_id = utils.get_raw_peer_id(update.peer)
+        return ChatJoinRequest(
+            chat=types.Chat._parse_chat(client, chats[chat_id]),
+            from_user=types.User._parse(client, users[update.user_id]),
+            user_chat_id=update.user_id,  # TODO
+            date=utils.timestamp_to_datetime(update.date),
+            bio=update.about,
+            invite_link=types.ChatInviteLink._parse(client, update.invite, users),
+            client=client
+        )
+
+    async def approve(self) -> bool:
+        """Bound method *approve* of :obj:`~pyrogram.types.ChatJoinRequest`.
+        
+        Use as a shortcut for:
+        
+        .. code-block:: python
+
+            await client.approve_chat_join_request(
+                chat_id=request.chat.id,
+                user_id=request.from_user.id
+            )
+            
+        Example:
+            .. code-block:: python
+
+                await request.approve()
+                
+        Returns:
+            ``bool``: True on success.
+        
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.approve_chat_join_request(
+            chat_id=self.chat.id,
+            user_id=self.from_user.id
+        )
+
+    async def decline(self) -> bool:
+        """Bound method *decline* of :obj:`~pyrogram.types.ChatJoinRequest`.
+        
+        Use as a shortcut for:
+        
+        .. code-block:: python
+
+            await client.decline_chat_join_request(
+                chat_id=request.chat.id,
+                user_id=request.from_user.id
+            )
+            
+        Example:
+            .. code-block:: python
+
+                await request.decline()
+                
+        Returns:
+            ``bool``: True on success.
+        
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+        return await self._client.decline_chat_join_request(
+            chat_id=self.chat.id,
+            user_id=self.from_user.id
+        )
+
+    # TODO
diff --git a/pyrogram/types/user_and_chats/chat_joiner.py b/pyrogram/types/user_and_chats/chat_joiner.py
new file mode 100644
index 0000000000..024f88ea26
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_joiner.py
@@ -0,0 +1,82 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Dict
+
+import pyrogram
+from pyrogram import raw, types, utils
+from ..object import Object
+
+
+class ChatJoiner(Object):
+    """Contains information about a joiner member of a chat.
+
+    Parameters:
+        user (:obj:`~pyrogram.types.User`):
+            Information about the user.
+
+        date (:py:obj:`~datetime.datetime`):
+            Date when the user joined.
+
+        bio (``str``, *optional*):
+            Bio of the user.
+
+        pending (``bool``, *optional*):
+            True in case the chat joiner has a pending request.
+
+        approved_by (:obj:`~pyrogram.types.User`, *optional*):
+            Administrator who approved this chat joiner.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client",
+        user: "types.User",
+        date: datetime = None,
+        bio: str = None,
+        pending: bool = None,
+        approved_by: "types.User" = None,
+    ):
+        super().__init__(client)
+
+        self.user = user
+        self.date = date
+        self.bio = bio
+        self.pending = pending
+        self.approved_by = approved_by
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        joiner: "raw.base.ChatInviteImporter",
+        users: Dict[int, "raw.base.User"],
+    ) -> "ChatJoiner":
+        return ChatJoiner(
+            user=types.User._parse(client, users[joiner.user_id]),
+            date=utils.timestamp_to_datetime(joiner.date),
+            pending=joiner.requested,
+            bio=joiner.about,
+            approved_by=(
+                types.User._parse(client, users[joiner.approved_by])
+                if joiner.approved_by
+                else None
+            ),
+            client=client
+        )
diff --git a/pyrogram/types/user_and_chats/chat_member.py b/pyrogram/types/user_and_chats/chat_member.py
new file mode 100644
index 0000000000..4459a8d1c0
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_member.py
@@ -0,0 +1,227 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Union, Dict
+
+import pyrogram
+from pyrogram import raw, types, utils, enums
+from ..object import Object
+
+
+class ChatMember(Object):
+    """Contains information about one member of a chat.
+
+    Parameters:
+        status (:obj:`~pyrogram.enums.ChatMemberStatus`):
+            The member's status in the chat.
+
+        user (:obj:`~pyrogram.types.User`, *optional*):
+            Information about the user.
+
+        chat (:obj:`~pyrogram.types.Chat`, *optional*):
+            Information about the chat (useful in case of banned channel senders).
+
+        joined_date (:py:obj:`~datetime.datetime`, *optional*):
+            Date when the user joined.
+            Not available for the owner.
+
+        custom_title (``str``, *optional*):
+            A custom title that will be shown to all members instead of "Owner" or "Admin".
+            Creator (owner) and administrators only. Can be None in case there's no custom title set.
+
+        until_date (:py:obj:`~datetime.datetime`, *optional*):
+            Restricted and banned only.
+            Date when restrictions will be lifted for this user.
+
+        invited_by (:obj:`~pyrogram.types.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:`~pyrogram.types.User`, *optional*):
+            Administrators only. Information about the user who promoted this member as administrator.
+
+        restricted_by (:obj:`~pyrogram.types.User`, *optional*):
+            Restricted and banned only. Information about the user who restricted or banned this member.
+
+        is_member (``bool``, *optional*):
+            Restricted only. True, if the user is a member of the chat at the moment of the request.
+
+        can_be_edited (``bool``, *optional*):
+            True, if the you are allowed to edit administrator privileges of the user.
+
+        permissions (:obj:`~pyrogram.types.ChatPermissions`, *optional*):
+            Restricted only. Restricted actions that a non-administrator user is allowed to take.
+
+        privileges (:obj:`~pyrogram.types.ChatPrivileges`, *optional*):
+            Administrators only. Privileged actions that an administrator is able to take.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        status: "enums.ChatMemberStatus",
+        user: "types.User" = None,
+        chat: "types.Chat" = None,
+        custom_title: str = None,
+        until_date: datetime = None,
+        joined_date: datetime = None,
+        invited_by: "types.User" = None,
+        promoted_by: "types.User" = None,
+        restricted_by: "types.User" = None,
+        is_member: bool = None,
+        can_be_edited: bool = None,
+        permissions: "types.ChatPermissions" = None,
+        privileges: "types.ChatPrivileges" = None
+    ):
+        super().__init__(client)
+
+        self.status = status
+        self.user = user
+        self.chat = chat
+        self.custom_title = custom_title
+        self.until_date = until_date
+        self.joined_date = joined_date
+        self.invited_by = invited_by
+        self.promoted_by = promoted_by
+        self.restricted_by = restricted_by
+        self.is_member = is_member
+        self.can_be_edited = can_be_edited
+        self.permissions = permissions
+        self.privileges = privileges
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        member: Union["raw.base.ChatParticipant", "raw.base.ChannelParticipant"],
+        users: Dict[int, "raw.base.User"],
+        chats: Dict[int, "raw.base.Chat"]
+    ) -> "ChatMember":
+        # Chat participants
+        if isinstance(member, raw.types.ChatParticipant):
+            return ChatMember(
+                status=enums.ChatMemberStatus.MEMBER,
+                user=types.User._parse(client, users[member.user_id]),
+                joined_date=utils.timestamp_to_datetime(member.date),
+                invited_by=types.User._parse(client, users[member.inviter_id]),
+                client=client
+            )
+        elif isinstance(member, raw.types.ChatParticipantAdmin):
+            return ChatMember(
+                status=enums.ChatMemberStatus.ADMINISTRATOR,
+                user=types.User._parse(client, users[member.user_id]),
+                joined_date=utils.timestamp_to_datetime(member.date),
+                invited_by=types.User._parse(client, users[member.inviter_id]),
+                client=client
+            )
+        elif isinstance(member, raw.types.ChatParticipantCreator):
+            return ChatMember(
+                status=enums.ChatMemberStatus.OWNER,
+                user=types.User._parse(client, users[member.user_id]),
+                client=client
+            )
+
+        # Channel participants
+        if isinstance(member, raw.types.ChannelParticipant):
+            return ChatMember(
+                status=enums.ChatMemberStatus.MEMBER,
+                user=types.User._parse(client, users[member.user_id]),
+                joined_date=utils.timestamp_to_datetime(member.date),
+                client=client
+            )
+        elif isinstance(member, raw.types.ChannelParticipantAdmin):
+            return ChatMember(
+                status=enums.ChatMemberStatus.ADMINISTRATOR,
+                user=types.User._parse(client, users[member.user_id]),
+                joined_date=utils.timestamp_to_datetime(member.date),
+                promoted_by=types.User._parse(client, users[member.promoted_by]),
+                invited_by=(
+                    types.User._parse(client, users[member.inviter_id])
+                    if member.inviter_id else None
+                ),
+                custom_title=member.rank,
+                can_be_edited=member.can_edit,
+                privileges=types.ChatPrivileges._parse(member.admin_rights),
+                client=client
+            )
+        elif isinstance(member, raw.types.ChannelParticipantBanned):
+            peer = member.peer
+            peer_id = utils.get_raw_peer_id(peer)
+
+            user = (
+                types.User._parse(client, users[peer_id])
+                if isinstance(peer, raw.types.PeerUser) else None
+            )
+
+            chat = (
+                types.Chat._parse_chat(client, chats[peer_id])
+                if not isinstance(peer, raw.types.PeerUser) else None
+            )
+
+            return ChatMember(
+                status=(
+                    enums.ChatMemberStatus.BANNED
+                    if member.banned_rights.view_messages
+                    else enums.ChatMemberStatus.RESTRICTED
+                ),
+                user=user,
+                chat=chat,
+                until_date=utils.timestamp_to_datetime(member.banned_rights.until_date),
+                joined_date=utils.timestamp_to_datetime(member.date),
+                is_member=not member.left,
+                restricted_by=types.User._parse(client, users[member.kicked_by]),
+                permissions=types.ChatPermissions._parse(member.banned_rights),
+                client=client
+            )
+        elif isinstance(member, raw.types.ChannelParticipantCreator):
+            return ChatMember(
+                status=enums.ChatMemberStatus.OWNER,
+                user=types.User._parse(client, users[member.user_id]),
+                custom_title=member.rank,
+                privileges=types.ChatPrivileges._parse(member.admin_rights),
+                client=client
+            )
+        elif isinstance(member, raw.types.ChannelParticipantLeft):
+            peer = member.peer
+            peer_id = utils.get_raw_peer_id(peer)
+
+            user = (
+                types.User._parse(client, users[peer_id])
+                if isinstance(peer, raw.types.PeerUser) else None
+            )
+
+            chat = (
+                types.Chat._parse_chat(client, chats[peer_id])
+                if not isinstance(peer, raw.types.PeerUser) else None
+            )
+
+            return ChatMember(
+                status=enums.ChatMemberStatus.LEFT,
+                user=user,
+                chat=chat,
+                client=client
+            )
+        elif isinstance(member, raw.types.ChannelParticipantSelf):
+            return ChatMember(
+                status=enums.ChatMemberStatus.MEMBER,
+                user=types.User._parse(client, users[member.user_id]),
+                joined_date=utils.timestamp_to_datetime(member.date),
+                invited_by=types.User._parse(client, users[member.inviter_id]),
+                client=client
+            )
diff --git a/pyrogram/types/user_and_chats/chat_member_updated.py b/pyrogram/types/user_and_chats/chat_member_updated.py
new file mode 100644
index 0000000000..adc5f42ad7
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_member_updated.py
@@ -0,0 +1,146 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Dict, Union
+
+import pyrogram
+from pyrogram import enums, raw, types, utils
+from ..object import Object
+from ..update import Update
+
+
+class ChatMemberUpdated(Object, Update):
+    """Represents changes in the status of a chat member.
+
+    Parameters:
+        chat (:obj:`~pyrogram.types.Chat`):
+            Chat the user belongs to.
+
+        from_user (:obj:`~pyrogram.types.User`):
+            Performer of the action, which resulted in the change.
+
+        date (:py:obj:`~datetime.datetime`):
+            Date the change was done.
+
+        old_chat_member (:obj:`~pyrogram.types.ChatMember`, *optional*):
+            Previous information about the chat member.
+
+        new_chat_member (:obj:`~pyrogram.types.ChatMember`, *optional*):
+            New information about the chat member.
+
+        invite_link (:obj:`~pyrogram.types.ChatInviteLink`, *optional*):
+            Chat invite link, which was used by the user to join the chat; for joining by invite link events only.
+        
+        via_join_request (``bool``, *optional*):
+            True, if the user joined the chat after sending a direct join request and being approved by an administrator
+
+        via_chat_folder_invite_link (``bool``, *optional*):
+            True, if the user joined the chat via a chat folder invite link
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        chat: "types.Chat",
+        from_user: "types.User",
+        date: datetime,
+        old_chat_member: "types.ChatMember",
+        new_chat_member: "types.ChatMember",
+        invite_link: "types.ChatInviteLink" = None,
+        via_join_request: bool = None,
+        via_chat_folder_invite_link: bool = None
+    ):
+        super().__init__(client)
+
+        self.chat = chat
+        self.from_user = from_user
+        self.date = date
+        self.old_chat_member = old_chat_member
+        self.new_chat_member = new_chat_member
+        self.invite_link = invite_link
+        self.via_join_request = via_join_request
+        self.via_chat_folder_invite_link = via_chat_folder_invite_link
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        update: Union["raw.types.UpdateChatParticipant", "raw.types.UpdateChannelParticipant", "raw.types.UpdateBotStopped"],
+        users: Dict[int, "raw.types.User"],
+        chats: Dict[int, "raw.types.Chat"]
+    ) -> "ChatMemberUpdated":
+        if isinstance(update, raw.types.UpdateBotStopped):
+            from_user = types.User._parse(client, users[update.user_id])
+            _chat_member_one = types.ChatMember(
+                user=from_user,
+                status=enums.ChatMemberStatus.BANNED,
+                client=client
+            )
+            _chat_member_two = types.ChatMember(
+                user=from_user,
+                status=enums.ChatMemberStatus.MEMBER,
+                client=client
+            )
+            if update.stopped:
+                return ChatMemberUpdated(
+                    chat=types.Chat._parse_chat(client, users[update.user_id]),
+                    from_user=from_user,
+                    date=utils.timestamp_to_datetime(update.date),
+                    old_chat_member=_chat_member_two,
+                    new_chat_member=_chat_member_one,
+                    client=client
+                )
+            return ChatMemberUpdated(
+                chat=types.Chat._parse_chat(client, users[update.user_id]),
+                from_user=from_user,
+                date=utils.timestamp_to_datetime(update.date),
+                old_chat_member=_chat_member_one,
+                new_chat_member=_chat_member_two,
+                client=client
+            )
+
+        chat_id = getattr(update, "chat_id", None) or getattr(update, "channel_id")
+
+        old_chat_member = None
+        new_chat_member = None
+        invite_link = None
+        via_join_request = None
+
+        if update.prev_participant:
+            old_chat_member = types.ChatMember._parse(client, update.prev_participant, users, chats)
+
+        if update.new_participant:
+            new_chat_member = types.ChatMember._parse(client, update.new_participant, users, chats)
+
+        if update.invite:
+            invite_link = types.ChatInviteLink._parse(client, update.invite, users)
+            if isinstance(update.invite, raw.types.ChatInvitePublicJoinRequests):
+                via_join_request = True
+
+        return ChatMemberUpdated(
+            chat=types.Chat._parse_chat(client, chats[chat_id]),
+            from_user=types.User._parse(client, users[update.actor_id]),
+            date=utils.timestamp_to_datetime(update.date),
+            old_chat_member=old_chat_member,
+            new_chat_member=new_chat_member,
+            invite_link=invite_link,
+            client=client,
+            via_join_request=via_join_request,
+            via_chat_folder_invite_link=getattr(update, "via_chatlist", False)
+        )
diff --git a/pyrogram/types/user_and_chats/chat_permissions.py b/pyrogram/types/user_and_chats/chat_permissions.py
new file mode 100644
index 0000000000..07b655caf9
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_permissions.py
@@ -0,0 +1,221 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from pyrogram import raw, utils
+from ..object import Object
+
+
+class ChatPermissions(Object):
+    """Describes actions that a non-administrator user is allowed to take in a chat.
+
+    Parameters:
+        can_send_messages (``bool``, *optional*):
+            True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues
+
+        can_send_audios (``bool``, *optional*):
+            True, if the user is allowed to send audios
+
+        can_send_documents (``bool``, *optional*):
+            True, if the user is allowed to send documents
+
+        can_send_photos (``bool``, *optional*):
+            True, if the user is allowed to send photos
+
+        can_send_videos (``bool``, *optional*):
+            True, if the user is allowed to send videos
+
+        can_send_video_notes (``bool``, *optional*):
+            True, if the user is allowed to send video notes
+
+        can_send_voice_notes (``bool``, *optional*):
+            True, if the user is allowed to send voice notes
+
+        can_send_polls (``bool``, *optional*):
+            True, if the user is allowed to send polls
+
+        can_send_other_messages (``bool``, *optional*):
+            True, if the user is allowed to send animations, games, stickers and use inline bots
+
+        can_add_web_page_previews (``bool``, *optional*):
+            True, if the user is allowed to add web page previews to their messages
+
+        can_change_info (``bool``, *optional*):
+            True, if the user is allowed to change the chat title, photo and other settings
+            Ignored in public supergroups
+
+        can_invite_users (``bool``, *optional*):
+            True, if the user is allowed to invite new users to the chat
+
+        can_pin_messages (``bool``, *optional*):
+            True, if the user is allowed to pin messages
+            Ignored in public supergroups
+
+        can_manage_topics (``bool``, *optional*):
+            True, if the user is allowed to create forum topics
+            If omitted defaults to the value of can_pin_messages
+
+        can_send_media_messages (``bool``, *optional*):
+            True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes.
+            Implies *can_send_messages*.
+    """
+
+    def __init__(
+        self,
+        *,
+        can_send_messages: bool = None,  # Text, contacts, giveaways, giveaway winners, invoices, locations and venues
+        can_send_audios: bool = None,
+        can_send_documents: bool = None,
+        can_send_photos: bool = None,
+        can_send_videos: bool = None,
+        can_send_video_notes: bool = None,
+        can_send_voice_notes: bool = None,
+        can_send_polls: bool = None,
+        can_send_other_messages: bool = None,  # animations, games, stickers, inline bots
+        can_add_web_page_previews: bool = None,
+        can_change_info: bool = None,
+        can_invite_users: bool = None,
+        can_pin_messages: bool = None,
+        can_manage_topics: bool = None,
+        can_send_media_messages: bool = None,  # Audio files, documents, photos, videos, video notes and voice notes
+    ):
+        super().__init__(None)
+
+        self.can_send_messages = can_send_messages
+        self.can_send_audios = can_send_audios
+        self.can_send_documents = can_send_documents
+        self.can_send_photos = can_send_photos
+        self.can_send_videos = can_send_videos
+        self.can_send_video_notes = can_send_video_notes
+        self.can_send_voice_notes = can_send_voice_notes
+        self.can_send_polls = can_send_polls
+        self.can_send_other_messages = can_send_other_messages
+        self.can_add_web_page_previews = can_add_web_page_previews
+        self.can_change_info = can_change_info
+        self.can_invite_users = can_invite_users
+        self.can_pin_messages = can_pin_messages
+        self.can_manage_topics = can_manage_topics
+        self.can_send_media_messages = can_send_media_messages
+
+    @staticmethod
+    def _parse(denied_permissions: "raw.base.ChatBannedRights") -> "ChatPermissions":
+        can_send_messages = False
+        can_send_audios = False
+        can_send_documents = False
+        can_send_photos = False
+        can_send_videos = False
+        can_send_video_notes = False
+        can_send_voice_notes = False
+        can_send_polls = False
+        can_send_other_messages = False
+        can_add_web_page_previews = False
+        can_change_info = False
+        can_invite_users = False
+        can_pin_messages = False
+        can_manage_topics = False
+        can_send_media_messages = False
+
+        if isinstance(denied_permissions, raw.types.ChatBannedRights):
+            can_send_messages = not denied_permissions.send_messages
+            can_send_polls = not denied_permissions.send_polls
+            can_send_other_messages = any([
+                not denied_permissions.send_gifs,
+                not denied_permissions.send_games,
+                not denied_permissions.send_stickers,
+                not denied_permissions.send_inline
+            ])
+            can_add_web_page_previews = not denied_permissions.embed_links
+            can_change_info = not denied_permissions.change_info
+            can_invite_users = not denied_permissions.invite_users
+            can_pin_messages = not denied_permissions.pin_messages
+            if denied_permissions.manage_topics is not None:
+                can_manage_topics = not denied_permissions.manage_topics
+            else:
+                can_manage_topics = can_pin_messages
+            if (
+                denied_permissions.send_audios is not None or
+                denied_permissions.send_docs is not None or
+                denied_permissions.send_photos is not None or
+                denied_permissions.send_videos is not None or
+                denied_permissions.send_roundvideos is not None or
+                denied_permissions.send_voices is not None
+            ):
+                can_send_audios = not denied_permissions.send_audios
+                can_send_documents = not denied_permissions.send_docs
+                can_send_photos = not denied_permissions.send_photos
+                can_send_videos = not denied_permissions.send_videos
+                can_send_video_notes = not denied_permissions.send_roundvideos
+                can_send_voice_notes = not denied_permissions.send_voices
+            else:
+                can_send_media_messages = not denied_permissions.send_media
+                can_send_audios = can_send_media_messages
+                can_send_documents = can_send_media_messages
+                can_send_photos = can_send_media_messages
+                can_send_videos = can_send_media_messages
+                can_send_video_notes = can_send_media_messages
+                can_send_voice_notes = can_send_media_messages
+
+            return ChatPermissions(
+                can_send_messages=can_send_messages,
+                can_send_audios=can_send_audios,
+                can_send_documents=can_send_documents,
+                can_send_photos=can_send_photos,
+                can_send_videos=can_send_videos,
+                can_send_video_notes=can_send_video_notes,
+                can_send_voice_notes=can_send_voice_notes,
+                can_send_polls=can_send_polls,
+                can_send_other_messages=can_send_other_messages,
+                can_add_web_page_previews=can_add_web_page_previews,
+                can_change_info=can_change_info,
+                can_invite_users=can_invite_users,
+                can_pin_messages=can_pin_messages,
+                can_manage_topics=can_manage_topics,
+                can_send_media_messages=can_send_media_messages
+            )
+
+    def write(
+        permissions: "ChatPermissions",
+        use_independent_chat_permissions: bool,
+        until_date: datetime = utils.zero_datetime()
+    ) -> "raw.base.ChatBannedRights":
+        return raw.types.ChatBannedRights(
+            until_date=utils.datetime_to_timestamp(until_date),
+            send_messages=not permissions.can_send_messages,
+            send_media=not permissions.can_send_media_messages,
+            send_stickers=not permissions.can_send_other_messages,
+            send_gifs=not permissions.can_send_other_messages,
+            send_games=not permissions.can_send_other_messages,
+            send_inline=not permissions.can_send_other_messages,
+            embed_links=not permissions.can_add_web_page_previews,
+            send_polls=not permissions.can_send_polls,
+            change_info=not permissions.can_change_info,
+            invite_users=not permissions.can_invite_users,
+            pin_messages=not permissions.can_pin_messages,
+            manage_topics=(
+                permissions.can_manage_topics and
+                not permissions.can_manage_topics
+            ) or not permissions.can_pin_messages,
+            # view_messages=# TODO
+            send_audios=not permissions.can_send_audios,# TODO
+            send_docs=not permissions.can_send_documents,# TODO
+            send_photos=not permissions.can_send_photos,# TODO
+            send_videos=not permissions.can_send_videos,# TODO
+            send_roundvideos=not permissions.can_send_video_notes,# TODO
+            send_voices=not permissions.can_send_voice_notes,# TODO
+            # send_plain=# TODO
+        )
diff --git a/pyrogram/types/user_and_chats/chat_photo.py b/pyrogram/types/user_and_chats/chat_photo.py
new file mode 100644
index 0000000000..7d805fc694
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_photo.py
@@ -0,0 +1,128 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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
+
+import pyrogram
+from pyrogram import raw, types
+from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
+from ..object import Object
+
+
+class ChatPhoto(Object):
+    """A chat photo.
+
+    Parameters:
+        small_file_id (``str``):
+            File identifier of small (160x160) chat photo.
+            This file_id can be used only for photo download and only for as long as the photo is not changed.
+
+        small_photo_unique_id (``str``):
+            Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for
+            different accounts. Can't be used to download or reuse the file.
+
+        big_file_id (``str``):
+            File identifier of big (640x640) chat photo.
+            This file_id can be used only for photo download and only for as long as the photo is not changed.
+
+        big_photo_unique_id (``str``):
+            Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for
+            different accounts. Can't be used to download or reuse the file.
+
+        has_animation (``bool``):
+            True, if the photo has animated variant
+        
+        is_personal (``bool``):
+            True, if the photo is visible only for the current user
+
+        minithumbnail (:obj:`~pyrogram.types.StrippedThumbnail`, *optional*):
+            User profile photo minithumbnail; may be None.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        small_file_id: str,
+        small_photo_unique_id: str,
+        big_file_id: str,
+        big_photo_unique_id: str,
+        has_animation: bool,
+        is_personal: bool,
+        minithumbnail: "types.StrippedThumbnail" = None
+    ):
+        super().__init__(client)
+
+        self.small_file_id = small_file_id
+        self.small_photo_unique_id = small_photo_unique_id
+        self.big_file_id = big_file_id
+        self.big_photo_unique_id = big_photo_unique_id
+        self.has_animation = has_animation
+        self.is_personal = is_personal
+        self.minithumbnail = minithumbnail
+
+    @staticmethod
+    def _parse(
+        client,
+        chat_photo: Union["raw.types.UserProfilePhoto", "raw.types.ChatPhoto"],
+        peer_id: int,
+        peer_access_hash: int
+    ):
+        if not isinstance(chat_photo, (raw.types.UserProfilePhoto, raw.types.ChatPhoto)):
+            return None
+
+        return ChatPhoto(
+            small_file_id=FileId(
+                file_type=FileType.CHAT_PHOTO,
+                dc_id=chat_photo.dc_id,
+                media_id=chat_photo.photo_id,
+                access_hash=0,
+                volume_id=0,
+                thumbnail_source=ThumbnailSource.CHAT_PHOTO_SMALL,
+                local_id=0,
+                chat_id=peer_id,
+                chat_access_hash=peer_access_hash
+            ).encode(),
+            small_photo_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT,
+                media_id=chat_photo.photo_id
+            ).encode(),
+            big_file_id=FileId(
+                file_type=FileType.CHAT_PHOTO,
+                dc_id=chat_photo.dc_id,
+                media_id=chat_photo.photo_id,
+                access_hash=0,
+                volume_id=0,
+                thumbnail_source=ThumbnailSource.CHAT_PHOTO_BIG,
+                local_id=0,
+                chat_id=peer_id,
+                chat_access_hash=peer_access_hash
+            ).encode(),
+            big_photo_unique_id=FileUniqueId(
+                file_unique_type=FileUniqueType.DOCUMENT,
+                media_id=chat_photo.photo_id
+            ).encode(),
+            has_animation=chat_photo.has_video,
+            is_personal=getattr(chat_photo, "personal", False),
+            minithumbnail=types.StrippedThumbnail(
+                client=client,
+                data=chat_photo.stripped_thumb
+            ) if chat_photo.stripped_thumb else None,
+            client=client
+        )
diff --git a/pyrogram/types/user_and_chats/chat_privileges.py b/pyrogram/types/user_and_chats/chat_privileges.py
new file mode 100644
index 0000000000..9c4e6f4b93
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_privileges.py
@@ -0,0 +1,156 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class ChatPrivileges(Object):
+    """Describes privileged actions an administrator is able to take in a chat.
+
+    Parameters:
+        is_anonymous (``bool``, *optional*):
+            True, if the user's presence in the chat is hidden.
+
+        can_manage_chat (``bool``, *optional*):
+            True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode.
+            Implied by any other administrator privilege.
+
+        can_delete_messages (``bool``, *optional*):
+            True, if the administrator can delete messages of other users.
+
+        can_manage_video_chats (``bool``, *optional*):
+            True, if the administrator can manage video chats
+
+        can_restrict_members (``bool``, *optional*):
+            True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics
+
+        can_promote_members (``bool``, *optional*):
+            True, if the administrator can add new administrators with a subset of his own privileges or demote
+            administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed
+            by the user).
+
+        can_change_info (``bool``, *optional*):
+            True, if the user is allowed to change the chat title, photo and other settings.
+
+        can_invite_users (``bool``, *optional*):
+            True, if the user is allowed to invite new users to the chat.
+
+        can_post_messages (``bool``, *optional*):
+            True, if the administrator can post messages in the channel, or access channel statistics.
+            channels only
+
+        can_edit_messages (``bool``, *optional*):
+            True, if the administrator can edit messages of other users and can pin messages.
+            channels only
+
+        can_pin_messages (``bool``, *optional*):
+            True, if the user is allowed to pin messages.
+            groups and supergroups only
+        
+        can_post_stories (``bool``, *optional*):
+            True, if the administrator can post stories to the chat.
+
+        can_edit_stories (``bool``, *optional*):
+            True, if the administrator can edit stories posted by other users.
+
+        can_delete_stories (``bool``, *optional*):
+            True, if the administrator can delete stories posted by other users
+
+        can_manage_topics (``bool``, *optional*):
+            True, if the user is allowed to create, rename, close, and reopen forum topics.
+            supergroups only
+    """
+
+    def __init__(
+        self,
+        *,
+        is_anonymous: bool = False,
+        can_manage_chat: bool = True,
+        can_delete_messages: bool = False,
+        can_manage_video_chats: bool = False,  # Groups and supergroups only
+        can_restrict_members: bool = False,
+        can_promote_members: bool = False,
+        can_change_info: bool = False,
+        can_invite_users: bool = False,
+        can_post_messages: bool = False,  # Channels only
+        can_edit_messages: bool = False,  # Channels only
+        can_pin_messages: bool = False,  # Groups and supergroups only
+        can_post_stories: bool = False,
+        can_edit_stories: bool = False,
+        can_delete_stories: bool = False,
+        can_manage_topics: bool = False,  # supergroups only
+    ):
+        super().__init__(None)
+
+        self.is_anonymous: bool = is_anonymous
+        self.can_manage_chat: bool = can_manage_chat
+        self.can_delete_messages: bool = can_delete_messages
+        self.can_manage_video_chats: bool = can_manage_video_chats
+        self.can_restrict_members: bool = can_restrict_members
+        self.can_promote_members: bool = can_promote_members
+        self.can_change_info: bool = can_change_info
+        self.can_invite_users: bool = can_invite_users
+        self.can_post_messages: bool = can_post_messages
+        self.can_edit_messages: bool = can_edit_messages
+        self.can_pin_messages: bool = can_pin_messages
+        self.can_post_stories: bool = can_post_stories
+        self.can_edit_stories: bool = can_edit_stories
+        self.can_delete_stories: bool = can_delete_stories
+        self.can_manage_topics: bool = can_manage_topics
+
+    @staticmethod
+    def _parse(admin_rights: "raw.base.ChatAdminRights") -> "ChatPrivileges":
+        if not admin_rights:
+            return None
+        return ChatPrivileges(
+            can_change_info=admin_rights.change_info,
+            can_post_messages=admin_rights.post_messages,
+            can_edit_messages=admin_rights.edit_messages,
+            can_delete_messages=admin_rights.delete_messages,
+            can_restrict_members=admin_rights.ban_users,
+            can_invite_users=admin_rights.invite_users,
+            can_pin_messages=admin_rights.pin_messages,
+            can_promote_members=admin_rights.add_admins,
+            is_anonymous=admin_rights.anonymous,
+            can_manage_video_chats=admin_rights.manage_call,
+            can_manage_chat=admin_rights.other,
+            can_manage_topics=admin_rights.manage_topics,
+            can_post_stories=admin_rights.post_stories,
+            can_edit_stories=admin_rights.edit_stories,
+            can_delete_stories=admin_rights.delete_stories
+        )
+
+    def write(self):
+        return raw.types.ChatAdminRights(
+            change_info=self.can_change_info,
+            post_messages=self.can_post_messages,
+            edit_messages=self.can_edit_messages,
+            delete_messages=self.can_delete_messages,
+            ban_users=self.can_restrict_members,
+            invite_users=self.can_invite_users,
+            pin_messages=self.can_pin_messages,
+            add_admins=self.can_promote_members,
+            anonymous=self.is_anonymous,
+            manage_call=self.can_manage_video_chats,
+            other=self.can_manage_chat,
+            manage_topics=self.can_manage_topics,
+            post_stories=self.can_post_stories,
+            edit_stories=self.can_edit_stories,
+            delete_stories=self.can_delete_stories
+        ) if self else raw.types.ChatAdminRights()
diff --git a/pyrogram/types/user_and_chats/chat_reactions.py b/pyrogram/types/user_and_chats/chat_reactions.py
new file mode 100644
index 0000000000..189ab45b1b
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_reactions.py
@@ -0,0 +1,81 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Optional, List
+
+import pyrogram
+from pyrogram import raw, types
+from ..object import Object
+
+
+class ChatReactions(Object):
+    """A chat reactions
+
+    Parameters:
+        all_are_enabled (``bool``, *optional*)
+
+        allow_custom_emoji (``bool``, *optional*):
+            Whether custom emoji are allowed or not.
+
+        reactions (List of :obj:`~pyrogram.types.Reaction`, *optional*):
+            Reactions available.
+        
+        max_reaction_count (``int``, *optional*):
+            Limit of the number of different unique reactions that can be added to a message, including already published ones. Can have values between 1 and 11. Defaults to 11, if not specified. Only applicable for :obj:`~pyrogram.enums.ChatType.CHANNEL`.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        all_are_enabled: Optional[bool] = None,
+        allow_custom_emoji: Optional[bool] = None,
+        reactions: Optional[List["types.Reaction"]] = None,
+        max_reaction_count: int = 11,
+    ):
+        super().__init__(client)
+
+        self.all_are_enabled = all_are_enabled
+        self.allow_custom_emoji = allow_custom_emoji
+        self.reactions = reactions
+        self.max_reaction_count = max_reaction_count
+
+    @staticmethod
+    def _parse(client, chat_reactions: "raw.base.ChatReactions", reactions_limit: int = 11) -> Optional["ChatReactions"]:
+        if isinstance(chat_reactions, raw.types.ChatReactionsAll):
+            return ChatReactions(
+                client=client,
+                all_are_enabled=True,
+                allow_custom_emoji=chat_reactions.allow_custom,
+                max_reaction_count=reactions_limit
+            )
+
+        if isinstance(chat_reactions, raw.types.ChatReactionsSome):
+            return ChatReactions(
+                client=client,
+                reactions=[
+                    types.ReactionType._parse(client, reaction)
+                    for reaction in chat_reactions.reactions
+                ],
+                max_reaction_count=reactions_limit
+            )
+
+        if isinstance(chat_reactions, raw.types.ChatReactionsNone):
+            return None
+
+        return None
diff --git a/pyrogram/types/user_and_chats/chat_shared.py b/pyrogram/types/user_and_chats/chat_shared.py
new file mode 100644
index 0000000000..7762048dbb
--- /dev/null
+++ b/pyrogram/types/user_and_chats/chat_shared.py
@@ -0,0 +1,47 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import types
+from ..object import Object
+
+
+class ChatShared(Object):
+    """This object contains information about a chat that was shared with the bot using a :obj:`~pyrogram.types.KeyboardButtonRequestChat` button.
+
+    Parameters:
+        request_id (``int``):
+            Identifier of the request.
+
+        chats (List of :obj:`~pyrogram.types.Chat`):
+            Information about chat shared with the bot.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        request_id: int,
+        chats: List["types.Chat"]
+    ):
+        super().__init__()
+
+        self.request_id = request_id
+        self.chats = chats
diff --git a/pyrogram/types/user_and_chats/dialog.py b/pyrogram/types/user_and_chats/dialog.py
new file mode 100644
index 0000000000..b942d631f7
--- /dev/null
+++ b/pyrogram/types/user_and_chats/dialog.py
@@ -0,0 +1,82 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from pyrogram import types
+from ..object import Object
+from ... import utils
+
+
+class Dialog(Object):
+    """A user's dialog.
+
+    Parameters:
+        chat (:obj:`~pyrogram.types.Chat`):
+            Conversation the dialog belongs to.
+
+        top_message (:obj:`~pyrogram.types.Message`):
+            The last message sent in the dialog at this time.
+
+        unread_messages_count (``int``):
+            Amount of unread messages in this dialog.
+
+        unread_mentions_count (``int``):
+            Amount of unread messages containing a mention in this dialog.
+
+        unread_mark (``bool``):
+            True, if the dialog has the unread mark set.
+
+        is_pinned (``bool``):
+            True, if the dialog is pinned.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        chat: "types.Chat",
+        top_message: "types.Message",
+        unread_messages_count: int,
+        unread_mentions_count: int,
+        unread_mark: bool,
+        is_pinned: bool,
+        _raw: "raw.types.Dialog" = None
+    ):
+        super().__init__(client)
+
+        self.chat = chat
+        self.top_message = top_message
+        self.unread_messages_count = unread_messages_count
+        self.unread_mentions_count = unread_mentions_count
+        self.unread_mark = unread_mark
+        self.is_pinned = is_pinned
+        self._raw = _raw
+
+    @staticmethod
+    def _parse(client, dialog: "raw.types.Dialog", messages, users, chats) -> "Dialog":
+        return Dialog(
+            chat=types.Chat._parse_dialog(client, dialog.peer, users, chats),
+            top_message=messages.get(utils.get_peer_id(dialog.peer)),
+            unread_messages_count=dialog.unread_count,
+            unread_mentions_count=dialog.unread_mentions_count,
+            unread_mark=dialog.unread_mark,
+            is_pinned=dialog.pinned,
+            client=client,
+            _raw=dialog
+        )
diff --git a/pyrogram/types/user_and_chats/emoji_status.py b/pyrogram/types/user_and_chats/emoji_status.py
new file mode 100644
index 0000000000..50b46bfa46
--- /dev/null
+++ b/pyrogram/types/user_and_chats/emoji_status.py
@@ -0,0 +1,77 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Optional
+
+import pyrogram
+from pyrogram import raw
+from pyrogram import utils
+from ..object import Object
+
+
+class EmojiStatus(Object):
+    """A user emoji status.
+
+    Parameters:
+        custom_emoji_id (``int``):
+            Custom emoji id.
+
+        until_date (:py:obj:`~datetime.datetime`, *optional*):
+            Valid until date.
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        custom_emoji_id: int,
+        until_date: Optional[datetime] = None
+    ):
+        super().__init__(client)
+
+        self.custom_emoji_id = custom_emoji_id
+        self.until_date = until_date
+
+    @staticmethod
+    def _parse(client, emoji_status: "raw.base.EmojiStatus") -> Optional["EmojiStatus"]:
+        if isinstance(emoji_status, raw.types.EmojiStatus):
+            return EmojiStatus(
+                client=client,
+                custom_emoji_id=emoji_status.document_id
+            )
+
+        if isinstance(emoji_status, raw.types.EmojiStatusUntil):
+            return EmojiStatus(
+                client=client,
+                custom_emoji_id=emoji_status.document_id,
+                until_date=utils.timestamp_to_datetime(emoji_status.until)
+            )
+
+        return None
+
+    def write(self):
+        if self.until_date:
+            return raw.types.EmojiStatusUntil(
+                document_id=self.custom_emoji_id,
+                until=utils.datetime_to_timestamp(self.until_date)
+            )
+
+        return raw.types.EmojiStatus(
+            document_id=self.custom_emoji_id
+        )
diff --git a/pyrogram/types/user_and_chats/group_call_participant.py b/pyrogram/types/user_and_chats/group_call_participant.py
new file mode 100644
index 0000000000..e43786cbe8
--- /dev/null
+++ b/pyrogram/types/user_and_chats/group_call_participant.py
@@ -0,0 +1,153 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+from typing import Dict
+
+import pyrogram
+from pyrogram import raw, types, utils
+from ..object import Object
+
+
+class GroupCallParticipant(Object):
+    """Represents a group call participant
+
+    Parameters:
+        participant (:obj:`~pyrogram.types.Chat`, *optional*):
+            Identifier of the group call participant
+
+        date (:py:obj:`~datetime.datetime`, *optional*):
+            Date when this participant join this group call.
+
+        active_date (:py:obj:`~datetime.datetime`, *optional*):
+            Date when this participant last active in this group call.
+        
+        volume_level (``int``, *optional*):
+            Participant's volume level, if not set the volume is set to 100%.
+
+        can_unmute_self (``bool``, *optional*):
+            True, if the participant is muted for all users, but can unmute themselves
+
+        is_muted_for_all_users (``bool``, *optional*):
+            True, if the participant is muted for all users
+
+        is_current_user (``bool``, *optional*):
+            True, if the participant is the current user
+
+        is_left (``bool``, *optional*):
+            Whether the participant has left.
+
+        is_just_joined (``bool``, *optional*):
+            Whether the participant has just joined.
+
+        is_muted_by_you (``bool``, *optional*):
+            Whether this participant was muted by the current user.
+
+        is_volume_by_admin (``bool``, *optional*):
+            Whether our volume can only changed by an admin.
+
+        is_video_joined (``bool``, *optional*):
+            Whether this participant is currently broadcasting video.
+
+        is_hand_raised (``bool``, *optional*):
+            True, if the participant hand is raised
+
+        is_video_enabled (``bool``, *optional*):
+            Whether this participant is currently broadcasting video.
+
+        is_screen_sharing_enabled (``bool``, *optional*):
+            Whether this participant is currently shared screen.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        participant: "types.Chat" = None,
+        date: datetime = None,
+        active_date: datetime = None,
+        volume_level: int = None,
+        can_unmute_self: bool = None,
+        is_muted_for_all_users: bool = None,
+        is_current_user: bool = None,
+        is_left: bool = None,
+        is_just_joined: bool = None,
+        is_muted_by_you: bool = None,
+        is_volume_by_admin: bool = None,
+        is_video_joined: bool = None,
+        is_hand_raised: bool = None,
+        is_video_enabled: bool = None,
+        is_screen_sharing_enabled: bool = None,
+        _raw: "raw.types.GroupCallParticipant" = None
+    ):
+        super().__init__(client)
+
+        self.participant = participant
+        self.date = date
+        self.active_date = active_date
+        self.volume_level = volume_level
+        self.can_unmute_self = can_unmute_self
+        self.is_muted_for_all_users = is_muted_for_all_users
+        self.is_current_user = is_current_user
+        self.is_left = is_left
+        self.is_just_joined = is_just_joined
+        self.is_muted_by_you = is_muted_by_you
+        self.is_volume_by_admin = is_volume_by_admin
+        self.is_video_joined = is_video_joined
+        self.is_hand_raised = is_hand_raised
+        self.is_video_enabled = is_video_enabled
+        self.is_screen_sharing_enabled = is_screen_sharing_enabled
+        self._raw = _raw
+
+    @staticmethod
+    def _parse(
+        client: "pyrogram.Client",
+        participant: "raw.types.GroupCallParticipant",
+        users: Dict[int, "raw.base.User"],
+        chats: Dict[int, "raw.base.Chat"]
+    ) -> "GroupCallParticipant":
+        peer = participant.peer
+        peer_id = utils.get_raw_peer_id(peer)
+
+        parsed_chat = types.Chat._parse_chat(
+            client,
+            users[peer_id] if isinstance(peer, raw.types.PeerUser) else chats[peer_id],
+        )
+
+        parsed_chat.bio = getattr(participant, "about", None)
+
+        return GroupCallParticipant(
+            participant=parsed_chat,
+            date=utils.timestamp_to_datetime(participant.date),
+            active_date=utils.timestamp_to_datetime(participant.active_date),
+            volume_level=getattr(participant, "volume", None),
+            can_unmute_self=participant.can_self_unmute,
+            is_muted_for_all_users=participant.muted,
+            is_current_user=participant.is_self,
+            is_left=participant.left,
+            is_just_joined=participant.just_joined,
+            is_muted_by_you=participant.muted_by_you,
+            is_volume_by_admin=participant.volume_by_admin,
+            is_video_joined=participant.video_joined,
+            is_hand_raised=bool(getattr(participant, "raise_hand_rating", None)),
+            is_video_enabled=bool(getattr(participant, "video", None)),
+            is_screen_sharing_enabled=bool(getattr(participant, "presentation", None)),
+            _raw=participant,
+            client=client
+        )
diff --git a/pyrogram/types/user_and_chats/invite_link_importer.py b/pyrogram/types/user_and_chats/invite_link_importer.py
new file mode 100644
index 0000000000..34e5f397f4
--- /dev/null
+++ b/pyrogram/types/user_and_chats/invite_link_importer.py
@@ -0,0 +1,61 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from pyrogram import raw, utils
+from pyrogram import types
+from ..object import Object
+
+
+class InviteLinkImporter(Object):
+    """The date and user of when someone has joined with an invite link.
+
+    Parameters:
+        date (:py:obj:`~datetime.datetime`):
+            The time of when this user used the given link
+
+        user (:obj:`~pyrogram.types.User`):
+            The user that has used the given invite link
+    """
+
+    def __init__(
+        self, *,
+        date: datetime,
+        user: "types.User"
+    ):
+        super().__init__(None)
+
+        self.date = date
+        self.user = user
+
+    @staticmethod
+    def _parse(client, invite_importers: "raw.types.messages.ChatInviteImporters"):
+        importers = types.List()
+
+        d = {i.id: i for i in invite_importers.users}
+
+        for j in invite_importers.importers:
+            importers.append(
+                InviteLinkImporter(
+                    date=utils.timestamp_to_datetime(j.date),
+                    user=types.User._parse(client=None, user=d[j.user_id])
+                )
+            )
+
+        return importers
diff --git a/pyrogram/types/user_and_chats/restriction.py b/pyrogram/types/user_and_chats/restriction.py
new file mode 100644
index 0000000000..8f7a1b7269
--- /dev/null
+++ b/pyrogram/types/user_and_chats/restriction.py
@@ -0,0 +1,50 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class Restriction(Object):
+    """A restriction applied to bots or chats.
+
+    Parameters:
+        platform (``str``):
+            The platform the restriction is applied to, e.g. "ios", "android"
+
+        reason (``str``):
+            The restriction reason, e.g. "porn", "copyright".
+
+        text (``str``):
+            The restriction text.
+    """
+
+    def __init__(self, *, platform: str, reason: str, text: str):
+        super().__init__(None)
+
+        self.platform = platform
+        self.reason = reason
+        self.text = text
+
+    @staticmethod
+    def _parse(restriction: "raw.types.RestrictionReason") -> "Restriction":
+        return Restriction(
+            platform=restriction.platform,
+            reason=restriction.reason,
+            text=restriction.text
+        )
diff --git a/pyrogram/types/user_and_chats/rtmp_url.py b/pyrogram/types/user_and_chats/rtmp_url.py
new file mode 100644
index 0000000000..a8ca06b4e5
--- /dev/null
+++ b/pyrogram/types/user_and_chats/rtmp_url.py
@@ -0,0 +1,46 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class RtmpUrl(Object):
+    """Represents an RTMP URL and stream key to be used in streaming software.
+
+    Parameters:
+        url (``str``):
+            The URL.
+
+        stream_key (``str``):
+            Stream key.
+
+    """
+
+    def __init__(self, *, url: str, stream_key: str):
+        super().__init__(None)
+
+        self.url = url
+        self.stream_key = stream_key
+
+    @staticmethod
+    def _parse(rtmp_url: "raw.types.GroupCallStreamRtmpUrl") -> "RtmpUrl":
+        return RtmpUrl(
+            url=rtmp_url.url,
+            stream_key=rtmp_url.key
+        )
diff --git a/pyrogram/types/user_and_chats/user.py b/pyrogram/types/user_and_chats/user.py
new file mode 100644
index 0000000000..d956c79aa1
--- /dev/null
+++ b/pyrogram/types/user_and_chats/user.py
@@ -0,0 +1,550 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 html
+from datetime import datetime
+from typing import List, Optional
+
+import pyrogram
+from pyrogram import enums, utils, raw, types
+from ..object import Object
+from ..update import Update
+
+
+class Link(str):
+    HTML = "{text}"
+    MARKDOWN = "[{text}]({url})"
+
+    def __init__(self, url: str, text: str, style: enums.ParseMode):
+        super().__init__()
+
+        self.url = url
+        self.text = text
+        self.style = style
+
+    @staticmethod
+    def format(url: str, text: str, style: enums.ParseMode):
+        if style == enums.ParseMode.MARKDOWN:
+            fmt = Link.MARKDOWN
+        else:
+            fmt = Link.HTML
+
+        return fmt.format(url=url, text=html.escape(text))
+
+    # noinspection PyArgumentList
+    def __new__(cls, url, text, style):
+        return str.__new__(cls, Link.format(url, text, style))
+
+    def __call__(self, other: str = None, *, style: str = None):
+        return Link.format(self.url, other or self.text, style or self.style)
+
+    def __str__(self):
+        return Link.format(self.url, self.text, self.style)
+
+
+class User(Object, Update):
+    """A Telegram user or bot.
+
+    Parameters:
+        id (``int``):
+            Unique identifier for this user or bot.
+
+        first_name (``str``, *optional*):
+            User's or bot's first name.
+
+        last_name (``str``, *optional*):
+            User's or bot's last name.
+
+        username (``str``, *optional*):
+            User's or bot's username.
+
+        language_code (``str``, *optional*):
+            IETF language tag of the user's language.
+
+        is_premium (``bool``, *optional*):
+            True, if this user is a premium user.
+
+        is_self(``bool``, *optional*):
+            True, if this user is you yourself.
+
+        is_contact(``bool``, *optional*):
+            True, if this user is in your contacts.
+
+        is_mutual_contact(``bool``, *optional*):
+            True, if you both have each other's contact.
+
+        is_deleted(``bool``, *optional*):
+            True, if this user is deleted.
+
+        is_verified (``bool``, *optional*):
+            True, if this user has been verified by Telegram.
+
+        is_restricted (``bool``, *optional*):
+            True, if this user has been restricted. Bots only.
+            See *restriction_reason* for details.
+
+        is_scam (``bool``, *optional*):
+            True, if this user has been flagged for scam.
+
+        is_fake (``bool``, *optional*):
+            True, if this user has been flagged for impersonation.
+
+        is_support (``bool``, *optional*):
+            True, if this user is part of the Telegram support team.
+
+        restricts_new_chats (``bool``, *optional*):
+            True, if the user may restrict new chats with non-contacts.
+
+        status (:obj:`~pyrogram.enums.UserStatus`, *optional*):
+            User's last seen & online status. ``None``, for bots.
+
+        last_online_date (:py:obj:`~datetime.datetime`, *optional*):
+            Last online date of a user. Only available in case status is :obj:`~pyrogram.enums.UserStatus.OFFLINE`.
+
+        next_offline_date (:py:obj:`~datetime.datetime`, *optional*):
+            Date when a user will automatically go offline. Only available in case status is :obj:`~pyrogram.enums.UserStatus.ONLINE`.
+
+        emoji_status (:obj:`~pyrogram.types.EmojiStatus`, *optional*):
+            Emoji status.
+
+        dc_id (``int``, *optional*):
+            User's or bot's assigned DC (data center). Available only in case the user has set a public profile photo.
+            Note that 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 `_.
+
+        phone_number (``str``, *optional*):
+            User's phone number.
+
+        photo (:obj:`~pyrogram.types.ChatPhoto`, *optional*):
+            User's or bot's current profile photo. Suitable for downloads only.
+
+        active_usernames (List of :obj:`~pyrogram.types.Username`, *optional*):
+            If non-empty, the list of all `active chat usernames `_; for private chats, supergroups and channels.
+
+        restrictions (List of :obj:`~pyrogram.types.Restriction`, *optional*):
+            The list of reasons why this bot might be unavailable to some users.
+            This field is available only in case *is_restricted* is True.
+
+        is_bot (``bool``, *optional*):
+            True, if this user is a bot.
+
+        can_be_added_to_attachment_menu (``bool``, *optional*):
+            True, if the bot can be added to attachment or side menu.
+
+        added_to_attachment_menu (``bool``, *optional*):
+            True, if this user added the bot to the attachment menu.
+
+        can_join_groups (``bool``, *optional*):
+            True, if the bot can be invited to groups. Returned only in get_me.
+
+        can_read_all_group_messages (``bool``, *optional*):
+            True, if privacy mode is disabled for the bot. Returned only in get_me.
+
+        supports_inline_queries (``bool``, *optional*):
+            True, if the bot supports inline queries. Returned only in get_me.
+
+        can_connect_to_business (``bool``, *optional*):
+            True, if the bot can be connected to a Telegram Business account to receive its messages.
+
+        inline_query_placeholder (``str``, *optional*):
+            Placeholder for inline queries (displayed on the application input field)
+
+        inline_need_location (``bool``, *optional*):
+            True, if the bot supports inline `user location `_ requests. Returned only in get_me.
+        
+        can_be_edited (``bool``, *optional*):
+            True, if the current user can edit this bot's profile picture.
+
+        is_close_friend (``bool``, *optional*):
+            True, if the user is a close friend of the current user; implies that the user is a contact
+
+        accent_color (:obj:`~pyrogram.types.ChatColor`, *optional*):
+            Chat accent color.
+
+        profile_color (:obj:`~pyrogram.types.ChatColor`, *optional*):
+            Chat profile color.
+        
+        have_access (``bool``, *optional*):
+            If False, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method.
+
+        has_main_web_app (``bool``, *optional*):
+            True, if the bot has a main Web App. Returned only in get_me.
+
+        active_user_count (``int``, *optional*):
+            The number of recently active users of the bot.
+
+        mention (``str``, *property*):
+            Generate a text mention for this user.
+            You can use ``user.mention()`` to mention the user using their first name (styled using html), or
+            ``user.mention("another name")`` for a custom name. To choose a different style
+            ("HTML" or "MARKDOWN") use ``user.mention(style=ParseMode.MARKDOWN)``.
+        
+        full_name (``str``, *property*):
+            Full name of the other party in a private chat, for private chats and bots.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        client: "pyrogram.Client" = None,
+        id: int,
+        is_self: bool = None,
+        is_contact: bool = None,
+        is_mutual_contact: bool = None,
+        is_deleted: bool = None,
+        is_bot: bool = None,
+        is_verified: bool = None,
+        is_restricted: bool = None,
+        is_scam: bool = None,
+        is_fake: bool = None,
+        is_support: bool = None,
+        is_premium: bool = None,
+        first_name: str = None,
+        last_name: str = None,
+        status: "enums.UserStatus" = None,
+        last_online_date: datetime = None,
+        next_offline_date: datetime = None,
+        username: str = None,
+        language_code: str = None,
+        emoji_status: Optional["types.EmojiStatus"] = None,
+        dc_id: int = None,
+        phone_number: str = None,
+        photo: "types.ChatPhoto" = None,
+        active_usernames: List["types.Username"] = None,
+        restrictions: List["types.Restriction"] = None,
+        added_to_attachment_menu: bool = None,
+        can_be_added_to_attachment_menu: bool = None,
+        can_join_groups: bool = None,
+        can_read_all_group_messages: bool = None,
+        supports_inline_queries: bool = None,
+        restricts_new_chats: bool = None,
+        inline_need_location: bool = None,
+        can_be_edited: bool = None,
+        can_connect_to_business: bool = None,
+        inline_query_placeholder: str = None,
+        is_close_friend: bool = None,
+        accent_color: "types.ChatColor" = None,
+        profile_color: "types.ChatColor" = None,
+        have_access: bool = None,
+        has_main_web_app: bool = None,
+        active_user_count: int = None,
+        _raw: "raw.base.User" = None
+    ):
+        super().__init__(client)
+
+        self.id = id
+        self.is_self = is_self
+        self.is_contact = is_contact
+        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_fake = is_fake
+        self.is_support = is_support
+        self.is_premium = is_premium
+        self.first_name = first_name
+        self.last_name = last_name
+        self.status = status
+        self.last_online_date = last_online_date
+        self.next_offline_date = next_offline_date
+        self.username = username
+        self.language_code = language_code
+        self.emoji_status = emoji_status
+        self.dc_id = dc_id
+        self.phone_number = phone_number
+        self.photo = photo
+        self.restrictions = restrictions
+        self.added_to_attachment_menu = added_to_attachment_menu
+        self.can_be_added_to_attachment_menu = can_be_added_to_attachment_menu
+        self.can_join_groups = can_join_groups
+        self.can_read_all_group_messages = can_read_all_group_messages
+        self.supports_inline_queries = supports_inline_queries
+        self.restricts_new_chats = restricts_new_chats
+        self.inline_need_location = inline_need_location
+        self.can_be_edited = can_be_edited
+        self.can_connect_to_business = can_connect_to_business
+        self.inline_query_placeholder = inline_query_placeholder
+        self.active_usernames = active_usernames
+        self.is_close_friend = is_close_friend
+        self.accent_color = accent_color
+        self.profile_color = profile_color
+        self.have_access = have_access
+        self.has_main_web_app = has_main_web_app
+        self.active_user_count = active_user_count
+        self._raw = _raw
+
+    @property
+    def mention(self):
+        return Link(
+            f"tg://user?id={self.id}",
+            self.first_name or "Deleted Account",
+            self._client.parse_mode
+        )
+
+    @property
+    def full_name(self) -> str:
+        return " ".join(
+            filter(
+                None,
+                [
+                    self.first_name,
+                    self.last_name
+                ]
+            )
+        ) or None
+
+    @staticmethod
+    def _parse(client, user: "raw.base.User") -> Optional["User"]:
+        if user is None:
+            return None
+
+        if isinstance(user, raw.types.UserEmpty):
+            return User(
+                id=user.id,
+                client=client,
+                _raw=user
+            )
+
+        active_usernames = types.List(
+            [
+                types.Username._parse(u)
+                for u in getattr(user, "usernames", [])
+            ]
+        ) or None
+        _tmp_username = None
+        if (
+            active_usernames and
+            len(active_usernames) > 0
+        ):
+            _tmp_username = active_usernames[0].username
+
+        parsed_user = User(
+            id=user.id,
+            is_self=user.is_self,
+            is_contact=user.contact,
+            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_fake=user.fake,
+            is_support=user.support,
+            is_premium=user.premium,
+            first_name=user.first_name,
+            last_name=user.last_name,
+            **User._parse_status(user.status, user.bot),
+            username=user.username or _tmp_username,
+            language_code=user.lang_code,
+            emoji_status=types.EmojiStatus._parse(client, user.emoji_status),
+            dc_id=getattr(user.photo, "dc_id", None),
+            phone_number=user.phone,
+            photo=types.ChatPhoto._parse(client, user.photo, user.id, user.access_hash),
+            restrictions=types.List([types.Restriction._parse(r) for r in user.restriction_reason]) or None,
+            client=client,
+            restricts_new_chats=getattr(user, "contact_require_premium", None),
+            active_usernames=active_usernames,
+            is_close_friend=getattr(user, "close_friend", None),
+            accent_color=types.ChatColor._parse(getattr(user, "color", None)),
+            profile_color=types.ChatColor._parse_profile_color(getattr(user, "profile_color", None)),
+            have_access=not bool(getattr(user, "min", False)),  # apply_min_photo
+            _raw=user
+        )
+        if parsed_user.is_bot:
+            parsed_user.added_to_attachment_menu = getattr(user, "attach_menu_enabled", None)
+            parsed_user.can_be_added_to_attachment_menu = getattr(user, "bot_attach_menu", None)
+            parsed_user.can_join_groups = not bool(getattr(user, "bot_nochats", None))
+            parsed_user.can_read_all_group_messages = getattr(user, "bot_chat_history", None)
+            parsed_user.inline_query_placeholder = getattr(
+                user, "bot_inline_placeholder", None
+            )
+            parsed_user.supports_inline_queries = bool(parsed_user.inline_query_placeholder)
+            parsed_user.inline_need_location = bool(
+                getattr(user, "bot_inline_geo", None)
+            )
+            parsed_user.can_connect_to_business = bool(
+                getattr(user, "bot_business", None)
+            )
+            parsed_user.has_main_web_app = bool(getattr(user, "bot_has_main_app", None))
+            parsed_user.active_user_count = getattr(user, "bot_active_users", None)
+        if parsed_user.is_bot:
+            parsed_user.can_be_edited = bool(
+                getattr(user, "bot_can_edit", None)
+            )
+        return parsed_user
+
+    @staticmethod
+    def _parse_status(user_status: "raw.base.UserStatus", is_bot: bool = False):
+        # TODO
+        if isinstance(user_status, raw.types.UserStatusOnline):
+            status, date = enums.UserStatus.ONLINE, user_status.expires
+        elif isinstance(user_status, raw.types.UserStatusOffline):
+            status, date = enums.UserStatus.OFFLINE, user_status.was_online
+        elif isinstance(user_status, raw.types.UserStatusRecently):
+            status, date = enums.UserStatus.RECENTLY, None
+        elif isinstance(user_status, raw.types.UserStatusLastWeek):
+            status, date = enums.UserStatus.LAST_WEEK, None
+        elif isinstance(user_status, raw.types.UserStatusLastMonth):
+            status, date = enums.UserStatus.LAST_MONTH, None
+        else:
+            status, date = enums.UserStatus.LONG_AGO, None
+
+        last_online_date = None
+        next_offline_date = None
+
+        if is_bot:
+            status = None
+
+        if status == enums.UserStatus.ONLINE:
+            next_offline_date = utils.timestamp_to_datetime(date)
+
+        if status == enums.UserStatus.OFFLINE:
+            last_online_date = utils.timestamp_to_datetime(date)
+
+        return {
+            "status": status,
+            "last_online_date": last_online_date,
+            "next_offline_date": next_offline_date
+        }
+
+    @staticmethod
+    def _parse_user_status(client, user_status: "raw.types.UpdateUserStatus"):
+        return User(
+            id=user_status.user_id,
+            **User._parse_status(user_status.status),
+            client=client
+        )
+
+    async def archive(self):
+        """Bound method *archive* of :obj:`~pyrogram.types.User`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.archive_chats(123456789)
+
+        Example:
+            .. code-block:: python
+
+               await user.archive()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.archive_chats(self.id)
+
+    async def unarchive(self):
+        """Bound method *unarchive* of :obj:`~pyrogram.types.User`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.unarchive_chats(123456789)
+
+        Example:
+            .. code-block:: python
+
+                await user.unarchive()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return await self._client.unarchive_chats(self.id)
+
+    def block(self):
+        """Bound method *block* of :obj:`~pyrogram.types.User`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            await client.block_user(123456789)
+
+        Example:
+            .. code-block:: python
+
+                await user.block()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return self._client.block_user(self.id)
+
+    def unblock(self):
+        """Bound method *unblock* of :obj:`~pyrogram.types.User`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.unblock_user(123456789)
+
+        Example:
+            .. code-block:: python
+
+                user.unblock()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return self._client.unblock_user(self.id)
+
+    def get_common_chats(self):
+        """Bound method *get_common_chats* of :obj:`~pyrogram.types.User`.
+
+        Use as a shortcut for:
+
+        .. code-block:: python
+
+            client.get_common_chats(123456789)
+
+        Example:
+            .. code-block:: python
+
+                user.get_common_chats()
+
+        Returns:
+            True on success.
+
+        Raises:
+            RPCError: In case of a Telegram RPC error.
+        """
+
+        return self._client.get_common_chats(self.id)
diff --git a/pyrogram/types/user_and_chats/username.py b/pyrogram/types/user_and_chats/username.py
new file mode 100644
index 0000000000..b386aa5100
--- /dev/null
+++ b/pyrogram/types/user_and_chats/username.py
@@ -0,0 +1,53 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class Username(Object):
+    """Describes usernames assigned to a user, a supergroup, or a channel.
+
+    Parameters:
+        username (``str``):
+            User's or chat's username.
+        is_editable (``bool``, *optional*):
+            True, if the username is editable.
+        is_active (``bool``, *optional*):
+            True, if the username is active.
+    """
+
+    def __init__(
+        self, *,
+        username: str,
+        is_editable: bool = None,
+        is_active: bool = None
+    ):
+        super().__init__()
+
+        self.username = username
+        self.is_editable = is_editable
+        self.is_active = is_active
+
+    @staticmethod
+    def _parse(username: "raw.types.Username") -> "Username":
+        return Username(
+            username=username.username,
+            is_editable=username.editable,
+            is_active=username.active
+        )
diff --git a/pyrogram/types/user_and_chats/users_shared.py b/pyrogram/types/user_and_chats/users_shared.py
new file mode 100644
index 0000000000..906518d236
--- /dev/null
+++ b/pyrogram/types/user_and_chats/users_shared.py
@@ -0,0 +1,47 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import types
+from ..object import Object
+
+
+class UsersShared(Object):
+    """This object contains information about the users whose identifiers were shared with the bot using a :obj:`~pyrogram.types.KeyboardButtonRequestUsers` button.
+
+    Parameters:
+        request_id (``int``):
+            Identifier of the request.
+
+        users (List of :obj:`~pyrogram.types.User`):
+            Information about users shared with the bot.
+
+    """
+
+    def __init__(
+        self,
+        *,
+        request_id: int,
+        users: List["types.User"]
+    ):
+        super().__init__()
+
+        self.request_id = request_id
+        self.users = users
diff --git a/pyrogram/types/user_and_chats/video_chat_ended.py b/pyrogram/types/user_and_chats/video_chat_ended.py
new file mode 100644
index 0000000000..8c9fac6a0a
--- /dev/null
+++ b/pyrogram/types/user_and_chats/video_chat_ended.py
@@ -0,0 +1,41 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 import raw
+from ..object import Object
+
+
+class VideoChatEnded(Object):
+    """A service message about a voice chat ended in the chat.
+
+    Parameters:
+        duration (``int``):
+            Voice chat duration; in seconds.
+    """
+
+    def __init__(
+        self, *,
+        duration: int
+    ):
+        super().__init__()
+
+        self.duration = duration
+
+    @staticmethod
+    def _parse(action: "raw.types.MessageActionGroupCall") -> "VideoChatEnded":
+        return VideoChatEnded(duration=action.duration)
diff --git a/pyrogram/types/user_and_chats/video_chat_participants_invited.py b/pyrogram/types/user_and_chats/video_chat_participants_invited.py
new file mode 100644
index 0000000000..5d5776b1e2
--- /dev/null
+++ b/pyrogram/types/user_and_chats/video_chat_participants_invited.py
@@ -0,0 +1,50 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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, Dict
+
+from pyrogram import raw, types
+from ..object import Object
+
+
+class VideoChatParticipantsInvited(Object):
+    """A service message about new members invited to a voice chat.
+
+
+    Parameters:
+        users (List of :obj:`~pyrogram.types.User`):
+            New members that were invited to the voice chat.
+    """
+
+    def __init__(
+        self, *,
+        users: List["types.User"]
+    ):
+        super().__init__()
+
+        self.users = users
+
+    @staticmethod
+    def _parse(
+        client,
+        action: "raw.types.MessageActionInviteToGroupCall",
+        users: Dict[int, "raw.types.User"]
+    ) -> "VideoChatParticipantsInvited":
+        users = [types.User._parse(client, users[i]) for i in action.users]
+
+        return VideoChatParticipantsInvited(users=users)
diff --git a/pyrogram/types/user_and_chats/video_chat_scheduled.py b/pyrogram/types/user_and_chats/video_chat_scheduled.py
new file mode 100644
index 0000000000..5bdd592515
--- /dev/null
+++ b/pyrogram/types/user_and_chats/video_chat_scheduled.py
@@ -0,0 +1,43 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 datetime import datetime
+
+from pyrogram import raw, utils
+from ..object import Object
+
+
+class VideoChatScheduled(Object):
+    """A service message about a voice chat scheduled in the chat.
+
+    Parameters:
+        start_date (:py:obj:`~datetime.datetime`):
+            Point in time when the voice chat is supposed to be started by a chat administrator.
+    """
+
+    def __init__(
+        self, *,
+        start_date: datetime
+    ):
+        super().__init__()
+
+        self.start_date = start_date
+
+    @staticmethod
+    def _parse(action: "raw.types.MessageActionGroupCallScheduled") -> "VideoChatScheduled":
+        return VideoChatScheduled(start_date=utils.timestamp_to_datetime(action.schedule_date))
diff --git a/pyrogram/types/user_and_chats/video_chat_started.py b/pyrogram/types/user_and_chats/video_chat_started.py
new file mode 100644
index 0000000000..ff48b39cd6
--- /dev/null
+++ b/pyrogram/types/user_and_chats/video_chat_started.py
@@ -0,0 +1,29 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 VideoChatStarted(Object):
+    """A service message about a voice chat started in the chat.
+
+    Currently holds no information.
+    """
+
+    def __init__(self):
+        super().__init__()
diff --git a/pyrogram/utils.py b/pyrogram/utils.py
new file mode 100644
index 0000000000..34ba51d2b9
--- /dev/null
+++ b/pyrogram/utils.py
@@ -0,0 +1,589 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 asyncio
+import base64
+import functools
+import hashlib
+import os
+import re
+import struct
+from concurrent.futures.thread import ThreadPoolExecutor
+from datetime import datetime, timezone
+from getpass import getpass
+from typing import Union, List, Dict, Optional
+
+import pyrogram
+from pyrogram import raw, enums
+from pyrogram import types
+from pyrogram.file_id import FileId, FileType, PHOTO_TYPES, DOCUMENT_TYPES
+
+
+async def ainput(prompt: str = "", *, hide: bool = False):
+    """Just like the built-in input, but async"""
+    with ThreadPoolExecutor(1) as executor:
+        func = functools.partial(getpass if hide else input, prompt)
+        return await asyncio.get_event_loop().run_in_executor(executor, func)
+
+
+def get_input_media_from_file_id(
+    file_id: str,
+    expected_file_type: FileType = None,
+    ttl_seconds: int = None,
+    has_spoiler: bool = None
+) -> Union["raw.types.InputMediaPhoto", "raw.types.InputMediaDocument"]:
+    try:
+        decoded = FileId.decode(file_id)
+    except Exception:
+        raise ValueError(
+            f'Failed to decode "{file_id}". The value does not represent an existing local file, '
+            f"HTTP URL, or valid file id."
+        )
+
+    file_type = decoded.file_type
+
+    if expected_file_type is not None and file_type != expected_file_type:
+        raise ValueError(f"Expected {expected_file_type.name}, got {file_type.name} file id instead")
+
+    if file_type in (FileType.THUMBNAIL, FileType.CHAT_PHOTO):
+        raise ValueError(f"This file id can only be used for download: {file_id}")
+
+    if file_type in PHOTO_TYPES:
+        return raw.types.InputMediaPhoto(
+            id=raw.types.InputPhoto(
+                id=decoded.media_id,
+                access_hash=decoded.access_hash,
+                file_reference=decoded.file_reference
+            ),
+            ttl_seconds=ttl_seconds,
+            spoiler=has_spoiler
+        )
+
+    if file_type in DOCUMENT_TYPES:
+        return raw.types.InputMediaDocument(
+            id=raw.types.InputDocument(
+                id=decoded.media_id,
+                access_hash=decoded.access_hash,
+                file_reference=decoded.file_reference
+            ),
+            ttl_seconds=ttl_seconds,
+            spoiler=has_spoiler
+        )
+
+    raise ValueError(f"Unknown file id: {file_id}")
+
+
+async def parse_messages(
+    client,
+    messages: "raw.types.messages.Messages",
+    is_scheduled: bool = False,
+    replies: int = 1,
+    business_connection_id: str = "",
+    r: "raw.base.Updates" = None
+) -> List["types.Message"]:
+    parsed_messages = []
+
+    if not messages and r:
+        users = {i.id: i for i in getattr(r, "users", [])}
+        chats = {i.id: i for i in getattr(r, "chats", [])}
+
+        for u in getattr(r, "updates", []):
+            if isinstance(
+                u,
+                (
+                    raw.types.UpdateNewMessage,
+                    raw.types.UpdateNewChannelMessage,
+                    raw.types.UpdateNewScheduledMessage,
+                )
+            ):
+                parsed_messages.append(
+                    await types.Message._parse(
+                        client,
+                        u.message,
+                        users,
+                        chats,
+                        is_scheduled=isinstance(u, raw.types.UpdateNewScheduledMessage),
+                        replies=client.fetch_replies
+                    )
+                )
+
+            elif isinstance(
+                u,
+                (
+                    raw.types.UpdateBotNewBusinessMessage,
+                )
+            ):
+                parsed_messages.append(
+                    await types.Message._parse(
+                        client,
+                        u.message,
+                        users,
+                        chats,
+                        business_connection_id=getattr(u, "connection_id", business_connection_id),
+                        raw_reply_to_message=u.reply_to_message,
+                        replies=0
+                    )
+                )
+
+        return types.List(parsed_messages)
+
+    users = {i.id: i for i in messages.users}
+    chats = {i.id: i for i in messages.chats}
+
+    if not messages.messages:
+        return types.List()
+
+    for message in messages.messages:
+        parsed_messages.append(
+            await types.Message._parse(
+                client,
+                message,
+                users,
+                chats,
+                is_scheduled=is_scheduled,
+                replies=client.fetch_replies
+            )
+        )
+
+    if replies and False:  # TODO
+        messages_with_replies = {
+            # TODO: fix this logic someday
+            i.id: i.reply_to.reply_to_msg_id
+            for i in messages.messages
+            if not isinstance(i, raw.types.MessageEmpty) and i.reply_to
+        }
+
+        if messages_with_replies:
+            # We need a chat id, but some messages might be empty (no chat attribute available)
+            # Scan until we find a message with a chat available (there must be one, because we are fetching replies)
+            for m in parsed_messages:
+                if m.chat:
+                    chat_id = m.chat.id
+                    break
+            else:
+                chat_id = 0
+
+            reply_messages = await client.get_messages(
+                chat_id=chat_id,
+                reply_to_message_ids=messages_with_replies.keys(),
+                replies=replies - 1
+            )
+
+            for message in parsed_messages:
+                reply_id = messages_with_replies.get(message.id, None)
+
+                for reply in reply_messages:
+                    if reply.id == reply_id:
+                        message.reply_to_message = reply
+
+    return types.List(parsed_messages)
+
+
+def pack_inline_message_id(msg_id: "raw.base.InputBotInlineMessageID"):
+    if isinstance(msg_id, raw.types.InputBotInlineMessageID):
+        inline_message_id_packed = struct.pack(
+            " Optional[int]:
+    """Get the raw peer id from a Peer object"""
+    if isinstance(peer, raw.types.PeerUser):
+        return peer.user_id
+
+    if isinstance(peer, raw.types.PeerChat):
+        return peer.chat_id
+
+    if isinstance(peer, raw.types.PeerChannel):
+        return peer.channel_id
+
+    return None
+
+
+def get_peer_id(peer: raw.base.Peer) -> int:
+    """Get the non-raw peer id from a Peer object"""
+    if isinstance(peer, raw.types.PeerUser):
+        return peer.user_id
+
+    if isinstance(peer, raw.types.PeerChat):
+        return -peer.chat_id
+
+    if isinstance(peer, raw.types.PeerChannel):
+        return MAX_CHANNEL_ID - peer.channel_id
+
+    raise ValueError(f"Peer type invalid: {peer}")
+
+
+def get_peer_type(peer_id: int) -> str:
+    if peer_id < 0:
+        if MIN_CHAT_ID <= peer_id:
+            return "chat"
+
+        if MIN_CHANNEL_ID <= peer_id < MAX_CHANNEL_ID:
+            return "channel"
+    elif 0 < peer_id <= MAX_USER_ID:
+        return "user"
+
+    raise ValueError(f"Peer id invalid: {peer_id}")
+
+
+def get_channel_id(peer_id: int) -> int:
+    return MAX_CHANNEL_ID - peer_id
+
+
+def btoi(b: bytes) -> int:
+    return int.from_bytes(b, "big")
+
+
+def itob(i: int) -> bytes:
+    return i.to_bytes(256, "big")
+
+
+def sha256(data: bytes) -> bytes:
+    return hashlib.sha256(data).digest()
+
+
+def xor(a: bytes, b: bytes) -> bytes:
+    return bytes(i ^ j for i, j in zip(a, b))
+
+
+def compute_password_hash(
+    algo: raw.types.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow,
+    password: str
+) -> bytes:
+    hash1 = sha256(algo.salt1 + password.encode() + algo.salt1)
+    hash2 = sha256(algo.salt2 + hash1 + algo.salt2)
+    hash3 = hashlib.pbkdf2_hmac("sha512", hash2, algo.salt1, 100000)
+
+    return sha256(algo.salt2 + hash3 + algo.salt2)
+
+
+# noinspection PyPep8Naming
+def compute_password_check(
+    r: raw.types.account.Password,
+    password: str
+) -> raw.types.InputCheckPasswordSRP:
+    algo = r.current_algo
+
+    p_bytes = algo.p
+    p = btoi(algo.p)
+
+    g_bytes = itob(algo.g)
+    g = algo.g
+
+    B_bytes = r.srp_B
+    B = btoi(B_bytes)
+
+    srp_id = r.srp_id
+
+    x_bytes = compute_password_hash(algo, password)
+    x = btoi(x_bytes)
+
+    g_x = pow(g, x, p)
+
+    k_bytes = sha256(p_bytes + g_bytes)
+    k = btoi(k_bytes)
+
+    kg_x = (k * g_x) % p
+
+    while True:
+        a_bytes = os.urandom(256)
+        a = btoi(a_bytes)
+
+        A = pow(g, a, p)
+        A_bytes = itob(A)
+
+        u = btoi(sha256(A_bytes + B_bytes))
+
+        if u > 0:
+            break
+
+    g_b = (B - kg_x) % p
+
+    ux = u * x
+    a_ux = a + ux
+    S = pow(g_b, a_ux, p)
+    S_bytes = itob(S)
+
+    K_bytes = sha256(S_bytes)
+
+    M1_bytes = sha256(
+        xor(sha256(p_bytes), sha256(g_bytes))
+        + sha256(algo.salt1)
+        + sha256(algo.salt2)
+        + A_bytes
+        + B_bytes
+        + K_bytes
+    )
+
+    return raw.types.InputCheckPasswordSRP(srp_id=srp_id, A=A_bytes, M1=M1_bytes)
+
+
+async def parse_text_entities(
+    client: "pyrogram.Client",
+    text: str,
+    parse_mode: Optional[enums.ParseMode],
+    entities: List["types.MessageEntity"]
+) -> Dict[str, Union[str, List[raw.base.MessageEntity]]]:
+    if entities:
+        # Inject the client instance because parsing user mentions requires it
+        for entity in entities:
+            entity._client = client
+
+        text, entities = text, [await entity.write() for entity in entities] or None
+    else:
+        text, entities = (await client.parser.parse(text, parse_mode)).values()
+
+    return {
+        "message": text,
+        "entities": entities
+    }
+
+
+async def parse_deleted_messages(client, update, users, chats) -> List["types.Message"]:
+    messages = update.messages
+    channel_id = getattr(update, "channel_id", None)
+    business_connection_id = getattr(update, "connection_id", None)
+    raw_business_peer = getattr(update, "peer", None)
+
+    delete_chat = None
+    if channel_id is not None:
+        chan_id = get_channel_id(channel_id)
+        # try:
+        # TODO
+        #     delete_chat = await client.get_chat(chan_id, False)
+        # except pyrogram.errors.RPCError:
+        delete_chat = types.Chat(
+            id=chan_id,
+            type=enums.ChatType.CHANNEL,
+            client=client
+        )
+
+    elif raw_business_peer is not None:
+        chat_id = get_raw_peer_id(raw_business_peer)
+        # yet another TODO comment here
+        if chat_id:
+            if isinstance(raw_business_peer, raw.types.PeerUser):
+                delete_chat = types.Chat._parse_user_chat(client, users[chat_id])
+
+            elif isinstance(raw_business_peer, raw.types.PeerChat):
+                delete_chat = types.Chat._parse_chat_chat(client, chats[chat_id])
+
+            else:
+                delete_chat = types.Chat._parse_channel_chat(
+                    client, chats[chat_id]
+                )
+
+    parsed_messages = []
+
+    for message in messages:
+        parsed_messages.append(
+            types.Message(
+                id=message,
+                chat=delete_chat,
+                business_connection_id=business_connection_id,
+                client=client
+            )
+        )
+
+    return types.List(parsed_messages)
+
+
+def zero_datetime() -> datetime:
+    return datetime.fromtimestamp(0, timezone.utc)
+
+
+def timestamp_to_datetime(ts: Optional[int]) -> Optional[datetime]:
+    return datetime.fromtimestamp(ts) if ts else None
+
+
+def datetime_to_timestamp(dt: Optional[datetime]) -> Optional[int]:
+    return int(dt.timestamp()) if dt else None
+
+
+async def _get_reply_message_parameters(
+    client: "pyroram.Client",
+    message_thread_id: int = None,
+    reply_parameters: "types.ReplyParameters" = None
+) -> Union[
+    raw.types.InputReplyToStory,
+    raw.types.InputReplyToMessage
+]:
+    reply_to = None
+    if not reply_parameters:
+        if message_thread_id:
+            reply_to = raw.types.InputReplyToMessage(
+                reply_to_msg_id=message_thread_id,
+                top_msg_id=message_thread_id
+            )
+        return reply_to
+    if (
+       reply_parameters and
+       reply_parameters.story_id and
+       reply_parameters.chat_id
+    ):
+        return raw.types.InputReplyToStory(
+            peer=await client.resolve_peer(reply_parameters.chat_id),
+            story_id=reply_parameters.story_id
+        )
+    reply_to_message_id = reply_parameters.message_id
+    if not reply_to_message_id:
+        return reply_to
+    reply_to = raw.types.InputReplyToMessage(
+        reply_to_msg_id=reply_to_message_id
+    )
+    if message_thread_id:
+        reply_to.top_msg_id = message_thread_id
+    # TODO
+    quote = reply_parameters.quote
+    if quote is not None:
+        quote_parse_mode = reply_parameters.quote_parse_mode
+        quote_entities = reply_parameters.quote_entities
+        message, entities = (await parse_text_entities(
+            client,
+            quote,
+            quote_parse_mode,
+            quote_entities
+        )).values()
+        reply_to.quote_text = message
+        reply_to.quote_entities = entities
+    if reply_parameters.chat_id:
+        reply_to.reply_to_peer_id = await client.resolve_peer(reply_parameters.chat_id)
+    if reply_parameters.quote_position:
+        reply_to.quote_offset = reply_parameters.quote_position
+    return reply_to
+
+
+def is_plain_domain(url):
+    # https://github.com/tdlib/td/blob/d963044/td/telegram/MessageEntity.cpp#L1778
+    return (
+        url.find('/') >= len(url) and
+        url.find('?') >= len(url) and
+        url.find('#') >= len(url)
+    )
+
+
+def get_first_url(message: "raw.types.Message") -> str:
+    text = message.message
+    entities = message.entities
+    # duplicate code copied from parser.
+    text = re.sub(r"^\s*(<[\w<>=\s\"]*>)\s*", r"\1", text)
+    text = re.sub(r"\s*(]*>)\s*$", r"\1", text)
+    SMP_RE = re.compile(r"[\U00010000-\U0010FFFF]")
+    text_ = SMP_RE.sub(
+        lambda match:  # Split SMP in two surrogates
+        "".join(
+            chr(i) for i in struct.unpack(
+                " str:
+    un_posi_mt = [
+        "application/zip",  # 0
+        # https://t.me/c/1220993104/1360174
+        "audio/mpeg",  # 1
+        "audio/ogg",  # 2
+    ]
+    mime_type = client.guess_mime_type(file_name) or un_posi_mt[dinxe]
+    # BEWARE: https://t.me/c/1279877202/31475
+    if dinxe == 1 and mime_type == "audio/ogg":
+        mime_type = "audio/opus"
+    elif dinxe == 2 and mime_type == "audio/mpeg":
+        mime_type = "audio/ogg"
+    # BEWARE: https://t.me/c/1279877202/74
+    return mime_type
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index fd96b3b431..0000000000
--- a/setup.cfg
+++ /dev/null
@@ -1,30 +0,0 @@
-[metadata]
-name = Pyrogram
-version = attr: pyrogram.__version__
-description = Telegram MTProto API Client Library for Python
-url = https://github.com/pyrogram/pyrogram
-author = Dan Tès
-author_email = admin@pyrogram.ml
-license = LGPLv3+
-keywords = telegram mtproto api client library python
-classifiers =
-    Development Status :: 3 - Alpha
-    Intended Audience :: Developers
-    License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
-    Operating System :: OS Independent
-    Programming Language :: Python
-    Programming Language :: Python :: 3
-    Programming Language :: Python :: 3.3
-    Programming Language :: Python :: 3.4
-    Programming Language :: Python :: 3.5
-    Programming Language :: Python :: 3.6
-    Topic :: Internet
-    Topic :: Communications :: Chat
-    Topic :: Software Development :: Libraries
-    Topic :: Software Development :: Libraries :: Python Modules
-
-[options]
-packages = find:
-zip_safe = False
-install_requires = pyaes
-include_package_data = True
\ No newline at end of file
diff --git a/setup.py b/setup.py
index c3bc6d6a55..2cb7d7f677 100644
--- a/setup.py
+++ b/setup.py
@@ -1,36 +1,88 @@
-# Pyrogram - Telegram MTProto API Client Library for Python
-# Copyright (C) 2017 Dan Tès 
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
 #
-# This file is part of Pyrogram.
+#  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 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.
+#  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 .
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with Pyrogram.  If not, see .
 
 import re
 from sys import argv
 
-from setuptools import setup
+from setuptools import setup, find_packages
 
 from compiler.api import compiler as api_compiler
-from compiler.error import compiler as error_compiler
+from compiler.errors import compiler as errors_compiler
 
-if len(argv) > 1 and argv[1] != "sdist":
-    api_compiler.start()
-    error_compiler.start()
+with open("requirements.txt", encoding="utf-8") as r:
+    requires = [i.strip() for i in r]
+
+with open("pyrogram/__init__.py", encoding="utf-8") as f:
+    version = re.findall(r"__version__ = \"(.+)\"", f.read())[0]
 
-# 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())
-    readme = re.sub(r"\|header\|", "|logo|\n######\n\n|description|\n\n|scheme| |mtproto|", readme)
+with open("README.md", encoding="utf-8") as f:
+    readme = f.read()
+
+if len(argv) > 1 and argv[1] in ["bdist_wheel", "install", "develop"]:
+    api_compiler.start()
+    errors_compiler.start()
 
-setup(long_description=readme)
+setup(
+    name="Pyrogram",
+    version=version,
+    description="Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots",
+    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",
+    author_email="dan@pyrogram.org",
+    license="LGPLv3",
+    classifiers=[
+        "Development Status :: 5 - Production/Stable",
+        "Intended Audience :: Developers",
+        "Natural Language :: English",
+        "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
+        "Operating System :: OS Independent",
+        "Programming Language :: Python",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
+        "Programming Language :: Python :: 3.11",
+        "Programming Language :: Python :: Implementation",
+        "Programming Language :: Python :: Implementation :: CPython",
+        "Programming Language :: Python :: Implementation :: PyPy",
+        "Topic :: Internet",
+        "Topic :: Communications",
+        "Topic :: Communications :: Chat",
+        "Topic :: Software Development :: Libraries",
+        "Topic :: Software Development :: Libraries :: Python Modules",
+        "Topic :: Software Development :: Libraries :: Application Frameworks"
+    ],
+    keywords="telegram chat messenger mtproto api client library python",
+    project_urls={
+        "Tracker": "https://github.com/pyrogram/pyrogram/issues",
+        "Community": "https://t.me/pyrogram",
+        "Source": "https://github.com/pyrogram/pyrogram",
+        "Documentation": "https://docs.pyrogram.org",
+    },
+    python_requires="~=3.7",
+    package_data={
+        "pyrogram": ["py.typed"],
+    },
+    packages=find_packages(exclude=["compiler*", "tests*"]),
+    zip_safe=False,
+    install_requires=requires
+)
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000000..46887cb7a5
--- /dev/null
+++ b/tests/__init__.py
@@ -0,0 +1,17 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .
diff --git a/tests/filters/__init__.py b/tests/filters/__init__.py
new file mode 100644
index 0000000000..6711b51b4c
--- /dev/null
+++ b/tests/filters/__init__.py
@@ -0,0 +1,36 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 Client:
+    def __init__(self):
+        self.me = User("username")
+
+    async def get_me(self):
+        return self.me
+
+
+class User:
+    def __init__(self, username: str = None):
+        self.username = username
+
+
+class Message:
+    def __init__(self, text: str = None, caption: str = None):
+        self.text = text
+        self.caption = caption
+        self.command = None
diff --git a/tests/filters/test_command.py b/tests/filters/test_command.py
new file mode 100644
index 0000000000..234ed69fc3
--- /dev/null
+++ b/tests/filters/test_command.py
@@ -0,0 +1,148 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 pytest
+
+from pyrogram import filters
+from tests.filters import Client, Message
+
+c = Client()
+
+
+@pytest.mark.asyncio
+async def test_single():
+    f = filters.command("start")
+
+    m = Message("/start")
+    assert await f(c, m)
+
+
+@pytest.mark.asyncio
+async def test_multiple():
+    f = filters.command(["start", "help"])
+
+    m = Message("/start")
+    assert await f(c, m)
+
+    m = Message("/help")
+    assert await f(c, m)
+
+    m = Message("/settings")
+    assert not await f(c, m)
+
+
+@pytest.mark.asyncio
+async def test_prefixes():
+    f = filters.command("start", prefixes=list(".!#"))
+
+    m = Message(".start")
+    assert await f(c, m)
+
+    m = Message("!start")
+    assert await f(c, m)
+
+    m = Message("#start")
+    assert await f(c, m)
+
+    m = Message("/start")
+    assert not await f(c, m)
+
+
+@pytest.mark.asyncio
+async def test_case_sensitive():
+    f = filters.command("start", case_sensitive=True)
+
+    m = Message("/start")
+    assert await f(c, m)
+
+    m = Message("/StArT")
+    assert not await f(c, m)
+
+
+@pytest.mark.asyncio
+async def test_case_insensitive():
+    f = filters.command("start", case_sensitive=False)
+
+    m = Message("/start")
+    assert await f(c, m)
+
+    m = Message("/StArT")
+    assert await f(c, m)
+
+
+@pytest.mark.asyncio
+async def test_with_mention():
+    f = filters.command("start")
+
+    m = Message("/start@username")
+    assert await f(c, m)
+
+    m = Message("/start@UserName")
+    assert await f(c, m)
+
+    m = Message("/start@another")
+    assert not await f(c, m)
+
+
+@pytest.mark.asyncio
+async def test_with_args():
+    f = filters.command("start")
+
+    m = Message("/start")
+    await f(c, m)
+    assert m.command == ["start"]
+
+    m = Message("/StArT")
+    await f(c, m)
+    assert m.command == ["start"]
+
+    m = Message("/start@username")
+    await f(c, m)
+    assert m.command == ["start"]
+
+    m = Message("/start a b c")
+    await f(c, m)
+    assert m.command == ["start"] + list("abc")
+
+    m = Message('/start@username a b c')
+    await f(c, m)
+    assert m.command == ["start"] + list("abc")
+
+    m = Message("/start 'a b' c")
+    await f(c, m)
+    assert m.command == ["start", "a b", "c"]
+
+    m = Message('/start     a     b     "c     d"')
+    await f(c, m)
+    assert m.command == ["start"] + list("ab") + ["c     d"]
+
+
+@pytest.mark.asyncio
+async def test_caption():
+    f = filters.command("start")
+
+    m = Message(caption="/start")
+    assert await f(c, m)
+
+
+@pytest.mark.asyncio
+async def test_no_text():
+    f = filters.command("start")
+
+    m = Message()
+    assert not await f(c, m)
diff --git a/tests/parser/__init__.py b/tests/parser/__init__.py
new file mode 100644
index 0000000000..46887cb7a5
--- /dev/null
+++ b/tests/parser/__init__.py
@@ -0,0 +1,17 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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 .
diff --git a/tests/parser/test_html.py b/tests/parser/test_html.py
new file mode 100644
index 0000000000..b9138f3cf1
--- /dev/null
+++ b/tests/parser/test_html.py
@@ -0,0 +1,147 @@
+#  Pyrogram - Telegram MTProto API Client Library for Python
+#  Copyright (C) 2017-present Dan 
+#
+#  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.parser.html import HTML
+
+
+# expected: the expected unparsed HTML
+# text: original text without entities
+# entities: message entities coming from the server
+
+def test_html_unparse_bold():
+    expected = "bold"
+    text = "bold"
+    entities = pyrogram.types.List(
+        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=4)])
+
+    assert HTML.unparse(text=text, entities=entities) == expected
+
+
+def test_html_unparse_italic():
+    expected = "italic"
+    text = "italic"
+    entities = pyrogram.types.List(
+        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.ITALIC, offset=0, length=6)])
+
+    assert HTML.unparse(text=text, entities=entities) == expected
+
+
+def test_html_unparse_underline():
+    expected = "underline"
+    text = "underline"
+    entities = pyrogram.types.List(
+        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=0, length=9)])
+
+    assert HTML.unparse(text=text, entities=entities) == expected
+
+
+def test_html_unparse_strike():
+    expected = "strike"
+    text = "strike"
+    entities = pyrogram.types.List(
+        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.STRIKETHROUGH, offset=0, length=6)])
+
+    assert HTML.unparse(text=text, entities=entities) == expected
+
+
+def test_html_unparse_spoiler():
+    expected = "spoiler"
+    text = "spoiler"
+    entities = pyrogram.types.List(
+        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.SPOILER, offset=0, length=7)])
+
+    assert HTML.unparse(text=text, entities=entities) == expected
+
+
+def test_html_unparse_url():
+    expected = 'URL'
+    text = "URL"
+    entities = pyrogram.types.List([pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.TEXT_LINK,
+                                                                 offset=0, length=3, url='https://pyrogram.org/')])
+
+    assert HTML.unparse(text=text, entities=entities) == expected
+
+
+def test_html_unparse_code():
+    expected = 'code'
+    text = "code"
+    entities = pyrogram.types.List(
+        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.CODE, offset=0, length=4)])
+
+    assert HTML.unparse(text=text, entities=entities) == expected
+
+
+def test_html_unparse_pre():
+    expected = """
for i in range(10):
+    print(i)
""" + + text = """for i in range(10): + print(i)""" + + entities = pyrogram.types.List([pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.PRE, offset=0, + length=32, language='python')]) + + assert HTML.unparse(text=text, entities=entities) == expected + + +def test_html_unparse_mixed(): + expected = "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd" \ + "eeeeeeeeeeffffffffffgggggggggghhhhhhhhhh" + text = "aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhh" + entities = pyrogram.types.List( + [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=14), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.ITALIC, offset=7, length=7), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=10, length=4), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=14, length=9), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.ITALIC, offset=14, length=9), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=23, length=10), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.STRIKETHROUGH, offset=30, length=3), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.STRIKETHROUGH, offset=33, length=10), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.SPOILER, offset=38, length=5), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.SPOILER, offset=43, length=10), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.CODE, offset=57, length=10)]) + + assert HTML.unparse(text=text, entities=entities) == expected + + +def test_html_unparse_escaped(): + expected = "<b>bold</b>" + text = "bold" + entities = pyrogram.types.List( + [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=11)]) + + assert HTML.unparse(text=text, entities=entities) == expected + + +def test_html_unparse_escaped_nested(): + expected = "<b>bold <u>underline</u> bold</b>" + text = "bold underline bold" + entities = pyrogram.types.List( + [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=33), + pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=8, length=16)]) + + assert HTML.unparse(text=text, entities=entities) == expected + + +def test_html_unparse_no_entities(): + expected = "text" + text = "text" + entities = [] + + assert HTML.unparse(text=text, entities=entities) == expected diff --git a/tests/test_file_id.py b/tests/test_file_id.py new file mode 100644 index 0000000000..96152e48ca --- /dev/null +++ b/tests/test_file_id.py @@ -0,0 +1,194 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 pytest + +from pyrogram.file_id import FileId, FileUniqueId, FileType, FileUniqueType + + +def check(file_id: str, expected_file_type: FileType): + decoded = FileId.decode(file_id) + + assert decoded.file_type == expected_file_type + assert decoded.encode() == file_id + + +def check_unique(file_unique_id: str, expected_file_unique_type: FileUniqueType): + decoded = FileUniqueId.decode(file_unique_id) + + assert decoded.file_unique_type == expected_file_unique_type + assert decoded.encode() == file_unique_id + + +def test_audio(): + audio = "CQACAgIAAx0CAAGgr9AAAgmQX7b4XPBstC1fFUuJBooHTHFd7HMAAgUAA4GkuUnVOGG5P196yR4E" + audio_unique = "AgADBQADgaS5SQ" + audio_thumb = "AAMCAgADHQIAAaCv0AACCZBftvhc8Gy0LV8VS4kGigdMcV3scwACBQADgaS5SdU4Ybk_X3rJIH3qihAAAwEAB20AA_OeAQABHgQ" + audio_thumb_unique = "AQADIH3qihAAA_OeAQAB" + + check(audio, FileType.AUDIO) + check_unique(audio_unique, FileUniqueType.DOCUMENT) + check(audio_thumb, FileType.THUMBNAIL) + check_unique(audio_thumb_unique, FileUniqueType.PHOTO) + + +def test_video(): + video = "BAACAgIAAx0CAAGgr9AAAgmRX7b4Xv9f-4BK5VR_5ppIOF6UIp0AAgYAA4GkuUmhnZz2xC37wR4E" + video_unique = "AgADBgADgaS5SQ" + video_thumb = "AAMCAgADHQIAAaCv0AACCZFftvhe_1_7gErlVH_mmkg4XpQinQACBgADgaS5SaGdnPbELfvBIH3qihAAAwEAB20AA_WeAQABHgQ" + video_thumb_unique = "AQADIH3qihAAA_WeAQAB" + + check(video, FileType.VIDEO) + check_unique(video_unique, FileUniqueType.DOCUMENT) + check(video_thumb, FileType.THUMBNAIL) + check_unique(video_thumb_unique, FileUniqueType.PHOTO) + + +def test_document(): + document = "BQACAgIAAx0CAAGgr9AAAgmPX7b4UxbjNoFEO_L0I4s6wrXNJA8AAgQAA4GkuUm9FFvIaOhXWR4E" + document_unique = "AgADBAADgaS5SQ" + document_thumb = "AAMCAgADHQIAAaCv0AACCY9ftvhTFuM2gUQ78vQjizrCtc0kDwACBAADgaS5Sb0UW8ho6FdZIH3qihAAAwEAB3MAA_GeAQABHgQ" + document_thumb_unique = "AQADIH3qihAAA_GeAQAB" + + check(document, FileType.DOCUMENT) + check_unique(document_unique, FileUniqueType.DOCUMENT) + check(document_thumb, FileType.THUMBNAIL) + check_unique(document_thumb_unique, FileUniqueType.PHOTO) + + +def test_animation(): + animation = "CgACAgIAAx0CAAGgr9AAAgmSX7b4Y2g8_QW2XFd49iUmRnHOyG8AAgcAA4GkuUnry9gWDzF_5R4E" + animation_unique = "AgADBwADgaS5SQ" + + check(animation, FileType.ANIMATION) + check_unique(animation_unique, FileUniqueType.DOCUMENT) + + +def test_voice(): + voice = "AwACAgIAAx0CAAGgr9AAAgmUX7b4c1KQyHVwzffxC2EnSYWsMAQAAgkAA4GkuUlsZUZ4_I97AR4E" + voice_unique = "AgADCQADgaS5SQ" + + check(voice, FileType.VOICE) + check_unique(voice_unique, FileUniqueType.DOCUMENT) + + +def test_video_note(): + video_note = "DQACAgIAAx0CAAGgr9AAAgmVX7b53qrRzCEO13BaLQJaYuFbdlwAAgoAA4GkuUmlqIzDy_PCsx4E" + video_note_unique = "AgADCgADgaS5SQ" + video_note_thumb = "AAMCAgADHQIAAaCv0AACCZVftvneqtHMIQ7XcFotAlpi4Vt2XAACCgADgaS5SaWojMPL88KzIH3qihAAAwEAB20AA_meAQABHgQ" + video_note_thumb_unique = "AQADIH3qihAAA_meAQAB" + + check(video_note, FileType.VIDEO_NOTE) + check_unique(video_note_unique, FileUniqueType.DOCUMENT) + check(video_note_thumb, FileType.THUMBNAIL) + check_unique(video_note_thumb_unique, FileUniqueType.PHOTO) + + +def test_sticker(): + sticker = "CAACAgEAAx0CAAGgr9AAAgmWX7b6uFeLlhXEgYrM8pIbGaQKRQ0AAswBAALjeAQAAbeooNv_tb6-HgQ" + sticker_unique = "AgADzAEAAuN4BAAB" + sticker_thumb = "AAMCAQADHQIAAaCv0AACCZZftvq4V4uWFcSBiszykhsZpApFDQACzAEAAuN4BAABt6ig2_-1vr5gWNkpAAQBAAdtAAM0BQACHgQ" + sticker_thumb_unique = "AQADYFjZKQAENAUAAg" + + check(sticker, FileType.STICKER) + check_unique(sticker_unique, FileUniqueType.DOCUMENT) + check(sticker_thumb, FileType.THUMBNAIL) + check_unique(sticker_thumb_unique, FileUniqueType.PHOTO) + + +def test_photo(): + photo_small = "AgACAgIAAx0CAAGgr9AAAgmZX7b7IPLRl8NcV3EJkzHwI1gwT-oAAq2nMRuBpLlJPJY-URZfhTkgfeqKEAADAQADAgADbQADAZ8BAAEeBA" + photo_small_unique = "AQADIH3qihAAAwGfAQAB" + photo_medium = "AgACAgIAAx0CAAGgr9AAAgmZX7b7IPLRl8NcV3EJkzHwI1gwT-oAAq2nMRuBpLlJPJY-URZfhTkgfeqKEAADAQADAgADeAADAp8BAAEeBA" + photo_medium_unique = "AQADIH3qihAAAwKfAQAB" + photo_big = "AgACAgIAAx0CAAGgr9AAAgmZX7b7IPLRl8NcV3EJkzHwI1gwT-oAAq2nMRuBpLlJPJY-URZfhTkgfeqKEAADAQADAgADeQAD_54BAAEeBA" + photo_big_unique = "AQADIH3qihAAA_-eAQAB" + + check(photo_small, FileType.PHOTO) + check_unique(photo_small_unique, FileUniqueType.PHOTO) + check(photo_medium, FileType.PHOTO) + check_unique(photo_medium_unique, FileUniqueType.PHOTO) + check(photo_big, FileType.PHOTO) + check_unique(photo_big_unique, FileUniqueType.PHOTO) + + +def test_chat_photo(): + user_photo_small = "AQADAgADrKcxGylBBQAJIH3qihAAAwIAAylBBQAF7bDHYwABnc983KcAAh4E" + user_photo_small_unique = "AQADIH3qihAAA9ynAAI" + user_photo_big = "AQADAgADrKcxGylBBQAJIH3qihAAAwMAAylBBQAF7bDHYwABnc983qcAAh4E" + user_photo_big_unique = "AQADIH3qihAAA96nAAI" + + chat_photo_small = "AQADAgATIH3qihAAAwIAA3t3-P______AAjhngEAAR4E" + chat_photo_small_unique = "AQADIH3qihAAA-GeAQAB" + chat_photo_big = "AQADAgATIH3qihAAAwMAA3t3-P______AAjjngEAAR4E" + chat_photo_big_unique = "AQADIH3qihAAA-OeAQAB" + + channel_photo_small = "AQADAgATIH3qihAAAwIAA-fFwCoX____MvARg8nvpc3RpwACHgQ" + channel_photo_small_unique = "AQADIH3qihAAA9GnAAI" + channel_photo_big = "AQADAgATIH3qihAAAwMAA-fFwCoX____MvARg8nvpc3TpwACHgQ" + channel_photo_big_unique = "AQADIH3qihAAA9OnAAI" + + check(user_photo_small, FileType.CHAT_PHOTO) + check_unique(user_photo_small_unique, FileUniqueType.PHOTO) + check(user_photo_big, FileType.CHAT_PHOTO) + check_unique(user_photo_big_unique, FileUniqueType.PHOTO) + + check(chat_photo_small, FileType.CHAT_PHOTO) + check_unique(chat_photo_small_unique, FileUniqueType.PHOTO) + check(chat_photo_big, FileType.CHAT_PHOTO) + check_unique(chat_photo_big_unique, FileUniqueType.PHOTO) + + check(channel_photo_small, FileType.CHAT_PHOTO) + check_unique(channel_photo_small_unique, FileUniqueType.PHOTO) + check(channel_photo_big, FileType.CHAT_PHOTO) + check_unique(channel_photo_big_unique, FileUniqueType.PHOTO) + + +def test_old_file_id(): + old = "BQADBAADQNKSZqjl5DcROGn_eu5JtgAEAgAEAg" + check(old, FileType.DOCUMENT) + + +def test_unknown_file_type(): + unknown = "RQACAgIAAx0CAAGgr9AAAgmPX7b4UxbjNoFEO_L0I4s6wrXNJA8AAgQAA4GkuUm9FFvIaOhXWR4E" + + with pytest.raises(ValueError, match=r"Unknown file_type \d+ of file_id \w+"): + check(unknown, FileType.DOCUMENT) + + +def test_unknown_thumbnail_source(): + unknown = "AAMCAgADHQIAAaCv0AACCY9ftvhTFuM2gUQ78vQjizrCtc0kDwACBAADgaS5Sb0UW8ho6FdZIH3qihAAA6QBAAIeBA" + + with pytest.raises(ValueError, match=r"Unknown thumbnail_source \d+ of file_id \w+"): + check(unknown, FileType.THUMBNAIL) + + +def test_stringify_file_id(): + file_id = "BQACAgIAAx0CAAGgr9AAAgmPX7b4UxbjNoFEO_L0I4s6wrXNJA8AAgQAA4GkuUm9FFvIaOhXWR4E" + string = "{'major': 4, 'minor': 30, 'file_type': , 'dc_id': 2, " \ + "'file_reference': b'\\x02\\x00\\xa0\\xaf\\xd0\\x00\\x00\\t\\x8f_\\xb6\\xf8S\\x16\\xe36\\x81D;\\xf2\\xf4#\\x8b:\\xc2\\xb5\\xcd$\\x0f', " \ + "'media_id': 5312458109417947140, 'access_hash': 6437869729085068477, 'thumbnail_size': ''}" + + assert str(FileId.decode(file_id)) == string + + +def test_stringify_file_unique_id(): + file_unique_id = "AgADBAADgaS5SQ" + string = "{'file_unique_type': , 'media_id': 5312458109417947140}" + + assert str(FileUniqueId.decode(file_unique_id)) == string