mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-31 15:06:42 +00:00 
			
		
		
		
	🎨 impove typing
This commit is contained in:
		| @@ -1,13 +1,13 @@ | ||||
| from nonebot.rule import to_me | ||||
| from nonebot.typing import Event | ||||
| from nonebot.typing import State | ||||
| from nonebot.plugin import on_command | ||||
| from nonebot.adapters.cqhttp import Bot | ||||
| from nonebot.adapters.cqhttp import Bot, Event | ||||
|  | ||||
| test_command = on_command("帮助", to_me()) | ||||
|  | ||||
|  | ||||
| @test_command.handle() | ||||
| async def test_handler(bot: Bot, event: Event, state: dict): | ||||
| async def test_handler(bot: Bot, event: Event, state: State): | ||||
|     args = str(event.message).strip() | ||||
|     print("[!] Command:", state["_prefix"], "Args:", args) | ||||
|     if args: | ||||
| @@ -17,7 +17,7 @@ async def test_handler(bot: Bot, event: Event, state: dict): | ||||
|  | ||||
|  | ||||
| @test_command.got("help", prompt="你要帮助的命令是?") | ||||
| async def test_handler(bot: Bot, event: Event, state: dict): | ||||
| async def test_handler(bot: Bot, event: Event, state: State): | ||||
|     print("[!] Command 帮助:", state["help"]) | ||||
|     if state["help"] not in ["test1", "test2"]: | ||||
|         await test_command.reject(f"{state['help']} 不支持,请重新输入!") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user