Add new chat actions (#751)

* Add new chat action

* Update send_chat_action.py

Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
Adek 2021-12-17 16:41:39 +07:00 committed by GitHub
parent cebecb99c0
commit 6fb427fb9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,8 @@ class ChatAction:
PLAYING = raw.types.SendMessageGamePlayAction
CHOOSE_CONTACT = raw.types.SendMessageChooseContactAction
SPEAKING = raw.types.SpeakingInGroupCallAction
IMPORT_HISTORY = raw.types.SendMessageHistoryImportAction
CHOOSE_STICKER = raw.types.SendMessageChooseStickerAction
CANCEL = raw.types.SendMessageCancelAction
@ -59,6 +61,7 @@ class SendChatAction(Scaffold):
*"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, *"speaking"* for speaking in group calls or
*"import_history"* for importing history, *"choose_sticker"* for stickers or
*"cancel"* to cancel any chat action currently displayed.
Returns:
@ -89,7 +92,7 @@ class SendChatAction(Scaffold):
raise ValueError("Invalid chat action '{}'. Possible values are: {}".format(
action, json.dumps(POSSIBLE_VALUES, indent=4))) from None
if "Upload" in action.__name__:
if "Upload" in action.__name__ or "History" in action.__name__:
action = action(progress=0)
else:
action = action()