listen()¶
- Client.listen()¶
Listen for a message, callback query, etc.
Message:
Usable by Users Bots
CallbackQuery:
Usable by Users Bots
- Parameters:¶
chat_id (``int`` | ``str`` | Iterable of ``int`` | Iterable of ``str``, *optional*) – Unique identifier (int) or username (str) of the target chat.
user_id (``int`` | ``str`` | Iterable of ``int`` | Iterable of ``str``, *optional*) – The user ID to listen for.
filters (:obj:`~pyrogram.filters`, *optional*) – A filter to check the incoming message against.
listener_type (:obj:`~pyrogram.enums.ListenerTypes`, *optional*) – The type of listener to listen for. Default to Message.
timeout (``int``, *optional*) – The maximum amount of time to wait for a message.
unallowed_click_alert (``bool``, *optional*) – Whether to alert the user if they click a button that doesn’t match the filters. Default to True.
message_id (``int``, *optional*) – The message ID to listen for.
inline_message_id (``str``, *optional*) – The inline message ID to listen for.
- Returns:¶
:obj:`~pyrogram.types.Message` | :obj:`~pyrogram.types.CallbackQuery` (On success, a message/callbackquery is returned.)
Example
await app.listen(chat_id)