'String args discord.py

I'm making an rpg game with discord.py, and I've run into an issue. I'm looking to make a command where you can hunt for an input animal in an input biome, but I don't know how to make it so they can just select the name of the animal or biome instead of having to type it all in. Is it similar to how you do it with bool arguments, or is it completely different? here is my best guess at what the code could be for what I'm trying to do

locations=['woods','caves']
weapons=['sword','axe']
creatures=['fox','wolf']
@slash.slash(description='an rpg command to hunt creatures')
async def hunt(ctx,weapon:weapons,creature:creatures,location:locations):
  await ctx.send(f'{ctx.author} chose to hunt a {creature} with a {weapon} in {location}')

here is an example of what I mean from the dank memer bot https://cdn.discordapp.com/attachments/892410036565970967/964529376261705728/IMG_0252.jpg



Solution 1:[1]

@slash.slash(description='an rpg command to hunt creatures')
async def hunt(ctx, weapon: str = commands.Param(choices=['sword', 'axe']),creature: str = commands.Param(choices=['fox', 'wolf'],location: str = commands.Param(choices=['woods', 'caves']):
await ctx.send(f'{ctx.author} chose to hunt a {creature} with a {weapon} in {location}')

I think this is what you looking for, now, i don't know what library you use, but on disnake/pycord it works.

To do something when the user is selecting one of the choices you can do for example :

if weapon == 'sword': # this string needs to be the same with the one you introduced in the choices=[]
     . . . do stuff.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ares