From 288de059687aeee0c2efae85803fec4ccf5173fa Mon Sep 17 00:00:00 2001 From: Lint Action Date: Sat, 11 Dec 2021 15:10:30 +0000 Subject: =?UTF-8?q?:rotating=5Flight:=20=E8=87=AA=E5=8A=A8=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/chatbot/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ATRI/plugins/chatbot/__init__.py') diff --git a/ATRI/plugins/chatbot/__init__.py b/ATRI/plugins/chatbot/__init__.py index 53b3772..e9061cc 100644 --- a/ATRI/plugins/chatbot/__init__.py +++ b/ATRI/plugins/chatbot/__init__.py @@ -12,6 +12,7 @@ from nonebot.permission import SUPERUSER chatbot = on_message(priority=114514) + @chatbot.handle() async def _learn_from_group(bot: Bot, event: MessageEvent): text = event.get_plaintext().strip() @@ -19,13 +20,14 @@ async def _learn_from_group(bot: Bot, event: MessageEvent): return if isinstance(event, GroupMessageEvent): # 从群友那学习说话 ATRIChatBot.learn(event.get_session_id(), text) - if random.random() <= ChatterBot.group_random_response_rate: # 随机回话 + if random.random() <= ChatterBot.group_random_response_rate: # 随机回话 await chatbot.finish(await ATRIChatBot.get_response(text)) chatbot_learn = on_command("/learn_corpus", permission=SUPERUSER) + @chatbot_learn.handle() async def _learn_from_corpus(bot: Bot, event: MessageEvent): ATRIChatBot.learn_from_corpus() - await chatbot.finish("咱从corpus那学习完了!") \ No newline at end of file + await chatbot.finish("咱从corpus那学习完了!") -- cgit v1.2.3