Skip to content

danog\MadelineProto\EventHandler\Message\RichMessage: A rich message: structured text made of blocks (headings, paragraphs, lists, tables, quotes, media, buttons and so on).

Back to index

Author: Daniil Gentili daniil@daniil.it

A rich message: structured text made of blocks (headings, paragraphs, lists, tables, quotes, media, buttons and so on).

Like a normal message, it has a plain text version ($message) with entities for styled text ($entities), its media ($media) and an HTML version (getHTML()).

Its blocks are typed Block objects (see the Rich\Block namespace), whose texts are RichText objects (see the Rich\Text namespace): each RichText also has a plain text, entities and HTML version.

The blocks can be sent again as-is with sendRichMessage (or editRich, replyRich and so on), and so can the whole object, except for:

  • unsupported blocks (blocks and media that can’t be represented), which are dropped;
  • mentions, hashtags, TON addresses and the other entities detected by Telegram, which are sent as plain text, and detected again unless entity detection is skipped.

Rich messages are not media messages: media filters (e.g. FilterMedia) don’t match them, FilterNoMedia does, and FilterRichMessage matches only them.

Properties

  • $message: string Plain text version of the rich message.

Blocks are separated by newlines, list items are prefixed by their label, table cells are separated by tabs; media blocks are represented by their caption.

  • $entities: list<MessageEntity> Entities for the styled text of $message.

Besides the styles of the text, headings are bold, preformatted blocks and mathematical expressions are pre entities, quotes are block quotes, and expandable quotes and the contents of collapsed details blocks are collapsed block quotes.

  • $media: list<Media> Media of the media blocks of the rich message, in order.
  • $blocks: list<Block> Blocks of the rich message.
  • $rtl: bool Whether the text is right-to-left
  • $part: bool Whether this is just a part of the message (e.g. while a rich message draft is being streamed)

Method list:

Methods:

getHTML(bool $allowTelegramTags = false): string

Get an HTML version of the message.

Parameters:

  • $allowTelegramTags: bool Whether to allow telegram-specific tags like tg-spoiler, tg-emoji, mention links and so on…

Generated by danog/phpdoc