User

class aiogram.types.user.User(*, id: int, is_bot: bool, first_name: str, last_name: str | None = None, username: str | None = None, language_code: str | None = None, is_premium: bool | None = None, added_to_attachment_menu: bool | None = None, can_join_groups: bool | None = None, can_read_all_group_messages: bool | None = None, supports_inline_queries: bool | None = None, can_connect_to_business: bool | None = None, has_main_web_app: bool | None = None, **extra_data: Any)[source]

This object represents a Telegram user or bot.

Source: https://core.telegram.org/bots/api#user

id: int

Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.

is_bot: bool

True, if this user is a bot

first_name: str

User’s or bot’s first name

last_name: str | None

Optional. User’s or bot’s last name

username: str | None

Optional. User’s or bot’s username

language_code: str | None

Optional. IETF language tag of the user’s language

is_premium: bool | None

Optional. True, if this user is a Telegram Premium user

added_to_attachment_menu: bool | None

Optional. True, if this user added the bot to the attachment menu

can_join_groups: bool | None

Optional. True, if the bot can be invited to groups. Returned only in aiogram.methods.get_me.GetMe.

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

can_read_all_group_messages: bool | None

Optional. True, if privacy mode is disabled for the bot. Returned only in aiogram.methods.get_me.GetMe.

supports_inline_queries: bool | None

Optional. True, if the bot supports inline queries. Returned only in aiogram.methods.get_me.GetMe.

can_connect_to_business: bool | None

Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in aiogram.methods.get_me.GetMe.

has_main_web_app: bool | None

Optional. True, if the bot has a main Web App. Returned only in aiogram.methods.get_me.GetMe.

property full_name: str
property url: str
mention_markdown(name: str | None = None) str[source]
mention_html(name: str | None = None) str[source]
get_profile_photos(offset: int | None = None, limit: int | None = None, **kwargs: Any) GetUserProfilePhotos[source]

Shortcut for method aiogram.methods.get_user_profile_photos.GetUserProfilePhotos will automatically fill method attributes:

  • user_id

Use this method to get a list of profile pictures for a user. Returns a aiogram.types.user_profile_photos.UserProfilePhotos object.

Source: https://core.telegram.org/bots/api#getuserprofilephotos

Parameters:
  • offset – Sequential number of the first photo to be returned. By default, all photos are returned.

  • limit – Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.

Returns:

instance of method aiogram.methods.get_user_profile_photos.GetUserProfilePhotos