Pyrogram Versions Save

Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots

v2.0.0

2 years ago

v1.4.0

2 years ago

v1.0.0

2 years ago

v1.1.0

2 years ago

v1.2.0

2 years ago

v1.3.0

2 years ago

v0.18.0

3 years ago

New Features & Enhancements

  • Updated the API schema to Layer 116.
  • Added support for uploads up to 2000 MiB in size to both user and bot identities.
  • Added support for in-memory uploads. You can now pass a BytesIO object when uploading a file that lives in-memory; make sure to set the object's .name attribute to a file name before using it, e.g.: b = BytesIO(...); b.name = "filename.zip" (contributed by @OctoNezd in #261).
  • Added support for profile videos. Pass a video file to set_profile_photo or set_chat_photo to update your profile picture using a video.
  • Added an automatic sleep mechanism for flood wait exceptions. Use Client's sleep_threshold parameter to set a sleep threshold for flood wait exceptions happening globally in a client instance, below which any request that raises a flood wait will be automatically invoked again after sleeping for the required amount of time. Flood wait exceptions requiring higher waiting times will be raised.
  • Added linked_chat to Chat objects. Useful to get the the linked discussion group (in case of channels) or the linked channel (in case of supergroups).
  • Added support for joining linked chats with the Chat.join bound method.
  • Filters.regex has been granted superpowers and can now be applied to handlers that receive Message, CallbackQuery or InlineQuery (previously it was only working for Message updates). This made Filters.callback_data obsolete which has been removed.
  • Added support for basketball and football animation of the random dice. Choose between different animations (dice, darts, basketball, football) by specifying the emoji parameter in the method send_dice.
  • Added search_global method for searching messages globally from all of your chats.
  • CallbackQuery.answer optional arguments are now actually optional in code.
  • Added the session name in log lines (contributed by @CrisMystik in #401).
  • Added Filters.linked_channel to filter messages coming from the channel connected to the chat.
  • Added file_name to file-related functions (contributed by @demget in #308 and @saidgadjiev in #440).
  • Logs in DEBUG level will now show more relevant information about what is being sent and received.
  • Updated the Bot API diagram in the documentation (minor graphical issues).
  • No need to add via_bot from Bot API v4.9 because Pyrogram already has it since long time ago.
  • Added a Message.link attribute to obtain the message link in form of a URL (contributed by @ColinTheShark in #442).
  • Extended set_slow_mode to accept None as argument for disabling the slow mode.
  • Added parse_mode parameter to Client. Set your desired parse_mode when creating a client instance (contributed by @mendelmaleh in #443).
  • send_document will now send actual documents, even when uploading a video file.
  • Updated instructions for accessing test servers in tdesktop.
  • Minor fixes and cleanups (also contributed by @alissonlauffer in #439).

Bug Fixes

  • Fixed docs about update_profile (contributed by @CyanBook in #395).
  • Fixed an issue in which messages sent with entities at the end of the text would result in messages without entities.
  • Fixed some small typos in the documentation.

Breaking Changes

  • Filters.callback_data has been removed in favor of Filters.regex.

v0.17.1

4 years ago

Bug Fixes

  • Fixed plugins not being properly unloaded when the exclude directive was used.
  • Fixed objects not being properly printed due to missing re.Match in Python <=3.6.
  • Fixed update_profile missing from docs and from Client.

v0.17.0

4 years ago

New Features and Enhancements

  • API schema updated to Layer 112.
  • Added a copy button to documentation snippets for easy copy pasting. Thanks to @ColinTheShark for this.
  • Added more Chat bound methods: get_member(), get_members(), iter_members and add_members (contributed by @rsktg in #383).
  • Added is_creator field to the Chat object.
  • A new block parameter has been added to stop(), restart() to allow calling them in a non-blocking way. Useful, with block=False, inside update handlers in order not to cause a deadlock.
  • Added a .bind() method to all Pyrogram types. Useful to re-enable bound-methods after deserialization by binding the client instance to the object.
  • Added a FAQ about why stop, restart, add/remove_handler could make the code hang if used improperly.
  • Added set_slow_mode() method.
  • Added update_profile() method (contributed by @kalmengr in #277).
  • Added support to quiz, public voting and multiple answers polls.
  • Added support for Telegram's Dice and Dart: added Dice and send_dice().
  • Added support for extended chat permissions for a finer control.
  • When no_updates=True Pyrogram will not spawn any unnecessary thread anymore.
  • Added FAQs about file_ref values, webhooks, flood limits and sqlite3.OperationalError.
  • Added support for ttl_seconds in Photo and Video objects. Useful for secret photos.
  • Added support for chosen inline results: added ChosenInlineResult type and an handler for listening to such update, on_chosen_inline_result().
  • Added support for scheduled forward messages.

Bug Fixes

  • Fixed an error causing delete_profile_photos() to fail.
  • Fixed group, channel and supergroup ChatPhoto downloads.
  • Fixed an issue causing Chat.restrict_member to fail.
  • Fixed plugins not being correctly reloaded from disk after a restart.
  • Fixed stop_poll (contributed by @trenoduro in #339).
  • Fixed error messages not being properly shown in case no_update=True.
  • Fixed set_administrator_title not properly setting permissions when changing a member's title.
  • Fixed editing media not working due to missing file references.
  • Fixed object decoder breaking on re.Match objects.
  • Fixed message entities being kept unparsed for private messages.

Breaking Changes

  • Dropped the [fast] setup directive. Now tgcrypto needs to be added as a separate dependency.

v0.16.0

4 years ago

New Features and Enhancements

  • Starting this version, support for Python 3.4 (EOL since March 16, 2019) has been dropped. The minimum requirement is now Python 3.5.3, but we suggest always using the latest Python version available, if possible.

  • The Telegram API schema has been updated to Layer 105.

  • Added support for scheduled messages. All applicable methods (send_message, send_photo, …) have now a schedule_date parameter used to schedule messages to be sent in a date in the future. Two filters have been added as well: Filters.scheduled, to filter outgoing messages that are scheduled and Filters.from_scheduled to filter messages that are sent automatically from the Telegram scheduler.

  • Added the attribute title (rank) to ChatMember objects and the method set_administrator_title().

  • The start() method has been finally decomposed into many reusable methods: connect(), disconnect(), initialize(), terminate(), send_code(), resend_code(), sign_in(), sign_up(), get_password_hint(), check_password(), send_recovery_code(), recover_password() and accept_terms_of_service(). You can use these methods individually to customize the authorization/registration flow much more easily.

  • You can now log-in with a bot token using the terminal prompt. Just paste a bot token and let Pyrogram authorize the bot automatically; once the session is created you don't need to keep the bot token around anymore.

  • Added log_out() method. Use it to log out your account from Telegram and delete the *.session file.

  • All available Pyrogram API methods in the documentation are now coupled with examples to give you an idea of how they are used.

  • Added WebPage type for web page previews. The web_page attribute of a Message will now point to a WebPage object instead of a boolean (contributed by @mendelmaleh in #268).

  • Added bound methods (contributed by @kalmengr in #274, #275, 278 and #279):

  • Removed get_user_dc() method. The user DC is now stored as a User attribute dc_id.

  • Added "md" to the possible parse modes for Markdown style.

  • Removed UserStatus type. A new status attribute has been added to User objects among with last_online_date and next_offline_date. This will make it easier to check for a user status by comparing user.status to strings such as "online", "offline", "last_week", …

  • The text parser will now log warnings instead of raising exceptions in case of unclosed tags.

  • Added set_parse_mode() method to set a global parse mode (client instance-wide). This is useful to save you from setting the parse mode on every method call, in case you want to use something else than the default.

  • send_media_group() is now able to send media from URLs.

  • Added new methods: add_chat_members(), create_group(), create_channel(), create_supergroup(), delete_channel() and delete_supergroup().

  • Added is_gallery parameter to to answer_inline_query() and InlineQuery.answer().

  • Added new inline query result types: InlineQueryResultPhoto and InlineQueryResultAnimation.

  • The command filter has been reworked to allow multiple words arguments inside quotes. For example: /start "this is one argument" will produce this Message.command list: ["start", "this is one argument"] (contributed by @mendelmaleh in #292). The prefix parameter has been renamed to prefixes for consistency with the other parameters names.

  • Added a new section to docs: scheduling (contributed by @MrNaif2018 in #283).

  • Added support for bot_token inside config.ini file (contributed by @trenoduro in #296).

  • Added a better support for unparsing nested entities (both for HTML and Markdown) (contributed by @Midblyte in #297).

  • Added Chat.export_invite_link() bound method (contributed by @ColinTheShark in #300) and get_common_chats() method (contributed by @ColinTheShark in #303).

  • Removed __slots__ from all Pyrogram types. They were pretty annoying to maintain and were giving little to no benefit.

  • Added is_animated field to Sticker.

  • Removed send_animated_sticker() in favour of send_sticker(), which is able to send both static and animated stickers.

  • Renamed restrict_chat to set_chat_permissions().

  • Moved all can_* permissions back to the ChatMember object.

  • Updated restrict_chat_member() to accept a single ChatPermissions argument.

  • Added Chat.description field to basic chats.

  • Added FAQ about "database is locked" error.

  • Added smarter auth import to deal with race conditions by multiple sessions: The time window in which export+import executes was narrowed down and a retry mechanism (up to three times) was added as well.

  • Removed the mention in the documentation of python-dev dependency for Termux when installing TgCrypto (contributed by @AlissonLauffer in #301).

  • Added missing members_count attribute in Chat objects.

  • Added get_nearby_chats() method to get the nearby chats given a location expressed in latitude and longitude coordinates.

  • Added new Restriction object and made User and Chat object use it. The User and Chat restriction_reason has been renamed to restrictions and its type is now a List of Restriction objects instead of just a plain string.

Bug Fixes

  • Fixed RPCError raising an error by itself because of non-optional arguments.
  • Fixed Filters.private not filtering bot chat types (which are a kind of private chat).
  • Fixed forwarded copies having "None" as caption in case of no caption at all.
  • Fixed Message.text and Message.caption messing up in case of web page previews.
  • Fixed dispatcher raising exceptions in case filter checks failed (contributed by @mendelmaleh in #293).
  • Fixed Message.click() not working because of wrong default arguments.
  • Fixed VACUUM failing in Python 3.6.0 (exactly this version).

Breaking Changes

  • Removed support for callback functions for Client arguments like phone_number, phone_code, password, … in favour of a simpler and sequential authorization flow.

  • Reworked idle(): the method is now static and will only do what it is supposed to do, idling; it won't stop the client anymore when idling ends. For this reason, you now have to call app.stop() yourself after it.

  • The upload/download progress callback will not accept the client parameter anymore because is often redundant. This means that only (current, total) arguments will be passed by default. If you need a client reference, you can pass it via progress_args anytime. Most likely you want to pass a Message instance, instead, and use bound methods to make API calls in a more convenient way.

  • All Photo-like file id formats have changed to be compatible with the ones offered by the Bot API. This, unfortunately, means that all previous file ids can't be used anymore.

  • To correctly download, re-send, edit or forward as copy a media message, you must now pass a valid and up to date file_ref (file reference) you can get from a media object (Photo, Audio, Document, …). The inevitable downside (because this is how Telegram wants it to work now) is that once a file reference expires (usually after 24h, but could happen anytime) you have to manually fetch the original message again with get_messages and the context (a pair of chat_id + message_id) in order to get a refreshed file reference. A new file_ref parameter has been added to all methods dealing with media messages as well (send_photo, *_audio, *_document, …).