nonebot2/tests/test_plugins/test_shell.py

16 lines
389 B
Python
Raw Normal View History

2021-02-02 03:59:14 +00:00
from nonebot.adapters import Bot
from nonebot.typing import T_State
from nonebot import on_shell_command
from nonebot.rule import to_me, ArgumentParser
parser = ArgumentParser()
2021-02-02 04:39:23 +00:00
parser.add_argument("-a", action="store_true")
2021-02-02 03:59:14 +00:00
shell = on_shell_command("ls", to_me(), parser=parser)
@shell.handle()
async def _(bot: Bot, state: T_State):
print(state["argv"])
print(state["args"])