stop_listening()¶
- async Client.stop_listening()¶
Stop the listeners covered by the given criteria.
Every waiter stopped this way raises
ListenerStopped. Criteria left out are wildcards, so calling this with no arguments at all stops every message listener on the client.Usable by Users Bots- Parameters:
listener_type (
ListenerTypes, optional) – Kind of listener to stop. Defaults to message listeners.chat_id (
int|str| List ofint|str, optional) – Only stop listeners waiting on this chat.user_id (
int|str| List ofint|str, optional) – Only stop listeners waiting on this user.message_id (
int| List ofint, optional) – Only stop listeners waiting on this message.inline_message_id (
str| List ofstr, optional) – Only stop listeners waiting on this inline message.
- Returns:
int– Number of listeners that were stopped.
Example
await app.stop_listening(chat_id=chat_id)