Skip to content

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

Class: MessageEntity ​

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

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

Constructors ​

Constructor ​

new MessageEntity(payload): MessageEntity

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

Parameters ​

ParameterType
payloadTelegramMessageEntity

Returns ​

MessageEntity

Properties ​

PropertyTypeDefined in
payloadTelegramMessageEntitycontexts/index.d.ts:670

Accessors ​

[toStringTag] ​

Get Signature ​

get [toStringTag](): string

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

MDN

Returns ​

string


customEmojiId ​

Get Signature ​

get customEmojiId(): string

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

For custom_emoji only, unique identifier of the custom emoji.

Use getCustomEmojiStickers to get full information about the sticker

Returns ​

string


dateTimeFormat ​

Get Signature ​

get dateTimeFormat(): string

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

For date_time only, the string that defines the formatting of the date and time

Returns ​

string


language ​

Get Signature ​

get language(): string

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

For pre only, the programming language of the entity text

Returns ​

string


length ​

Get Signature ​

get length(): number

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

Length of the entity in UTF-16 code units

Returns ​

number


offset ​

Get Signature ​

get offset(): number

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

Offset in UTF-16 code units to the start of the entity

Returns ​

number


type ​

Get Signature ​

get type(): TelegramMessageEntityType

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

Type of the entity.

Can be mention (@username), hashtag (#hashtag), cashtag ($USD), bot_command (/start@jobs_bot), url (https://telegram.org), email (do-not-reply@telegram.org), phone_number (+1-212-555-0123), bold (bold text), italic (italic text), underline (underlined text), strikethrough (strikethrough text), “spoiler” (spoiler message), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames)

Returns ​

TelegramMessageEntityType


unixTime ​

Get Signature ​

get unixTime(): number

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

For date_time only, the Unix time associated with the entity

Returns ​

number


url ​

Get Signature ​

get url(): string

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

For text_link only, url that will be opened after user taps on the text

Returns ​

string


user ​

Get Signature ​

get user(): User

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

For text_mention only, the mentioned user

Returns ​

User