Pyrogram v0.14.1#

Layer 100 and Performance Improvements#

New Features#

  • API Schema updated to Layer 100.

  • Pyrogram is now able to handle message floods without slowing down. While there’s still a lot of room for extra performance, thanks to the community and in particular to @Talocan who helped with load tests, I was able to fix this major bottleneck which would have slowed down the library in case of huge amount of messages received - we are talking about 50-80 messages per second, which is quite a lot for a single user/bot to handle.

  • Added get_user_dc() to get a user’s assigned DC (Data Center).

  • Added read_history() to read (marking as read, double-tick) a chat history.

  • Added Filters.callback_data to filter callback query data (contributed by @ColinTheShark in #248 ).

  • Added send_animated_sticker() to send the new Telegram animated stickers in .tgs format. Note: this is still an experimental feature, not even all official clients properly support animated stickers and Telegram has not announced anything yet about this new feature.

  • Added iter_profile_photos() to iterate over a user or a chat profile photos sequentially.

  • Added a new section in the documentation: Debugging and Release Notes.

  • Added new FAQs in the documentation.

  • Added easter eggs.

Enhancements#

  • Added the unsave parameter to send_animation(). Pass True in order to remove the GIF animation from your own collection (the server automatically adds them).

  • Bare lists, such as [1, 2, 3, 4, 5] when coming from the Telegram raw API are now printed nicely.

  • The PhotoSize type has been replaced by Thumbnail, a much more interesting and useful name.

  • The Photo type has been revamped: forget message.photo.sizes[-1].file_id, you can now simply use message.photo.file_id to get the highest quality available, all the other sizes are kept as a list of thumbnails in the thumbs attribute.

  • All applicable media now have a thumbs attribute to store all the available thumbnails (there can be more than one, sorted by ascending size).

  • When printing Pyrogram objects, phone numbers are now hidden and each digit replaced with a star *. E.g. 391234567890************. Date attributes are shown as human-readable dates instead of a unix timestamps. E.g. 15597426282019-06-05 15:50:28. Note this is just a visual modification, when accessing the inner attributes, you will still get the same values (full number, unix timestamp).

  • get_profile_photos() and get_profile_photos_count() now work for both users and chats.

  • Chat and User types have new attributes:

    • is_verified

    • is_restricted

    • is_scam

    • is_support (user only).

Bug Fixes#

Breaking Changes#