From 5c11f429332ad3f9cd071393db2f658a0d97d41e Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 6 Dec 2017 21:57:46 +0100 Subject: [PATCH] Rename ACTIONS -> CHAT_ACTIONS --- pyrogram/client/client.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 38f18740..980fb2ff 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -49,6 +49,22 @@ Config = namedtuple("Config", ["api_id", "api_hash"]) class Client: DIALOGS_AT_ONCE = 100 + CHAT_ACTIONS = { + "cancel": types.SendMessageCancelAction, + "typing": types.SendMessageTypingAction, + "playing": types.SendMessageGamePlayAction, + "choose_contact": types.SendMessageChooseContactAction, + "upload_photo": types.SendMessageUploadPhotoAction, + "record_video": types.SendMessageRecordVideoAction, + "upload_video": types.SendMessageUploadVideoAction, + "record_audio": types.SendMessageRecordAudioAction, + "upload_audio": types.SendMessageUploadAudioAction, + "upload_document": types.SendMessageUploadDocumentAction, + "find_location": types.SendMessageGeoLocationAction, + "record_video_note": types.SendMessageRecordRoundAction, + "upload_video_note": types.SendMessageUploadRoundAction, + } + def __init__(self, session_name: str, test_mode: bool = False): self.session_name = session_name self.test_mode = test_mode @@ -454,27 +470,11 @@ class Client: ) ) - ACTIONS = { - "cancel": types.SendMessageCancelAction, - "typing": types.SendMessageTypingAction, - "playing": types.SendMessageGamePlayAction, - "choose_contact": types.SendMessageChooseContactAction, - "upload_photo": types.SendMessageUploadPhotoAction, - "record_video": types.SendMessageRecordVideoAction, - "upload_video": types.SendMessageUploadVideoAction, - "record_audio": types.SendMessageRecordAudioAction, - "upload_audio": types.SendMessageUploadAudioAction, - "upload_document": types.SendMessageUploadDocumentAction, - "find_location": types.SendMessageGeoLocationAction, - "record_video_note": types.SendMessageRecordRoundAction, - "upload_video_note": types.SendMessageUploadRoundAction, - } - def send_chat_action(self, chat_id: int or str, action: str, progress: int = 0): return self.send( functions.messages.SetTyping( peer=self.resolve_peer(chat_id), - action=self.ACTIONS.get( + action=self.CHAT_ACTIONS.get( action.lower() )(progress=progress) )