textHandle.py 消息解耦

This commit is contained in:
Chingfeng Li
2025-09-03 09:43:34 +08:00
parent fa79e2b379
commit 3cfc1cf97a
11 changed files with 353 additions and 163 deletions
@@ -0,0 +1,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