User Methods
Theusers namespace provides methods for working with users in Telegram.
Accessing User Methods
Getting User Information
getFullUser
Get full information about a user.User ID, username, or user object
- Basic profile data (name, username, phone)
- Bio and about text
- Profile photo
- Privacy settings
- Verification status
- Premium status
Helper Methods
MadelineProto provides several helper methods for user information through the API class:getInfo
Get basic user information (lightweight).This method is faster than
getFullUser for basic information.getSelf
Get information about the currently logged-in user.getId
Extract the numeric user ID from various formats.User Status
Checking Online Status
User Profile Photos
Getting Profile Photos
Common Use Cases
Check if User is Bot
Get User’s Username
Check Premium Status
Best Practices
Cache user information
Cache user information
Don’t call
getFullUser repeatedly for the same user. Cache the results and refresh periodically.Use getInfo for lightweight checks
Use getInfo for lightweight checks
When you only need basic information like username or ID, use
getInfo() instead of getFullUser().Handle privacy restrictions
Handle privacy restrictions
Some users may have restricted their profile information. Always check if fields exist before accessing them.
Respect rate limits
Respect rate limits
Avoid making too many user lookup requests in quick succession to prevent flood waits.
See Also
- Chat Info Guide - Working with chat and channel information
- Error Handling - Handling user lookup errors
- Flood Wait - Managing rate limits