mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 09:05:04 +08:00
✅ update test case
This commit is contained in:
parent
85aba9e36f
commit
24349953e3
@ -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
|
from nonebot.adapters.mirai import Bot, MessageEvent
|
||||||
|
|
||||||
message_test = on_message()
|
message_test = on_keyword({'reply'}, rule=to_me())
|
||||||
|
|
||||||
|
|
||||||
@message_test.handle()
|
@message_test.handle()
|
||||||
async def _message(bot: Bot, event: MessageEvent):
|
async def _message(bot: Bot, event: MessageEvent):
|
||||||
text = event.get_plaintext()
|
text = event.get_plaintext()
|
||||||
if not text:
|
await bot.send(event, text, at_sender=True)
|
||||||
return
|
|
||||||
reversed_text = ''.join(reversed(text))
|
|
||||||
await bot.send(event, reversed_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)
|
Loading…
Reference in New Issue
Block a user