Skip to content

Commit

Permalink
Merge pull request #10 from tudou2/master
Browse files Browse the repository at this point in the history
0419
  • Loading branch information
congxuma committed Apr 19, 2023
2 parents e13dbc6 + 1c0874a commit 520fc04
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions plugins/plugin_getnews/getnews.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def on_handle_context(self, e_context: EventContext):
logger.debug("[getnews] on_handle_context. content: %s" % content)

help_info = "\n【请注意尽量不要询问涉及个人隐私和敏感问题哦!】 \
\n\n使用技巧 \
\n\n 使用技巧 \
\n\n0、直接输入可进行对话,支持1000字上下文联系,输入#help 获取帮助 \
\n\n1、输入内容中含‘每日新闻’可获取当日新闻;含‘每日摄影’可获取每日的一张摄影作品 \
\n\n2、关键字画开头将触发画图,目前需要以特殊的格式输入【画 <模型>:prompt】如:画journey:1cat,big eyes,garden \
Expand All @@ -54,7 +54,7 @@ def on_handle_context(self, e_context: EventContext):

e_context['reply'] = reply
e_context.action = EventAction.BREAK_PASS # 事件结束,并跳过处理context的默认逻辑

if re.match(r"我是.*", content):
reply = Reply()
reply.type = ReplyType.TEXT
Expand All @@ -68,7 +68,7 @@ def on_handle_context(self, e_context: EventContext):
reply.content = f"Hello, {msg.from_user_nickname} \n" + help_info
e_context["reply"] = reply
e_context.action = EventAction.BREAK_PASS # 事件结束,并跳过处理context的默认逻辑

if re.search(r"每日图片|getimg|今日摄影|每日摄影", content):
reply = Reply()
reply.type = ReplyType.IMAGE_URL
Expand Down Expand Up @@ -107,7 +107,14 @@ def on_handle_context(self, e_context: EventContext):

e_context['reply'] = reply
e_context.action = EventAction.BREAK_PASS # 事件结束,并跳过处理context的默认逻辑


# 替换开头的bot
if re.match(r"bot.*", content):
content = re.sub(r'^bot', '', content) #删除开头的bot
logger.info("[getnews] replace bot and new content:" + content)

e_context.action = EventAction.CONTINUE # 事件继续,交付给下个插件或默认逻辑

# if content == "Hi":
# reply = Reply()
# reply.type = ReplyType.TEXT
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ replicate>=0.7.0
lxml==4.9.2
pre-commit
webdriver_manager
selenium==2.48.0
selenium>=3.13.0

0 comments on commit 520fc04

Please sign in to comment.