messages.searchGlobal
Search for messages and peers globally
Example
const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');
const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
const result = await client.invoke(new Api.messages.searchGlobal({
folderId: 9421634,
q: 'random string here',
filter: new Api.MessagesFilter({...}),
minDate: 9329785,
maxDate: 7418948,
offsetRate: 6917823,
offsetPeer: new Api.InputPeer({...}),
offsetId: 9896393,
limit: 6987313,
}));
console.log(result); // prints the result
})();
TL schema
messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
messages.messagesSlice#3a54685e flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
messages.channelMessages#64479808 flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
messages.messagesNotModified#74535f21 count:int = messages.Messages;
---functions---
messages.searchGlobal#4bc6589a flags:# 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
min_date
If a positive value was specified, the method will return only messages with date bigger than min_date
max_date
If a positive value was transferred, the method will return only messages with date smaller than max_date
Result
Possible errors
Code
Type
Description
400
FOLDER_ID_INVALID
Invalid folder ID
400
SEARCH_QUERY_EMPTY
The search query is empty
Can bots use this methd ?
yes
Related pages
Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists.
Incomplete list of messages and auxiliary data.
How to fetch results from large lists of objects.
Last updated
Was this helpful?