Skip to content
Back to top
View this page

# SharedUser

class telegram.SharedUser(user_id, first_name=None, last_name=None, username=None, photo=None, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This object contains information about a user that was shared with the bot using a `telegram.KeyboardButtonRequestUsers` button.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `user_id` is equal.

  Available In

  `telegram.UsersShared.users`

  Added in version 21.1.

  Parameters:

    - user_id (`int`) – Identifier of the shared user. This number may have 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has atmost 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means.

    - first_name (`str`, optional) – First name of the user, if the name was requested by the bot.

    - last_name (`str`, optional) – Last name of the user, if the name was requested by the bot.

    - username (`str`, optional) – Username of the user, if the username was requested by the bot.

    - photo (Sequence[`telegram.PhotoSize`], optional) – Available sizes of the chat photo, if the photo was requested by the bot.

  user_id

    Identifier of the shared user. This number may have 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has atmost 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means.

    Type:

      `int`

  first_name

    Optional. First name of the user, if the name was requested by the bot.

    Type:

      `str`

  last_name

    Optional. Last name of the user, if the name was requested by the bot.

    Type:

      `str`

  username

    Optional. Username of the user, if the username was requested by the bot.

    Type:

      `str`

  photo

    Available sizes of the chat photo, if the photo was requested by the bot. This list is empty if the photo was not requsted.

    Type:

      tuple[`telegram.PhotoSize`]

  classmethod de_json(data, bot=None)

    See `telegram.TelegramObject.de_json()`.

  property full_name

    Convenience property. If `first_name` is not `None`, gives `first_name` followed by (if available) `last_name`.

    Added in version 22.4.

    Type:

      `str`

  property link

    Convenience property. If `username` is available, returns a t.me link of the user.

    Added in version 22.4.

    Type:

      `str`

  property name

    Convenience property. If available, returns the user’s `username` prefixed with “@”. If `username` is not available, returns `full_name`.

    Added in version 22.4.

    Type:

      `str`