fix(msgbot): re.search()返回值缺bool()包装导致|=类型错误

- 第7863行/7875行:`'@' in text and re.search(...)` 赋值为 re.Match 而非 bool
- 后续 `|= any(...)` 触发 re.Match |= bool → TypeError
- 修复:两处均加 bool() 包裹,与第7819行一致
This commit is contained in:
youpaishidifu
2026-08-29 17:46:24 +08:00
parent 19019f80d3
commit c55c382358
+2 -2
View File
@@ -7860,7 +7860,7 @@ class MessageMonitor:
_eq_matches = re.findall(_eq_pattern, text)
if len(_eq_matches) >= 2:
# ⭐ Task #1595: 检查用户消息特征
_has_user_msg_feature = '@' in text and re.search(r'@\w+', text)
_has_user_msg_feature = '@' in text and bool(re.search(r'@\w+', text))
_has_user_msg_feature |= any(q in text for q in ['?', '?', '吗', '呢', '多少', '怎么', '如何', '哪', '什么', '几'])
if _has_user_msg_feature:
logger.debug(f"[ocr] 过滤器2结果: 检测到等号配置但含用户消息特征,继续检查: {text[:80]!r}")
@@ -7872,7 +7872,7 @@ class MessageMonitor:
_yaml_ini_matches = re.findall(_yaml_ini_pattern, text, re.MULTILINE)
if len(_yaml_ini_matches) >= 2:
# ⭐ Task #1595: 检查用户消息特征
_has_user_msg_feature = '@' in text and re.search(r'@\w+', text)
_has_user_msg_feature = '@' in text and bool(re.search(r'@\w+', text))
_has_user_msg_feature |= any(q in text for q in ['?', '?', '吗', '呢', '多少', '怎么', '如何', '哪', '什么', '几'])
if _has_user_msg_feature:
logger.debug(f"[ocr] 过滤器2结果: 检测到YAML/INI但含用户消息特征,继续检查: {text[:80]!r}")