MessageEntity

Message entities, representing styled text in a message

Method schema is available as of layer 224. Switch »

Constructors

Constructor Description
messageEntityUnknown Unknown message entity
messageEntityMention Message entity mentioning a user by @username; messageEntityMentionName can also be used to mention users by their ID.
messageEntityHashtag #hashtag message entity
messageEntityBotCommand Message entity representing a bot /command
messageEntityUrl Message entity representing an in-text url: https://google.com; for text urls, use messageEntityTextUrl.
messageEntityEmail Message entity representing an email@example.com.
messageEntityBold Message entity representing bold text.
messageEntityItalic Message entity representing italic text.
messageEntityCode Message entity representing a codeblock.
messageEntityPre Message entity representing a preformatted codeblock, allowing the user to specify a programming language for the codeblock.
messageEntityTextUrl Message entity representing a text url: for in-text urls like https://google.com use messageEntityUrl.

Note that an additional confirmation popup with the full URL must be displayed to the user before opening this link, unless the domain satisfies the conditions specified in the domain whitelist documentation ».
messageEntityUnderline Message entity representing underlined text.
messageEntityStrike Message entity representing strikethrough text.
messageEntityBlockquote Message entity representing a block quote.
messageEntitySpoiler Message entity representing a spoiler
messageEntityCustomEmoji Represents a custom emoji.
Note that this entity must wrap exactly one regular emoji (the one contained in documentAttributeCustomEmoji.alt) in the related text, otherwise the server will ignore it.
messageEntityMentionName Message entity representing a user mention: for creating a mention use inputMessageEntityMentionName.
inputMessageEntityMentionName Message entity that can be used to create a user user mention: received mentions use the messageEntityMentionName constructor, instead.
messageEntityPhone Message entity representing a phone number.
messageEntityCashtag Message entity representing a $cashtag.
messageEntityBankCard Indicates a credit card number
messageEntityFormattedDate Represents a specific point in time, rendered as specified here »

All flags are optional, with the following limitations:

- relative cannot combined with any other flag
- short_time and long_time cannot be combined with each other
- short_date and long_date cannot be combined with each other

If any of the flags are combined, their rendering order in the text is the following:

- day_of_week
- short_time/long_time
- short_date/long_date
messageEntityDiffInsert Represents an diff addition: render it by simply underlining the specified section and coloring it in green, see here » for more info on how to render diff entities.
messageEntityDiffReplace Represents an diff replacement, render it as follows:

- Insert old_text into the text at offset offset, underline it and color it in red: note that this insertion does not affect the offsets of entities that come after it.
- underline the section delimited by offset and limit and color it in green.

See here » for more info on how to render diff entities.
messageEntityDiffDelete Represents an diff deletion: render it by simply underlining the specified section and coloring it in red, see here » for more info on how to render diff entities.