QChatGPT/pkg/qqbot/ignore.py
2023-04-06 20:34:56 +08:00

17 lines
422 B
Python

import re
def ignore(msg: str) -> bool:
"""检查消息是否应该被忽略"""
import config
if 'prefix' in config.ignore_rules:
for rule in config.ignore_rules['prefix']:
if msg.startswith(rule):
return True
if 'regexp' in config.ignore_rules:
for rule in config.ignore_rules['regexp']:
if re.search(rule, msg):
return True