summaryrefslogtreecommitdiff
path: root/ATRI/plugins/chatbot
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/plugins/chatbot')
-rw-r--r--ATRI/plugins/chatbot/__init__.py6
1 files changed, 4 insertions, 2 deletions
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那学习完了!")