2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-09-10 11:15:27 +00:00

Also allow strings for send_chat_action

This commit is contained in:
JosXa
2018-04-30 16:28:43 +02:00
parent e2d80a6087
commit abf89688ed
2 changed files with 18 additions and 4 deletions

View File

@@ -2503,7 +2503,7 @@ class Client:
def send_chat_action(self,
chat_id: int or str,
action: ChatAction,
action: ChatAction or str,
progress: int = 0):
"""Use this method when you need to tell the other party that something is happening on your side.
@@ -2528,8 +2528,12 @@ class Client:
Raises:
:class:`Error <pyrogram.Error>`
"""
# Resolve Enum type
action = action.value if isinstance(action, ChatAction) else action
if isinstance(action, str):
action = ChatAction.from_string(action).value
elif isinstance(action, ChatAction):
action = action.value
if "Upload" in action.__name__:
action = action(progress)