Class TdApi.SearchChatMessages

  • Enclosing class:
    TdApi

    public static class TdApi.SearchChatMessages
    extends TdApi.Function
    Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing messageId. Cannot be used in secret chats with a non-empty query (searchSecretMessages should be used instead), or without an enabled message database. For optimal performance the number of returned messages is chosen by the library.

    Returns Messages

    • Field Summary

      Fields 
      Modifier and Type Field Description
      long chatId
      Identifier of the chat in which to search messages.
      static int CONSTRUCTOR
      Identifier uniquely determining type of the object.
      TdApi.SearchMessagesFilter filter
      Filter for message content in the search results.
      long fromMessageId
      Identifier of the message starting from which history must be fetched; use 0 to get results from the beginning.
      int limit
      The maximum number of messages to be returned; must be positive and can't be greater than 100.
      int offset
      Specify 0 to get results from exactly the fromMessageId or a negative offset to get the specified message and some newer messages.
      java.lang.String query
      Query to search for.
      int senderUserId
      If not 0, only messages sent by the specified user will be returned.
    • Field Detail

      • chatId

        public long chatId
        Identifier of the chat in which to search messages.
      • query

        public java.lang.String query
        Query to search for.
      • senderUserId

        public int senderUserId
        If not 0, only messages sent by the specified user will be returned. Not supported in secret chats.
      • fromMessageId

        public long fromMessageId
        Identifier of the message starting from which history must be fetched; use 0 to get results from the beginning.
      • offset

        public int offset
        Specify 0 to get results from exactly the fromMessageId or a negative offset to get the specified message and some newer messages.
      • limit

        public int limit
        The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached.
      • CONSTRUCTOR

        public static final int CONSTRUCTOR
        Identifier uniquely determining type of the object.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SearchChatMessages

        public SearchChatMessages()
        Default constructor.
      • SearchChatMessages

        public SearchChatMessages​(long chatId,
                                  java.lang.String query,
                                  int senderUserId,
                                  long fromMessageId,
                                  int offset,
                                  int limit,
                                  TdApi.SearchMessagesFilter filter)
        Constructor for initialization of all fields.
        Parameters:
        chatId - Identifier of the chat in which to search messages.
        query - Query to search for.
        senderUserId - If not 0, only messages sent by the specified user will be returned. Not supported in secret chats.
        fromMessageId - Identifier of the message starting from which history must be fetched; use 0 to get results from the beginning.
        offset - Specify 0 to get results from exactly the fromMessageId or a negative offset to get the specified message and some newer messages.
        limit - The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached.
        filter - Filter for message content in the search results.