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
offsetintOffset for paginationOptional
limitintMaximum number of results to return, see paginationOptional
hashArray of longHash for pagination, for more info click hereOptional

Return type: contacts.TopPeers

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, offset: $int, limit: $int, hash: [$long, $long], );