MessageEntity

class aiogram.types.message_entity.MessageEntity(conf: Optional[Dict[str, Any]] = None, **kwargs: Any)[source]

Bases: aiogram.types.base.TelegramObject

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

https://core.telegram.org/bots/api#messageentity

Deserialize object

Parameters
  • conf

  • kwargs

get_text(text)[source]

Get value of entity

Parameters

text – full text

Returns

part of text

parse(**kwargs)[source]

Get entity value with markup

Parameters
  • text – original text

  • as_html – as html?

Returns

entity text with markup

MessageEntityType

class aiogram.types.message_entity.MessageEntityType[source]

Bases: aiogram.utils.helper.Helper

List of entity types

Key

MENTION

Key

HASHTAG

Key

CASHTAG

Key

BOT_COMMAND

Key

URL

Key

EMAIL

Key

PHONE_NUMBER

Key

BOLD

Key

ITALIC

Key

CODE

Key

PRE

Key

UNDERLINE

Key

STRIKETHROUGH

Key

TEXT_LINK

Key

TEXT_MENTION