GetUsersRequest
Both users and bots can use this request. See code examples.
---functions--- users.getUsers#0d91a548 id:Vector<InputUser> = Vector<User>
Returns
A list of the following type is returned.
User |
This type can be an instance of either:
User | UserEmpty |
Parameters
id | InputUser | Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer , User or Channel objects, etc.). A list must be supplied. |
Known RPC errors
This request can cause 5 known errors:
AuthKeyPermEmptyError | The method is unavailable for temporary authorization key, not bound to permanent. |
MemberNoLocationError | An internal failure occurred while fetching user info (couldn't find location). |
NeedMemberInvalidError | The provided member is invalid or does not exist (for example a thumb size). |
SessionPasswordNeededError | Two-steps verification is enabled and a password is required. |
TimeoutError | A timeout occurred while fetching data from the worker. |
You can import these from telethon.errors
.
Example
Please refer to the documentation of client.get_entity()
to learn about the parameters and see several code examples on how to use it.
The method above is the recommended way to do it. If you need more control over the parameters or want to learn how it is implemented, open the details by clicking on the "Details" text.
from telethon.sync import TelegramClient from telethon import functions, types with TelegramClient(name, api_id, api_hash) as client: result = client(functions.users.GetUsersRequest( id=['username'] )) for x in result: print(x)