|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
-
-
- from enum import Enum
-
-
- class Event(Enum):
-
-
- ON_HANDLE_CONTEXT = 2
- """
- e_context = { "channel": 消息channel, "context" : 本次消息的context, "reply" : 目前的回复,初始为空 }
- """
-
- ON_DECORATE_REPLY = 3
- """
- e_context = { "channel": 消息channel, "context" : 本次消息的context, "reply" : 目前的回复 }
- """
-
- ON_SEND_REPLY = 4
- """
- e_context = { "channel": 消息channel, "context" : 本次消息的context, "reply" : 目前的回复 }
- """
-
-
-
-
- class EventAction(Enum):
- CONTINUE = 1
- BREAK = 2
- BREAK_PASS = 3
-
-
- class EventContext:
- def __init__(self, event, econtext=dict()):
- self.event = event
- self.econtext = econtext
- self.action = EventAction.CONTINUE
-
- def __getitem__(self, key):
- return self.econtext[key]
-
- def __setitem__(self, key, value):
- self.econtext[key] = value
-
- def __delitem__(self, key):
- del self.econtext[key]
-
- def is_pass(self):
- return self.action == EventAction.BREAK_PASS
|