get_dialogs()¶
- 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.
pinned_only (``bool``, *optional*) – Pass True if you want to get only pinned dialogs. Defaults to False.
chat_list (``int``, *optional*) – Chat list from which to get the dialogs; Only Main (0) and Archive (1) chat lists are supported. Defaults to (0) Main chat list.
offset_date (:py:obj:`~datetime.datetime`, *optional*) – The date starting from which the dialogs need to be fetched. Use 0 or any date in the future to get results from the last dialog.
offset_message_id (``int``, *optional*) – The message identifier of the last message in the last found dialog, or 0 for the first request.
- Returns:¶
``Generator`` (A generator yielding
Dialogobjects.)
Example
# Iterate through all dialogs async for dialog in app.get_dialogs(): print(dialog.chat.first_name or dialog.chat.title)