-
Notifications
You must be signed in to change notification settings - Fork 147
feat(commands): support Annotated[tp, converter] in prefix commands
#1431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(commands): support Annotated[tp, converter] in prefix commands
#1431
Conversation
onerandomusername
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, but we should make sure we support typing_extensions Annotated as well. This can be done by implementing typing_extensions.get_type_hints.
|
I'm wondering if it's a good idea to make converters the only use of |
@onerandomusername $ uv run -p 3.10 python
Python 3.10.12 (main, Aug 15 2025, 14:32:43) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing, typing_extensions
>>> typing.Annotated is typing_extensions.Annotated
True |
@Enegg Yeah, it would be nice to have prefix/slash commands diverge less long-term. Not necessarily with some sort of hybrid command, but more so by just reusing internals more between the two command types |
Summary
Fixes #1422.
See https://disnake--1431.org.readthedocs.build/en/1431/ext/commands/commands.html#typing-annotated for a proper explanation :>
Checklist
uv run nox -s lintuv run nox -s pyright