nonebot2/nonebot/plugins/base.py

14 lines
426 B
Python
Raw Normal View History

2018-12-27 20:23:45 +08:00
from nonebot import on_command, CommandSession, permission as perm
from nonebot.message import unescape
2018-06-15 15:00:58 +08:00
2018-07-06 19:07:02 +08:00
@on_command('echo')
2018-06-27 22:05:12 +08:00
async def echo(session: CommandSession):
2019-01-26 16:43:02 +08:00
await session.send(session.state.get('message') or session.current_arg)
2018-06-15 06:58:24 +08:00
2018-07-06 19:07:02 +08:00
@on_command('say', permission=perm.SUPERUSER)
2018-12-22 21:22:58 +08:00
async def say(session: CommandSession):
2018-06-30 21:00:41 +08:00
await session.send(
2019-01-26 16:43:02 +08:00
unescape(session.state.get('message') or session.current_arg))