SharedUser

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

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.

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[source]

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[source]

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

Type:

str

last_name[source]

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

Type:

str

username[source]

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

Type:

str

photo[source]

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)[source]

See telegram.TelegramObject.de_json().