mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Update to v1.2
This commit is contained in:
parent
06da651f27
commit
7efa53fedf
|
@ -14,8 +14,92 @@ it can take advantage of new goodies!
|
|||
.. contents:: List of All Versions
|
||||
|
||||
|
||||
Better Custom Message(v1.1.1)
|
||||
=============================
|
||||
Conversations, String Sessions and More (v1.2)
|
||||
==============================================
|
||||
|
||||
*Published at 2018/08/14*
|
||||
|
||||
|
||||
This is a big release! Quite a few things have been added to the library,
|
||||
such as the new `Conversation <telethon.tl.custom.conversation.Conversation>`.
|
||||
This makes it trivial to get tokens from `@BotFather <https://t.me/BotFather>`_:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl import types
|
||||
|
||||
with client.conversation('BotFather') as conv:
|
||||
conv.send_message('/mybots')
|
||||
message = conv.get_response()
|
||||
message.click(0)
|
||||
message = conv.get_edit()
|
||||
message.click(0)
|
||||
message = conv.get_edit()
|
||||
for _, token in message.get_entities_text(types.MessageEntityCode):
|
||||
print(token)
|
||||
|
||||
|
||||
In addition to that, you can now easily load and export session files
|
||||
without creating any on-disk file thanks to the ``StringSession``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.sessions import StringSession
|
||||
string = StringSession.save(client.session)
|
||||
|
||||
Check out :ref:`sessions` for more details.
|
||||
|
||||
For those who aren't able to install ``cryptg``, the support for ``libssl``
|
||||
has been added back. While interfacing ``libssl`` is not as fast, the speed
|
||||
when downloading and sending files should really be noticeably faster.
|
||||
|
||||
While those are the biggest things, there are still more things to be
|
||||
excited about.
|
||||
|
||||
|
||||
Additions
|
||||
~~~~~~~~~
|
||||
|
||||
- The mentioned method to start a new `client.conversation
|
||||
<telethon.client.dialogs.DialogMethods.conversation>`.
|
||||
- Implemented global search through `client.iter_messages
|
||||
<telethon.client.messages.MessageMethods.iter_messages>`
|
||||
with ``None`` entity.
|
||||
- New `client.inline_query <telethon.client.bots.BotMethods.inline_query>`
|
||||
method to perform inline queries.
|
||||
- Bot-API-style ``file_id`` can now be used to send files and download media.
|
||||
You can also access `telethon.utils.resolve_bot_file_id` and
|
||||
`telethon.utils.pack_bot_file_id` to resolve and create these
|
||||
file IDs yourself. Note that each user has its own ID for each file
|
||||
so you can't use a bot's ``file_id`` with your user, except stickers.
|
||||
- New `telethon.utils.get_peer`, useful when you expect a :tl:`Peer`.
|
||||
|
||||
Bug fixes
|
||||
~~~~~~~~~
|
||||
|
||||
- UTC timezone for `telethon.events.userupdate.UserUpdate`.
|
||||
- Bug with certain input parameters when iterating messages.
|
||||
- RPC errors without parent requests caused a crash, and better logging.
|
||||
- ``incoming = outgoing = True`` was not working properly.
|
||||
- Getting a message's ID was not working.
|
||||
- File attributes not being inferred for ``open()``'ed files.
|
||||
- Use ``MemorySession`` if ``sqlite3`` is not installed by default.
|
||||
- Self-user would not be saved to the session file after signing in.
|
||||
- `client.catch_up() <telethon.client.updates.UpdateMethods.catch_up>`
|
||||
seems to be functional again.
|
||||
|
||||
|
||||
Enhancements
|
||||
~~~~~~~~~~~~
|
||||
|
||||
- Updated documentation.
|
||||
- Invite links will now use cache, so using them as entities is cheaper.
|
||||
- You can reuse message buttons to send new messages with those buttons.
|
||||
- ``.to_dict()`` will now work even on invalid ``TLObject``'s.
|
||||
|
||||
|
||||
Better Custom Message (v1.1.1)
|
||||
==============================
|
||||
|
||||
*Published at 2018/07/23*
|
||||
|
||||
|
|
|
@ -14,6 +14,17 @@ the library.
|
|||
|
||||
.. _projects-telegram-export:
|
||||
|
||||
telethon_examples/
|
||||
******************
|
||||
|
||||
`Link <https://github.com/LonamiWebs/Telethon/tree/master/telethon_examples>`_ /
|
||||
`Author's website <https://lonamiwebs.github.io>`_
|
||||
|
||||
This documentation is not the only place where you can find useful code
|
||||
snippets using the library. The main repository also has a folder with
|
||||
some cool examples (even a Tkinter GUI!) which you can download, edit
|
||||
and run to learn and play with them.
|
||||
|
||||
telegram-export
|
||||
***************
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ request. Omitted fields won't change after invoking :tl:`UpdateProfile`:
|
|||
|
||||
from telethon.tl.functions.account import UpdateProfileRequest
|
||||
|
||||
client(UpdateProfileRequest(a
|
||||
bout='This is a test from Telethon'
|
||||
client(UpdateProfileRequest(
|
||||
about='This is a test from Telethon'
|
||||
))
|
||||
|
||||
|
||||
|
|
|
@ -127,6 +127,13 @@ class UpdateMethods(UserMethods):
|
|||
return [(callback, event) for event, callback in self._event_builders]
|
||||
|
||||
async def catch_up(self):
|
||||
"""
|
||||
"Catches up" on the missed updates while the client was offline.
|
||||
You should call this method after registering the event handlers
|
||||
so that the updates it loads can by processed by your script.
|
||||
|
||||
This can also be used to forcibly fetch new updates if there are any.
|
||||
"""
|
||||
state = self.session.get_update_state(0)
|
||||
if not state or not state.pts:
|
||||
state = await self(functions.updates.GetStateRequest())
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Versions should comply with PEP440.
|
||||
# This line is parsed in setup.py:
|
||||
__version__ = '1.1.1'
|
||||
__version__ = '1.2'
|
||||
|
|
Loading…
Reference in New Issue
Block a user