> For the complete documentation index, see [llms.txt](https://rahulps1000.gitbook.io/pyropatch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rahulps1000.gitbook.io/pyropatch/patches/listen/message-listener.md).

# Message Listener

Listens for a message update

### listen\_message()

Parameters

* **chat\_id** (`int` ) – Unique identifier (int) of the target chat.
* **filters** ([`filters`](https://docs.pyrogram.org/api/filters.html#module-pyrogram.filters), *optional*) – Pass one or more filters to allow only a subset of chosen inline results to be passed in your function.
* **timeout** (`int,`*optional*) – To specify the timeout duration in seconds for a client to listen for a message.

Returns : [Message](https://docs.pyrogram.org/api/types/Message#pyrogram.types.Message)

Example

```
await app.listen_message(chat_id=chat_id, filters=filters, timeout=timeout)
```

### ask\_message()

Parameters

* **chat\_id** (`int` ) – Unique identifier (int) of the target chat.
* **text** (`str`) – Text of the message to be sent.
* **filters** ([`filters`](https://docs.pyrogram.org/api/filters.html#module-pyrogram.filters), *optional*) – Pass one or more filters to allow only a subset of chosen inline results to be passed in your function.
* **timeout** (`int,`*optional*) – To specify the timeout duration in seconds for a client to listen for a message.
* **parse\_mode** ([`ParseMode`](https://docs.pyrogram.org/api/enums/ParseMode.html#pyrogram.enums.ParseMode), *optional*) – By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together.
* **entities** (List of [`MessageEntity`](https://docs.pyrogram.org/api/types/MessageEntity.html#pyrogram.types.MessageEntity)) – List of special entities that appear in message text, which can be specified instead of *parse\_mode*.
* **disable\_web\_page\_preview** (`bool`, *optional*) – Disables link previews for links in this message.
* **disable\_notification** (`bool`, *optional*) – Sends the message silently. Users will receive a notification with no sound.
* **reply\_to\_message\_id** (`int`, *optional*) – If the message is a reply, ID of the original message.
* **schedule\_date** ([`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime), *optional*) – Date when the message will be automatically sent.
* **protect\_content** (`bool`, *optional*) – Protects the contents of the sent message from forwarding and saving.
* **reply\_markup** ([`InlineKeyboardMarkup`](https://docs.pyrogram.org/api/types/InlineKeyboardMarkup.html#pyrogram.types.InlineKeyboardMarkup) | [`ReplyKeyboardMarkup`](https://docs.pyrogram.org/api/types/ReplyKeyboardMarkup.html#pyrogram.types.ReplyKeyboardMarkup) | [`ReplyKeyboardRemove`](https://docs.pyrogram.org/api/types/ReplyKeyboardRemove.html#pyrogram.types.ReplyKeyboardRemove) | [`ForceReply`](https://docs.pyrogram.org/api/types/ForceReply.html#pyrogram.types.ForceReply), *optional*) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

Returns : [Message](https://docs.pyrogram.org/api/types/Message#pyrogram.types.Message)

Example

```
await app.ask_message(chat_id=chat_id, text=text, filters=filters, timeout=timeout)
```

### cancel\_message\_listener()

Parameters

* **chat\_id** (`int` ) – Unique identifier (int) of the target chat.

Returns : None

Example

```
await app.cancel_message_listener(chat_id=chat_id)
```
