Skip to content
Discussion options

You must be logged in to vote
  1. You can use the discord.app_commands.autocomplete decorator to set an autocomplete callable for a parameter.

Example:

async def my_autocomplete(...):
    ...

@app_commands.command()
@app_commands.autocomplete(colour=my_autocomplete)
async def foo(
    self,
    interaction: Interaction,
    colour: str
):
    ...

@app_commands.command()
@app_commands.autocomplete(color=my_autocomplete)
async def bar(
    self,
    interaction: Interaction,
    color: int
):
    ...
  1. I'm not too sure about this and haven't tried but I guess you can try stacking the @command.autocomplete(...) decorators on one autocomplete
@foo.autocomplete("colour")
@bar.autocomplete("color")
async def my_autocomplete(…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@codeofdusk
Comment options

@LostLuma
Comment options

@codeofdusk
Comment options

Answer selected by codeofdusk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants