mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 08:11:38 +00:00
✨ rewrite shell command
This commit is contained in:
15
tests/test_plugins/test_shell.py
Normal file
15
tests/test_plugins/test_shell.py
Normal file
@ -0,0 +1,15 @@
|
||||
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()
|
||||
parser.add_argument("-a", type=bool)
|
||||
|
||||
shell = on_shell_command("ls", to_me(), parser=parser)
|
||||
|
||||
|
||||
@shell.handle()
|
||||
async def _(bot: Bot, state: T_State):
|
||||
print(state["argv"])
|
||||
print(state["args"])
|
Reference in New Issue
Block a user