Summary
Allow using typing.Annotated in slash command parameters to specify numeric ranges and string length limits.
What is the feature request for?
disnake.ext.commands
The Problem
Similarly to #1422, we could add direct support for using Annotated in slash command parameters, like name: Annotated[str, 2, 32] and number: Annotated[float, 10, 15.5].
The library currently uses two dataclasses and some metaclass magic to implement Range and String, and circumvents the type checker incompatibility by aliasing these two types to Annotated (under TYPE_CHECKING). We could go a step further and actually make them be Annotated, possibly simplifying the implementation.
The Ideal Solution
Support Annotated for annotating string and numeric parameters, alias Range and String to Annotated at runtime; possibly also add support for annotated-types
The Current Solution
null
Additional Context
No response
Summary
Allow using
typing.Annotatedin slash command parameters to specify numeric ranges and string length limits.What is the feature request for?
disnake.ext.commands
The Problem
Similarly to #1422, we could add direct support for using
Annotatedin slash command parameters, likename: Annotated[str, 2, 32]andnumber: Annotated[float, 10, 15.5].The library currently uses two dataclasses and some metaclass magic to implement
RangeandString, and circumvents the type checker incompatibility by aliasing these two types toAnnotated(underTYPE_CHECKING). We could go a step further and actually make them beAnnotated, possibly simplifying the implementation.The Ideal Solution
Support
Annotatedfor annotating string and numeric parameters, aliasRangeandStringtoAnnotatedat runtime; possibly also add support for annotated-typesThe Current Solution
null
Additional Context
No response