• Search for messages inside a specific chat

    Parameters

    • client: ITelegramClient
    • Optionalparams: {
          addOffset?: number;
          chatId?: InputPeerLike;
          filter?: TypeMessagesFilter;
          fromUser?: InputPeerLike;
          limit?: number;
          maxDate?: number | Date;
          maxId?: number;
          minDate?: number | Date;
          minId?: number;
          offset?: number;
          query?: string;
          threadId?: number;
      }

      Additional search parameters

      • OptionaladdOffset?: number

        Additional offset from offset, in resulting messages.

        This can be used for advanced use cases, like:

        • Loading 20 results newer than message with ID MSGID: offset = MSGID, addOffset = -20, limit = 20
        • Loading 20 results around message with ID MSGID: offset = MSGID, addOffset = -10, limit = 20

        When offset is not set, this will be relative to the last message

        0 (disabled)

      • OptionalchatId?: InputPeerLike

        Chat where to search for messages.

        When empty, will search across common message box (i.e. private messages and legacy chats)

      • Optionalfilter?: TypeMessagesFilter

        Filter the results using some filter (see SearchFilters)

        SearchFilters.Empty (i.e. will return all messages)

      • OptionalfromUser?: InputPeerLike

        Search only for messages sent by a specific user.

        You can pass their marked ID, username, phone or "me" or "self"

      • Optionallimit?: number

        Limits the number of messages to be retrieved.

        100
        
      • OptionalmaxDate?: number | Date

        Maximum message date to return

        0 (disabled).

      • OptionalmaxId?: number

        Maximum message ID to return.

        Unless addOffset is used, this will work the same as offset.

        0 (disabled).

      • OptionalminDate?: number | Date

        Minimum message date to return

        0 (disabled).

      • OptionalminId?: number

        Minimum message ID to return

        0 (disabled).

      • Optionaloffset?: number

        Offset ID for the search. Only messages earlier than this ID will be returned.

        0 (starting from the latest message).

      • Optionalquery?: string

        Text query string. Required for text-only messages, optional for media.

        "" (empty string)

      • OptionalthreadId?: number

        Thread ID to return only messages from this thread.

    Returns Promise<ArrayPaginated<Message, SearchMessagesOffset>>