Reorder fruit autocomplete example to be less confusing

This commit is contained in:
Rapptz 2022-06-14 20:40:27 -04:00
parent 7e66e11640
commit 9648986028

View File

@ -1808,11 +1808,6 @@ def autocomplete(**parameters: AutocompleteCallback[GroupT, ChoiceT]) -> Callabl
.. code-block:: python3
@app_commands.command()
@app_commands.autocomplete(fruit=fruit_autocomplete)
async def fruits(interaction: discord.Interaction, fruit: str):
await interaction.response.send_message(f'Your favourite fruit seems to be {fruit}')
async def fruit_autocomplete(
interaction: discord.Interaction,
current: str,
@ -1823,6 +1818,11 @@ def autocomplete(**parameters: AutocompleteCallback[GroupT, ChoiceT]) -> Callabl
for fruit in fruits if current.lower() in fruit.lower()
]
@app_commands.command()
@app_commands.autocomplete(fruit=fruit_autocomplete)
async def fruits(interaction: discord.Interaction, fruit: str):
await interaction.response.send_message(f'Your favourite fruit seems to be {fruit}')
Parameters
-----------
\*\*parameters