send_chat_action()¶
-
Client.
send_chat_action
()¶ Tell the other party that something is happening on your side.
- 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 (
str
) – Type of action to broadcast. Choose one, depending on what the user is about to receive: “typing” for text messages, “upload_photo” for photos, “record_video” or “upload_video” for videos, “record_audio” or “upload_audio” for audio files, “upload_document” for general files, “find_location” for location data, “record_video_note” or “upload_video_note” for video notes, “choose_contact” for contacts, “playing” for games or “cancel” to cancel any chat action currently displayed.
- Returns
bool
– On success, True is returned.- Raises
ValueError – In case the provided string is not a valid chat action.
Example
# Send "typing" chat action app.send_chat_action(chat_id, "typing") # Send "upload_video" chat action app.send_chat_action(chat_id, "upload_video") # Send "playing" chat action app.send_chat_action(chat_id, "playing") # Cancel any current chat action app.send_chat_action(chat_id, "cancel")