2.5 KiB
2.5 KiB
title | description | image | redirect_from |
---|---|---|---|
messages.searchGlobal | Search for messages and peers globally | https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png | /API_docs/methods/messages_searchGlobal.html |
Method: messages.searchGlobal
Search for messages and peers globally
Parameters:
Name | Type | Description | Required |
---|---|---|---|
folder_id | int | Peer folder ID, for more info click here | Optional |
q | string | Query | Yes |
filter | MessagesFilter | Optional | |
min_date | int | Yes | |
max_date | int | Yes | |
offset_rate | int | Initially 0, then set to the next_rate parameter of messages.messagesSlice |
Yes |
offset_peer | Username, chat ID, Update, Message or InputPeer | Offsets for pagination, for more info click here | Optional |
offset_id | int | Offsets for pagination, for more info click here | Yes |
limit | int | Offsets for pagination, for more info click here | Yes |
Return type: messages.Messages
Can bots use this method: NO
MadelineProto Example (now async for huge speed and parallelism!):
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
$messages.Messages = $MadelineProto->messages->searchGlobal(['folder_id' => int, 'q' => 'string', 'filter' => MessagesFilter, 'min_date' => int, 'max_date' => int, 'offset_rate' => int, 'offset_peer' => InputPeer, 'offset_id' => int, 'limit' => int, ]);
Or, if you're into Lua:
messages.Messages = messages.searchGlobal({folder_id=int, q='string', filter=MessagesFilter, min_date=int, max_date=int, offset_rate=int, offset_peer=InputPeer, offset_id=int, limit=int, })
Errors
Code | Type | Description |
---|---|---|
400 | FOLDER_ID_INVALID | Invalid folder ID |
400 | SEARCH_QUERY_EMPTY | The search query is empty |