One special entity in a text message (like mention, hashtag, URL, etc.)

Constructors

Properties

Accessors

Methods

Constructors

Properties

_text?: string

Accessors

  • get kind():
        | "url"
        | "bold"
        | "email"
        | "mention"
        | "hashtag"
        | "cashtag"
        | "bot_command"
        | "phone_number"
        | "italic"
        | "underline"
        | "strikethrough"
        | "spoiler"
        | "code"
        | "bank_card"
        | "unknown"
        | "blockquote"
        | "pre"
        | "text_link"
        | "text_mention"
        | "emoji"
  • Kind of the entity (see MessageEntityParams)

    Returns
        | "url"
        | "bold"
        | "email"
        | "mention"
        | "hashtag"
        | "cashtag"
        | "bot_command"
        | "phone_number"
        | "italic"
        | "underline"
        | "strikethrough"
        | "spoiler"
        | "code"
        | "bank_card"
        | "unknown"
        | "blockquote"
        | "pre"
        | "text_link"
        | "text_mention"
        | "emoji"

Methods

  • Checks if this entity is of the given type, and adjusts the type accordingly.

    Type Parameters

    • const T extends
          | "url"
          | "bold"
          | "email"
          | "mention"
          | "hashtag"
          | "cashtag"
          | "bot_command"
          | "phone_number"
          | "italic"
          | "underline"
          | "strikethrough"
          | "spoiler"
          | "code"
          | "bank_card"
          | "unknown"
          | "blockquote"
          | "pre"
          | "text_link"
          | "text_mention"
          | "emoji"

    Parameters

    • kind: T

    Returns this is MessageEntity & {
        kind: T;
        params:
            | Extract<{
                kind:
                    | "url"
                    | "bold"
                    | "email"
                    | "mention"
                    | "hashtag"
                    | "cashtag"
                    | "bot_command"
                    | "phone_number"
                    | "italic"
                    | "underline"
                    | "strikethrough"
                    | "spoiler"
                    | "code"
                    | "bank_card"
                    | "unknown";
            }, {
                kind: T;
            }>
            | Extract<{
                collapsible: boolean;
                kind: "blockquote";
            }, {
                kind: T;
            }>
            | Extract<{
                kind: "pre";
                language?: string;
            }, {
                kind: T;
            }>
            | Extract<{
                kind: "text_link";
                url: string;
            }, {
                kind: T;
            }>
            | Extract<{
                kind: "text_mention";
                userId: number;
            }, {
                kind: T;
            }>
            | Extract<{
                emojiId: Long;
                kind: "emoji";
            }, {
                kind: T;
            }>;
    }