1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| from abc import abstractmethod, ABC
| from typing import Dict, Any
|
| from core.handle.textMessageType import TextMessageType
|
| TAG = __name__
|
|
| class TextMessageHandler(ABC):
| """消息处理器抽象基类"""
|
| @abstractmethod
| async def handle(self, conn, msg_json: Dict[str, Any]) -> None:
| """处理消息的抽象方法"""
| pass
|
| @property
| @abstractmethod
| def message_type(self) -> TextMessageType:
| """返回处理的消息类型"""
| pass
|
|