mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-02-20 09:40:36 +08:00
增加新人入群自定义欢迎语参数
This commit is contained in:
@@ -6,6 +6,7 @@ from bridge.reply import Reply, ReplyType
|
||||
from channel.chat_message import ChatMessage
|
||||
from common.log import logger
|
||||
from plugins import *
|
||||
from config import conf
|
||||
|
||||
|
||||
@plugins.register(
|
||||
@@ -31,6 +32,13 @@ class Hello(Plugin):
|
||||
return
|
||||
|
||||
if e_context["context"].type == ContextType.JOIN_GROUP:
|
||||
if "group_welcome_msg" in conf():
|
||||
reply = Reply()
|
||||
reply.type = ReplyType.TEXT
|
||||
reply.content = conf().get("group_welcome_msg", "")
|
||||
e_context["reply"] = reply
|
||||
e_context.action = EventAction.BREAK_PASS # 事件结束,并跳过处理context的默认逻辑
|
||||
return
|
||||
e_context["context"].type = ContextType.TEXT
|
||||
msg: ChatMessage = e_context["context"]["msg"]
|
||||
e_context["context"].content = f'请你随机使用一种风格说一句问候语来欢迎新用户"{msg.actual_user_nickname}"加入群聊。'
|
||||
|
||||
Reference in New Issue
Block a user