Class MessageEntities

Hierarchy (view full)

Constructors

  • Creates an instance of the MessageEntities class.

    Parameters

    • client: TelegramClient | BaseClient

      The client that instantiated this.

    • searchText: string

      The text to search within.

    • entities: MessageEntity[]

      The array of message entities.

    Returns MessageEntities

Properties

searchText: string

The text to search within.

Accessors

  • get blockquote(): SearchResult[]
  • Retrieves all blockquote entities from the message.

    Returns SearchResult[]

    An array of objects representing blockquote entities.

  • get bold(): SearchResult[]
  • Retrieves all bold entities from the message.

    Returns SearchResult[]

    An array of objects representing bold entities.

  • get botCommand(): SearchResult[]
  • Retrieves all bot command entities from the message.

    Returns SearchResult[]

    An array of objects representing bot command entities.

  • get cashtag(): SearchResult[]
  • Retrieves all cashtag entities from the message.

    Returns SearchResult[]

    An array of objects representing cashtag entities.

  • get code(): SearchResult[]
  • Retrieves all code entities from the message.

    Returns SearchResult[]

    An array of objects representing code entities.

  • get customEmoji(): (SearchResult & {
        customEmojiId: string;
    })[]
  • Retrieves all custom emoji entities from the message.

    Returns (SearchResult & {
        customEmojiId: string;
    })[]

    An array of objects representing custom emoji entities.

  • get email(): SearchResult[]
  • Retrieves all email entities from the message.

    Returns SearchResult[]

    An array of objects representing email entities.

  • get hashtag(): SearchResult[]
  • Retrieves all hashtag entities from the message.

    Returns SearchResult[]

    An array of objects representing hashtag entities.

  • get italic(): SearchResult[]
  • Retrieves all italic entities from the message.

    Returns SearchResult[]

    An array of objects representing italic entities.

  • get mention(): SearchResult[]
  • Retrieves all mention entities from the message.

    Returns SearchResult[]

    An array of objects representing mention entities.

  • get phoneNumber(): SearchResult[]
  • Retrieves all phone number entities from the message.

    Returns SearchResult[]

    An array of objects representing phone number entities.

  • get pre(): (SearchResult & {
        language?: string;
    })[]
  • Retrieves all pre entities from the message.

    Returns (SearchResult & {
        language?: string;
    })[]

    An array of objects representing pre entities.

  • get spoiler(): SearchResult[]
  • Retrieves all spoiler entities from the message.

    Returns SearchResult[]

    An array of objects representing spoiler entities.

  • get strikethrough(): SearchResult[]
  • Retrieves all strikethrough entities from the message.

    Returns SearchResult[]

    An array of objects representing strikethrough entities.

  • Retrieves all text link entities from the message.

    Returns (SearchResult & {
        url: string;
    })[]

    An array of objects representing text link entities.

  • get textMention(): (SearchResult & {
        user: User;
    })[]
  • Retrieves all text mention entities from the message.

    Returns (SearchResult & {
        user: User;
    })[]

    An array of objects representing text mention entities.

  • get underline(): SearchResult[]
  • Retrieves all underline entities from the message.

    Returns SearchResult[]

    An array of objects representing underline entities.

  • get url(): SearchResult[]
  • Retrieves all URL entities from the message.

    Returns SearchResult[]

    An array of objects representing URL entities.

Methods

  • Enables iteration over the message entities.

    Returns Generator<never, any, unknown>

    An iterator over the message entities.

  • Protected

    Creates a clone of the current instance

    Returns Base

    A clone of the current instance

  • Protected

    Patches the current instance with new data

    Parameters

    • data: Record<string, any>

      The data to patch the instance with

    Returns Record<string, any>

    The patched data

  • Protected

    Updates the current instance with new data and returns a clone of the updated instance

    Parameters

    • data: Record<string, any>

      The data to update the instance with

    Returns Base

    A clone of the updated instance

  • Searches for a specific type of entity in the message.

    Parameters

    • searchType:
          | "bold"
          | "url"
          | "code"
          | "phone_number"
          | "email"
          | "mention"
          | "hashtag"
          | "cashtag"
          | "bot_command"
          | "italic"
          | "underline"
          | "strikethrough"
          | "spoiler"
          | "blockquote"
          | "pre"
          | "text_link"
          | "text_mention"
          | "custom_emoji"

      The type of entity to search for.

    Returns (SearchResult & (
        | {
            language?: string;
        }
        | {
            url: string;
        }
        | {
            user: User;
        }
        | {
            customEmojiId: string;
        }))[]

    An array of objects representing the found entities.

  • Flatten an object. Any properties that are collections will get converted to an array of keys.

    Parameters

    • OptionalpropsRecursive: boolean

      Optional. If true, calls toJSON method on nested objects.

    • Rest...props: Record<string, string | boolean>[]

      Optional. Specific properties to include/exclude, or rename.

    Returns Record<string, any>

    Flattened object.

  • Returns the id instance Chat, User, ChatMember and other

    Returns null | string