telegram.messageentity module

This module contains an object that represents a Telegram MessageEntity.

class telegram.messageentity.MessageEntity(type, offset, length, url=None, user=None, **kwargs)

Bases: telegram.base.TelegramObject

This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.

Parameters:
  • type (str) –
  • offset (int) –
  • length (int) –
  • url (Optional[str]) –
  • user (Optional[telegram.User]) –
ALL_TYPES = ['mention', 'hashtag', 'bot_command', 'url', 'email', 'bold', 'italic', 'code', 'pre', 'text_link', 'text_mention']
BOLD = 'bold'
BOT_COMMAND = 'bot_command'
CODE = 'code'
EMAIL = 'email'
HASHTAG = 'hashtag'
ITALIC = 'italic'
MENTION = 'mention'
PRE = 'pre'
TEXT_MENTION = 'text_mention'
URL = 'url'
static de_json(data, bot)
static de_list(data, bot)
Parameters:data (list) –
Returns:
Return type:List<telegram.MessageEntity>