Layer 224
MessagesSearchGlobal
Search for messages and peers globally
method
Users
messages.searchGlobal#4bc6589a flags:# broadcasts_only:flags.1?true groups_only:flags.2?true users_only:flags.3?true folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
Parameters
| Name | Type | Description |
|---|---|---|
| BroadcastsOnly | flags.1?true | If set, only returns results from channels (used in the global channel search tab ). |
| GroupsOnly | flags.2?true | Whether to search only in groups |
| UsersOnly | flags.3?true | Whether to search only in private chats |
| FolderId | flags.0?int | Peer folder ID, for more info click here |
| Q | string | Query |
| Filter | MessagesFilter | Global search filter |
| MinDate | int | If a positive value was specified, the method will return only messages with date bigger than min_date |
| MaxDate | int | If a positive value was transferred, the method will return only messages with date smaller than max_date |
| OffsetRate | int | Initially 0, then set to the next_rate parameter of messages. messages Slice, or if that is absent, the date of the last returned message. |
| OffsetPeer | InputPeer | Offsets for pagination, for more info click here |
| OffsetId | int | Offsets for pagination, for more info click here |
| Limit | int | Offsets for pagination, for more info click here |
Returns
messages.MessagesGogram Example
// MessagesSearchGlobal - using Params struct result, err := client.MessagesSearchGlobal(&tg.MessagesSearchGlobalParams{ Q: "Hello, World!", Filter: &tg.MessagesFilter{}, MinDate: 42, MaxDate: 42, OffsetRate: 42, OffsetPeer: &tg.InputPeerUser{UserID: int64(777000)}, OffsetId: 42, Limit: 42, // Optional fields: // BroadcastsOnly: true, // GroupsOnly: true, // UsersOnly: true, // FolderId: 42, }) if err != nil { // handle error } // result is *tg.MessagesMessages
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. |