feat: 添加带有消息处理和路由功能的NEW_napcat_adapter插件
- 为NEW_napcat_adapter插件实现了核心模块,包括消息处理、事件处理和路由。 - 创建了MessageHandler、MetaEventHandler和NoticeHandler来处理收到的消息和事件。 - 开发了SendHandler,用于向Napcat发送回消息。 引入了StreamRouter来管理多个聊天流,确保消息的顺序和高效处理。 - 增加了对各种消息类型和格式的支持,包括文本、图像和通知。 - 建立了一个用于监控和调试的日志系统。
This commit is contained in:
@@ -12,7 +12,7 @@ from abc import ABC, abstractmethod
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional
|
||||
|
||||
from mofox_bus import AdapterBase as MoFoxAdapterBase, CoreMessageSink, MessageEnvelope
|
||||
from mofox_bus import AdapterBase as MoFoxAdapterBase, CoreSink, MessageEnvelope
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from src.plugin_system.base.base_plugin import BasePlugin
|
||||
@@ -47,7 +47,7 @@ class BaseAdapter(MoFoxAdapterBase, ABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
core_sink: CoreMessageSink,
|
||||
core_sink: CoreSink,
|
||||
plugin: Optional[BasePlugin] = None,
|
||||
**kwargs
|
||||
):
|
||||
@@ -227,7 +227,7 @@ class BaseAdapter(MoFoxAdapterBase, ABC):
|
||||
)
|
||||
|
||||
@abstractmethod
|
||||
def from_platform_message(self, raw: Any) -> MessageEnvelope:
|
||||
async def from_platform_message(self, raw: Any) -> MessageEnvelope:
|
||||
"""
|
||||
将平台原始消息转换为 MessageEnvelope
|
||||
|
||||
|
||||
Reference in New Issue
Block a user