fix(chat): 防止机器人回复自身消息
添加配置选项 `allow_reply_self` 控制是否允许机器人回复自己发送的消息 当此选项为 false 时,在回复动作执行前检查目标用户 ID,如果是机器人自身则跳过回复 同时删除无用的测试文件 `test_planner_personality.py
This commit is contained in:
@@ -311,6 +311,10 @@ class CycleProcessor:
|
||||
if reply_actions:
|
||||
logger.info(f"{self.log_prefix} 正在执行文本回复...")
|
||||
for action in reply_actions:
|
||||
target_user_id = action.get("action_message",{}).get("chat_info_user_id","")
|
||||
if target_user_id == global_config.bot.qq_account and not global_config.chat.allow_reply_self:
|
||||
logger.warning("选取的reply的目标为bot自己,跳过reply action")
|
||||
continue
|
||||
result = await execute_action(action)
|
||||
if isinstance(result, Exception):
|
||||
logger.error(f"{self.log_prefix} 回复动作执行异常: {result}")
|
||||
|
||||
Reference in New Issue
Block a user