Skip to main content

messages.searchGlobal

Search for messages and peers globally

func (c *Client) MessagesSearchGlobal(ctx context.Context, request *MessagesSearchGlobalRequest) (MessagesMessagesClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesSearchGlobal(ctx, &tg.MessagesSearchGlobalRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // MessagesMessagesClass
return nil
})

Parameters

NameTypeRequiredDescription
BroadcastsOnlyboolIf set, only returns results from channels (used in the global channel search tab »).
GroupsOnlyboolWhether to search only in groups
UsersOnlyboolWhether to search only in private chats
FolderIDintPeer folder ID, for more info click here
QstringyesQuery
FilterMessagesFilterClassyesGlobal search filter
MinDateintyesIf a positive value was specified, the method will return only messages with date bigger than min_date
MaxDateintyesIf a positive value was transferred, the method will return only messages with date smaller than max_date
OffsetRateintyesInitially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message.
OffsetPeerInputPeerClassyesOffsets for pagination, for more info click here
OffsetIDintyesOffsets for pagination, for more info click here
LimitintyesOffsets for pagination, for more info click here

Returns

MessagesMessagesClass

Possible errors

CodeTypeDescription
400FOLDER_ID_INVALIDInvalid folder ID.
400INPUT_FILTER_INVALIDThe specified filter is invalid.
400SEARCH_QUERY_EMPTYThe search query is empty.

References