GetUserInfoRequest
Only users can use this request. See code examples.
---functions--- help.getUserInfo#038a08d3 user_id:InputUser = help.UserInfo
Returns
| help.UserInfo |
This type can be an instance of either:
| UserInfo | UserInfoEmpty |
Parameters
| user_id | InputUser | Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.). |
Known RPC errors
This request can cause 1 known error:
UserInvalidError | The given user was invalid. |
You can import these from telethon.errors.
Example
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.help.GetUserInfoRequest(
user_id='username'
))
print(result.stringify())