From 24349953e3ff1cc9d3a1478d50b2564e3bd8c4c6 Mon Sep 17 00:00:00 2001 From: Mix Date: Sun, 7 Feb 2021 12:17:34 +0800 Subject: [PATCH] :white_check_mark: update test case --- tests/test_plugins/test_mirai.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/test_plugins/test_mirai.py b/tests/test_plugins/test_mirai.py index a5da93ae..c518290a 100644 --- a/tests/test_plugins/test_mirai.py +++ b/tests/test_plugins/test_mirai.py @@ -1,13 +1,20 @@ -from nonebot.plugin import on_message +from nonebot.plugin import on_keyword, on_command +from nonebot.rule import to_me from nonebot.adapters.mirai import Bot, MessageEvent -message_test = on_message() +message_test = on_keyword({'reply'}, rule=to_me()) @message_test.handle() async def _message(bot: Bot, event: MessageEvent): text = event.get_plaintext() - if not text: - return - reversed_text = ''.join(reversed(text)) - await bot.send(event, reversed_text, at_sender=True) + await bot.send(event, text, at_sender=True) + + +command_test = on_command('miecho') + + +@command_test.handle() +async def _echo(bot: Bot, event: MessageEvent): + text = event.get_plaintext() + await bot.send(event, text, at_sender=True) \ No newline at end of file