Link Search Menu Expand Document

Method: contacts.getTopPeers

Back to methods index

Get most used peers

Parameters:

NameTypeDescriptionRequired
correspondentsBoolUsers we’ve chatted most frequently withOptional
bots_pmBoolMost used botsOptional
bots_inlineBoolMost used inline botsOptional
phone_callsBoolMost frequently called usersOptional
forward_usersBoolUsers to which the users often forwards messages toOptional
forward_chatsBoolChats to which the users often forwards messages toOptional
groupsBoolOften-opened groups and supergroupsOptional
channelsBoolMost frequently visited channelsOptional
bots_appBoolOptional
offsetintOffset for paginationOptional
limitintMaximum number of results to return, see paginationOptional
hashArray of long|stringHash for pagination, for more info click hereOptional

Return type: contacts.TopPeers

Can userbots use this method: YES

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

$contacts_TopPeers = $MadelineProto->contacts->getTopPeers(correspondents: $Bool, bots_pm: $Bool, bots_inline: $Bool, phone_calls: $Bool, forward_users: $Bool, forward_chats: $Bool, groups: $Bool, channels: $Bool, bots_app: $Bool, offset: $int, limit: $int, hash: [$long\|string, $long\|string], );