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
.tgsformat. 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
unsaveparameter 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
PhotoSizetype 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 usemessage.photo.file_idto get the highest quality available, all the other sizes are kept as a list of thumbnails in thethumbsattribute.All applicable media now have a
thumbsattribute 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.1559742628→2019-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_verifiedis_restrictedis_scamis_support(user only).
Bug Fixes#
export_chat_invite_link() wasn’t working on basic groups.
Breaking Changes#
Renamed
UserProfilePhotosto just ProfilePhotos for brevity, but also because such object can now store profile photos from both users and chats.Due to internal server changes, the file_id format of all photo-like objects has changed. Types affected are Thumbnail, ChatPhoto and Photo.
Renamed some methods:
delete_user_profile_photos()→ delete_profile_photos()get_user_profile_photos()→ get_profile_photos()set_user_profile_photo()→ set_profile_photo()get_user_profile_photos_count()→ get_profile_photos_count()