python-telegram-bot
15.6K subscribers
90 links
The official channel for the python-telegram-bot library | https://python-telegram-bot.org
Download Telegram
We've just released v13.7.
Thank you to everyone who contributed to this release.

As usual, upgrade using pip install -U python-telegram-bot.

This release brings full support for Bot API 5.3. Note that Bot.get_chat_member and Chat.get_member now return an instance of a subclass of ChatMember.

⚠️ Due to the changes in the API update, we made three kinds of deprecations:

Bot.{kick_chat_member, get_chat_members_count} were deprecated in favor of the new methods Bot.{ban_chat_member, get_chat_member_count}. Analogously, Chat.{kick_member, get_members_count} were deprecated in favor of the new methods Chat.{ban_member, get_member_count}.
• Because ChatMember is now merely a base class for the 6 new ChatMember* subclasses, most of its arguments and attributes were deprecated (except for status and user, which are common to all subclasses). Once we drop these attributes, this will also affect the subclasses due to inheritance. Therefore, you should check which type of ChatMember* you have and only access the attributes that exist for that type of ChatMember*. For this you can either check the type (isinstance(…)) or check the status.
• As Bot.get_my_commands can now return a different set of commands depending on the scope and language code, it doesn't make sense anymore to cache the commands in Bot.commands. We therefore deprecated this convenience property.

For the full list of changes and improvements, please see below.

Please note that this is the last planned 13.x.y release. We are now starting to work towards v14 and will only make another 13.x.y release if there are serious bugs to be fixed or API updates to implement. As stated in our announcement from January, we don't know how long development for v14 will take. We expect v14 to be ready sometime in 2022.

Major Changes:

