feat: itchat support joingroup message

This commit is contained in:
lanvent
2023-04-18 02:21:41 +08:00
parent e8aae27ee9
commit 6404332adc
4 changed files with 51 additions and 9 deletions

View File

@@ -23,7 +23,16 @@ class Hello(Plugin):
logger.info("[Hello] inited")
def on_handle_context(self, e_context: EventContext):
if e_context["context"].type != ContextType.TEXT:
if e_context["context"].type not in [ContextType.TEXT, ContextType.JOIN_GROUP]:
return
if e_context["context"].type == ContextType.JOIN_GROUP:
e_context["context"].type = ContextType.TEXT
msg: ChatMessage = e_context["context"]["msg"]
e_context[
"context"
].content = f'请你随机使用一种风格说一句问候语来欢迎新用户"{msg.actual_user_nickname}"加入群聊。'
e_context.action = EventAction.CONTINUE # 事件继续,交付给下个插件或默认逻辑
return
content = e_context["context"].content