python-telegram-bot
16.3K subscribers
91 links
The official channel for the python-telegram-bot library | https://python-telegram-bot.org
Download Telegram
As promised, we bring you API 4.4 support!

We've just released v12.1.0
Thanks for anyone who've contributed to this release.

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

Major changes:

* Bot API 4.4 support (#1464, #1510)
* Add get_file method to Animation & ChatPhoto. Add get_small_file & get_big_file methods to ChatPhoto (#1489)
* Tools for deep linking (#1049)

Minor changes and/or bug fixes:

* Documentation fixes (#1500, #1499)
* Improved examples (#1502)
We've just released v12.1.1

This is an hotfix release for #1517

As usual upgrade using pip install -U python-telegram-bot
Forwarded from Poolitzer X
Fellow programmers.

Happy #hacktoberfest. This event, hosted over here, is about giving back to open source projects. We encourage you all to check it out and make some contributions. We prepared some issues by ourself, they can be found here, but fear not to take on other issues in our repo.

If you have any questions, feel free to ask them away in our chats, we are there to help!
We've just released v12.2.0
Thanks for anyone who've contributed to this release.

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

New features:

- Nested ConversationHandlers (#1512).

Minor changes, CI improvments or bug fixes:

- Fix CI failures due to non-backward compat attrs depndency (#1540).
- travis.yaml: TEST_OFFICIAL removed from allowed_failures.
- Fix typos in examples (#1537).
- Fix Bot.to_dict to use proper first_name (#1525).
- Refactor test_commandhandler.py (#1408).
- Add Python 3.8 (RC version) to Travis testing matrix (#1543).
- test_bot.py: Add to_dict test (#1544).
- Flake config moved into setup.cfg (#1546).
Hi all,

As you might know python 2.7.x will reach its end of life on January 1st 2020. We will follow this by also stopping support for python 2.7. Commits made to the library after this date will no longer be tested for version 2.7 support and python 3.x specific features will be accepted in PRs.
Be advised that if you're still using python 2.7 and you want to keep using our library in the new year, it's time for you to move on.
We've just released v12.3.0
Thanks for anyone who've contributed to this release.

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

New features:
- Filters.caption allows only messages with caption (#1631).
- Filter for exact messages/captions with new capability of Filters.text and Filters.caption. Especially useful in combination with ReplyKeyboardMarkup. (#1631).

Major changes:
- Fix inconsistent handling of naive datetimes (#1506).

Minor changes, CI improvments or bug fixes:
- Documentation fixes (#1558, #1569, #1579, #1572, #1566, #1577, #1656).
- Add mutex protection on ConversationHandler (#1533).
- Add MAX_PHOTOSIZE_UPLOAD constant (#1560).
- Add args and kwargs to Message.forward() (#1574).
- Transfer to GitHub Actions CI (#1555, #1556, #1605, #1606, #1607, #1612, #1615, #1645).
- Fix deprecation warning with Py3.8 by vendored urllib3 (#1618).
- Simplify assignements for optional arguments (#1600)
- Allow private groups for Message.link (#1619).
- Fix wrong signature call for ConversationHandler.TIMEOUT handlers (#1653).
We've just released v12.4.0
Thanks for anyone who've contributed to this release.

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

New features:

- Set default values for arguments appearing repeatedly. We also have a [wiki page for the new defaults](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Adding-defaults-to-your-bot). (#1490)
- Store data in CallbackContext.bot_data to access it in every callback. Also persists. (#1325)
- Filters.poll allows only messages containing a poll (#1673)

Major changes:

- Filters.text now accepts messages that start with a slash, because CommandHandler checks for MessageEntity.BOT_COMMAND since v12. This might lead to your MessageHandlers receiving more updates than before (#1680).
- Filters.command new checks for MessageEntity.BOT_COMMAND instead of just a leading slash. Also by Filters.command(False) you can now filters for messages containing a command anywhere in the text (#1744).

Minor changes, CI improvements or bug fixes:

- Add disptacher argument to Updater to allow passing a customized Dispatcher (#1484)
- Add missing names for Filters (#1632)
- Documentation fixes (#1624, #1647, #1669, #1703, #1718, #1734, #1740, #1642, #1739, #1746)
- CI improvements (#1716, #1731, #1738, #1748, #1749, #1750, #1752)
- Fix spelling issue for encode_conversations_to_json (#1661)
- Remove double assignement of Dispatcher.job_queue (#1698)
- Expose dispatcher as property for CallbackContext (#1684)
- Fix None check in JobQueue._put() (#1707)
- Log datetimes correctly in JobQueue (#1714)
- Fix false Message.link creation for private groups (#1741)
- Add option --with-upstream-urllib3 to setup.py to allow using non-vendored version (#1725)
- Fix persistence for nested ConversationHandlers (#1679)
- Improve handling of non-decodable server responses (#1623)
- Fix download for files without file_path (#1591)
- test_webhook_invalid_posts is now considered flaky and retried on failure (#1758)
Quick release v12.4.1

#1744 was accidentally left out of v12.4.0 though mentioned in the release notes.
Now this PR is merged.

Upgrade using: pip install -U python-telegram-bot
Bug fixes release 12.4.2

Thanks for bringing these to our attention:

* Pass correct parse_mode to InlineResults if bot.defaults is None (#1763)
* Make sure PicklePersistence can read files that dont have bot_data (#1760)

Upgrade using: pip install -U python-telegram-bot
We've just released v12.5
Thanks for anyone who've contributed to this release.

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

New Features:

- Bot.link gives the t.me link of the bot (#1770)

Major Changes:

- Bot API 4.5 and 4.6 support. (#1508, #1723)

Minor changes, CI improvements or bug fixes:

- Remove legacy CI files (#1783, #1791)
- Update pre-commit config file (#1787)
- Remove builtin names (#1792)
- CI improvements (#1808, #1848)
- Support Python 3.8 (#1614, #1824)
- Use stale bot for auto closing stale issues (#1820, #1829, #1840)
- Doc fixes (#1778, #1818)
- Fix typo in edit_message_media (#1779)
- In examples, answer CallbackQueries and use edit_message_text shortcut (#1721)
- Revert accidental change in vendored urllib3 (#1775)
We've just released v12.5.1
Thanks for anyone who've contributed to this release.

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

Minor changes, doc fixes or bug fixes:

- Add missing docs for PollHandler and PollAnswerHandler (#1853)
- Fix wording in Filters docs (#1855)
- Reorder tests to make them more stable (#1835)
- Make ConversationHandler attributes immutable (#1756)
- Make PrefixHandler attributes command and prefix editable (#1636)
- Fix UTC as default tzinfo for Job (#1696)
We've just released v12.6
Thanks for anyone who've contributed to this release.

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

Major Changes:

- Bot API 4.7 support. Note: In Bot.create_new_sticker_set and Bot.add_sticker_to_set, the order of the parameters had be changed, as the png_sticker parameter is now optional. (#1858)

Minor changes, CI improvements or bug fixes:

- Add tests for swtich_inline_query(_current_chat) with empty string (#1635)
- Doc fixes (#1854, #1874, #1884)
- Update issue templates (#1880)
- Favor concrete types over "Iterable" (#1882)
- Pass last valid CallbackContext to TIMEOUT handlers of ConversationHandler (#1826)
- Tweak handling of persistence and update persistence after job calls (#1827)
- Use checkout@v2 for GitHub actions (#1887)
We've just released v12.6.1

This is a bug fix release. As usual, upgrade using pip install -U python-telegram-bot

Thanks for bringing this to our attention:

- Fix serialization of reply_markup in media messages (#1889)
We've just released v12.7
Thanks for anyone who've contributed to this release.

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

Major Changes:

- Bot API 4.8 support. Note: The Dice object now has a second positional argument emoji. This is relevant, if you instantiate Dice objects manually. (#1917)
- Added tzinfo argument to helpers.from_timestamp. It now returns an timezone aware object. This is relevant for Message.{date,forward_date,edit_date}, Poll.close_date and ChatMember.until_date (#1621)

New Features:

- New method run_mothly for the JobQueue (#1705)
- Job.next_t now gives the datetime of the jobs next execution (#1685)

Minor changes, CI improvements, doc fixes or bug fixes:

- Stabalize CI (#1919, #1931)
- Use ABCs @abstractmethod instead of raising NotImplementedError for Handler, BasePersistence and BaseFilter (#1905)
- Doc fixes (#1914, #1902, #1910)
We've just released v12.8
Thanks for anyone who've contributed to this release.

⚠️ As announced in 11/2019, we discontinued support for Python 2 since the start of 2020, as it reached end of life. In correspondence with that, this release now actually removes support for Python 2, making python-telegram-bot a Python 3 only library.
Be advised that if you're still using Python 2 and you want to keep using this library, it's time for you to move on.

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

Major Changes:

- Remove Python 2 support (#1715)
- Bot API 4.9 support (#1980)
- IDs/Usernames of Filters.user and Filters.chat can now be updated (#1757)

Minor changes, CI improvements, doc fixes or bug fixes:

- Update contribution guide and stale bot (#1937)
- Remove NullHandlers (#1913)
- Improve and expand examples (#1943, #1995, #1983, #1997)
- Doc fixes (#1940, #1962)
- Add User.send_poll() shortcut (#1968)
- Ignore private attributes en TelegramObject.to_dict() (#1989)
- Stabilize CI (#2000)
We've just released v13.0. 🥳

It's a major release and brings some major changes.
⚠️ So before upgrading with pip install -U python-telegram-bot as usual, please carefully read the following notes!
You can also find a detailed transition guide on this wiki page.

We'd like to thank everyone, who has contributed to this release!

Major Changes:

v13 presents two massive improvements to our library: Static type hinting and a reworked JobQueue. The first one will be a huge advancement for anyone writing complex programs with an IDE that supports proper auto completion. This will hopefully save you a lot of debugging time. The latter will not directly affect you in most cases. However, we no longer implement the scheduling logic on our own, but use the third party library APSchelduler instead. This enables us to focus our development effort onto other parts of the library. Detailed information on the new JobQueue can be found here.

- Refactor JobQueue (#1981)
- Type Hinting (#1920)

⚠️ v13 also refactors how persistence of Bots is handled. Anyone using PicklePersistence (or a custom persistence class)
should read this paragraph of the transition guide.

- Refactor persistence of Bot instances (#1994)

⚠️ There have been some more reworks and deprecations listed below. Additionally, v13.0 drops Python 3.5, which reached its end of life at the beginning of September 2020.

- Deprecate old-style callbacks, i.e. set use_context=True by default (#2050)
- Refactor Handling of Message VS Update Filters (#2032)
- Deprecate Message.default_quote (#1965)
- Refactor handling of kwargs in Bot methods (#1924)
- Refactor Dispatcher.run_async, deprecating the @run_async decorator (#2051)

New Features:

Besides the big changes, v13 brings some new functionality. Especially noteworthy are the automatic pagination for answer_inline_query, which takes care of the maximum number of InlineResults for you, and the addition of tzinfo to the Defaults setup, which integrates nicely into the new JobQueue.

- Automatic Pagination for answer_inline_query (#2072)
- Defaults.tzinfo (#2042)
- Extend rich comparison of objects (#1724)
- Add Filters.via_bot (#2009)
- Add missing shortcuts (#2043)
- Allow DispatcherHandlerStop in ConversationHandler (#2059)
- Make Errors picklable (#2106 by Delgan)

Minor changes, CI improvements, doc fixes or bug fixes:

Last, but not least, there have been a bunch of smaller additions and improvements to the documentation.

- Fix Webhook not working on Windows with Python 3.8+ (#2067)
- Fix setting thumbs with send_media_group (#2093)
- Make MessageHandler filter for Filters.update first (#2085)
- Fix PicklePersistence.flush() with only bot_data (#2017)
- Add test for clean argument of Updater.start_polling/webhook (#2002 by ikkemaniac)
- Doc fixes, refinements and additions (#2005 by ikkemaniac, #2008, #2089, #2094, #2090)
- CI fixes (#2018, #2061)
- Refine pollbot.py example (#2047 by lrezende)
- Refine Filters in examples (#2027)
- Rename echobotcode> examples (#2025)
- Use Lock-Bot to lock old threads (#2048, #2052, #2049, #2053)
The v13 release is not just a release either, it is also our official announcement of participation in the annual #hacktoberfest. 💻🥨
We know that we're a few days late to the party, but v13 had to get ready before. 😉

This year, the fest is opt-in for projects and we definitely want to opt into taking part in this great event! 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.

We already prepared some issues on our repositories and aim towards opening more issues for starters, but feel free to begin a hunt for improvements and fixes by yourself!
Hi there!
Small announcement:

With high regards to @Poolitzer dedication and contribution to the project, we (the active and emeritus maintainers) have decided to give him a more official role/title: Community Liaison.

Thank you Poolitzer for being with us in the last year 😊
The PTB-ecosystem is growing!

Over time, we have seen a lot of awesome code from the community, ranging from custom handlers to additional convenience methods and full grown extension packages, and we're always eager to see how PTB is used for this wide variety of use cases.

While some of you made feature requests or even pull requests to add additional functionality to PTB, we often had to decline them as those features were too specific for a general purpose library and maintaining them would have resulted in a big amount of extra work. Sadly this leads to a lot of code being written all over again by users.

This is why we're happy to announce a new library: ptbcontrib - a place for community based extensions. Let us describe the idea of ptbcontrib in a few bullet points:

• Everyone is welcome to contribute!
• No releases - ptbcontrib is installed directly from GitHub. So no waiting for maintainers to make time for a release
• No limit on 3rd party requirements: Your contribution is welcome to rely on other libraries

We hope to encourage exchange of code within the PTB community with this library and are looking forward to your involvement. You wrote a date picker menu? Cool! An anonymous forward method? We love it. A database-based persistence class? The holy grail!

Have a look at the contribution guide and the example contribution and you're ready to go. Happy coding!
We've just released v13.1.
Thank you to everyone who contributed to this release.

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

This version brings the long awaited support for Bot API 5.0. PTB now handles all of the long Bot API changelog and provides convenience utilities such as shortcuts for Bot.copy and Filters.sender_chat. Of course PTB also allows you to use your own self hosted Bot API instance. For a full overview on that, please head over to the corresponding wiki page.

Besides the API updates, v13.1 brings Defaults.run_async, making it easy to run all handler callbacks and error handlers asynchronously, and some new filters. Note that Filters.private and Filters.group where deprecated in favor of Filters.chat_type.

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

Major Changes:

• Full support of Bot API 5.0 (#2181, #2186, #2190, #2189, #2183, #2184 by harshil21, #2188, #2185, #2192, #2196, #2193, #2223, #2199, #2187, #2147 by NikitaPirate, #2205)

New Features:

• Add Defaults.run_async (#2210 by starry69)
• Improve and Expand CallbackQuery Shortcuts (#2172)
• Add XOR Filters and make Filters.name a Property (#2179)
• Add Filters.document.file_extension (#2169 by eIGato)
• Add Filters.caption_regex (#2163 by marc0777)
• Add Filters.chat_type (#2128 by GauthamramRavichandran)
• Handle Non-Binary File Input (#2202)

Bug Fixes:

• Improve Handling of Custom Objects in BasePersistence.insert/replace_bot (#2151)
• Fix bugs in replace/insert_bot (#2218)

Minor changes, CI improvements, doc fixes and type hinting:

• Improve Type hinting (#2204, #2118 by harshil21, #2167 by eIGato, #2136)
• Doc Fixes & Extensions (#2201, #2161)
• Use F-Strings Where Possible (#2222)
• Rename kwargs to _kwargs where possible (#2182)
• Comply with PEP561 (#2168)
• Improve Code Quality (#2131)
• Switch Code Formatting to Black (#2122, #2159, #2158)
• Update Wheel Settings (#2142 by michael-k)
• Update timerbot.py to v13.0 (#2149 by timqsh)
• Overhaul Constants (#2137 by NikitaPirate)
• Add Python 3.9 to Test Matrix (#2132)
• Switch Codecov to GitHub Action (#2127)
• Specify Required pytz Version (#2121 by Konano)