The Wayback Machine - https://web.archive.org/web/20201210054118/https://github.com/pyrogram/pyrogram/releases
Skip to content

@delivrance delivrance released this Sep 5, 2020 · 84 commits to master since this release

Bugfixes & Enhancements

  • Fixed get_messages not working with list of ids in case the first message was empty.
  • Changed the default filter for get/iter_chat_members to "recent".
  • Fixed the raw API not being properly imported when using repr/eval.
  • Various improvements when using Pyrogram in a sync context.
Assets 2

@delivrance delivrance released this Aug 29, 2020 · 99 commits to master since this release

Bugfixes & Enhancements

  • Fixed get_profile_photos not working correctly in case of no chat photos.
  • Attempt to fix clock issues when running on AWS Lambda.
Assets 2

@delivrance delivrance released this Aug 29, 2020 · 102 commits to master since this release

Bugfixes & Enhancements

  • Fixed get_profile_photos not working properly in channels.
  • Added a warning to users in case they try to use base types as arguments.
  • Fixed dispatcher not obeying to the INFO logging level.
  • Added force_document argument for send_document.
Assets 2

@delivrance delivrance released this Aug 27, 2020 · 108 commits to master since this release

Bugfixes & Enhancements

  • Fixed an issue causing inline callback queries to fail.
  • Removed TLObject as super class for base types.
  • Added the attribute dc_id to Chat objects.
Assets 2

@delivrance delivrance released this Aug 27, 2020 · 113 commits to master since this release

Bugfixes & Enhancements

  • Enabled passing sleep_threshold=0 to always raise flood waits.
  • Fixed a bad f-string usage causing the text parser to break.
Assets 2

@delivrance delivrance released this Aug 26, 2020 · 116 commits to master since this release

Bugfixes & Enhancements

  • Added some missing await keywords.
  • Fixed caption being displayed as "None" for inline media results when no caption was passed.
  • Reverted to input for passwords and added the hide_password parameter to Client.
  • Added the sleep_threshold parameter to send()method.
  • Decreased the default sleep threshold from 60 to 10 seconds.
  • Fixed some "invalid escape" warnings.
Assets 2

@delivrance delivrance released this Aug 25, 2020 · 124 commits to master since this release

Bugfixes & Enhancements

Assets 2

@delivrance delivrance released this Aug 25, 2020 · 128 commits to master since this release

Welcome to Pyrogram 1.0!

Since the first release almost three years ago, we've made over 3,000 commits by continuously delivering plenty of new features and fixes, which account for more than 300,000 lines of code added, edited or removed. Thousands of developers across the world have shown their appreciation to the project by kind words praising the way Pyrogram is built and performing, by donations or by simply giving a star to the repository.

This really means a lot, and today I'm pleased to announce the next step taken towards what represents over two and a half years worth of Open Source software development and community management efforts.

What's New

Pyrogram now fully supports asynchronous handlers and filters by default. This was possible by rewriting the whole framework using asynchronous interfaces down to the TCP core level. The result is concurrent code running in a single OS-level thread allowing for greater performance.

@app.on_message(filters.private)
async def my_handler(client, message):
    await message.reply_text("Hello, async world!")

Asynchronous support is entirely backwards-compatible and transparent to users, meaning your existing synchronous code will still be functional. In fact, you are free to mix async and sync handlers and filters as much as you want. Pyrogram will still work concurrently and efficiently regardless of what you choose.

We expect that most projects will migrate to asynchronous handlers and filters for long-running applications such as event-driven bots in order to take advantage of a considerable speed increase. Batch applications without user interactions can still be written using synchronous calls to keep code more concise, but it is entirely your choice.

You can read more about Pyrogram's async support in the documentation:

Notable Changes

  • Since Pyrogram is now async natively, all the branches dedicated to the old async variant will be deleted soon, namely asyncio and asyncio-dev. To add Pyrogram in your requirements list, you can now simply use pyrogram instead of a URL.
  • The develop branch will also be removed in favor of the default master branch to keep branching clean. This is due to the fact that the master branch was never found to be of any real use except for keeping track of the latest published release (something that can be done with git tags).
  • Python 3.5 (EOL in less than three weeks) is no longer supported and you need to upgrade to at least Python 3.6.
  • Pyrogram's TL compiler now generates better code: the types used across the Telegram raw API are now 100% hinted allowing for excellent IDE support (auto-completion, warnings in case of wrong type usages, ...).
  • Pyrogram types, filters, handlers and emoji have been moved to their dedicated packages/modules:
    • The Filters and Emoji classes are now turned into modules. Import them this way:
      from pyrogram import filters, emoji
      instead of the old way:
      from pyrogram import Filters, Emoji
      
    • Pyrogram types and handlers now live in separate packages. Import them this way:
      from pyrogram.types import Message, User, ...
      from pyrogram.handlers import MessageHandler, ...
      instead of the old way:
      from pyrogram import Message, User, MessageHandler
      
  • idle() is now a function you can import from the main package and can be used right away:
    from pyrogram import idle
    ...
    idle()
    ...
  • The package holding the Telegram API raw methods and types has been renamed to a more suitable name. Import it this way:
    from pyrogram.raw import types, functions
    instead of the old way:
    from pyrogram.api import types, functions
    
  • Filter callbacks now take three arguments (self, client, update) instead of two (self, update). Your functions will therefore need to be defined like this:
    lambda flt, client, update: ...
    or:
    def filter_callback(flt, client, update):
        ...
    or (async):
    async def filter_callback(flt, client, update):
        ...

Miscellaneous

  • Pyrogram now uses a synced internal clock (synced with Telegram's server) that's independent of the local system's clock.
  • Heavy crypto parts will be executed in a pool of threads for big enough chunks of data. This will prevent the async event loop from blocking for too much time while allowing encryption & decryption tasks running in parallel thanks to TgCrypto's ability to leverage multiple CPU cores.
  • Examples previously found in GitHub are now accessible at https://docs.pyrogram.org/start/examples.
  • getpass is brought back, allowing to input your password without echoing it when you log-in with your account.
  • A warning message saying "do not edit - changes are lost" has been put inside each of the automatically generated Python files to warn curious developers about the possibility of losing changes to those files in case of re-compilations.
  • Implemented short-circuit evaluation for filters to avoid useless checks in and and or operations.
  • Added support for compiled patterns in filters.regex (contributed by @CyanBook in #468).
  • Updated send_* methods to accept pathlib objects (contributed by @CyanBook in $458).
  • Async filters are partly contributed by @HasibulKabir in #437, extended later on to work in an executor.
  • Added filters.all to filter all updates, useful as default filter to be combined with other optional filters (contributed bu @Princic-1837592 in #464).
Assets 2

@delivrance delivrance released this Jul 29, 2020 · 10 commits to develop since this release

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.
Assets 2

@delivrance delivrance released this May 2, 2020 · 72 commits to develop since this release

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.
Assets 2
You can’t perform that action at this time.