User#

class pyrogram.raw.types.User#

Indicates info about a certain user.

Constructor of User.

Details:
  • Layer: 187

  • ID: 83314FCA

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) – If set, we can only write to this user if they have already sent some messages to us, if we are subscribed to Telegram Premium, or if they’re a mutual contact (user.mutual_contact). All the secondary conditions listed above must be checked separately to verify whether we can still write to the user, even if this flag is set (i.e. a mutual contact will have this flag set even if we can still write to them, and so on…); to avoid doing these extra checks if we haven’t yet cached all the required information (for example while displaying the chat list in the sharing UI) the users.getIsPremiumRequiredToContact method may be invoked instead, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user; alternatively, the userFull.contact_require_premium flag contains the same (fully checked, i.e. it’s not just a copy of this flag) info returned by users.getIsPremiumRequiredToContact. To set this flag for ourselves invoke account.setGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium 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).

Functions:

This object can be returned by 5 functions.

account.UpdateProfile

Updates user profile.

account.UpdateUsername

Changes username for the current user.

account.ChangePhone

Change the phone number of the current account

users.GetUsers

Returns basic user info according to their identifiers.

contacts.ImportContactToken

Obtain user info from a temporary profile link.