Skip to content

Call expression in type expression when defining list of allowed values for slash_command parameter #2748

Closed Answered by JustaSqu1d
seyfu-t asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the @option decorator instead.

from discord import option
from typing import Literal


@bot.slash_command()
@option("option_name", type=str, description="Choose a genre", choices=["thriller", "horror", "action"])
async def command(ctx, option_name: Literal["category1", "category2", "category3"]):
    ...

I hope this answers your question.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@seyfu-t
Comment options

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