api.searchMessages()
Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
Parameters
SearchMessagesParams
:chevron_leftchevron_right
Parameters
Interface
Name | Type | Description |
---|---|---|
chatList | Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported | |
query | string | Query to search for |
offsetDate | number | The date of the message starting from which the results need to be fetched. Use 0 or any date in the future to get results from the last message |
offsetChatId | number | The chat identifier of the last found message, or 0 for the first request |
offsetMessageId | number | The message identifier of the last found message, or 0 for the first request |
limit | number | The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit |
filter | Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterFailedToSend and searchMessagesFilterPinned are unsupported in this function | |
minDate | number | If not 0, the minimum date of the messages to return |
maxDate | number | If not 0, the maximum date of the messages to return |
Returns
ApiResponse
interface:interface ApiResponse {
_: 'searchMessages' | 'error'
airgram: Airgram
request: {
method: 'searchMessages'
params: SearchMessagesParams
}
response: |
setState: (nextState: Record<string, unknown>) => void
getState: () => Record<string, unknown>
}