Full information about a particular user.

Hierarchy (View Summary)

Constructors

Properties

peers: PeersIndex
raw: RawUser

Underlying raw TL object

type: "user" = ...

Accessors

  • get bio(): string
  • Bio of the other party in a private chat, or description of a group, supergroup or channel.

    Returns string

  • get birthday(): null | RawBirthday
  • Information about the user's birthday

    Returns null | RawBirthday

  • get blockedMyStoriesFrom(): boolean
  • Whether the current user has blocked this user from seeing our stories

    Returns boolean

  • get botActiveUsers(): null | number
  • Number of bot's active users, if available

    Returns null | number

  • get botBroadcastAdminRights(): null | RawChatAdminRights
  • Suggested admin rights for channels for this bot

    Returns null | RawChatAdminRights

  • get botGroupAdminRights(): null | RawChatAdminRights
  • Suggested admin rights for groups for this bot

    Returns null | RawChatAdminRights

  • get botVerification(): null | BotVerification
  • Information about a bot-issued verification (if any)

    Returns null | BotVerification

  • get business(): null | BusinessAccount
  • If this is a business account, information about the business.

    Returns null | BusinessAccount

  • get canCall(): boolean
  • Whether the current user can call this user

    Returns boolean

  • get canManageBotEmojiStatus(): boolean
  • If this chat is a bot, whether the current user can manage its emoji status

    Returns boolean

  • get canViewAdRevenue(): boolean
  • Whether the current user can view ad revenue for this bot

    Returns boolean

  • get color(): ChatColors
  • Color that should be used when rendering replies to their messages and web previews sent by them, as well as to render the chat title

    Returns ChatColors

  • get commonChatsCount(): number
  • Number of common chats with this user

    Returns number

  • get customVerificationEmojiId(): null | Long
  • If non-null, this user was verified by a bot, and this field contains the ID of the custom emoji to display as the verification icon.

    Returns null | Long

  • get dcId(): null | number
  • User's or bot's assigned DC (data center). Available only in case the user has set a public profile photo.

    Note: this information is approximate; it is based on where Telegram stores a user profile pictures and does not by any means tell you the user location (i.e. a user might travel far away, but will still connect to its assigned DC). More info at Pyrogram FAQ.

    Returns null | number

  • get displayName(): string
  • User's display name.

    First name and last name if available, only first name otherwise.

    Returns string

  • get emojiStatus(): null | EmojiStatus
  • User's emoji status, if any.

    Returns null | EmojiStatus

  • get firstName(): string
  • User's or bot's first name

    Returns string

  • get fullPhoto(): null | Photo
  • Full information about this chat's photo, if any.

    Unlike Chat.photo, this field contains additional information about the photo, such as its date, more sizes, and is the only way to get the animated profile photo.

    This field takes into account any personal/fallback photo that the user may have set

    Returns null | Photo

  • get hasBlockedVoices(): boolean
  • Whether this user has restricted sending them voice/video messages.

    Returns boolean

  • get hasCallsAvailable(): boolean
  • Whether the user can make/accept calls

    Returns boolean

  • get hasCustomWallpaper(): boolean
  • Whether the chat with this user has a custom wallpaper

    Returns boolean

  • get hasHiddenReadDate(): boolean
  • Whether this user has hidden the exact read dates

    Returns boolean

  • get hasMainApp(): boolean
  • Whether this bot has a main app

    Returns boolean

  • get hasPinnedStories(): boolean
  • Whether this chat has pinned stories

    Returns boolean

  • get hasScheduled(): boolean
  • Whether the chat with this user has some scheduled messages

    Returns boolean

  • get hasSponsoredEnabled(): boolean
  • (Only for current user) Whether we have re-enabled sponsored messages, despite having Telegram Premium

    Returns boolean

  • get hasTranslationsDisabled(): boolean
  • Whether the real-time translations popup should not be shown for this channel

    Returns boolean

  • get hasVideoCallsAvailable(): boolean
  • Whether the user can make/accept video calls

    Returns boolean

  • get id(): number
  • Unique identifier for this user or bot

    Returns number

  • get inputPeer(): TypeInputPeer
  • Get this user's input peer for advanced use-cases.

    Note: for min users, this method will return mtcute.dummyInputPeerMinUser, which is actually not a valid input peer. These are used to indicate that the user is incomplete, and a message reference is needed to resolve the peer.

    Such objects are handled by TelegramClient.resolvePeer method, so prefer using it whenever you need an input peer.

    Returns TypeInputPeer

  • get isArchived(): boolean
  • Whether this chat is archived

    Returns boolean

  • get isBlocked(): boolean
  • Whether the user is blocked by the current user

    Returns boolean

  • get isBot(): boolean
  • Whether this user is a bot

    Returns boolean

  • get isBotAttachmentMenuEnabled(): boolean
  • Whether this bot offers an attachment menu web app, and we have it enabled

    Returns boolean

  • get isBotEditable(): boolean
  • Whether this bot can be edited by the current user

    Returns boolean

  • get isBotWithAttachmentMenu(): boolean
  • Whether this bot offers an attachment menu web app

    Returns boolean

  • get isBotWithHistory(): boolean
  • Whether this user is a bot that has access to all messages

    Returns boolean

  • get isBotWithInlineGeo(): boolean
  • Whether this bot can request geolocation when used in inline mode

    Returns boolean

  • get isBotWithoutChats(): boolean
  • Whether this user is a bot that can't be added to chats

    Returns boolean

  • get isBusinessBot(): boolean
  • Whether this user is a bot that can be connected to a Telegram Business account to receive its messages

    Returns boolean

  • get isCloseFriend(): boolean
  • Whether this user is in yout "close friends" list

    Returns boolean

  • get isContact(): boolean
  • Whether this user is in your contacts

    Returns boolean

  • get isDeleted(): boolean
  • Whether this user is deleted

    Returns boolean

  • get isFake(): boolean
  • Whether this user has been flagged for impersonation

    Returns boolean

  • get isMin(): boolean
  • Whether this user's information is incomplete.

    This usually only happens in large chats, where the server sometimes sends only a part of the user's information. Basic info like name and profile photo are always available, but other fields may be omitted despite being available.

    For a rough list of fields that may be missing, see the official docs.

    This currently only ever happens for non-bot users, so if you are building a normal bot, you can safely ignore this field.

    To fetch the "complete" user information, use one of these methods:

    Learn more: Incomplete peers

    Returns boolean

  • get isMutualContact(): boolean
  • Whether you both have each other's contact

    Returns boolean

  • get isPremium(): boolean
  • Whether this user has Premium subscription

    Returns boolean

  • get isPremiumRequired(): boolean
  • Whether Premium is required to contact this user

    Returns boolean

  • get isRestricted(): boolean
  • Whether this user has been restricted. Bots only. See restrictionReason for details

    Returns boolean

  • get isScam(): boolean
  • Whether this user has been flagged for scam

    Returns boolean

  • get isSelf(): boolean
  • Whether this user is you yourself

    Returns boolean

  • get isSupport(): boolean
  • Whether this user is part of the Telegram support team

    Returns boolean

  • get isVerified(): boolean
  • Whether this user has been verified by Telegram

    Returns boolean

  • get language(): null | string
  • IETF language tag of the user's language

    Only available in some contexts

    Returns null | string

  • get lastName(): null | string
  • User's or bot's last name

    Returns null | string

  • get lastOnline(): null | Date
  • Last time this user was seen online. Only available if status is offline

    Returns null | Date

  • get nextOffline(): null | Date
  • Time when this user will automatically go offline. Only available if status is online

    Returns null | Date

  • get personalChannel(): null | Chat
  • Information about the user's personal channel.

    Returns null | Chat

  • get personalChannelMessageId(): null | number
  • ID of the last message in personalChannel

    Returns null | number

  • get personalPhoto(): null | Photo
  • A custom photo (set by the current user) that should be displayed instead of the actual chat photo.

    Currently only available for users.

    Returns null | Photo

  • get phoneNumber(): null | string
  • User's phone number

    Returns null | string

  • get photo(): null | ChatPhoto
  • User's or bot's current profile photo, if any. Suitable for downloads only

    Returns null | ChatPhoto

  • get pinnedMsgId(): null | number
  • ID of the last pinned message in the chat with this user

    Returns null | number

  • get privateForwardName(): null | string
  • Anonymized text to be shown instead of the user's name when forwarding their messages

    Returns null | string

  • get profileColors(): null | ChatColors
  • Color that should be used when rendering the header of the user's profile

    If null, a generic header should be used instead

    Returns null | ChatColors

  • get publicPhoto(): null | Photo
  • A photo that the user has set to be shown in case their actual profile photo is not available due to privacy settings.

    Currently only available for users.

    Returns null | Photo

  • get realPhoto(): null | Photo
  • Actual profile photo of the user, bypassing the custom one.

    Returns null | Photo

  • get restrictionReason(): RawRestrictionReason[]
  • Reason why this bot was restricted

    Returns RawRestrictionReason[]

  • get restrictions(): null | readonly RawRestrictionReason[]
  • The list of reasons why this bot might be unavailable to some users. This field is available only in case isRestricted is true

    Returns null | readonly RawRestrictionReason[]

  • get starGiftsCount(): number
  • Number of star gifts the user has chosen to display on their profile

    Returns number

  • get status(): UserStatus
  • User's Last Seen & Online status

    Returns UserStatus

  • get statusHiddenByMe(): boolean
  • Whether user's online status is hidden because we have hidden our own online status from them, and we don't have Premium subscription.

    Returns boolean

  • get storiesHidden(): boolean
  • Whether you have hidden (arhived) this user's stories

    Returns boolean

  • get storiesMaxId(): number
  • Maximum ID of stories this user has (or 0 if none)

    Returns number

  • get storiesUnavailable(): boolean
  • Returns boolean

  • get ttlPeriod(): null | number
  • TTL of all messages in this chat, in seconds

    Returns null | number

  • get username(): null | string
  • User's or bot's username

    Returns null | string

  • get usernames(): null | readonly RawUsername[]
  • User's or bot's usernames (including collectibles)

    Returns null | readonly RawUsername[]

