mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-17 03:09:05 +00:00
Reorder fruit autocomplete example to be less confusing
This commit is contained in:
parent
7e66e11640
commit
9648986028
@ -1808,11 +1808,6 @@ def autocomplete(**parameters: AutocompleteCallback[GroupT, ChoiceT]) -> Callabl
|
|||||||
|
|
||||||
.. code-block:: python3
|
.. 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(
|
async def fruit_autocomplete(
|
||||||
interaction: discord.Interaction,
|
interaction: discord.Interaction,
|
||||||
current: str,
|
current: str,
|
||||||
@ -1823,6 +1818,11 @@ def autocomplete(**parameters: AutocompleteCallback[GroupT, ChoiceT]) -> Callabl
|
|||||||
for fruit in fruits if current.lower() in fruit.lower()
|
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
|
||||||
-----------
|
-----------
|
||||||
\*\*parameters
|
\*\*parameters
|
||||||
|
Loading…
x
Reference in New Issue
Block a user