Skip to content

Commit 7458a62

Browse files
committed
feat: add trigger_by_self option
1 parent b0f54bb commit 7458a62

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

channel/chat_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _compose_context(self, ctype: ContextType, content, **kwargs):
3838
if first_in: # context首次传入时,receiver是None,根据类型设置receiver
3939
config = conf()
4040
cmsg = context['msg']
41-
if cmsg.from_user_id == self.user_id:
41+
if cmsg.from_user_id == self.user_id and not config.get('trigger_by_self', False):
4242
logger.debug("[WX]self message skipped")
4343
return None
4444
if context["isgroup"]:

config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"group_name_white_list": ["ChatGPT测试群", "ChatGPT测试群2"], # 开启自动回复的群名称列表
2626
"group_name_keyword_white_list": [], # 开启自动回复的群名称关键词列表
2727
"group_chat_in_one_session": ["ChatGPT测试群"], # 支持会话上下文共享的群名称
28+
"trigger_by_self": False, # 是否允许机器人触发
2829
"image_create_prefix": ["画", "看", "找"], # 开启图片回复的前缀
2930

3031
# chatgpt会话参数

0 commit comments

Comments
 (0)