get_top_chats()

async Client.get_top_chats()

Returns a list of frequently used chats.

Usable by Users Bots
Parameters:
  • category (TopChatCategory) – Category of chats to be returned.

  • limit (int, optional) – The maximum number of chats to be returned. By default, no limit is applied and all chats are returned.

Returns:

Generator – A generator yielding Chat objects.

Example

# Iterate through all top chats in the "users" category
async for chat in app.get_top_chats(enums.TopChatCategory.USERS):
    print(chat.full_name)