Skip to content

Commit

Permalink
Added description to parameters in commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Endyya committed Dec 1, 2024
1 parent 6b4b4b3 commit 14cc20f
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions src/SilicaAnimus/discord_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ async def ping(interaction: discord.Interaction):
description = """
L'application répète le message envoyé
""")
@app_commands.describe(text = 'Texte à répéter')
@app_commands.rename(text = 'texte')
async def echo(interaction: discord.Interaction, text: str):
embed = MessageTemplate(
description = text,
Expand All @@ -158,6 +160,8 @@ async def my_roles(interaction: discord.Interaction):
description = """
Affiche les utilisateurs ayant le rôle fourni en paramètre
""")
@app_commands.rename(role = 'rôle')
@app_commands.describe(role = 'Role dont il faut lister les membres')
async def whois(interaction: discord.Interaction,
role: discord.Role):

Expand All @@ -173,14 +177,6 @@ async def whois(interaction: discord.Interaction,
for member in role.members[i::max_fields]]))
await interaction.response.send_message(embed = embed)

class MyView(discord.ui.View):
@discord.ui.button(label = 'Click me !')
async def button_callback(self, interaction, button):
await interaction.response.send_message('You clicked !!')

@self.tree.command(guild = self.thalos_guild)
async def testing_button(interaction: discord.Interaction):
await interaction.response.send_message('My button', view = MyView())


@self.tree.context_menu(name = 'Epingler',
Expand All @@ -204,6 +200,9 @@ async def pin(interaction: discord.Interaction,
Donne un rôle à tous les membres ayant le rôle fourni en
paramètre
""")
@app_commands.describe(role_given = 'Rôle à donner',
user_group = """Groupe d'utilisateurs recevant
le nouveau rôle""")
async def give_role(interaction: discord.Interaction,
role_given: discord.Role,
user_group: discord.Role):
Expand Down Expand Up @@ -272,6 +271,26 @@ async def info(interaction: discord.Interaction,
embed.add_field(name = 'Prénom', value = first_name)

await interaction.response.send_message(embed = embed, ephemeral = True)

class MyView(discord.ui.View):
@discord.ui.button(label = 'Je cherche un adversaire')
async def button_callback(self, interaction, button):
content = interaction.message.content
edit = content + f'\n{interaction.user.mention} cherche un adversaire'
await interaction.message.edit(content = edit)
@discord.ui.button(label = 'Rejoindre une partie')
async def button_callback(self, interaction, button):
content = interaction.message.content
edit = content + f'\n{interaction.user.mention} a rejoint une partie'
await interaction.message.edit(content = edit)

@self.tree.command(guild = self.thalos_guild)
async def make_table(interaction: discord.Interaction):
embed = MessageTemplate(
title = 'Organisation du 14/12/24')
await interaction.response.send_message(embed = embed,
view = MyView())



# Events
Expand Down

0 comments on commit 14cc20f

Please sign in to comment.