Pyrogram v1.1#

Layer 122, Performance gains, Bot API file ids and more#

Notable Changes#

  • The API schema has been updated to Layer 122 adding support for group calls (voice chats), channel comments, multiple message pins, message replies and more.

  • Performance improvements: some critical parts were optimized to allow the async event loop running smoother; other parts have been optimized as well to avoid unnecessary computations.

  • Added support for the newest Bot API file ids: the file_ref parameter is now useless and has been removed from the API in favour of a single file_id parameter. A file_unique_id parameter has also been added to media types, making Pyrogram file ids 100% compatible with the Bot API. This means all file ids (old and new) you take or might have taken from the Bot API will work with Pyrogram, and vice-versa.

  • Pyrogram’s raw API reference docs have been enhanced: you can now find a description to methods, types and constructors, as well as each combinator’s argument (when available and applicable). This will allow people to better understand how to use the vast Telegram low-level API.

  • Pyrogram is now fully independent on the system clock. This means that any modification to the system clock will not make Pyrogram misbehave anymore because the internal clock used is now synced with Telegram servers instead.

  • Added initial automated test suites for Python 3.6, 3.7, 3.8 and 3.9 in Linux, Windows and macOS environments.

  • Added the new method copy_message and the bound method Message.copy. This will replace the feature found in forward_messages “as_copy=True” by also enhancing its behaviour.

  • Added the ability to manually pass text entities to methods instead of specifying the parse_mode.

  • Added support for anonymous messages: added the sender_chat attribute to Message objects.

  • Added support for anonymous chat members: added is_anonymous attribute to ChatMember.

  • Added the ability to search for pinned messages in a chat with search_messages.

  • Added support for InputMediaAudio and InputMediaDocument in albums. To be used to send audio and documents inside media groups.

  • Added support for multiple pins and the ability to pin messages in private chats.

  • Pyrogram objects are now pickable (contributed by @GodSaveTheDoge in #526).

  • Added bio attribute in Chat objects. When using get_chat, expect the bio attributed to be set for users and the description attribute for other chats.

  • Added the method unpin_all_chat_messages to unpin all pinned messages in a chat.

  • Added support for the new football and slot machine animations for the random dice.

  • Added the new method get_media_group (contributed by @Legenda24 in #550).

  • Improved typing hints throughout the library (contributed by @alissonlauffer in #537).

  • Added ttl_seconds support for send_video and Message.reply_video (contributed by @drizzt in #556).

Bugfixes & Enhancements#

  • Made new_chat_photo downloadable (contributed by @GodSaveTheDoge #508).

  • Enhanced filters.me to allow it intercept own anonymous messages (contributed by @M-Smits in #501).

  • Added a missing parameter in Message.reply_poll (contributed by @SpEcHiDe in #507) .

  • Skip empty messages when parsing dialogs (contributed by @JosXa in #555).

  • Added a nicer error in case of unknown constructors.

  • Added schedule_date parameter to send_media_group.

  • Fixed filters.user and filters.chat breaking when no initial collection is passed.

  • Fixed idle() not working in windows.

  • Added some missing await keywords.

  • Fixed media captions being displayed as “None” for inline media results when no caption was passed.

  • Reverted to input for passwords and added the hide_password parameter to Client.

  • Added the sleep_threshold parameter to the send() method.

  • Decreased the default sleep threshold from 60 to 10 seconds.

  • Fixed some “invalid escape” warnings.

  • Enabled passing sleep_threshold=0 to always raise flood waits.

  • Fixed a bad f-string usage causing the text parser to break.

  • Fixed an issue causing inline callback queries to fail.

  • Removed TLObject as super class for base types.

  • Added the attribute dc_id to Chat objects.

  • Fixed get_profile_photos not working properly in channels.

  • Added a warning to users in case they try to use base types as arguments.

  • Fixed dispatcher not obeying to the INFO logging level.

  • Added force_document argument for send_document.

  • Fixed get_profile_photos not working correctly in case of no chat photos.

  • Fixed clock issues when running on AWS Lambda.

  • Fixed get_messages not working with list of ids in case the first message was empty.

  • Changed the default filter for get/iter_chat_members to “recent”.

  • Fixed the raw API not being properly imported when using repr/eval.

  • Various improvements when using Pyrogram in a sync context.

  • Fixed sync callback progress not working properly for downloads.