2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Update chat_action.py

This commit is contained in:
Dan 2018-04-30 19:34:59 +02:00 committed by GitHub
parent 33dd708831
commit 9b9c7ced77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from enum import Enum
from pyrogram.api import types
@ -66,10 +67,11 @@ class ChatAction(Enum):
"""User is uploading a round video note."""
@classmethod
def from_string(cls, action: str) -> 'ChatAction':
def from_string(cls, action: str) -> "ChatAction":
for a in iter(ChatAction):
if a.name.lower() == action.lower():
return a
raise ValueError("Invalid ChatAction: '{}'. Possible types are {}".format(
action, [x.name.lower() for x in iter(ChatAction)]
))