新增bot回复格式说明碎片拦截(格式X: json格式等)

This commit is contained in:
youpaishidifu
2026-08-21 11:44:25 +08:00
parent 093ddb77d2
commit 04328d7022
+10
View File
@@ -6711,6 +6711,16 @@ class MessageMonitor:
if code_keyword_count >= 2:
logger.debug(f"[ocr] 过滤器3结果: 检测到代码块内容({code_keyword_count}个编程关键字),返回True")
return True
# ⭐ 2026-08-21 新增:bot回复格式说明碎片拦截
# 用户反馈 "格式2: json格式/" 这类碎片触发自动回复(内容牛头不对马嘴)
# 特征:格式编号 + 格式名称(json/php/yaml/xml等)
if re.search(r'格式\d+', text):
logger.debug(f"[ocr] 过滤器3结果: 检测到格式编号(如'格式2'),返回True")
return True
# 组合模式:格式\d+.*格式(如 "格式2: json格式/")
if re.search(r'格式\d+[::].*格式', text):
logger.debug(f"[ocr] 过滤器3结果: 检测到格式编号+格式名称组合,返回True")
return True
# 文件扩展名检测(Bot md 回复中常引用文件)
if re.search(r'\S+\.(txt|json|yml|yaml|md|py|js|ts|html|css|xml|java|c|cpp|h|rs|go|sh|bat|cmd)\b', text):
logger.debug(f"[ocr] 过滤器3结果: 检测到文件扩展名,返回True")