contacts.getTopPeers
Get most used peers
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.contacts.getTopPeers({
correspondents: true,
botsPm: true,
botsInline: true,
phoneCalls: true,
forwardUsers: true,
forwardChats: true,
groups: true,
channels: true,
offset: 5972771,
limit: 6658168,
hash: 1575713,
}));
console.log(result); // prints the result
})();
import {Api, TelegramClient} from 'telegram';
import {StringSession} from 'telegram/sessions';
const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
const result: Api.contacts.TopPeers = await client.invoke(new Api.contacts.getTopPeers({
correspondents: true,
botsPm: true,
botsInline: true,
phoneCalls: true,
forwardUsers: true,
forwardChats: true,
groups: true,
channels: true,
offset: 5972771,
limit: 6658168,
hash: 1575713,
}));
console.log(result); // prints the result
})();
TL schema
contacts.topPeersNotModified#de266ef5 = contacts.TopPeers;
contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<Chat> users:Vector<User> = contacts.TopPeers;
contacts.topPeersDisabled#b52c939d = contacts.TopPeers;
---functions---
contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true forward_users:flags.4?true forward_chats:flags.5?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers;
Parameters
Result
Possible errors
Can bots use this methd ?
yes
Related pages
How to fetch results from large lists of objects.
Last updated