app_commands options #9495
-
Hi all, I'm currently in process of writing a app command which mostly works fine, but feel like im really struggling/misreading the documentation for options. So anyway what I am trying to achieve is an lfg bot just to keep my mind busy and what i am failing is making it so whena user runs the command they can add in their own text string so for example: /tlfg (options box shows up named title that can be type in) "my jail raid" but yeah, failing miserably tbh.
I was wondering someone could advise or give me pointers on what i'm doing wrong. At this bit "discord.app_commands.Option" I have tried it as jsut app_commands.Option and even just Option to no avail either. Cheers |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
App commands in discord.py specify their parameters via Python parameters rather than having to manually specify them in the decorator. The different types of options can be used by placing their respective type into the type hint for the parameter. See two short examples here: # Turns into a command called /example_one with a required string as an option
@client.tree.command()
async def example_one(interaction: discord.Interaction, example: str) -> None:
...
# Turns into a command called /example_two which requires choosing a server member to use
@client.tree.command()
async def example_two(interaction: discord.Interaction, example: discord.Member) -> None:
... See more examples here: https://github.com/Rapptz/discord.py/blob/master/examples/app_commands |
Beta Was this translation helpful? Give feedback.
App commands in discord.py specify their parameters via Python parameters rather than having to manually specify them in the decorator. The different types of options can be used by placing their respective type into the type hint for the parameter. See two short examples here:
See more examples…