#trying to figure out slash command string choices

1 messages · Page 1 of 1 (latest)

slow grove
#

got this code off of reddit, dont know if this is the right way to do this but it sure dont work

@bot.slash_command(name='stealer-settings', description='change stealer settings')
@option("stealer", description="choose which stealer to change settings of", choices=["MM2", "AdoptMe", "AnimeAdventures", "BladeBall"])
async def stealer(ctx: discord.ApplicationContext, stealer: str):
    await ctx.respond(f'{stealer}')
hazy seal
#

how do you import option?

slow grove
# hazy seal how do you import `option`?
import discord

bot = discord.Bot()

@bot.event
async def on_ready():
    print(f"{bot.user} is ready and online!")

@bot.slash_command(name="ping", description="responds with pong")
async def hello(ctx: discord.ApplicationContext):
    await ctx.respond("Pong! 🏓")

@bot.slash_command(name='stealer-settings', description='change stealer settings')
@option("stealer", description="choose which stealer to change settings of", choices=["MM2", "AdoptMe", "AnimeAdventures", "BladeBall"])
async def stealer(ctx: discord.ApplicationContext, stealer: str):
    await ctx.respond(f'{stealer}')

bot.run("")
#

i don't

hazy seal
#

You need to import it or use the full length name of
discord.commands.option(...)

timid bloom
wet crown
#

you do need it for the decorator tho

timid bloom
#

no ?

#

@discord.option works just fine afaik

teal girder
#

It should indeed work.

discord/__init__.py has from .commands import *, and commands/__init__.py has from .options import *.

timid bloom
#

Yeah no it does I do that all the time lol