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:

UserUserEmpty

Parameters

idInputUserAnything 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:

AuthKeyPermEmptyErrorThe method is unavailable for temporary authorization key, not bound to permanent.
MemberNoLocationErrorAn internal failure occurred while fetching user info (couldn't find location).
NeedMemberInvalidErrorThe provided member is invalid or does not exist (for example a thumb size).
SessionPasswordNeededErrorTwo-steps verification is enabled and a password is required.
TimeoutErrorA 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)