• Full support for Bot API 5.3 (#2572)

Bug Fixes:

• Fix Bug in BasePersistence.insert/replace_bot for Objects with __dict__ in their slots (#2561)
• Remove Incorrect Warning About Defaults and ExtBot (#2553)

Minor changes, CI improvements, Doc fixes and Type hinting:

• Type Hinting Fixes (#2552)
• Doc Fixes (#2551)
• Improve Deprecation Warning for __slots__ (#2574)
• Stabilize CI (#2575)
• Fix Coverage Configuration (#2571)
• Better Exception-Handling for BasePersistence.replace/insert_bot (#2564 by zeroone2numeral2)
• Remove Deprecated pass_args from Deeplinking Example (#2550)
In some parts of the world it's already 1st of October and this means: It's time for Hacktoberfest! 💻🥨

Hacktoberfest is an event that encourages open source developers to contribute to repositories through pull requests. If you ever thought about starting coding or giving back to your favourite open source repositories, now is the time! Head over to the hacktoberfest website to learn more about it.

Of course, this is also a great opportunity to contribute to python-telegram-bot 🙂 We already prepared some issues on our repositories, but feel free to begin a hunt for improvements and fixes by yourself! We'd like to especially point out issue #2633, which is about improving our documentation. This issue has several aspects that can be tackled in multiple pull requests and it's great for first time contributors.

⚠️ If you want to tackle an issue, please be sure to
• first comment on that issue so that we can assign you to it and avoid duplicate pull requests for the same issue by several people.
• read this version of the contribution guide
• base your branch on the v14 branch and not on the master branch (see here). This is important, as we're currently working towards a breaking release and the v14 branch already contains some notable changes from master.
True to the Hacktoberfest spirit, we want to try something related to the development of our library: A development group. If you want to start developing something for PTB, you are welcome to join it! We can have some informal discussion about your code changes or provide quick help if you are stuck somewhere.

Some notes regarding this group:
• This is a test. If it doesn't work out/no one uses it, we will shut it down again.
• This will not replace GitHub or the existing groups. It should provide a low barrier entry to the joyful world of PTB development.
• This group is aimed at people who have specific questions regarding the development of PTB and would like to actively participate in the former. Therefore we will keep a closer look at the member list than in the user group.

That out of the way, here is the link: @pythontelegrambotdev
Hacktoberfest is coming to an end and we're happy to report that 13 contributions where proposed by first-time contributors, 10 of which have already been merged. We want to sincerely thank everyone who participated in this event!

Of course contributions are just as welcome after Hacktoberfest ends 🙃 Feel free to join us in the development group chat and we'll be happy to get you started.
We've just released v13.8.
Thank you to everyone who contributed to this release.

As usual, upgrade using pip install -U python-telegram-bot.

This release brings support for Bot API 5.4 as well as some bug fixes.

For the full list of changes and improvements, please see below.

Please note that we are currently working towards v14 and will only make another 13.x.y release if there are serious bugs to be fixed or API updates to implement. As stated in our announcement from January, we don't know how long development for v14 will take. We expect v14 to be ready sometime in 2022.

Major Changes:

• Full support for API 5.4 (#2767)

Minor changes, CI improvements, Doc fixes and Type hinting:

• Create Issue Template Forms (#2689 by abxhr)
• Fix camelCase Functions in ExtBot (#2659 by OctoNezd)
• Fix Empty Captions not Being Passed by Bot.copy_message (#2651 by DonalDuck004)
• Fix Setting Thumbs When Uploading A Single File (#2583 by paradox70)
• Fix Bug in BasePersistence.insert/replace_bot for Objects with __dict__ not in __slots__ (#2603)
We've just released v13.8.1.

As usual, upgrade using pip install -U python-telegram-bot.

This is a hotfix release that adds the classes telegram.ChatJoinRequest and telegram.ext.ChatJoinRequest to the documentation, that where introduced in v13.8.

Doc fixes:

• Add ChatJoinRequest(Handler) to Docs (#2771)
We've just released v13.9.
Thank you to everyone who contributed to this release.

As usual, upgrade using pip install -U python-telegram-bot.

This release brings support for Bot API 5.5.
⚠️ There are a few things to mention about the API update. Since API 5.5 is online,

• it is impossible to forward messages from some chats. Use the attributes Message/Chat.has_protected_content to check this.
• users are able to send messages on behalf of channels they own. Bots are expected to use the attribute Message.sender_chat to correctly support such messages.
• Bots are allowed to contact users who sent a join request to a chat where the bot is an administrator with the ChatMemberAdministrator.can_invite_users administrator right – even if the user never interacted with the bot before.
• users can be mentioned by their ID in inline keyboards. This will only work in Telegram versions released after December 7, 2021. Older clients will display unsupported message.

For the full list of changes and improvements, please see below.

Please note that we are currently working towards v14 and will only make another 13.x.y release if there are serious bugs to be fixed or API updates to implement. As stated in our announcement from January, we don't know how long development for v14 will take. We expect v14 to be ready sometime in 2022.

Major Changes:

• Full Support for API 5.5 (#2809)

Minor Changes:

• Adjust Automated Locking of Inactive Issues (#2775)
We've just released v13.10.
Thank you to everyone who contributed to this release.

As usual, upgrade using pip install -U python-telegram-bot.

This release brings support for Bot API 5.6.

For the full list of changes and improvements, please see below.

Please note that we are currently working towards v14 and will only make another 13.x.y release if there are serious bugs to be fixed or API updates to implement. As stated in our announcement from January 2021, we don't know how long development for v14 will take. We expect v14 to be ready sometime in 2022.

Major Changes:

• Full Support for API 5.6 (#2835)

Minor Changes & Doc fixes:

• Update Copyright to 2022 (#2836)
• Update Documentation of BotCommand (#2820)
Hi.

Occasionally the developer team of PTB is being asked about the status of the ptbtest library, which is intended to help write unit tests for bots built with python-telegram-bot.

ptbtest is currently not maintained and not compatible with recent PTB versions. The former maintainer has transferred the ownership of the repository to PTBs dev team. However, we have no resources to maintain ptbtest in addition to PTB.

Since we have seen some interest from the community in the continuation of ptbtest, we would like to start a search for a new maintainer/developer team. A new maintainer/dev team would be responsible for adapting ptbtest to new PTB releases, fixing bugs in ptbtest and releasing new versions to PyPi when appropriate. Of course a new maintainer/dev team would be given the appropriate access rights and ownerships. Please note that we are looking for people, who are willing to be committed to the project in the mid to long term, i.e. rather a few years than a few month. Moreover, ptbtest is currently a pure spare-time project, so a maintainer/dev team would not get paid for their work (as is the case for python-telegram-bot).

As our goal is for the library to maintained by members of the PTB community, we would prefer to intervene as little as possible in the search for a new maintainer/dev team. We therefore created a group chat where you can get in contact with other interested people and exchange about your different insights on ptbtest, Python packaging and open source development. To join the chat, please contact @BiboJoshi, @Poolitzer or @Hoppingturtles.

Of course, we'd like to make sure for ptbtest to be in good hands. On the other hand, deciding who the right maintainer/dev team might be, is not easy. E.g. we are aware that there are some forks of ptbtest, but we are not familiar with the exact status of each fork. We therefore decided on the following procedure:

This search for a maintainer/dev team will stay open until the end of April. Until then, we ask the members of the group chat (see above) to elect one maintainer and optionally additional members of the development team. We expect the maintainer to be able to demonstrate experience with Python packaging, open source development and familiarity with ptbtest. If for example the elected person has published a non-trivial package on PyPi or is already a maintainer of another library (Python or other language) and uses ptbtest elaborately in as existing project or even has worked with the ptbtest source before, we can safely assume that these requirements are fulfilled. The cherry on the cake would be if the elected maintainer/dev team already submit some initial work on ptbtest until end of April.

We emphasize that we ask for one maintainer to be elected who we can grant the access rights and ownerships.

We are very looking forward to your involvement and hope that ptbtest will be continued.

Your PTB Developer Team
We've just released v13.11.
Thank you to everyone who contributed to this release.

As usual, upgrade using pip install -U python-telegram-bot.

This release brings full support for Bot API 5.7.

For the full list of changes and improvements, please see below.

Please note that we are currently working towards v14 and will only make another 13.x.y release if there are serious bugs to be fixed or API updates to implement. As stated in our announcement from January 2021, we don't know how long development for v14 will take. We expect v14 to be ready sometime in 2022.

Major Changes:

• Full Support for Bot API 5.7 (#2881)
Hi.

Many of you are eagerly waiting for the promised asyncio release. The developers team has been working on this for quite some time now and we are happy to say that the "14" release is closing in.

Many of you will also know that Telegram released an API update earlier today. So far we have added support for new API updates to version 13 rather quickly. However, each API update has slowed down the development of v14.

As the 6.0 API update is a relatively large one and an asyncio release is rather close at hand, we have decided to postpone adding support for the new API update until after an asyncio release is out. Our specific plan is as follows:

1️⃣ We do our best to get a v14 release out as fast as possible. This will be a pre-release.
2️⃣ We add support for Bot API 6.0 to v14.
3️⃣ We backport Bot API 6.0 to v13.
4️⃣ We positively consider backporting any Bot API updates to v13 as long as there is no stable v14 release. The backports may take more time than the updates for v14. If the development team has too few resources or the updates are too big, we may have to abandon API updates for v13 in favour of improving v14.

We are aware that our decision may not be convenient for everyone. We hope that you can understand that we aim to advance our library and not delay the asyncio release any more.

Sincerely,
the PTB development team
We've just released v20.0a0. 🥳
A big thank you to everyone who contributed to this release.

asyncio has arrived and with it major redesigns of our code base.

The release notes and changelogs are way too long to fit in a channel post, so this time we published them over at telegra.ph.
Please do not upgrade before reading the release notes!
python-telegram-bot
Hi. Occasionally the developer team of PTB is being asked about the status of the ptbtest library, which is intended to help write unit tests for bots built with python-telegram-bot. ptbtest is currently not maintained and not compatible with recent PTB…
Unfortunately, our call for maintainers for ptbtest was not successful. We therefore decided that the first person who reaches out to us and wants to take over maintenance of ptbtest will be granted the corresponding access rights and ownerships. We still expect that person to demonstrate a minimum level of experience with Python packaging, open source development and familiarity with ptbtest.
We've just released v13.12.
Thank you to everyone who contributed to this release.

To upgrade from v13.x to v13.12, use pip install -U python-telegram-bot.

Please note that we have recently published the pre-release v20.0a0 and the focus of our development efforts is directed at v20. Our plans for the future of v13 are explained in the v20.0a0 release notes.

Major Changes:

• Full Support for API 6.0 (#3027)
⚠️ Note that all parameters, attributes and classes with voice_chat/VoiceChat in their name have been renamed to video_chat/VideoChat in order to comply with the Bot API update. The old names have been kept for backwards compatibility. Also note that after the next API update, only HTTPS links will be allowed in the login_url argument of InlineKeyboardButton.
• Drop Support for Python 3.6 (#3027)

Minor Changes:

• Documentation Improvements (#3029)
We've just released v20.0a1.
Thank you to everyone who contributed to this release.

If you want to upgrade from v20.0a0 to v20.0a1, please carefully read the notes below before upgrading with pip install -U --pre python-telegram-bot.
Before upgrading from v13.x to v20.0a1, please carefully read the v20.0a0 release notes.

This update brings a few breaking changes compared to v20.0a0, but none of them are as disruptive as the changes introduced in v20.0a0. Let us highlight a few of them:

CallbackContext.DEFAULT_TYPE was moved to ContextTypes.DEFAULT_TYPE.
• Support for ujson was dropped. If you want to use a 3rd party JSON library, you can do so by using a custom implementation of BaseRequest.
• The day argument of JobQueue.run_daily was changed to align with cron, i.e. 0 is now Sunday and 6 is Saturday
• The context argument of JobQueue.run_* was renamed to data and similarly for Job.context - in hopes of avoiding confusion in the future.

This release also brings some new features, including Application.post_init to effortlessly execute asyncio code on startup and version info in the style of sys.version_info.

For the full list of changes and improvements, please see below.

Major Changes:

• Drop Support for ujson and instead BaseRequest.parse_json_payload (#3037, #3072)
• Drop InputFile.is_image (#3053)
• Drop Explicit Type conversions in __init__ s (#3056)
• Handle List-Valued Attributes More Consistently (#3057)
• Split {Command, Prefix}Handler And Make Attributes Immutable (#3045)
• Align Behavior Of JobQueue.run_daily With cron (#3046 by jcnecio)
• Make PTB Specific Keyword-Only Arguments for PTB Specific in Bot methods (#3035 by tal66)
• Adjust Equality Comparisons to Fit Bot API 6.0 (#3033)
• Add Tuple Based Version Info (#3030)- Improve Type Annotations for CallbackContext and Move Default Type Alias to ContextTypes.DEFAULT_TYPE (#3017, #3023)
• Rename Job.context to Job.data (#3028 by aditya-yadav-27)
• Rename Handler to BaseHandler (#3019)

New Features:

• Add Application.post_init (#3078)
• Add Arguments chat/user_id to CallbackContext And Example On Custom Webhook Setups (#3059)
• Add Convenience Property Message.id (#3077 by dglitxh)
• Add Example for WebApp (#3052)
• Rename telegram.bot_api_version to telegram.__bot_api_version__ (#3030)

Bug Fixes:

• Fix Non-Blocking Entry Point in ConversationHandler (#3068)
• Escape Backslashes in escape_markdown (#3055)

Dependencies:

• Update httpx requirement from ~=0.22.0 to ~=0.23.0 (#3069)
• Update cachetools requirement from ~=5.0.0 to ~=5.2.0 (#3058, #3080)

Minor Changes, Documentation Improvements and CI:

• Move Examples To Documentation (#3089)
• Documentation Improvements and Update Dependencies (#3010, #3007 by KnorpelSenf, #3012, #3067 by Aditya-Rajgor, #3081, #3082)
• Improve Some Unit Tests (#3026)
• Update Code Quality dependencies (#3070, #3032,#2998, #2999)
• Don't Set Signal Handlers On Windows By Default (#3065)
• Split {Command, Prefix}Handler And Make Attributes Immutable (#3045)
• Apply isort and Update pre-commit.ci Configuration (#3049)
• Adjust pre-commit Settings for isort (#3043)
• Add Version Check to Examples (#3036)
• Use Collection Instead of List and Tuple (#3025)
• Remove Client-Side Parameter Validation (#3024)
• Don't Pass Default Values of Optional Parameters to Telegram (#2978)
• Stabilize Application.run_* on Python 3.7 (#3009)
• Ignore Code Style Commits in git blame (#3003)
• Adjust Tests to Changed API Behavior (#3002)
We've just released v20.0a2.
Thank you to everyone who contributed to this release.

If you want to upgrade from v20.0a1 to v20.0a2, please upgrade with pip install -U --pre python-telegram-bot.
Before upgrading from v13.x to v20.0a2, please carefully read the v20.0a0 release notes.

This update brings full support for Bot API 6.1 along with some minor, non-breaking changes.

Note that a backport of API 6.1 to v13.x will be released before the end of this week.

For the full list of changes and improvements, please see below.

Major Changes

• Full Support for API 6.1 (#3112)

New Features

• Add Additional Shortcut Methods to Chat (#3115 by aditya-yadav-27)
• Mermaid-based Example State Diagrams (#3090 by cyc8)

Minor Changes, Documentation Improvements and CI

• Documentation Improvements (#3103, #3121 by ExalFabu, #3098 by david-shiko)
• Stabilize CI (#3119)
• Bump pyupgrade from 2.32.1 to 2.34.0 (#3096)
• Bump furo from 2022.6.4 to 2022.6.4.1 (#3095)
• Bump mypy from 0.960 to 0.961 (#3093)
We've just released v13.13.
Thank you to everyone who contributed to this release.

To upgrade from v13.x to v13.13, use pip install -U python-telegram-bot.

Please note that we have recently published the pre-release v20.0a0 and the focus of our development efforts is directed at v20. Our plans for the future of v13 are explained in the v20.0a0 release notes.

Major Changes:

• Full Support for API 6.1 (#3117)
We've just released v20.0a3.
Thank you to everyone who contributed to this release.

If you want to upgrade from v20.0a2 to v20.0a3, please upgrade with pip install -U --pre python-telegram-bot.
Before upgrading from v13.x to v20.0a3, please carefully read the v20.0a0 release notes.

This update brings full support for Bot API 6.2. It also brings a brand-new mechanism for rate limiting API requests. This is a replacement for the former MessageQueue and is well-integrated into the PTB framework. Also check out our updated wiki page on this topic!

Major Changes

• Full Support for API 6.2 (#3195)

New Features

• New Rate Limiting Mechanism (#3148)
• Make chat/user_data Available in Error Handler for Errors in Jobs (#3152)
• Add Application.post_shutdown (#3126 by ExalFabu)

Bug Fixes

• Fix helpers.mention_markdown for Markdown V1 and Improve Related Unit Tests (#3155)
• Add api_kwargs Parameter to Bot.log_out and Improve Related Unit Tests (#3147)
• Make Bot.delete_my_commands a Coroutine Function (#3136)
• Fix ConversationHandler.check_update not respecting per_user (#3128)

Minor Changes, Documentation Improvements and CI

• Add Python 3.11 to Test Suite & Adapt Enum Behaviour (#3168)
• Drop Manual Token Validation (#3167)
• Simplify Unit Tests for Bot.send_chat_action (#3151)
• Drop pre-commit Dependencies from requirements-dev.txt (#3120)
• Change Default Values for concurrent_updates and connection_pool_size (#3127)
• Documentation Improvements (#3139, #3153 by pawanrai9999, #3135 by aditya-yadav-27)
• Type Hinting Fixes (#3202)

Dependencies

• Bump sphinx from 5.0.2 to 5.1.1 (#3177)
• Update pre-commit Dependencies (#3085)
• Bump pytest-asyncio from 0.18.3 to 0.19.0 (#3158)
• Update tornado requirement from ~=6.1 to ~=6.2 (#3149)
• Bump black from 22.3.0 to 22.6.0 (#3132)
• Bump actions/setup-python from 3 to 4 (#3131)
We've just released v20.0a4.

This is a hot fix release for a bug in setup.py that prevented optional dependencies from being recognized correctly.

If you want to upgrade from v20.0a3 to v20.0a4, please upgrade with pip install -U --pre python-telegram-bot.
Before upgrading from v13.x to v20.0a4, please carefully read the v20.0a0 release notes.

• Fix a Bug in setup.py Regarding Optional Dependencies (#3209)
We've just released v13.14.
Thank you to everyone who contributed to this release.

As usual, upgrade using pip install -U python-telegram-bot.

Please note that we have recently published the pre-release v20.0a0 and the focus of our development efforts is directed at v20. Our plans for the future of v13 are explained in the v20.0a0 release notes.

Major Changes:

• Full Support for API 6.2 (#3203)

Minor Changes:

• Documentation Improvements (#3144, #3140 by javad94, #3164 by javad94)
• Pin tornado to Version 6.1 (#3145)