User#
- class pyrogram.raw.types.User#
Indicates info about a certain user. Unless specified otherwise, when updating the local peer database, all fields from the newly received constructor take priority over the old constructor cached locally (including by removing fields that aren’t set in the new constructor). See here for an implementation of the logic to use when updating the local user peer database.
Constructor of
User
.- Details:
Layer:
211
ID:
20B1422
- Parameters:
- id (
int
64-bit
): ID of the user, see here » for more info.
- is_self (
bool
, optional): N/A
- contact (
bool
, optional): Whether this user is a contact When updating the local peer database, do not apply changes to this field if the min flag is set.
- mutual_contact (
bool
, optional): Whether this user is a mutual contact. When updating the local peer database, do not apply changes to this field if the min flag is set.
- deleted (
bool
, optional): Whether the account of this user was deleted. Changes to this flag should invalidate the local userFull cache for this user ID, see here » for more info.
- bot (
bool
, optional): Is this user a bot? Changes to this flag should invalidate the local userFull cache for this user ID, see here » for more info.
- bot_chat_history (
bool
, optional): Can the bot see all messages in groups?
- bot_nochats (
bool
, optional): Can the bot be added to groups?
- verified (
bool
, optional): Whether this user is verified
- restricted (
bool
, optional): Access to this user must be restricted for the reason specified in restriction_reason
- min (
bool
, optional): See min
- bot_inline_geo (
bool
, optional): Whether the bot can request our geolocation in inline mode
- support (
bool
, optional): Whether this is an official support user
- scam (
bool
, optional): This may be a scam user
- apply_min_photo (
bool
, optional): If set and min is set, the value of photo can be used to update the local database, see the documentation of that flag for more info.
- fake (
bool
, optional): If set, this user was reported by many users as a fake or scam user: be careful when interacting with them.
- bot_attach_menu (
bool
, optional): Whether this bot offers an attachment menu web app
- premium (
bool
, optional): Whether this user is a Telegram Premium user Changes to this flag should invalidate the local userFull cache for this user ID, see here » for more info. Changes to this flag if the self flag is set should also trigger the following calls, to refresh the respective caches: - The help.getConfig cache - The messages.getTopReactions cache if the bot flag is not set
- attach_menu_enabled (
bool
, optional): Whether we installed the attachment menu web app offered by this bot. When updating the local peer database, do not apply changes to this field if the min flag is set.
- bot_can_edit (
bool
, optional): Whether we can edit the profile picture, name, about text and description of this bot because we own it. When updating the local peer database, do not apply changes to this field if the min flag is set. Changes to this flag (if min is not set) should invalidate the local userFull cache for this user ID.
- close_friend (
bool
, optional): Whether we marked this user as a close friend, see here » for more info. When updating the local peer database, do not apply changes to this field if the min flag is set.
- stories_hidden (
bool
, optional): Whether we have hidden » all active stories of this user. When updating the local peer database, do not apply changes to this field if the min flag is set.
- stories_unavailable (
bool
, optional): No stories from this user are visible.
- contact_require_premium (
bool
, optional): See here for more info on this flag ».
- bot_business (
bool
, optional): Whether this bot can be connected to a user as specified here ».
- bot_has_main_app (
bool
, optional): If set, this bot has configured a Main Mini App ».
- access_hash (
int
64-bit
, optional): Access hash of the user, see here » for more info. If this flag is set, when updating the local peer database, generate a virtual flag called min_access_hash, which is: - Set to true if min is set AND – The phone flag is not set OR – The phone flag is set and the associated phone number string is non-empty - Set to false otherwise. Then, apply both access_hash and min_access_hash to the local database if: - min_access_hash is false OR - min_access_hash is true AND – There is no locally cached object for this user OR – There is no access_hash in the local cache OR – The cached object’s min_access_hash is also true If the final merged object stored to the database has the min_access_hash field set to true, the related access_hash is only suitable to use in inputPeerPhotoFileLocation », to directly download the profile pictures of users, everywhere else a inputPeer*FromMessage constructor will have to be generated as specified here ». Bots can also use min access hashes in some conditions, by passing 0 instead of the min access hash.
- first_name (
str
, optional): First name. When updating the local peer database, apply changes to this field only if: - The min flag is not set OR - The min flag is set AND – The min flag of the locally cached user entry is set.
- last_name (
str
, optional): Last name. When updating the local peer database, apply changes to this field only if: - The min flag is not set OR - The min flag is set AND – The min flag of the locally cached user entry is set.
- username (
str
, optional): Main active username. When updating the local peer database, apply changes to this field only if: - The min flag is not set OR - The min flag is set AND – The min flag of the locally cached user entry is set. Changes to this flag should invalidate the local userFull cache for this user ID if the above conditions are respected and the bot_can_edit flag is also set.
- phone (
str
, optional): Phone number. When updating the local peer database, apply changes to this field only if: - The min flag is not set OR - The min flag is set AND – The min flag of the locally cached user entry is set.
- photo (
UserProfilePhoto
, optional): Profile picture of user. When updating the local peer database, apply changes to this field only if: - The min flag is not set OR - The min flag is set AND – The apply_min_photo flag is set OR – The min flag of the locally cached user entry is set.
- status (
UserStatus
, optional): Online status of user. When updating the local peer database, apply changes to this field only if: - The min flag is not set OR - The min flag is set AND – The min flag of the locally cached user entry is set OR – The locally cached user entry is equal to userStatusEmpty.
- bot_info_version (
int
32-bit
, optional): Version of the bot_info field in userFull, incremented every time it changes. Changes to this flag should invalidate the local userFull cache for this user ID, see here » for more info.
- restriction_reason (List of
RestrictionReason
, optional): Contains the reason why access to this user must be restricted.
- bot_inline_placeholder (
str
, optional): Inline placeholder for this inline bot
- lang_code (
str
, optional): Language code of the user
- emoji_status (
EmojiStatus
, optional): Emoji status
- usernames (List of
Username
, optional): Additional usernames. When updating the local peer database, apply changes to this field only if: - The min flag is not set OR - The min flag is set AND – The min flag of the locally cached user entry is set. Changes to this flag (if the above conditions are respected) should invalidate the local userFull cache for this user ID.
- stories_max_id (
int
32-bit
, optional): ID of the maximum read story. When updating the local peer database, do not apply changes to this field if the min flag of the incoming constructor is set.
- color (
PeerColor
, optional): The user’s accent color.
- profile_color (
PeerColor
, optional): The user’s profile color.
- bot_active_users (
int
32-bit
, optional): Monthly Active Users (MAU) of this bot (may be absent for small bots).
bot_verification_icon (
int
64-bit
, optional):- send_paid_messages_stars (
int
64-bit
, optional): If set, the user has enabled paid messages », we might need to pay the specified amount of Stars to send them messages, depending on the configured exceptions: check userFull.send_paid_messages_stars or users.getRequirementsToContact to see if the currently logged in user actually has to pay or not, see here » for the full flow.
- id (
- Functions:
This object can be returned by 7 functions.
Updates user profile.
Changes username for the current user.
Change the phone number of the current account
Returns basic user info according to their identifiers.
Obtain user info from a temporary profile link.
Details:
Get a list of bots owned by the current user