SearchRequest

Only users can use this request. See code examples.

---functions---
contacts.search#05f58d0f flags:# broadcasts:flags.0?true bots:flags.1?true q:string limit:int = contacts.Found

Returns

contacts.Found

This type can only be an instance of:

Found

Parameters

qstring
limitint
broadcastsflagThis argument defaults to None and can be omitted.
botsflagThis argument defaults to None and can be omitted.

Known RPC errors

This request can cause 3 known errors:

QueryTooShortErrorThe query string is too short.
SearchQueryEmptyErrorThe search query is empty.
TimeoutErrorA timeout occurred while fetching data from the worker.

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.SearchRequest(
        q='some string here',
        limit=100,
        broadcasts=True,
        bots=True
    ))
    print(result.stringify())