mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-06 15:14:52 +00:00
Update chat_action.py
This commit is contained in:
parent
33dd708831
commit
9b9c7ced77
1 changed files with 3 additions and 1 deletions
|
|
@ -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…
Reference in a new issue