class pyrogram.types.MessageEntity

One special entity in a text message. For example, hashtags, usernames, URLs, etc.

  • type (str) – Type of the entity. Can be:

    • “mention”: @username.

    • “hashtag”: #hashtag.

    • “cashtag”: $PYRO.

    • “bot_command”: /start@pyrogrambot.

    • “url”: (see url below).

    • “email”:

    • “phone_number”: +69-420-1337.

    • “bold”: bold text.

    • “italic”: italic text.

    • “underline”: underlined text.

    • “strikethrough”: strikethrough text.

    • “code”: monowidth string.

    • “pre”: monowidth block (see language below).

    • “text_link”: for clickable text URLs.

    • “text_mention”: for users without usernames (see user below).

  • offset (int) – Offset in UTF-16 code units to the start of the entity.

  • length (int) – Length of the entity in UTF-16 code units.

  • url (str, optional) – For “text_link” only, url that will be opened after user taps on the text.

  • user (User, optional) – For “text_mention” only, the mentioned user.

  • language (str. optional) – For “pre” only, the programming language of the entity text.