Pyrogram v1.3

Docs Dark mode, Reactions, Spoiler Texts and more

Security Update

A team of cryptographers at ETH Zürich (Switzerland) 1 has performed a security analysis of Pyrogram’s implementation of the MTProto 2.0 protocol, which resulted in a discovery of a vulnerability. More in details: the implementation was missing some checks listed here https://core.telegram.org/mtproto/security_guidelines#checking-msg-id. The vulnerability has been promptly patched within the usual industry practice of a 90-day disclosure period. All users are strongly encouraged to update to the latest version of Pyrogram.

New Features & Additions

  • Added Dark Mode to the documentation. You can switch between Light, Dark and Auto themes on the fly.

  • Added support for message reactions. Added the type Reaction, the method send_reaction() and fields Chat.available_reactions and Message.reactions.

  • Added support for spoiler text via markdown ||text|| and HTML <spoiler>text</spoiler>.

  • Added support for protected content messages. Added the parameter protect_content to all applicable send_* methods.

  • Added support for channel comments via the new method get_discussion_message(). Get the discussion message from the linked discussion group of a channel post and reply to it to leave a comment.

  • Added support for “send_as” chats. You can send messages in groups on behalf of another channel. Added the methods get_send_as_chats() and set_send_as_chat(). Added the field send_as_chat to the Chat type.

  • Added support for bot commands with trailing usernames. Now filters.command("start") will recognise both /start and /start@usernamebot commands.

  • Added the field chat_type to the type InlineQuery.

  • Added VoiceChatScheduled type and Message.voice_chat_scheduled field.

  • Message.media and Message.service are now strings and contain the name of the media or service message instead of a boolean value. This way you can tell which media or service message is by looking at the attribute.

  • Added the new methods copy_media_group(), set_bot_commands(), search_messages_count() and search_global_count().

  • Added the new types InlineQueryResultAudio and InlineQueryResultVideo.

  • Added support for in-memory uploads in send_media_group().

  • Added support for mentioning users by their ID in inline keyboards via the new user_id argument.

  • Added the field has_protected_content to the types Chat and Message.

  • Added the the parameter creates_join_request to the methods create_chat_invite_link() and edit_chat_invite_link() for managing chat invite links that create join requests.

  • Added the fields creates_join_request and pending_join_request_count to the type ChatInviteLink.

  • Added the field name to the type ChatInviteLink and the parameters name to the methods create_chat_invite_link() and edit_chat_invite_link() for managing invite link names.

  • Added event handlers about new requests to join a chat. Added ChatJoinRequest, ChatJoinRequestHandler and on_chat_join_request.

  • Added the methods set_chat_protected_content() and the respective Chat bound method.

  • Added support for the choose_sticker and import_history action in the method send_chat_action().

  • Added the methods approve_chat_join_request() and decline_chat_join_request() for managing requests to join the chat.

Other changes

  • Chat permissions are now the same as the ones seen in official clients. This means you cannot set sticker, gif, game and inline bot permission singularly anymore, but they all fall under the can_send_other_messages permission.

  • All “kick(ed)” occurrences have been replaced by “ban(ned)”. This means the method kick_chat_member has been renamed to ban_chat_member() and the “kicked” filter to be used in get_chat_members() has been renamed to “banned”.

1

The team of cryptographers: Theo von Arx and Kenneth G. Paterson.