feat:将旧版示例插件更新,更新mute插件(tts,vtb,doubaopic持续炸裂中)

This commit is contained in:
SengokuCola
2025-06-10 23:36:45 +08:00
parent 9f90b2568c
commit 6455dab5b8
45 changed files with 1657 additions and 2001 deletions

View File

@@ -59,10 +59,13 @@ class ChatBot:
# 使用新的组件注册中心查找命令
command_result = component_registry.find_command_by_text(text)
if command_result:
command_class, matched_groups = command_result
command_class, matched_groups, intercept_message, plugin_name = command_result
# 获取插件配置
plugin_config = component_registry.get_plugin_config(plugin_name)
# 创建命令实例
command_instance = command_class(message)
command_instance = command_class(message, plugin_config)
command_instance.set_matched_groups(matched_groups)
try:
@@ -71,11 +74,12 @@ class ChatBot:
# 记录命令执行结果
if success:
logger.info(f"命令执行成功: {command_class.__name__}")
logger.info(f"命令执行成功: {command_class.__name__} (拦截: {intercept_message})")
else:
logger.warning(f"命令执行失败: {command_class.__name__} - {response}")
return True, response, False # 找到命令,不继续处理
# 根据命令的拦截设置决定是否继续处理消息
return True, response, not intercept_message # 找到命令根据intercept_message决定是否继续
except Exception as e:
logger.error(f"执行命令时出错: {command_class.__name__} - {e}")
@@ -88,7 +92,8 @@ class ChatBot:
except Exception as send_error:
logger.error(f"发送错误消息失败: {send_error}")
return True, str(e), False # 命令出错,不继续处理
# 命令出错时,根据命令的拦截设置决定是否继续处理消息
return True, str(e), not intercept_message
# 没有找到命令,继续处理消息
return False, None, True