mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 13:29:47 +00:00
Update code using get_input_entity
This commit is contained in:
@@ -100,12 +100,12 @@ Note that this function can also work with other types, like :tl:`Chat` or
|
||||
:tl:`Channel` instances.
|
||||
|
||||
If you need to convert other types like usernames which might need to perform
|
||||
API calls to find out the identifier, you can use ``client.get_peer_id``:
|
||||
API calls to find out the identifier, you can use ``client.get_profile``:
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
print(await client.get_peer_id('me')) # your id
|
||||
print((await client.get_profile('me')).id) # your id
|
||||
|
||||
|
||||
If there is no "mark" (no minus sign), Telethon will assume your identifier
|
||||
|
@@ -129,7 +129,7 @@ as you wish. Remember to use the right types! To sum up:
|
||||
.. code-block:: python
|
||||
|
||||
result = await client(SendMessageRequest(
|
||||
await client.get_input_entity('username'), 'Hello there!'
|
||||
await client.get_profile('username'), 'Hello there!'
|
||||
))
|
||||
|
||||
|
||||
|
@@ -8,7 +8,7 @@ does a result have? Well, the easiest thing to do is printing it:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
entity = await client.get_entity('username')
|
||||
entity = await client.get_profile('username')
|
||||
print(entity)
|
||||
|
||||
That will show a huge **string** similar to the following:
|
||||
|
@@ -107,7 +107,7 @@ use :tl:`GetMessagesViewsRequest`, setting ``increment=True``:
|
||||
.. code-block:: python
|
||||
|
||||
|
||||
# Obtain `channel' through dialogs or through client.get_entity() or anyhow.
|
||||
# Obtain `channel' through dialogs or through client.get_profile() or anyhow.
|
||||
# Obtain `msg_ids' through `.get_messages()` or anyhow. Must be a list.
|
||||
|
||||
await client(GetMessagesViewsRequest(
|
||||
|
@@ -54,6 +54,7 @@ and identifier, rather than just the number.
|
||||
|
||||
// TODO we DEFINITELY need to provide a way to "upgrade" old ids
|
||||
// TODO and storing type+number by hand is a pain, provide better alternative
|
||||
// TODO get_peer_id is gone now too!
|
||||
|
||||
|
||||
Synchronous compatibility mode has been removed
|
||||
|
@@ -118,9 +118,7 @@ Users
|
||||
get_me
|
||||
is_bot
|
||||
is_user_authorized
|
||||
get_entity
|
||||
get_input_entity
|
||||
get_peer_id
|
||||
get_profile
|
||||
|
||||
Chats
|
||||
-----
|
||||
|
Reference in New Issue
Block a user