小修复
This commit is contained in:
@@ -157,6 +157,10 @@ class ChatBot:
|
||||
if message.message_segment.type == "adapter_response":
|
||||
await self.handle_adapter_response(message)
|
||||
return True
|
||||
elif message.message_segment.type == "adapter_command":
|
||||
# 适配器命令消息不需要进一步处理
|
||||
logger.debug("收到适配器命令消息,跳过后续处理")
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@@ -116,6 +116,8 @@ class MessageStorage:
|
||||
"""更新消息ID"""
|
||||
try:
|
||||
mmc_message_id = message.message_info.message_id # 修复:正确访问message_id
|
||||
qq_message_id = None # 初始化变量
|
||||
|
||||
if message.message_segment.type == "notify":
|
||||
qq_message_id = message.message_segment.data.get("id")
|
||||
elif message.message_segment.type == "text":
|
||||
@@ -125,9 +127,14 @@ class MessageStorage:
|
||||
logger.info(f"更新消息ID完成,消息ID为{qq_message_id}")
|
||||
elif message.message_segment.type == "adapter_response":
|
||||
logger.debug("适配器响应消息,不需要更新ID")
|
||||
return
|
||||
elif message.message_segment.type == "adapter_command":
|
||||
logger.debug("适配器命令消息,不需要更新ID")
|
||||
return
|
||||
else:
|
||||
logger.info(f"更新消息ID错误,seg类型为{message.message_segment.type}")
|
||||
return
|
||||
|
||||
if not qq_message_id:
|
||||
logger.info("消息不存在message_id,无法更新")
|
||||
return
|
||||
|
||||
@@ -411,6 +411,7 @@ async def custom_to_stream(
|
||||
async def adapter_command_to_stream(
|
||||
action: str,
|
||||
params: dict,
|
||||
platform: str,
|
||||
stream_id: Optional[str] = None,
|
||||
timeout: float = 30.0,
|
||||
storage_message: bool = False
|
||||
@@ -452,12 +453,12 @@ async def adapter_command_to_stream(
|
||||
temp_user_info = UserInfo(
|
||||
user_id="system",
|
||||
user_nickname="System",
|
||||
platform="adapter_command"
|
||||
platform=platform
|
||||
)
|
||||
|
||||
temp_chat_stream = ChatStream(
|
||||
stream_id=stream_id,
|
||||
platform="adapter_command",
|
||||
platform=platform,
|
||||
user_info=temp_user_info,
|
||||
group_info=None
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import os
|
||||
import traceback
|
||||
import sys
|
||||
@@ -513,7 +514,7 @@ class PluginManager:
|
||||
plugin_instance.on_unload()
|
||||
|
||||
# 从组件注册表中移除插件的所有组件
|
||||
component_registry.unregister_plugin(plugin_name)
|
||||
asyncio.run(component_registry.unregister_plugin(plugin_name))
|
||||
|
||||
# 从已加载插件中移除
|
||||
del self.loaded_plugins[plugin_name]
|
||||
|
||||
Reference in New Issue
Block a user