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

Parameters

Name

Type

Description

correspondents

Users we've chatted most frequently with

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

limit

Maximum number of results to return, see paginationarrow-up-right

Result

contacts.TopPeersarrow-up-right

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

Was this helpful?