From 9648986028a9721e1ba733750eb8c30e163dcb2c Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 14 Jun 2022 20:40:27 -0400 Subject: [PATCH] Reorder fruit autocomplete example to be less confusing --- discord/app_commands/commands.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/discord/app_commands/commands.py b/discord/app_commands/commands.py index 340cc53be..457fecafe 100644 --- a/discord/app_commands/commands.py +++ b/discord/app_commands/commands.py @@ -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