Skip to main content

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.

type tg.User struct { /* ... */ }

Implements User.

Fields

NameTypeRequiredDescription
SelfboolWhether this user indicates the currently logged in user
ContactboolWhether this user is a contact When updating the local peer database, do not apply changes to this field if the min flag is set.
MutualContactboolWhether 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.
DeletedboolWhether 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.
BotboolIs this user a bot? Changes to this flag should invalidate the local userFull cache for this user ID, see here » for more info.
BotChatHistoryboolCan the bot see all messages in groups?
BotNochatsboolCan the bot be added to groups?
VerifiedboolWhether this user is verified
RestrictedboolAccess to this user must be restricted for the reason specified in restriction_reason
MinboolSee min
BotInlineGeoboolWhether the bot can request our geolocation in inline mode
SupportboolWhether this is an official support user
ScamboolThis may be a scam user
ApplyMinPhotoboolIf 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.
FakeboolIf set, this user was reported by many users as a fake or scam user: be careful when interacting with them.
BotAttachMenuboolWhether this bot offers an attachment menu web app
PremiumboolWhether 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
AttachMenuEnabledboolWhether 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.
Flags2bin.FieldsyesFlags, see TL conditional fields
BotCanEditboolWhether 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.
CloseFriendboolWhether 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.
StoriesHiddenboolWhether 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.
StoriesUnavailableboolNo stories from this user are visible.
ContactRequirePremiumboolSee here for more info on this flag ».
BotBusinessboolWhether this bot can be connected to a user as specified here ».
BotHasMainAppboolIf set, this bot has configured a Main Mini App ».
BotForumViewboolIf set, this bot supports bot forum topics ».
BotForumCanManageTopicsboolIf 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.
BotCanManageBotsboolBotCanManageBots field of User.
BotGuestchatboolBotGuestchat field of User.
BotGuardboolBotGuard field of User.
IDint64yesID of the user, see here » for more info and the available ID range.
AccessHashint64Access 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.
FirstNamestringFirst 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.
LastNamestringLast 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.
UsernamestringMain 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.
PhonestringPhone 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.
PhotoUserProfilePhotoClassProfile 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.
StatusUserStatusClassOnline 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.
BotInfoVersionintVersion 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.
RestrictionReason[]RestrictionReasonContains the reason why access to this user must be restricted.
BotInlinePlaceholderstringInline placeholder for this inline bot
LangCodestringLanguage code of the user
EmojiStatusEmojiStatusClassEmoji status
Usernames[]UsernameAdditional 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.
StoriesMaxIDRecentStoryID 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.
ColorPeerColorClassThe user's accent color.
ProfileColorPeerColorClassThe user's profile color.
BotActiveUsersintMonthly Active Users (MAU) of this bot (may be absent for small bots).
BotVerificationIconint64Describes a bot verification icon ».
SendPaidMessagesStarsint64If 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.

References