telegram.User

class telegram.User(id, first_name, last_name=None, username=None, language_code=None, bot=None, **kwargs)

Bases: telegram.base.TelegramObject

This object represents a Telegram user or bot.

id

int – Unique identifier for this user or bot.

first_name

str – 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 last name.

language_code

str – Optional. IETF language tag of the user’s language.

bot

telegram.Bot – Optional. The Bot to use for instance methods.

Parameters:
  • id (int) – Unique identifier for this user or bot.
  • first_name (str) – 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.
  • bot (telegram.Bot, optional) – The Bot to use for instance methods.
classmethod de_json(data, bot)
classmethod de_list(data, bot)
get_profile_photos(*args, **kwargs)

Shortcut for:

bot.get_user_profile_photos(update.message.from_user.id, *args, **kwargs)
name

str – The users username if available, if not it returns the first name and if present first_name and last_name.