Skip to content

GramIO API Reference / @gramio/contexts/dist / RichMessage

Class: RichMessage ​

Defined in: contexts/index.d.ts:2846

Rich formatted message.

The blocks are exposed as their raw TelegramObjects.TelegramRichBlock payloads — the rich message tree is a deeply nested, recursive union, so it is left untyped-wrapped and consumed directly via the fully typed payload.

Use .text to get the flattened plain text, which lets existing ctx.text-based handlers (commands, filters) keep working on rich messages.

Documentation

Constructors ​

Constructor ​

new RichMessage(payload): RichMessage

Defined in: contexts/index.d.ts:2848

Parameters ​

ParameterType
payloadTelegramRichMessage

Returns ​

RichMessage

Properties ​

PropertyTypeDefined in
payloadTelegramRichMessagecontexts/index.d.ts:2847

Accessors ​

[toStringTag] ​

Get Signature ​

get [toStringTag](): string

Defined in: contexts/index.d.ts:2849

Returns ​

string


blocks ​

Get Signature ​

get blocks(): TelegramRichBlock[]

Defined in: contexts/index.d.ts:2851

Content of the message

Returns ​

TelegramRichBlock[]


isRtl ​

Get Signature ​

get isRtl(): boolean

Defined in: contexts/index.d.ts:2853

true, if the rich message must be shown right-to-left

Returns ​

boolean


text ​

Get Signature ​

get text(): string

Defined in: contexts/index.d.ts:2860

The message flattened to plain text — blocks joined by blank lines, formatting stripped.

Lets text-based handlers keep working on rich messages: ctx.text falls back to this when a message has no plain text. Returns "" for a message with no textual content.

Returns ​

string

Methods ​

toString() ​

toString(): string

Defined in: contexts/index.d.ts:2861

Returns ​

string