Skip to content

Commit

Permalink
fix: nick name config name
Browse files Browse the repository at this point in the history
  • Loading branch information
zhayujie committed Nov 27, 2023
1 parent bad20ff commit d4da4d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 4 additions & 3 deletions channel/chat_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _compose_context(self, ctype: ContextType, content, **kwargs):
# 校验关键字
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", [])
nick_name_black_list = conf().get("nick_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:
Expand All @@ -107,8 +107,9 @@ def _compose_context(self, ctype: ContextType, content, **kwargs):
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")
nick_name = context["msg"].actual_user_nickname
if nick_name and nick_name in nick_name_black_list:
logger.info(f"[WX] Nickname {nick_name} in In BlackList, ignore")
return None
if not conf().get("group_at_off", False):
flag = True
Expand Down
4 changes: 0 additions & 4 deletions config-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
"ChatGPT测试群",
"ChatGPT测试群2"
],
"group_name_black_list": [
"测试昵称",
"测试昵称2"
],
"group_chat_in_one_session": [
"ChatGPT测试群"
],
Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"group_name_white_list": ["ChatGPT测试群", "ChatGPT测试群2"], # 开启自动回复的群名称列表
"group_name_keyword_white_list": [], # 开启自动回复的群名称关键词列表
"group_chat_in_one_session": ["ChatGPT测试群"], # 支持会话上下文共享的群名称
"group_name_black_list": [], # 黑名单
"nick_name_black_list": [], # 用户昵称黑名单
"group_welcome_msg": "", # 配置新人进群固定欢迎语,不配置则使用随机风格欢迎
"trigger_by_self": False, # 是否允许机器人触发
"text_to_image": "dall-e-2", # 图片生成模型,可选 dall-e-2, dall-e-3
Expand Down

0 comments on commit d4da4d2

Please sign in to comment.