{"id":13461895,"url":"https://github.com/python-telegram-bot/python-telegram-bot","last_synced_at":"2025-05-12T17:43:35.141Z","repository":{"id":34719635,"uuid":"38696925","full_name":"python-telegram-bot/python-telegram-bot","owner":"python-telegram-bot","description":"We have made you a wrapper you can't refuse","archived":false,"fork":false,"pushed_at":"2025-05-05T09:34:22.000Z","size":16539,"stargazers_count":27438,"open_issues_count":22,"forks_count":5635,"subscribers_count":603,"default_branch":"master","last_synced_at":"2025-05-05T15:09:37.528Z","etag":null,"topics":["bot","chatbot","framework","python","telegram"],"latest_commit_sha":null,"homepage":"https://python-telegram-bot.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-telegram-bot.png","metadata":{"files":{"readme":"README.rst","changelog":"changes/22.0_2025-03-15/4671.7B3boYRvHdGzsrZgkpKp7B.toml","contributing":".github/CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.rst","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-07-07T15:30:39.000Z","updated_at":"2025-05-05T11:50:36.000Z","dependencies_parsed_at":"2023-10-03T19:41:25.879Z","dependency_job_id":"3af27c1e-fbe3-4537-b62e-528112813356","html_url":"https://github.com/python-telegram-bot/python-telegram-bot","commit_stats":{"total_commits":2384,"total_committers":195,"mean_commits":"12.225641025641025","dds":0.8171140939597316,"last_synced_commit":"300ec920a186345590811f685f42ef9597d946f2"},"previous_names":[],"tags_count":125,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-telegram-bot%2Fpython-telegram-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-telegram-bot%2Fpython-telegram-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-telegram-bot%2Fpython-telegram-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-telegram-bot%2Fpython-telegram-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-telegram-bot","download_url":"https://codeload.github.com/python-telegram-bot/python-telegram-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253009990,"owners_count":21839718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","chatbot","framework","python","telegram"],"created_at":"2024-07-31T12:00:26.778Z","updated_at":"2025-05-12T17:43:33.216Z","avatar_url":"https://github.com/python-telegram-bot.png","language":"Python","readme":".. image:: https://raw.githubusercontent.com/python-telegram-bot/logos/master/logo-text/png/ptb-logo-text_768.png\n   :align: center\n   :target: https://python-telegram-bot.org\n   :alt: python-telegram-bot Logo\n\n.. image:: https://img.shields.io/pypi/v/python-telegram-bot.svg\n   :target: https://pypi.org/project/python-telegram-bot/\n   :alt: PyPi Package Version\n\n.. image:: https://img.shields.io/pypi/pyversions/python-telegram-bot.svg\n   :target: https://pypi.org/project/python-telegram-bot/\n   :alt: Supported Python versions\n\n.. image:: https://img.shields.io/badge/Bot%20API-8.3-blue?logo=telegram\n   :target: https://core.telegram.org/bots/api-changelog\n   :alt: Supported Bot API version\n\n.. image:: https://img.shields.io/pypi/dm/python-telegram-bot\n   :target: https://pypistats.org/packages/python-telegram-bot\n   :alt: PyPi Package Monthly Download\n\n.. image:: https://app.readthedocs.org/projects/python-telegram-bot/badge/?version=stable\n   :target: https://docs.python-telegram-bot.org/en/stable/\n   :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/l/python-telegram-bot.svg\n   :target: https://www.gnu.org/licenses/lgpl-3.0.html\n   :alt: LGPLv3 License\n\n.. image:: https://github.com/python-telegram-bot/python-telegram-bot/actions/workflows/unit_tests.yml/badge.svg?branch=master\n   :target: https://github.com/python-telegram-bot/python-telegram-bot/\n   :alt: Github Actions workflow\n\n.. image:: https://codecov.io/gh/python-telegram-bot/python-telegram-bot/branch/master/graph/badge.svg\n   :target: https://app.codecov.io/gh/python-telegram-bot/python-telegram-bot\n   :alt: Code coverage\n\n.. image:: https://isitmaintained.com/badge/resolution/python-telegram-bot/python-telegram-bot.svg\n   :target: https://isitmaintained.com/project/python-telegram-bot/python-telegram-bot\n   :alt: Median time to resolve an issue\n\n.. image:: https://api.codacy.com/project/badge/Grade/99d901eaa09b44b4819aec05c330c968\n   :target: https://app.codacy.com/gh/python-telegram-bot/python-telegram-bot/dashboard\n   :alt: Code quality: Codacy\n\n.. image:: https://results.pre-commit.ci/badge/github/python-telegram-bot/python-telegram-bot/master.svg\n   :target: https://results.pre-commit.ci/latest/github/python-telegram-bot/python-telegram-bot/master\n   :alt: pre-commit.ci status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/psf/black\n   :alt: Code Style: Black\n\n.. image:: https://img.shields.io/badge/Telegram-Channel-blue.svg?logo=telegram\n   :target: https://t.me/pythontelegrambotchannel\n   :alt: Telegram Channel\n\n.. image:: https://img.shields.io/badge/Telegram-Group-blue.svg?logo=telegram\n   :target: https://telegram.me/pythontelegrambotgroup\n   :alt: Telegram Group\n\nWe have made you a wrapper you can't refuse\n\nWe have a vibrant community of developers helping each other in our `Telegram group \u003chttps://telegram.me/pythontelegrambotgroup\u003e`_. Join us!\n\n*Stay tuned for library updates and new releases on our* `Telegram Channel \u003chttps://telegram.me/pythontelegrambotchannel\u003e`_.\n\nIntroduction\n------------\n\nThis library provides a pure Python, asynchronous interface for the\n`Telegram Bot API \u003chttps://core.telegram.org/bots/api\u003e`_.\nIt's compatible with Python versions **3.9+**.\n\nIn addition to the pure API implementation, this library features several convenience methods and shortcuts as well as a number of high-level classes to\nmake the development of bots easy and straightforward. These classes are contained in the\n``telegram.ext`` submodule.\n\nAfter installing_ the library, be sure to check out the section on `working with PTB`_.\n\nTelegram API support\n~~~~~~~~~~~~~~~~~~~~\n\nAll types and methods of the Telegram Bot API **8.3** are natively supported by this library.\nIn addition, Bot API functionality not yet natively included can still be used as described `in our wiki \u003chttps://github.com/python-telegram-bot/python-telegram-bot/wiki/Bot-API-Forward-Compatibility\u003e`_.\n\nNotable Features\n~~~~~~~~~~~~~~~~\n\n- `Fully asynchronous \u003chttps://github.com/python-telegram-bot/python-telegram-bot/wiki/Concurrency\u003e`_\n- Convenient shortcut methods, e.g. `Message.reply_text \u003chttps://docs.python-telegram-bot.org/en/stable/telegram.message.html#telegram.Message.reply_text\u003e`_\n- `Fully annotated with static type hints \u003chttps://github.com/python-telegram-bot/python-telegram-bot/wiki/Type-Checking\u003e`_\n- `Customizable and extendable interface \u003chttps://github.com/python-telegram-bot/python-telegram-bot/wiki/Architecture\u003e`_\n- Seamless integration with `webhooks \u003chttps://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks\u003e`_ and `polling \u003chttps://docs.python-telegram-bot.org/en/stable/telegram.ext.application.html#telegram.ext.Application.run_polling\u003e`_\n- `Comprehensive documentation and examples \u003c#working-with-ptb\u003e`_\n\nInstalling\n----------\n\nYou can install or upgrade ``python-telegram-bot`` via\n\n.. code:: shell\n\n    $ pip install python-telegram-bot --upgrade\n\nTo install a pre-release, use the ``--pre`` `flag \u003chttps://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-pre\u003e`_ in addition.\n\nYou can also install ``python-telegram-bot`` from source, though this is usually not necessary.\n\n.. code:: shell\n\n    $ git clone https://github.com/python-telegram-bot/python-telegram-bot\n    $ cd python-telegram-bot\n    $ pip install build\n    $ python -m build\n\nVerifying Releases\n~~~~~~~~~~~~~~~~~~\n\nTo enable you to verify that a release file that you downloaded was indeed provided by the ``python-telegram-bot`` team, we have taken the following measures.\n\nStarting with v21.4, all releases are signed via `sigstore \u003chttps://www.sigstore.dev\u003e`_.\nThe corresponding signature files are uploaded to the `GitHub releases page`_.\nTo verify the signature, please install the `sigstore Python client \u003chttps://pypi.org/project/sigstore/\u003e`_ and follow the instructions for `verifying signatures from GitHub Actions \u003chttps://github.com/sigstore/sigstore-python?tab=readme-ov-file\u003e`_. As input for the ``--repository`` parameter, please use the value ``python-telegram-bot/python-telegram-bot``.\n\nEarlier releases are signed with a GPG key.\nThe signatures are uploaded to both the `GitHub releases page`_ and the `PyPI project \u003chttps://pypi.org/project/python-telegram-bot/\u003e`_ and end with a suffix ``.asc``.\nPlease find the public keys `here \u003chttps://github.com/python-telegram-bot/python-telegram-bot/tree/master/public_keys\u003e`_.\nThe keys are named in the format ``\u003cfirst_version\u003e-\u003clast_version\u003e.gpg``.\n\nIn addition, the GitHub release page also contains the sha1 hashes of the release files in the files with the suffix ``.sha1``.\n\nDependencies \u0026 Their Versions\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n``python-telegram-bot`` tries to use as few 3rd party dependencies as possible.\nHowever, for some features using a 3rd party library is more sane than implementing the functionality again.\nAs these features are *optional*, the corresponding 3rd party dependencies are not installed by default.\nInstead, they are listed as optional dependencies.\nThis allows to avoid unnecessary dependency conflicts for users who don't need the optional features.\n\nThe only required dependency is `httpx ~= 0.27 \u003chttps://www.python-httpx.org\u003e`_ for\n``telegram.request.HTTPXRequest``, the default networking backend.\n\n``python-telegram-bot`` is most useful when used along with additional libraries.\nTo minimize dependency conflicts, we try to be liberal in terms of version requirements on the (optional) dependencies.\nOn the other hand, we have to ensure stability of ``python-telegram-bot``, which is why we do apply version bounds.\nIf you encounter dependency conflicts due to these bounds, feel free to reach out.\n\nOptional Dependencies\n#####################\n\nPTB can be installed with optional dependencies:\n\n* ``pip install \"python-telegram-bot[passport]\"`` installs the `cryptography\u003e=39.0.1 \u003chttps://cryptography.io/en/stable\u003e`_ library. Use this, if you want to use Telegram Passport related functionality.\n* ``pip install \"python-telegram-bot[socks]\"`` installs `httpx[socks] \u003chttps://www.python-httpx.org/#dependencies\u003e`_. Use this, if you want to work behind a Socks5 server.\n* ``pip install \"python-telegram-bot[http2]\"`` installs `httpx[http2] \u003chttps://www.python-httpx.org/#dependencies\u003e`_. Use this, if you want to use HTTP/2.\n* ``pip install \"python-telegram-bot[rate-limiter]\"`` installs `aiolimiter~=1.1,\u003c1.3 \u003chttps://aiolimiter.readthedocs.io/en/stable/\u003e`_. Use this, if you want to use ``telegram.ext.AIORateLimiter``.\n* ``pip install \"python-telegram-bot[webhooks]\"`` installs the `tornado~=6.4 \u003chttps://www.tornadoweb.org/en/stable/\u003e`_ library. Use this, if you want to use ``telegram.ext.Updater.start_webhook``/``telegram.ext.Application.run_webhook``.\n* ``pip install \"python-telegram-bot[callback-data]\"`` installs the `cachetools\u003e=5.3.3,\u003c5.6.0 \u003chttps://cachetools.readthedocs.io/en/latest/\u003e`_ library. Use this, if you want to use `arbitrary callback_data \u003chttps://github.com/python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data\u003e`_.\n* ``pip install \"python-telegram-bot[job-queue]\"`` installs the `APScheduler\u003e=3.10.4,\u003c3.12.0 \u003chttps://apscheduler.readthedocs.io/en/3.x/\u003e`_ library. Use this, if you want to use the ``telegram.ext.JobQueue``.\n\nTo install multiple optional dependencies, separate them by commas, e.g. ``pip install \"python-telegram-bot[socks,webhooks]\"``.\n\nAdditionally, two shortcuts are provided:\n\n* ``pip install \"python-telegram-bot[all]\"`` installs all optional dependencies.\n* ``pip install \"python-telegram-bot[ext]\"`` installs all optional dependencies that are related to ``telegram.ext``, i.e. ``[rate-limiter, webhooks, callback-data, job-queue]``.\n\nWorking with PTB\n----------------\n\nOnce you have installed the library, you can begin working with it - so let's get started!\n\nQuick Start\n~~~~~~~~~~~\n\nOur Wiki contains an `Introduction to the API \u003chttps://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API\u003e`_ explaining how the pure Bot API can be accessed via ``python-telegram-bot``.\nMoreover, the `Tutorial: Your first Bot \u003chttps://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions---Your-first-Bot\u003e`_ gives an introduction on how chatbots can be easily programmed with the help of the ``telegram.ext`` module.\n\nResources\n~~~~~~~~~\n\n- The `package documentation \u003chttps://docs.python-telegram-bot.org/\u003e`_ is the technical reference for ``python-telegram-bot``.\n  It contains descriptions of all available classes, modules, methods and arguments as well as the `changelog \u003chttps://docs.python-telegram-bot.org/changelog.html\u003e`_.\n- The `wiki \u003chttps://github.com/python-telegram-bot/python-telegram-bot/wiki/\u003e`_ is home to number of more elaborate introductions of the different features of ``python-telegram-bot`` and other useful resources that go beyond the technical documentation.\n- Our `examples section \u003chttps://docs.python-telegram-bot.org/examples.html\u003e`_ contains several examples that showcase the different features of both the Bot API and ``python-telegram-bot``.\n  Even if it is not your approach for learning, please take a look at ``echobot.py``. It is the de facto base for most of the bots out there.\n  The code for these examples is released to the public domain, so you can start by grabbing the code and building on top of it.\n- The `official Telegram Bot API documentation \u003chttps://core.telegram.org/bots/api\u003e`_ is of course always worth a read.\n\nGetting help\n~~~~~~~~~~~~\n\nIf the resources mentioned above don't answer your questions or simply overwhelm you, there are several ways of getting help.\n\n1. We have a vibrant community of developers helping each other in our `Telegram group \u003chttps://telegram.me/pythontelegrambotgroup\u003e`_. Join us! Asking a question here is often the quickest way to get a pointer in the right direction.\n\n2. Ask questions by opening `a discussion \u003chttps://github.com/python-telegram-bot/python-telegram-bot/discussions/new\u003e`_.\n\n3. You can even ask for help on Stack Overflow using the `python-telegram-bot tag \u003chttps://stackoverflow.com/questions/tagged/python-telegram-bot\u003e`_.\n\nConcurrency\n~~~~~~~~~~~\n\nSince v20.0, ``python-telegram-bot`` is built on top of Pythons ``asyncio`` module.\nBecause ``asyncio`` is in general single-threaded, ``python-telegram-bot`` does currently not aim to be thread-safe.\nNoteworthy parts of ``python-telegram-bots`` API that are likely to cause issues (e.g. race conditions) when used in a multi-threaded setting include:\n\n* ``telegram.ext.Application/Updater.update_queue``\n* ``telegram.ext.ConversationHandler.check/handle_update``\n* ``telegram.ext.CallbackDataCache``\n* ``telegram.ext.BasePersistence``\n* all classes in the ``telegram.ext.filters`` module that allow to add/remove allowed users/chats at runtime\n\nContributing\n------------\n\nContributions of all sizes are welcome.\nPlease review our `contribution guidelines \u003chttps://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst\u003e`_ to get started.\nYou can also help by `reporting bugs or feature requests \u003chttps://github.com/python-telegram-bot/python-telegram-bot/issues/new/choose\u003e`_.\n\nDonating\n--------\nOccasionally we are asked if we accept donations to support the development.\nWhile we appreciate the thought, maintaining PTB is our hobby, and we have almost no running costs for it. We therefore have nothing set up to accept donations.\nIf you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead.\n\nLicense\n-------\n\nYou may copy, distribute and modify the software provided that modifications are described and licensed for free under `LGPL-3 \u003chttps://www.gnu.org/licenses/lgpl-3.0.html\u003e`_.\nDerivative works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.\n\n.. _`GitHub releases page`: https://github.com/python-telegram-bot/python-telegram-bot/releases\n","funding_links":[],"categories":["Bot Libraries","Python","Development","Career Path","网络服务","Third-party Web APIs","Libraries","📚 فهرست","Bots","一般机器人（bots）","📦 Additional Python Libraries"],"sub_categories":["Bot Development","网络服务_其他","Unofficial","Telegram","ساخت بات تلگرام","Python","Bot Libs","机器人类库","Miscellaneous"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-telegram-bot%2Fpython-telegram-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-telegram-bot%2Fpython-telegram-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-telegram-bot%2Fpython-telegram-bot/lists"}