From 7458a6298ffd4649941beeed83a92504073ab3d8 Mon Sep 17 00:00:00 2001 From: lanvent Date: Mon, 3 Apr 2023 23:58:19 +0800 Subject: [PATCH] feat: add trigger_by_self option --- channel/chat_channel.py | 2 +- config.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/channel/chat_channel.py b/channel/chat_channel.py index aacc381..24d9cca 100644 --- a/channel/chat_channel.py +++ b/channel/chat_channel.py @@ -38,7 +38,7 @@ class ChatChannel(Channel): if first_in: # context首次传入时,receiver是None,根据类型设置receiver config = conf() cmsg = context['msg'] - if cmsg.from_user_id == self.user_id: + if cmsg.from_user_id == self.user_id and not config.get('trigger_by_self', False): logger.debug("[WX]self message skipped") return None if context["isgroup"]: diff --git a/config.py b/config.py index 8607fe4..d455f45 100644 --- a/config.py +++ b/config.py @@ -25,6 +25,7 @@ available_setting = { "group_name_white_list": ["ChatGPT测试群", "ChatGPT测试群2"], # 开启自动回复的群名称列表 "group_name_keyword_white_list": [], # 开启自动回复的群名称关键词列表 "group_chat_in_one_session": ["ChatGPT测试群"], # 支持会话上下文共享的群名称 + "trigger_by_self": False, # 是否允许机器人触发 "image_create_prefix": ["画", "看", "找"], # 开启图片回复的前缀 # chatgpt会话参数