2021-02-07 12:17:34 +08:00
|
|
|
from nonebot.plugin import on_keyword, on_command
|
|
|
|
from nonebot.rule import to_me
|
2021-02-01 16:37:42 +08:00
|
|
|
from nonebot.adapters.mirai import Bot, MessageEvent
|
|
|
|
|
2021-02-07 12:17:34 +08:00
|
|
|
message_test = on_keyword({'reply'}, rule=to_me())
|
2021-02-01 16:37:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
@message_test.handle()
|
|
|
|
async def _message(bot: Bot, event: MessageEvent):
|
|
|
|
text = event.get_plaintext()
|
2021-02-07 12:17:34 +08:00
|
|
|
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)
|