#How to make a list of available arguments in a slash command
1 messages · Page 1 of 1 (latest)
This thread was archived by the user that opened it.
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]
Here's the slash autocomplete example.
technically you want choices but it looks like we don't have an example for that
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}!")