Merge pull request #1538 from dividduang/blacklist

Blacklist
This commit is contained in:
zhayujie
2023-11-27 14:29:06 +08:00
committed by GitHub
3 changed files with 9 additions and 0 deletions

View File

@@ -98,6 +98,7 @@ class ChatChannel(Channel):
# 校验关键字
match_prefix = check_prefix(content, conf().get("group_chat_prefix"))
match_contain = check_contain(content, conf().get("group_chat_keyword"))
group_name_black_list = config.get("group_name_black_list", [])
flag = False
if context["msg"].to_user_id != context["msg"].actual_user_id:
if match_prefix is not None or match_contain is not None:
@@ -106,6 +107,9 @@ class ChatChannel(Channel):
content = content.replace(match_prefix, "", 1).strip()
if context["msg"].is_at:
logger.info("[WX]receive group at")
if context["msg"].actual_user_nickname in group_name_black_list:
logger.info("[WX]Is In BlackList")
return None
if not conf().get("group_at_off", False):
flag = True
pattern = f"@{re.escape(self.name)}(\u2005|\u0020)"