#How to make a list of available arguments in a slash command

1 messages · Page 1 of 1 (latest)

gentle arrow
#

Example of what I want to do in the screenshot

#

I saw it, but unfortunately I did not understand how to do it

#

Thanks a lot

quiet wadiBOT
#

This thread was archived by the user that opened it.

gentle arrow
#

I closed the thread early

#
Traceback (most recent call last):
  File "C:\Users\User\Documents\Testings\CMSelfBot\centurybot.py", line 82, in <module>
    @option(
NameError: name 'option' is not defined. Did you mean: 'Option'?
[Finished in 635ms]
quiet wadiBOT
#

Here's the slash autocomplete example.

flat lynx
#

technically you want choices but it looks like we don't have an example for that

gentle arrow
#

Thanks
The working version was

#
from discord.commands import option

@bot.slash_command(name='devtest', description='Greet someone!')
@option(
    "name",
    description="Enter your friend's name",
autocomplete=discord.utils.basic_autocomplete(["snail", "python", "cricket", "orca"])
)
async def greet(
    ctx: discord.ApplicationContext,
    name: str
):
    await ctx.respond(f"Hello {name}!")