Skip to content
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

fix(app-cmds): unfocused options not getting passed in autocomplete callback #1046

Merged
merged 1 commit into from Aug 6, 2023

Conversation

DenverCoder1
Copy link
Collaborator

@DenverCoder1 DenverCoder1 commented Apr 24, 2023

Summary

Fixes #1045

Bug:

from_autocomplete_callback is not getting called and autocomplete_options is not getting populated when autocomplete_callback is supplied to a SlashOption rather than using the decorator. This causes other options from the command to be inaccessible from the autocomplete callback method (see linked issue).

Fix:

Replaces iscoroutinefunction check in SlashCommandOption with a call to self.from_autocomplete_callback(self.autocomplete_callback) which includes the iscoroutinefunction check and also populates the autocomplete_options field to have the other options in the command so they can be accessed later when the callback is called (see from_autocomplete_callback).

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
    • I have run task pyright and fixed the relevant issues.
  • This PR fixes an issue.
  • 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, ...)

@DenverCoder1 DenverCoder1 marked this pull request as ready for review April 24, 2023 19:41
@DenverCoder1 DenverCoder1 changed the title Fix unfocused options in autocomplete enabled by SlashOption argument fix(app-cmds): unfocused options not getting passed in autocomplete callback Apr 24, 2023
@DenverCoder1 DenverCoder1 added t: bug Type: bug - something isn't working p: medium Priority: medium - should be worked on in the near future s: awaiting review Status: the issue or PR is awaiting reviews labels Apr 24, 2023
@ooliver1 ooliver1 merged commit be181c9 into nextcord:master Aug 6, 2023
10 checks passed
@ooliver1 ooliver1 removed the s: awaiting review Status: the issue or PR is awaiting reviews label Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: medium Priority: medium - should be worked on in the near future t: bug Type: bug - something isn't working
Projects
No open projects
Status: In Cycle
Development

Successfully merging this pull request may close these issues.

Autocomplete alternate syntax does not support reading adjacent options
3 participants