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
})();

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

Name

Type

Description

flags

correspondents

Users we've chatted most frequently with

bots_pm

Most used bots

bots_inline

Most used inline bots

phone_calls

Most frequently called users

forward_users

Users to which the users often forwards messages to

forward_chats

Chats to which the users often forwards messages to

groups

Often-opened groups and supergroups

channels

Most frequently visited channels

offset

Offset for pagination

limit

Maximum number of results to return, see pagination

Result

contacts.TopPeers

Possible errors

Code

Type

Description

400

TYPES_EMPTY

No top peer type was provided

Can bots use this methd ?

yes

How to fetch results from large lists of objects.

Last updated