GetTopPeersRequest

Only users can use this request. See code examples.

---functions---
contacts.getTopPeers#973478b6 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:long = contacts.TopPeers

Returns

contacts.TopPeers

This type can be an instance of either:

TopPeersTopPeersDisabled
TopPeersNotModified

Parameters

offsetint
limitint
hashlong
correspondentsflagThis argument defaults to None and can be omitted.
bots_pmflagThis argument defaults to None and can be omitted.
bots_inlineflagThis argument defaults to None and can be omitted.
phone_callsflagThis argument defaults to None and can be omitted.
forward_usersflagThis argument defaults to None and can be omitted.
forward_chatsflagThis argument defaults to None and can be omitted.
groupsflagThis argument defaults to None and can be omitted.
channelsflagThis argument defaults to None and can be omitted.

Known RPC errors

This request can cause 1 known error:

TypesEmptyErrorThe types field is empty.

You can import these from telethon.errors.

Example

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.contacts.GetTopPeersRequest(
        offset=42,
        limit=100,
        hash=-12398745604826,
        correspondents=True,
        bots_pm=True,
        bots_inline=True,
        phone_calls=True,
        forward_users=True,
        forward_chats=True,
        groups=True,
        channels=True
    ))
    print(result.stringify())