Pyrogram v0.12.0#
Welcome Inline Mode, Layer 97 and many other additions#
New Features#
The API Schema has been updated to Layer 97.
The new Inline Mode makes it possible to create bots that answer to inline queries. For now, only InlineQueryResultArticle is supported, more types coming soon! https://github.com/pyrogram/assistant contains the source code of @PyrogramBot you can explore. Use the bot inline to search for Pyrogram docs directly on Telegram.
New update_username() and update_chat_username() methods to set/update/remove usernames of your own account and chats (supergroups/channels) (contributed by @bakatrouble in #208).
New
bot_token
Client parameter to start a bot session (contributed by @bakatrouble in #221).New send_cached_media() method to send any media stored on the Telegram servers using a file_id.
New ChatPermissions type to represent both chats’ default permissions and chat members’ permissions.
New restrict_chat() method used to edit a chat default permissions.
Lots of new (21) Message bound methods: reply_animation(), reply_audio() , reply_cached_media() , reply_chat_action() , reply_contact() , reply_document() , reply_game() , reply_inline_bot_result() , reply_location() , reply_media_group() , reply_photo() , reply_poll() , reply_sticker() , reply_venue() , reply_video() , reply_video_note() , reply_voice() , edit_caption() , edit_media() , edit_reply_markup() and pin() (contributed by @xsolinsx in #233).
Enhancements#
Added Python
__slots__
in every single type to help reduce the memory footprint.The send_media_group() method will now return a Messages object.
Added a retry mechanism when uploading file chunks.
The get_contacts() method will now return a list of User objects.
Embedded an updated version of typing.py as an attempt to fix Python 3.5.0-3.5.2 issues.
All
send_*
methods dealing with media messages (audio, document, animation, etc…) will now always send the correct Telegram media kind, regardless of the uploaded file.Keyboard buttons’ texts are now automatically coerced to
str
.The join_chat() method will now return a Chat object (contributed by @bakatrouble in #206).
Use a lower timeout when starting a session to speed up re-connections.
Updated the restrict_chat_member() method with new permissions and made it return a Chat object.
Printed object (e.g.: when using
print(message)
) will now display UTF-8 characters instead of ASCII representations of their code points.You can now forward messages as copy with the new
as_copy
parameter in forward_messages() method and Message.forward() bound method (contributed by @bakatrouble in #227 ).Added support for forwarded messages with hidden users; the new
forward_from_name
attribute of a Message will contain the user first name only (as string) of the author as opposed to a full User object.
Bug Fixes#
Fixed a loss of thumbnails after editing media messages (contributed by @23rd in #216).
Fixed plugins not working under Windows because of broken paths (contributed by @bakatrouble in #223).
Fixed “ModuleNotFoundError is not defined” error for Python <3.6.
Fixed the get_chat_member() method not working when passing “me” in basic groups.
Fixed flood wait errors generated when iterating over basic chat members.
Fixed library not loading for Python 3.5.0-3.5.2 (contributed by @Bfaschat in #236).
Fixed set_chat_description() not working anymore after the new Layer update.
Breaking Changes#
When using raw functions and types, you now must fill in the parameters using named arguments.
The
errors
package has been moved; it is now importable withfrom pyrogram import errors
, and theError
exception has been renamed to RPCError.