Skip to content

Commit

Permalink
feat: add trigger_by_self option
Browse files Browse the repository at this point in the history
  • Loading branch information
lanvent committed Apr 3, 2023
1 parent b0f54bb commit 7458a62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion channel/chat_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _compose_context(self, ctype: ContextType, content, **kwargs):
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"]:
Expand Down
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"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会话参数
Expand Down

0 comments on commit 7458a62

Please sign in to comment.