-
Notifications
You must be signed in to change notification settings - Fork 145
Description
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