I was going to make a rock paper scissors game with discord.py and I first defaulted to using select menus in messages, that would work if I could find a way to do it, so then I decided to just make it use a string object, but then I thought to myself it would not be easy if the user had to guess what the choices where, so then I wanted to include a select menu inside of a slash command like the one you get from this code:
@tree.command(name="boolean_test", description="Boolean test")
async def boolean_test(command, boolean: bool):
pass
but I could not find a way to do that. I'm not using any forks of discord.py
Can someone help?
CodePudding user response:
There are three ways to do this:
choices
Literal
Enum
The docs page for choices
shows an example for all three of them. The one you decide to go for depends on your use case. For example, Choice
s have a value
attribute that you can use to make them easier to work with internally (like attaching an id to the choices instead of the raw strings).