I have this so far:
@app_commands.Argument( username={ "min_length": 3, "max_length": 22 } ) async def inv(interaction:discord.Interaction, username:str): # code
But it gives me this error:
Traceback (most recent call last): File "main.py", line 69, in <module> @app_commands.Argument( TypeError: __init__() got an unexpected keyword argument 'username'
How do I make it so that the min and max length of the username
argument is 3
and 22
.
Advertisement
Answer
I was able to accomplish this by using app_commands.Range.
async def inv(interaction:discord.Interaction, username:app_commands.Range[str, 3, 22]): # code