2024-04-16 00:33:48 +08:00
|
|
|
from typing import Annotated
|
2023-06-24 19:18:24 +08:00
|
|
|
|
2023-06-24 14:47:35 +08:00
|
|
|
from nonebot.adapters import Message
|
2024-12-01 12:31:11 +08:00
|
|
|
from nonebot.params import Arg, ArgPlainText, ArgStr
|
2021-12-20 14:31:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
async def arg(key: Message = Arg()) -> Message:
|
|
|
|
return key
|
|
|
|
|
|
|
|
|
|
|
|
async def arg_str(key: str = ArgStr()) -> str:
|
|
|
|
return key
|
|
|
|
|
|
|
|
|
2021-12-23 22:16:55 +08:00
|
|
|
async def arg_plain_text(key: str = ArgPlainText()) -> str:
|
2021-12-20 14:31:48 +08:00
|
|
|
return key
|
2023-06-24 19:18:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2023-09-14 00:14:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
# test dependency priority
|
|
|
|
async def annotated_prior_arg(key: Annotated[str, ArgStr("foo")] = ArgPlainText()):
|
|
|
|
return key
|
|
|
|
|
|
|
|
|
|
|
|
async def annotated_multi_arg(
|
2024-12-01 12:31:11 +08:00
|
|
|
key: Annotated[Annotated[str, ArgStr("foo")], ArgPlainText()],
|
2023-09-14 00:14:45 +08:00
|
|
|
):
|
|
|
|
return key
|