mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-06 12:06:45 +00:00
🐛 Fix: 修复 ArgParam
不支持 Annotated
(#2124)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from nonebot.adapters import Message
|
||||
from nonebot.params import Arg, ArgStr, ArgPlainText
|
||||
|
||||
@ -12,3 +14,15 @@ async def arg_str(key: str = ArgStr()) -> str:
|
||||
|
||||
async def arg_plain_text(key: str = ArgPlainText()) -> str:
|
||||
return key
|
||||
|
||||
|
||||
async def annotated_arg(key: Annotated[Message, Arg()]) -> Message:
|
||||
return key
|
||||
|
||||
|
||||
async def annotated_arg_str(key: Annotated[str, ArgStr()]) -> str:
|
||||
return key
|
||||
|
||||
|
||||
async def annotated_arg_plain_text(key: Annotated[str, ArgPlainText()]) -> str:
|
||||
return key
|
||||
|
Reference in New Issue
Block a user