search_chats()

Client.search_chats()

Searches for the specified query in the title and username of already known chats via request to the server.

Usable by Users Bots
Parameters:
  • query (``str``) – Query to search for.

  • limit (``int``, *optional*) – The maximum number of chats to be returned. Defaults to 10.

  • personalize_result (``bool``, *optional*) – True, if should return personalized results, else would return all found user identifiers. Defaults to False.

Returns:

List of :obj:`~pyrogram.types.Chat` (Returns chats in the order seen in the main chat list)

Example

chats = await app.search_chats("Pyrogram")