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
| Name | Type | Required | Description |
|---|---|---|---|
BroadcastsOnly | bool | — | If set, only returns results from channels (used in the global channel search tab »). |
GroupsOnly | bool | — | Whether to search only in groups |
UsersOnly | bool | — | Whether to search only in private chats |
FolderID | int | — | Peer folder ID, for more info click here |
Q | string | yes | Query |
Filter | MessagesFilterClass | yes | Global search filter |
MinDate | int | yes | If a positive value was specified, the method will return only messages with date bigger than min_date |
MaxDate | int | yes | If a positive value was transferred, the method will return only messages with date smaller than max_date |
OffsetRate | int | yes | Initially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message. |
OffsetPeer | InputPeerClass | yes | Offsets for pagination, for more info click here |
OffsetID | int | yes | Offsets for pagination, for more info click here |
Limit | int | yes | Offsets for pagination, for more info click here |
Returns
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | FOLDER_ID_INVALID | Invalid folder ID. |
| 400 | INPUT_FILTER_INVALID | The specified filter is invalid. |
| 400 | SEARCH_QUERY_EMPTY | The search query is empty. |
References
- Official documentation
- Generated Go reference
- TL definition:
messages.searchGlobal#4bc6589a