aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/infini/event.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/infini/event.py b/src/infini/event.py
index a83c4042..659ae73e 100644
--- a/src/infini/event.py
+++ b/src/infini/event.py
@@ -1,4 +1,3 @@
-from abc import ABCMeta
from .typing import Dict
from .exceptions import UnknownMessageEvent
@@ -7,6 +6,12 @@ import re
__all__ = ["MessageEvent", "events"]
+class InfiniEvent:
+ """Inifni 事件基类"""
+
+ name: str
+
+
class Events:
"""事件集合"""
@@ -30,20 +35,31 @@ class Events:
return string
-class MessageEvent(metaclass=ABCMeta):
- """消息事件基类"""
+class MessageEvent(InfiniEvent):
+ """Message 事件"""
name: str
output: str
- def __init_subclass__(cls) -> None:
- events.regist(cls.name, cls.output)
+ def __repr__(self) -> str:
+ return f"<MessageEvent [{self.name}]>"
+
+
+class WorkflowEvent(InfiniEvent):
+ """Workflow 事件"""
+
+ name: str
+ kwargs: dict
+
+ def __repr__(self) -> str:
+ return f"<WorkflowEvent [{self.name}]>"
-class MatcherEvent:
+class MatcherEvent(InfiniEvent):
"""Matcher 事件"""
name: str
+ prefix: str
string: str
kwargs: dict