send_chat_action()#

Client.send_chat_action()#

Tell the other party that something is happening on your side.

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str).

  • action (ChatAction) – Type of action to broadcast.

Returns:

bool – On success, True is returned.

Raises:

ValueError – In case the provided string is not a valid chat action.

Example

from pyrogram import enums

# Send "typing" chat action
await app.send_chat_action(chat_id, enums.ChatAction.TYPING)

# Send "upload_video" chat action
await app.send_chat_action(chat_id, enums.ChatAction.UPLOAD_VIDEO)

# Send "playing" chat action
await app.send_chat_action(chat_id, enums.ChatAction.PLAYING)

# Cancel any current chat action
await app.send_chat_action(chat_id, enums.ChatAction.CANCEL)