Pyrogram v0.8.0#

IPv6, custom filters, media editing and more!#

What’s New#

  • API scheme updated to Layer 82.

  • Client instances can now be used in a context manager with the with statement:

    from pyrogram import Client
    
    with Client("my_account") as app:
        app.send_message("pyrogram", "hi")
    
  • You can now use your IPv6 network stack. Set ipv6=True when creating a Client.

  • Easily create custom filters with the new Filters.create() method.

  • You can delete your own profile photos with the method delete_profile_photos().

  • Added support for retrieving chat members and channel subscribers: use get_chat_members() to get the members list of a chat and get_chat_member() (note the missing “s” at the end) to get information about a single member of a chat.

  • Added support for editing the media content of messages: added the method edit_message_media() and new types InputMediaAnimation, InputMediaAudio, and InputMediaDocument.

  • Added the .download() bound method to the Message object.

  • Added new attributes to the User object: is_self, is_contact, is_mutual_contact and is_deleted to describe a user in a more detailed fashion.

  • Added the Dialog type along with its method get_dialogs() to retrieve a user dialogs list.

  • Added support for pinned messages in channels and supergroups: use the method pin_chat_message() to pin a message and the method unpin_chat_message() to remove the previously pinned message.

  • Added support for editing group and channel settings. Added four methods for editing title, description and photo of a chat: set_chat_title(), set_chat_description(), set_chat_photo(), delete_chat_photo().

  • Added the critical 406 - Not Acceptable class error: AUTH_KEY_DUPLICATED. Make sure you don’t use the same session in more than one client at the same time to avoid receiving it; the server doesn’t allow this usage, and so doesn’t Pyrogram.

  • Added a new Photo type containing the photo id and all available PhotoSize’s. All references to the plain List of PhotoSize are replaced by this object; for example, Message.photo.

  • Added vCard support when sharing contacts: added the field vcard to the Contact object and the parameter vcard to the send_contact() method.

  • Added support for Foursquare venues: added the new field foursquare_type to the Venue object and the parameter foursquare_type to the send_venue() method.

  • Added two new MessageEntity types: cashtag and phone_number.

  • Added the field animation to the Message object.

  • Added the method send_animation(), which can be used instead of send_document() to send animations, specifying their duration, width and height.

  • Added support for attaching custom thumbnails to uploaded files. For animations, audios, videos and video notes, which are less than 10 MB in size, thumbnails are generated automatically server side.

  • Added the field thumb to the Audio object to contain the thumbnail of the album cover to which the music file belongs (contributed by @zeroone2numeral2 in #111 ).

Breaking Changes#

  • The method download_media() will now raise ValueError in case of non-media messages instead of returning silently.

  • Removed the possibility to send messages to private chats using t.me/joinchat/ links directly. You have to resolve the invite link into a valid id and use that instead. For now you need to use messages.CheckChatInvite raw function.

  • Rename any GIF object reference to Animation.