mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-02-17 16:38:37 +08:00
feat: add support for PATPAT context
This commit is contained in:
@@ -23,7 +23,11 @@ class Hello(Plugin):
|
||||
logger.info("[Hello] inited")
|
||||
|
||||
def on_handle_context(self, e_context: EventContext):
|
||||
if e_context["context"].type not in [ContextType.TEXT, ContextType.JOIN_GROUP]:
|
||||
if e_context["context"].type not in [
|
||||
ContextType.TEXT,
|
||||
ContextType.JOIN_GROUP,
|
||||
ContextType.PATPAT,
|
||||
]:
|
||||
return
|
||||
|
||||
if e_context["context"].type == ContextType.JOIN_GROUP:
|
||||
@@ -35,6 +39,13 @@ class Hello(Plugin):
|
||||
e_context.action = EventAction.CONTINUE # 事件继续,交付给下个插件或默认逻辑
|
||||
return
|
||||
|
||||
if e_context["context"].type == ContextType.PATPAT:
|
||||
e_context["context"].type = ContextType.TEXT
|
||||
msg: ChatMessage = e_context["context"]["msg"]
|
||||
e_context["context"].content = f"请你随机使用一种风格介绍你自己,并告诉用户输入#help可以查看帮助信息。"
|
||||
e_context.action = EventAction.CONTINUE # 事件继续,交付给下个插件或默认逻辑
|
||||
return
|
||||
|
||||
content = e_context["context"].content
|
||||
logger.debug("[Hello] on_handle_context. content: %s" % content)
|
||||
if content == "Hello":
|
||||
|
||||
Reference in New Issue
Block a user