We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Options that are not focused are inaccessible when setting the autocomplete_callback in a SlashOption
Example 1 is working as expected. Example 2 below causes an error since the other options are not getting passed to the autocomplete callback.
class Testing(commands.Cog): # Example 1 (working) @nextcord.slash_command() async def example1(self, interaction: Interaction, state: str, city: str): await interaction.response.send_message(f"You chose {state} and {city}") @example1.on_autocomplete("city") async def example1_autocomplete(self, interaction: Interaction, city: str, state: Optional[str]): await interaction.response.send_autocomplete([f"City: {city}", f"State: {state}"]) # Example 2 (not working) async def example2_autocomplete(self, interaction: Interaction, city: str, state: Optional[str]): await interaction.response.send_autocomplete([f"City: {city}", f"State: {state}"]) @nextcord.slash_command() async def example2( self, interaction: Interaction, state: str, city: str = SlashOption(autocomplete_callback=example2_autocomplete), ): await interaction.response.send_message(f"You chose {state} and {city}")
Working, as it does in example 1:
Error when running example 2:
Ignoring exception in on_interaction Traceback (most recent call last): File ".venv/lib/python3.10/site-packages/nextcord/client.py", line 490, in _run_event await coro(*args, **kwargs) File ".venv/lib/python3.10/site-packages/nextcord/client.py", line 2000, in on_interaction await self.process_application_commands(interaction) File ".venv/lib/python3.10/site-packages/nextcord/client.py", line 2076, in process_application_commands await app_cmd.call_autocomplete_from_interaction(interaction) # type: ignore File ".venv/lib/python3.10/site-packages/nextcord/application_command.py", line 1062, in call_autocomplete_from_interaction await self.call_autocomplete(self._state, interaction) File ".venv/lib/python3.10/site-packages/nextcord/application_command.py", line 1131, in call_autocomplete value = await focused_option.invoke_autocomplete_callback( File ".venv/lib/python3.10/site-packages/nextcord/application_command.py", line 1030, in invoke_autocomplete_callback return await self.autocomplete_callback( TypeError: Testing.example2_autocomplete() missing 1 required positional argument: 'state' Ignoring exception in on_interaction Traceback (most recent call last): File ".venv/lib/python3.10/site-packages/nextcord/client.py", line 490, in _run_event await coro(*args, **kwargs) File ".venv/lib/python3.10/site-packages/nextcord/client.py", line 2000, in on_interaction await self.process_application_commands(interaction) File ".venv/lib/python3.10/site-packages/nextcord/client.py", line 2076, in process_application_commands await app_cmd.call_autocomplete_from_interaction(interaction) # type: ignore File ".venv/lib/python3.10/site-packages/nextcord/application_command.py", line 1062, in call_autocomplete_from_interaction await self.call_autocomplete(self._state, interaction) File ".venv/lib/python3.10/site-packages/nextcord/application_command.py", line 1131, in call_autocomplete value = await focused_option.invoke_autocomplete_callback( File ".venv/lib/python3.10/site-packages/nextcord/application_command.py", line 1030, in invoke_autocomplete_callback return await self.autocomplete_callback( TypeError: Testing.example2_autocomplete() missing 1 required positional argument: 'state'
default
Current workaround is to use example1 syntax rather than example2 syntax.
from_autocomplete_callback is not getting called and autocomplete_options is not getting populated
from_autocomplete_callback
autocomplete_options
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Summary
Options that are not focused are inaccessible when setting the autocomplete_callback in a SlashOption
Reproduction Steps
Example 1 is working as expected. Example 2 below causes an error since the other options are not getting passed to the autocomplete callback.
Minimal Reproducible Code
Expected Results
Working, as it does in example 1:
Actual Results
Error when running example 2:
Intents
default
System Information
Checklist
Additional Context
Current workaround is to use example1 syntax rather than example2 syntax.
from_autocomplete_callback
is not getting called andautocomplete_options
is not getting populatedThe text was updated successfully, but these errors were encountered: