From 665c844c9dec499908774a28e680c75c6387eac0 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 22 Apr 2019 20:05:45 +0200 Subject: [PATCH] Update to v1.7 --- readthedocs/custom_roles.py | 1 - readthedocs/extra/changelog.rst | 132 ++++++++++++++++++++++++++++++++ telethon/version.py | 2 +- 3 files changed, 133 insertions(+), 2 deletions(-) diff --git a/readthedocs/custom_roles.py b/readthedocs/custom_roles.py index 89a5bd79..a9bb9608 100644 --- a/readthedocs/custom_roles.py +++ b/readthedocs/custom_roles.py @@ -63,7 +63,6 @@ def setup(app): :param app: Sphinx application context. """ - app.info('Initializing TL reference plugin') app.add_role('tl', tl_role) app.add_config_value('tl_ref_url', None, 'env') return diff --git a/readthedocs/extra/changelog.rst b/readthedocs/extra/changelog.rst index c584914d..25de48da 100644 --- a/readthedocs/extra/changelog.rst +++ b/readthedocs/extra/changelog.rst @@ -14,6 +14,138 @@ it can take advantage of new goodies! .. contents:: List of All Versions +Easier Events (v1.7) +==================== + +*Published at 2019/04/22* + ++-----------------------+ +| Scheme layer used: 98 | ++-----------------------+ + +If you have been using Telethon for a while, you probably know how annoying +the "Could not find the input entity for…" error can be. In this new version, +the library will try harder to find the input entity for you! + +That is, instead of doing: + +.. code-block:: python + + @client.on(events.NewMessage) + async def handler(event): + await client.download_profile_photo(await event.get_input_sender()) + # ...... needs await, it's a method ^^^^^ ^^ + +You can now do: + +.. code-block:: python + + @client.on(events.NewMessage) + async def handler(event): + await client.download_profile_photo(event.input_sender) + # ...... no await, it's a property! ^ + # It's also 12 characters shorter :) + +And even the following will hopefully work: + +.. code-block:: python + + @client.on(events.NewMessage) + async def handler(event): + await client.download_profile_photo(event.sender_id) + +A lot of people use IDs thinking this is the right way of doing it. Ideally, +you would always use ``input_*``, not ``sender`` or ``sender_id`` (and the +same applies to chats). But, with this change, IDs will work just the same as +``input_*`` inside events. + +**This feature still needs some more testing**, so please do open an issue +if you find strange behaviour. + + +Breaking Changes +~~~~~~~~~~~~~~~~ + +* The layer changed, and a lot of things did too. If you are using + raw API, you should be careful with this. In addition, some attributes + weren't of type ``datetime`` when they should be, which has been fixed. +* `client.disconnect() + ` + is now asynchronous again. This means you need to ``await`` it. You + don't need to worry about this if you were using ``with client`` or + `client.run_until_disconnected + `. + This should prevent the "pending task was destroyed" errors. + +Additions +~~~~~~~~~ + +* New in-memory cache for input entities. This should mean a lot less + of disk look-ups. +* New `client.action ` method + to easily indicate that you are doing some chat action: + + .. code-block:: python + + async with client.action(chat, 'typing'): + await asyncio.sleep(2) # type for 2 seconds + await client.send_message(chat, 'Hello world! I type slow ^^') + + You can also easily use this for sending files, playing games, etc. + + +Bug fixes +~~~~~~~~~ + +* Fix sending photos from streams/bytes. +* Fix unhandled error when sending requests that were too big. +* Fix edits that arrive too early on conversations. +* Fix `client.edit_message() + ` + when trying to edit a file. +* Fix method calls on the objects returned by `client.iter_dialogs() + `. +* Attempt at fixing `client.iter_dialogs() + ` missing many dialogs. +* ``offset_date`` in `client.iter_messages() + ` was being + ignored in some cases. This has been worked around. +* Fix `callback_query.edit() + `. +* Fix `CallbackQuery(func=...) ` + was being ignored. +* Fix `UserUpdate ` not working for + "typing" (and uploading file, etc.) status. +* Fix library was not expecting ``IOError`` from PySocks. +* Fix library was raising a generic ``ConnectionError`` + and not the one that actually occurred. +* Fix the ``blacklist_chats`` parameter in `MessageRead + ` not working as intended. +* Fix `client.download_media(contact) + `. +* Fix mime type when sending ``mp3`` files. +* Fix forcibly getting the sender or chat from events would + not always return all their information. +* Fix sending albums with `client.send_file() + ` was not returning + the sent messages. +* Fix forwarding albums with `client.forward_messages() + `. +* Some fixes regarding filtering updates from chats. +* Attempt at preventing duplicated updates. +* Prevent double auto-reconnect. + + +Enhancements +~~~~~~~~~~~~ + +* Some improvements related to proxy connections. +* Several updates and improvements to the documentation, + such as optional dependencies now being properly listed. +* You can now forward messages from different chats directly with + `client.forward_messages `. + + Tidying up Internals (v1.6) =========================== diff --git a/telethon/version.py b/telethon/version.py index 88c6a90a..377717e4 100644 --- a/telethon/version.py +++ b/telethon/version.py @@ -1,3 +1,3 @@ # Versions should comply with PEP440. # This line is parsed in setup.py: -__version__ = '1.6.2' +__version__ = '1.7'