diff --git a/Retrieving-an-entity.md b/Retrieving-an-entity.md index 780b8ab..d20ea25 100644 --- a/Retrieving-an-entity.md +++ b/Retrieving-an-entity.md @@ -1,6 +1,12 @@ -An "entity" is used to refer to either an [`User`](https://lonamiwebs.github.io/Telethon/types/user.html) or a [`Chat`](https://lonamiwebs.github.io/Telethon/types/chat.html) (which includes a [`Channel`](https://lonamiwebs.github.io/Telethon/constructors/channel.html)). The most straightforward way to get an entity is to use `TelegramClient.get_entity()`. This method accepts either a string, which can be a username or a phone number, or an integer that will be the ID of an **user**. You can use it like so: +An "entity" is used to refer to either an [`User`](https://lonamiwebs.github.io/Telethon/types/user.html) or a [`Chat`](https://lonamiwebs.github.io/Telethon/types/chat.html) (which includes a [`Channel`](https://lonamiwebs.github.io/Telethon/constructors/channel.html)). The most straightforward way to get an entity is to use `TelegramClient.get_entity()`. This method accepts either a string, which can be a username, phone number or [t.me](https://t.me)-like link, or an integer that will be the ID of an **user**. You can use it like so: ```python +# all of these work lonami = client.get_entity('lonami') +lonami = client.get_entity('t.me/lonami') +lonami = client.get_entity('https://telegram.dog/lonami') + +# other kind of entities +channel = client.get_entity('telegram.me/joinchat/AAAAAEkk2WdoDrB4-Q8-gg') contact = client.get_entity('+34xxxxxxxxx') friend = client.get_entity(friend_id) ```