Layer 220
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 |
|---|---|---|
| Flags | # | Flags, see TL conditional fields |
| 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.MessagesPossible 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. |
Gogram Example
// MessagesSearchGlobal - using Params struct result, err := client.MessagesSearchGlobal(&tg.MessagesSearchGlobalParams{ Q: "...", Filter: &tg.MessagesFilter{}, MinDate: 0, MaxDate: 0, OffsetRate: 0, OffsetPeer: &tg.InputPeerUser{UserID: int64(123456789)}, OffsetId: 0, Limit: 0, // Optional fields: // BroadcastsOnly: true, // GroupsOnly: true, // UsersOnly: true, // FolderId: 0, }) if err != nil { // handle error } // result is *tg.MessagesMessages