Methods

  • Create a mention for the user.

    When available and text is omitted, this method will return @username. Otherwise, text mention is created.

    Use null as text (first parameter) to force create a text mention with display name, even if there is a username.

    Note: This method doesn't format anything on its own. Instead, it returns a MessageEntity that can later be used with html or md template tags

    Parameters

    • Optionaltext: null | string

      Text of the mention.

    Returns string | MessageEntity

    msg.replyText(html`Hello, ${msg.sender.mention()`)
    
  • Create a permanent mention for this user.

    Permanent* means that this mention will also contain user's access hash, so even if the user changes their username or the client forgets about that user, it can still be mentioned.

    Telegram might change access hash in some cases, so it may not exactly be permanent. The only way to actually make it permanent is to send it as a message somewhere and load it from there if needed.

    Note that some users (particularly, users with hidden forwards) may not be mentioned like this outside the chats you have in common.

    This method is only needed when the result will be stored somewhere outside current mtcute instance (e.g. saved for later use), otherwise mention will be enough.

    Note: This method doesn't format anything on its own. Instead, it returns a MessageEntity that can later be used with html or md template tags

    Note: the resulting text can only be used by clients that support mtcute notation of permanent mention links (tg://user?id=123&hash=abc).

    Also note that these permanent mentions are only valid for current account, since peer access hashes are account-specific and can't be used on another account.

    Also note that for some users such mentions might not work at all due to privacy settings.

    Parameters

    • Optionaltext: null | string

      Mention text

    Returns MessageEntity