mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-09 15:29:57 +00:00
Fix autocomplete example to not be as confusing
This commit is contained in:
parent
bd637e2462
commit
37076a04de
@ -816,10 +816,10 @@ class Command(Generic[GroupT, P, T]):
|
|||||||
.. code-block:: python3
|
.. code-block:: python3
|
||||||
|
|
||||||
@app_commands.command()
|
@app_commands.command()
|
||||||
async def fruits(interaction: discord.Interaction, fruits: str):
|
async def fruits(interaction: discord.Interaction, fruit: str):
|
||||||
await interaction.response.send_message(f'Your favourite fruit seems to be {fruits}')
|
await interaction.response.send_message(f'Your favourite fruit seems to be {fruit}')
|
||||||
|
|
||||||
@fruits.autocomplete('fruits')
|
@fruits.autocomplete('fruit')
|
||||||
async def fruits_autocomplete(
|
async def fruits_autocomplete(
|
||||||
interaction: discord.Interaction,
|
interaction: discord.Interaction,
|
||||||
current: str,
|
current: str,
|
||||||
@ -1763,11 +1763,11 @@ def autocomplete(**parameters: AutocompleteCallback[GroupT, ChoiceT]) -> Callabl
|
|||||||
.. code-block:: python3
|
.. code-block:: python3
|
||||||
|
|
||||||
@app_commands.command()
|
@app_commands.command()
|
||||||
@app_commands.autocomplete(fruits=fruits_autocomplete)
|
@app_commands.autocomplete(fruit=fruit_autocomplete)
|
||||||
async def fruits(interaction: discord.Interaction, fruits: str):
|
async def fruits(interaction: discord.Interaction, fruit: str):
|
||||||
await interaction.response.send_message(f'Your favourite fruit seems to be {fruits}')
|
await interaction.response.send_message(f'Your favourite fruit seems to be {fruit}')
|
||||||
|
|
||||||
async def fruits_autocomplete(
|
async def fruit_autocomplete(
|
||||||
interaction: discord.Interaction,
|
interaction: discord.Interaction,
|
||||||
current: str,
|
current: str,
|
||||||
) -> List[app_commands.Choice[str]]:
|
) -> List[app_commands.Choice[str]]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user