wait_for_message()¶
- async Client.wait_for_message()¶
Wait for the next message in a chat.
Shortcut for
listen()with a message listener.Usable by Users Bots- Parameters:
chat_id (
int|str) – Chat the message has to come from.filters (
Filter, optional) – Extra filter the message has to pass.timeout (
float, optional) – Seconds to wait before raisingListenerTimeout. Defaults to the client’slistener_timeout(300s).
- Returns:
Message– The matching message.- Raises:
ListenerTimeout – In case no message arrived in time.
ListenerStopped – In case the listener was stopped, or the client is.
Example
message = await app.wait_for_message(chat_id, timeout=30)