get_dialogs()

async Client.get_dialogs()

Get a user’s dialogs sequentially.

Usable by Users Bots
Parameters:
  • limit (int, optional) – Limits the number of dialogs to be retrieved. By default, no limit is applied and all dialogs are returned.

  • exclude_pinned (bool, optional) – Pass True to exclude the pinned dialogs.

  • from_archive (bool, optional) – Pass True to get the archived dialogs, False for the unarchived ones. By default, dialogs from both lists are returned.

Returns:

Generator – A generator yielding Dialog objects.

Example

# Iterate through all dialogs
async for dialog in app.get_dialogs():
    print(dialog.chat.first_name or dialog.chat.title)