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
| q | string | |
| limit | int | |
| broadcasts | flag | This argument defaults to None and can be omitted. |
| bots | flag | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 3 known errors:
QueryTooShortError | The query string is too short. |
SearchQueryEmptyError | The search query is empty. |
TimeoutError | A 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())