Help needed for app_commands.choice max choices #9241
-
Hello! I have a few app_command options for some roulette stuff, now roulette lets you select a single number from 1 to 36 instead of a "group of numbers". Now you only have 25 choices, but I have many more choices This command is inspired by UnbelieaveaBoat, which offers well over 25 choices. How to add it in discord.py too? @tree.command(
name="roulette", description="Play roulette and multipliers high multipliers!"
)
@app_commands.describe(
number="Amount of money in your wallet that you want to gamble with! (e.g. 10 or all)"
)
@app_commands.choices(
fields=[
app_commands.Choice(name="🔴 Red", value="RED"),
app_commands.Choice(name="⚫ Black", value="BLACK"),
app_commands.Choice(name="🔶 even", value="EVEN"),
app_commands.Choice(name="🔷 odd", value="ODD"),
app_commands.Choice(name=" 0", value="GREEN"),
app_commands.Choice(name="1-12", value="1ST"),
app_commands.Choice(name="13-24", value="2ND"),
app_commands.Choice(name="25-36", value="3RD"),
app_commands.Choice(name="1st column", value="2TO1 1"),
app_commands.Choice(name="2nd column", value="2TO1 2"),
app_commands.Choice(name="3rd column", value="2TO1 3"),
]
)
async def roulette(
Interaction: Discord.Interaction,
number: st,
fields: app_commands.Choice[str],
):
#... Here is some of the code needed. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Autocomplete options and choices have a fixed limit at 25, can't go past that. Discord API does however support optional minimum and maximum limits for numeric and string types. So to pick a number between 1-36, you can annotate to a @app_commands.command()
async def command(interaction: discord.Interaction, number: app_commands.Range[int, 1, 36]):
... |
Beta Was this translation helpful? Give feedback.
Autocomplete options and choices have a fixed limit at 25, can't go past that.
Discord API does however support optional minimum and maximum limits for numeric and string types. So to pick a number between 1-36, you can annotate to a
Range
, for example: