diff options
author | Lint Action <[email protected]> | 2021-12-11 15:10:30 +0000 |
---|---|---|
committer | Lint Action <[email protected]> | 2021-12-11 15:10:30 +0000 |
commit | 288de059687aeee0c2efae85803fec4ccf5173fa (patch) | |
tree | 72acee8461c82c0328a8cd959c1f9fda5eea3de3 /ATRI/plugins/chatbot | |
parent | 42d6bb6e4d492aac530042a9b9d1a7e477c0f51b (diff) | |
download | ATRI-288de059687aeee0c2efae85803fec4ccf5173fa.tar.gz ATRI-288de059687aeee0c2efae85803fec4ccf5173fa.tar.bz2 ATRI-288de059687aeee0c2efae85803fec4ccf5173fa.zip |
:rotating_light: 自动进行代码格式化
Diffstat (limited to 'ATRI/plugins/chatbot')
-rw-r--r-- | ATRI/plugins/chatbot/__init__.py | 6 |
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那学习完了!") |