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 ofint
| Iterable ofstr
, optional) – Unique identifier (int) or username (str) of the target chat.user_id (
int
|str
| Iterable ofint
| Iterable ofstr
, optional) – The user ID to listen for.filters (
filters
, optional) – A filter to check the incoming message against.listener_type (
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:¶
Message
|CallbackQuery
– On success, a message/callbackquery is returned.
Example
await app.listen(chat_id)