nonebot2/tests/test_plugins/test_shell.py
2021-11-22 23:21:26 +08:00

16 lines
389 B
Python

from nonebot.adapters import Bot
from nonebot.typing import T_State
from nonebot import on_shell_command
from nonebot.rule import ArgumentParser, to_me
parser = ArgumentParser()
parser.add_argument("-a", action="store_true")
shell = on_shell_command("ls", to_me(), parser=parser)
@shell.handle()
async def _(bot: Bot, state: T_State):
print(state["argv"])
print(state["args"])