mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Update chat_action.py
This commit is contained in:
parent
33dd708831
commit
9b9c7ced77
@ -15,6 +15,7 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
from pyrogram.api import types
|
from pyrogram.api import types
|
||||||
@ -66,10 +67,11 @@ class ChatAction(Enum):
|
|||||||
"""User is uploading a round video note."""
|
"""User is uploading a round video note."""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_string(cls, action: str) -> 'ChatAction':
|
def from_string(cls, action: str) -> "ChatAction":
|
||||||
for a in iter(ChatAction):
|
for a in iter(ChatAction):
|
||||||
if a.name.lower() == action.lower():
|
if a.name.lower() == action.lower():
|
||||||
return a
|
return a
|
||||||
|
|
||||||
raise ValueError("Invalid ChatAction: '{}'. Possible types are {}".format(
|
raise ValueError("Invalid ChatAction: '{}'. Possible types are {}".format(
|
||||||
action, [x.name.lower() for x in iter(ChatAction)]
|
action, [x.name.lower() for x in iter(ChatAction)]
|
||||||
))
|
))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user