Slash_commands and interactions #8424
Unanswered
jbaumgarten
asked this question in
Q&A
Replies: 1 comment 8 replies
-
You can see some examples of Slash Commands in the examples folder: https://github.com/Rapptz/discord.py/tree/master/examples/app_commands Parameters to slash commands work the same as adding parameters to a Python function, you can use type annotations to make them take different types of input, for example @client.tree.command()
@app_commands.describe(member='The member you want to get the joined date from')
async def joined(interaction: discord.Interaction, member: discord.Member):
"""Says when a member joined."""
# The format_dt function formats the date time into a human readable representation in the official client
await interaction.response.send_message(f'{member} joined {discord.utils.format_dt(member.joined_at)}') You can see more info about the supported annotations here: https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.app_commands.Namespace |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys,
I have several servers where there are some slash commands to interact with it.
Some slash commands requires some parameters which are, I suppose, a kind of context.
Is it possible to use that commands with this library?
Some slash commands take channel member as argument
Beta Was this translation helpful? Give feedback.
All reactions