User#

class pyrogram.types.User#

A Telegram user or bot.

Parameters:
  • id (int) – Unique identifier for this user or bot.

  • first_name (str, optional) – User’s or bot’s first name.

  • last_name (str, optional) – User’s or bot’s last name.

  • username (str, optional) – User’s or bot’s username.

  • language_code (str, optional) – IETF language tag of the user’s language.

  • is_premium (bool, optional) – True, if this user is a premium user.

  • is_self (bool, optional) – True, if this user is you yourself.

  • is_contact (bool, optional) – True, if this user is in your contacts.

  • is_mutual_contact (bool, optional) – True, if you both have each other’s contact.

  • is_deleted (bool, optional) – True, if this user is deleted.

  • is_verified (bool, optional) – True, if this user has been verified by Telegram.

  • is_restricted (bool, optional) – True, if this user has been restricted. Bots only. See restriction_reason for details.

  • is_scam (bool, optional) – True, if this user has been flagged for scam.

  • is_fake (bool, optional) – True, if this user has been flagged for impersonation.

  • is_support (bool, optional) – True, if this user is part of the Telegram support team.

  • restricts_new_chats (bool, optional) – True, if the user may restrict new chats with non-contacts.

  • status (UserStatus, optional) – User’s last seen & online status. None, for bots.

  • last_online_date (datetime, optional) – Last online date of a user. Only available in case status is OFFLINE.

  • next_offline_date (datetime, optional) – Date when a user will automatically go offline. Only available in case status is ONLINE.

  • emoji_status (EmojiStatus, optional) – Emoji status.

  • dc_id (int, optional) – User’s or bot’s assigned DC (data center). Available only in case the user has set a public profile photo. Note that 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 FAQs.

  • phone_number (str, optional) – User’s phone number.

  • photo (ChatPhoto, optional) – User’s or bot’s current profile photo. Suitable for downloads only.

  • active_usernames (List of Username, optional) – If non-empty, the list of all active chat usernames; for private chats, supergroups and channels.

  • restrictions (List of Restriction, optional) – The list of reasons why this bot might be unavailable to some users. This field is available only in case is_restricted is True.

  • is_bot (bool, optional) – True, if this user is a bot.

  • can_be_added_to_attachment_menu (bool, optional) – True, if the bot can be added to attachment or side menu.

  • added_to_attachment_menu (bool, optional) – True, if this user added the bot to the attachment menu.

  • can_join_groups (bool, optional) – True, if the bot can be invited to groups. Returned only in get_me.

  • can_read_all_group_messages (bool, optional) – True, if privacy mode is disabled for the bot. Returned only in get_me.

  • supports_inline_queries (bool, optional) – True, if the bot supports inline queries. Returned only in get_me.

  • can_connect_to_business (bool, optional) – True, if the bot can be connected to a Telegram Business account to receive its messages.

  • inline_query_placeholder (str, optional) – Placeholder for inline queries (displayed on the application input field)

  • inline_need_location (bool, optional) – True, if the bot supports inline user location requests. Returned only in get_me.

  • can_be_edited (bool, optional) – True, if the current user can edit this bot’s profile picture.

  • is_close_friend (bool, optional) – True, if the user is a close friend of the current user; implies that the user is a contact

  • accent_color (ChatColor, optional) – Chat accent color.

  • profile_color (ChatColor, optional) – Chat profile color.

  • have_access (bool, optional) – If False, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can’t be passed to any method.

  • has_main_web_app (bool, optional) – True, if the bot has a main Web App. Returned only in get_me.

  • active_user_count (int, optional) – The number of recently active users of the bot.

  • paid_message_star_count (int, optional) – Number of Telegram Stars that must be paid by general user for each sent message to the user. If positive and userFullInfo is unknown, use canSendMessageToUser to check whether the current user must pay.

  • mention (str, property) – Generate a text mention for this user. You can use user.mention() to mention the user using their first name (styled using html), or user.mention("another name") for a custom name. To choose a different style (“HTML” or “MARKDOWN”) use user.mention(style=ParseMode.MARKDOWN).

  • full_name (str, property) – Full name of the other party in a private chat, for private chats and bots.