User¶
- class pyrogram.raw.types.User[source]¶
Indicates info about a certain user.
Constructor of
User.- Details:
Layer:
229ID:
B1B8CC83
- Parameters:
id (
int64-bit) – ID of the user, see here » for more info and the available ID range.is_self (
bool, optional) – Whether this user indicates the currently logged in usercontact (
bool, optional) – Whether this user is a contact When updating the local peer database, do not apply changes to this field if theminflag 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 theminflag 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 verifiedrestricted (
bool, optional) – Access to this user must be restricted for the reason specified inrestriction_reasonmin (
bool, optional) – See minbot_inline_geo (
bool, optional) – Whether the bot can request our geolocation in inline modesupport (
bool, optional) – Whether this is an official support userscam (
bool, optional) – This may be a scam userapply_min_photo (
bool, optional) – If set andminis set, the value ofphotocan 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 apppremium (
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 theselfflag is set should also trigger the following calls, to refresh the respective caches: - The help.getConfig cache - The messages.getTopReactions cache if thebotflag is not setattach_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 theminflag 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 theminflag is set. Changes to this flag (ifminis 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 theminflag 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 theminflag 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 ».bot_forum_view (
bool, optional) – If set, this bot supports bot forum topics ».bot_forum_can_manage_topics (
bool, optional) – If set, this bot supports bot forum topics », and users (not just the bot!) are allowed to create and manage bot forum topics in their private chat with the bot.bot_can_manage_bots (
bool, optional) – If set, this bot is a manager bot that can create and manage managed bots » on behalf of the user.bot_guestchat (
bool, optional) – If set, this bot can be invoked as a guest in chats ».bot_guard (
bool, optional) – N/Aaccess_hash (
int64-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 calledmin_access_hash, which is: - Set totrueifminis set AND – Thephoneflag is not set OR – Thephoneflag is set and the associated phone number string is non-empty - Set tofalseotherwise. Then, apply bothaccess_hashandmin_access_hashto the local database if: -min_access_hashis false OR -min_access_hashis true AND – There is no locally cached object for this user OR – There is noaccess_hashin the local cache OR – The cached object’smin_access_hashis also true If the final merged object stored to the database has themin_access_hashfield set to true, the relatedaccess_hashis only suitable to use in inputPeerPhotoFileLocation », to directly download the profile pictures of users, everywhere else ainputPeer*FromMessageconstructor will have to be generated as specified here ». Bots can also use min access hashes in some conditions, by passing0instead of the min access hash.first_name (
str, optional) – First name. When updating the local peer database, apply changes to this field only if: - Theminflag is not set OR - Theminflag is set AND – Theminflag 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: - Theminflag is not set OR - Theminflag is set AND – Theminflag 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: - Theminflag is not set OR - Theminflag is set AND – Theminflag 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 thebot_can_editflag is also set.phone (
str, optional) – Phone number. When updating the local peer database, apply changes to this field only if: - Theminflag is not set OR - Theminflag is set AND – Theminflag 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: - Theminflag is not set OR - Theminflag is set AND – Theapply_min_photoflag is set OR – Theminflag 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: - Theminflag is not set OR - Theminflag is set AND – Theminflag of the locally cached user entry is set OR – The locally cached user entry is equal to userStatusEmpty.bot_info_version (
int32-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 botlang_code (
str, optional) – Language code of the useremoji_status (
EmojiStatus, optional) – Emoji statususernames (List of
Username, optional) – Additional usernames. When updating the local peer database, apply changes to this field only if: - Theminflag is not set OR - Theminflag is set AND – Theminflag 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 (
RecentStory, optional) – Summary of the user’s active stories ». When updating the local peer database, do not apply changes to this field if theminflag 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 (
int32-bit, optional) – Monthly Active Users (MAU) of this bot (may be absent for small bots).bot_verification_icon (
int64-bit, optional) – Describes a bot verification icon ».send_paid_messages_stars (
int64-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_starsor users.getRequirementsToContact to see if the currently logged in user actually has to pay or not, see here » for the full flow.linked_community_id (
int64-bit, optional) – N/A
- Functions:
This object can be returned by 9 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.
Group/channel owners only: returns the ID of the user that will become the new owner of the group if we decide to leave the group, see here » for more info on the full flow.
Can only be invoked by non-bot admins of a monoforum », obtains the original sender of a message sent by other monoforum admins to the monoforum, on behalf of the channel associated to the monoforum.
Get a list of bots owned by the current user
Create a managed bot » owned by the current user and controlled by the specified manager bot.