telegram.User¶
-
class
telegram.User(id, first_name, is_bot, last_name=None, username=None, language_code=None, bot=None, **kwargs)¶ Bases:
telegram.base.TelegramObjectThis object represents a Telegram user or bot.
-
id¶ Unique identifier for this user or bot.
Type: int
-
is_bot¶ True, if this user is a bot
Type: bool
-
first_name¶ User’s or bot’s first name.
Type: str
-
last_name¶ Optional. User’s or bot’s last name.
Type: str
-
username¶ Optional. User’s or bot’s username.
Type: str
-
language_code¶ Optional. IETF language tag of the user’s language.
Type: str
-
bot¶ Optional. The Bot to use for instance methods.
Type: telegram.Bot
Parameters: - id (
int) – Unique identifier for this user or bot. - is_bot (
bool) – True, if this user is a 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)¶
-
full_name¶ Convenience property. The user’s
first_name, followed by (if available)last_name.Type: str
-
get_profile_photos(*args, **kwargs)¶ Shortcut for:
bot.get_user_profile_photos(update.message.from_user.id, *args, **kwargs)
-
mention_html(name=None)¶ Parameters: name ( str) – The name used as a link for the user. Defaults tofull_name.Returns: The inline mention for the user as HTML. Return type: str
-
mention_markdown(name=None)¶ Parameters: name ( str) – The name used as a link for the user. Defaults tofull_name.Returns: The inline mention for the user as markdown. Return type: str
-
name¶ Convenience property. If available, returns the user’s
usernameprefixed with “@”. Ifusernameis not available, returnsfull_name.Type: str
-
send_animation(*args, **kwargs)¶ Shortcut for:
bot.send_animation(User.id, *args, **kwargs)
Where User is the current instance.
Returns: On success, instance representing the message posted. Return type: telegram.Message
-
send_audio(*args, **kwargs)¶ Shortcut for:
bot.send_audio(User.id, *args, **kwargs)
Where User is the current instance.
Returns: On success, instance representing the message posted. Return type: telegram.Message
-
send_document(*args, **kwargs)¶ Shortcut for:
bot.send_document(User.id, *args, **kwargs)
Where User is the current instance.
Returns: On success, instance representing the message posted. Return type: telegram.Message
-
send_message(*args, **kwargs)¶ Shortcut for:
bot.send_message(User.id, *args, **kwargs)
Where User is the current instance.
Returns: On success, instance representing the message posted. Return type: telegram.Message
-
send_photo(*args, **kwargs)¶ Shortcut for:
bot.send_photo(User.id, *args, **kwargs)
Where User is the current instance.
Returns: On success, instance representing the message posted. Return type: telegram.Message
-
send_sticker(*args, **kwargs)¶ Shortcut for:
bot.send_sticker(User.id, *args, **kwargs)
Where User is the current instance.
Returns: On success, instance representing the message posted. Return type: telegram.Message
-
send_video(*args, **kwargs)¶ Shortcut for:
bot.send_video(User.id, *args, **kwargs)
Where User is the current instance.
Returns: On success, instance representing the message posted. Return type: telegram.Message
-
send_video_note(*args, **kwargs)¶ Shortcut for:
bot.send_video_note(User.id, *args, **kwargs)
Where User is the current instance.
Returns: On success, instance representing the message posted. Return type: telegram.Message
-
send_voice(*args, **kwargs)¶ Shortcut for:
bot.send_voice(User.id, *args, **kwargs)
Where User is the current instance.
Returns: On success, instance representing the message posted. Return type: telegram.Message
-