mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-21 22:27:13 +08:00
blacklist
This commit is contained in:
@@ -99,6 +99,7 @@ class ChatChannel(Channel):
|
|||||||
# 校验关键字
|
# 校验关键字
|
||||||
match_prefix = check_prefix(content, conf().get("group_chat_prefix"))
|
match_prefix = check_prefix(content, conf().get("group_chat_prefix"))
|
||||||
match_contain = check_contain(content, conf().get("group_chat_keyword"))
|
match_contain = check_contain(content, conf().get("group_chat_keyword"))
|
||||||
|
group_name_black_list = config.get("group_name_black_list", [])
|
||||||
flag = False
|
flag = False
|
||||||
if context["msg"].to_user_id != context["msg"].actual_user_id:
|
if context["msg"].to_user_id != context["msg"].actual_user_id:
|
||||||
if match_prefix is not None or match_contain is not None:
|
if match_prefix is not None or match_contain is not None:
|
||||||
@@ -107,6 +108,10 @@ class ChatChannel(Channel):
|
|||||||
content = content.replace(match_prefix, "", 1).strip()
|
content = content.replace(match_prefix, "", 1).strip()
|
||||||
if context["msg"].is_at:
|
if context["msg"].is_at:
|
||||||
logger.info("[WX]receive group at")
|
logger.info("[WX]receive group at")
|
||||||
|
if context["msg"].actual_user_nickname in group_name_black_list:
|
||||||
|
print('黑名单2',context["msg"].actual_user_nickname)
|
||||||
|
logger.info("[WX]Is In BlackList")
|
||||||
|
return None
|
||||||
if not conf().get("group_at_off", False):
|
if not conf().get("group_at_off", False):
|
||||||
flag = True
|
flag = True
|
||||||
pattern = f"@{re.escape(self.name)}(\u2005|\u0020)"
|
pattern = f"@{re.escape(self.name)}(\u2005|\u0020)"
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
"ChatGPT测试群",
|
"ChatGPT测试群",
|
||||||
"ChatGPT测试群2"
|
"ChatGPT测试群2"
|
||||||
],
|
],
|
||||||
|
"group_name_black_list": [
|
||||||
|
"测试昵称",
|
||||||
|
"测试昵称2"
|
||||||
|
],
|
||||||
"group_chat_in_one_session": [
|
"group_chat_in_one_session": [
|
||||||
"ChatGPT测试群"
|
"ChatGPT测试群"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ available_setting = {
|
|||||||
"group_name_white_list": ["ChatGPT测试群", "ChatGPT测试群2"], # 开启自动回复的群名称列表
|
"group_name_white_list": ["ChatGPT测试群", "ChatGPT测试群2"], # 开启自动回复的群名称列表
|
||||||
"group_name_keyword_white_list": [], # 开启自动回复的群名称关键词列表
|
"group_name_keyword_white_list": [], # 开启自动回复的群名称关键词列表
|
||||||
"group_chat_in_one_session": ["ChatGPT测试群"], # 支持会话上下文共享的群名称
|
"group_chat_in_one_session": ["ChatGPT测试群"], # 支持会话上下文共享的群名称
|
||||||
|
"group_name_black_list": [], # 黑名单
|
||||||
"group_welcome_msg": "", # 配置新人进群固定欢迎语,不配置则使用随机风格欢迎
|
"group_welcome_msg": "", # 配置新人进群固定欢迎语,不配置则使用随机风格欢迎
|
||||||
"trigger_by_self": False, # 是否允许机器人触发
|
"trigger_by_self": False, # 是否允许机器人触发
|
||||||
"text_to_image": "dall-e-2", # 图片生成模型,可选 dall-e-2, dall-e-3
|
"text_to_image": "dall-e-2", # 图片生成模型,可选 dall-e-2, dall-e-3
|
||||||
|
|||||||
Reference in New Issue
Block a user