pycord
pycord copied to clipboard
feat: :sparkles: Allow for `functools.partial` and functions returning an awaitable as autocomplete
Summary
Allows usage of functions with any number of optional parameters as autocomplete. This allows by extent the usage of partials and similar as autocomplete.
Fixes #2668
Information
- [x] This PR fixes an issue.
- [x] This PR adds something new (e.g. new method or parameters).
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed).
- [ ] This PR is not a code change (e.g. documentation, README, typehinting, examples, ...).
Checklist
- [x] I have searched the open pull requests for duplicates.
- [x] If code changes were made then they have been tested.
- [ ] I have updated the documentation to reflect the changes.
- [ ] If
type: ignorecomments were used, a comment is also left explaining why. - [x] I have updated the changelog to include these changes.
@DefiDebauchery Would you mind testing this pr with your usecase and functools.partial?
@DefiDebauchery Would you mind testing this pr with your usecase and
functools.partial?
Yes, this did work on my side, thank you! While I also like the solution offered in https://github.com/Pycord-Development/pycord/issues/2668#issuecomment-2540044621, I do think partials make sense in many contexts, and it would be great to have support for those who need something quick.
https://discord.com/channels/881207955029110855/881735314987708456/1316992273476747375
Oh shoot checks failing... This is why we should be using Annotated for options...
Merge conflicts
Fixed
tbh I might as well give up this one and make it part of the options rewrite in next
idk. we dunno when next comes out. i'd prefer if we still have it here
It's just that I don't really like that code I wrote but at the same time it's mainly because options are spaghetti code
This breaks autocomplete, please hold