Skip to content

Commit 96feb33

Browse files
committed
document commands
1 parent bafdd2a commit 96feb33

2 files changed

Lines changed: 41 additions & 20 deletions

File tree

src/commands/club.py

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,31 @@ async def autocomplete_existing_club(
4848
clubs = clubs[:25] # discord autocomplete can have at most 25 items
4949
return [Choice(name=club.name, value=str(club.id)) for club in clubs]
5050

51-
@app_commands.command(name="infos")
51+
@app_commands.command(
52+
name="infos",
53+
description="Récupère les informations sur un club à partir du site AE.",
54+
)
5255
@app_commands.autocomplete(club=autocomplete_club)
56+
@app_commands.describe(club="Le club dont on veut avoir les infos")
5357
async def club_infos(
5458
self, interaction: Interaction, club: Transform[ClubSchema, ClubTransformer]
5559
):
56-
"""Permet d'envoie les informations d'un club"""
57-
await interaction.response.defer(thinking=True)
58-
await interaction.followup.send(embed=self.club_service.embed(club))
60+
await interaction.response.send(embed=self.club_service.embed(club))
5961

60-
@app_commands.command(name="remove_member")
62+
@app_commands.command(
63+
name="remove_member",
64+
description="Retire un membre du club et le marque comme ancien membre.",
65+
)
6166
@app_commands.autocomplete(club=autocomplete_existing_club)
67+
@app_commands.describe(
68+
club="le club d'où retirer le membre", member="le membre à retirer"
69+
)
6270
async def remove_club_member(
6371
self,
6472
interaction: Interaction,
6573
club: Transform[ClubSchema, ClubTransformer],
6674
member: Member,
6775
):
68-
"""
69-
Permet d'enlever, sur discord, un membre d'un club
70-
et de l'ajouter en tant qu'ancien
71-
"""
7276
await interaction.response.defer(thinking=True)
7377
db_club = Club.get_or_none(Club.sith_id == club.id)
7478
if not db_club:
@@ -91,15 +95,18 @@ async def remove_club_member(
9195
f"{member.name} a été retiré du club :thumbs_up:"
9296
)
9397

94-
@app_commands.command(name="add_member")
98+
@app_commands.command(name="add_member", description="Ajoute un membre au club.")
9599
@app_commands.autocomplete(club=autocomplete_existing_club)
100+
@app_commands.describe(
101+
club="Le club dans lequel mettre l'utilisateur",
102+
member="L'utilisateur à rajouter",
103+
)
96104
async def add_club_member(
97105
self,
98106
interaction: Interaction,
99107
club: Transform[ClubSchema, ClubTransformer],
100108
member: Member,
101109
):
102-
"""Permet d'ajouter un membre à un club existant sur le serveur discord"""
103110
await interaction.response.defer(thinking=True)
104111
db_club = Club.get_or_none(Club.sith_id == club.id)
105112
role_membre = member.guild.get_role(db_club.member_role_id)
@@ -122,13 +129,16 @@ async def add_club_member(
122129
f"{member.name} a été ajouté au club :thumbs_up:"
123130
)
124131

125-
@app_commands.command(name="create")
132+
@app_commands.command(
133+
name="create",
134+
description="Crée un club, avec ses salons, ses rôles et ses permissions.",
135+
)
126136
@app_commands.autocomplete(club=autocomplete_club)
127137
@app_commands.checks.has_permissions(manage_guild=True)
138+
@app_commands.describe(club="le club à créer")
128139
async def create_club(
129140
self, interaction: Interaction, club: Transform[ClubSchema, ClubTransformer]
130141
):
131-
"""Permet de créer un club déjà disponible sur le sith"""
132142
await interaction.response.defer(thinking=True)
133143
if Club.filter(Club.sith_id == club.id).exists():
134144
await interaction.followup.send(f"Le club : {club.name} existe déjà...")
@@ -138,24 +148,34 @@ async def create_club(
138148
guild.channels, id=self.bot.settings.guild.auto_role_channel_id
139149
)
140150
mess = await id_channel_autorole.send(
141-
f"Réagi à ce message pour rejoindre le club {club.name}"
151+
f"Réagis à ce message pour rejoindre le club {club.name}"
142152
)
143153

144154
await mess.add_reaction("✅")
145155
await self.club_service.create_club(club, guild, mess)
146156
await interaction.followup.send(f"Le club : {club.name} à été créé")
147157

148-
@app_commands.command(name="passation")
158+
@app_commands.command(
159+
name="passation",
160+
description=(
161+
"Change le responsable et le trésorier du club. "
162+
"Réactive le club s'il était inactif"
163+
),
164+
)
149165
@app_commands.autocomplete(club=autocomplete_existing_club)
150166
@app_commands.checks.has_permissions(manage_roles=True)
167+
@app_commands.describe(
168+
club="le club pour lequel faire la passation",
169+
new_president="le nouveau président du club",
170+
new_treasurer="le nouveau trésorier du club",
171+
)
151172
async def handover(
152173
self,
153174
interaction: Interaction,
154175
club: Transform[ClubSchema, ClubTransformer],
155176
new_president: Member,
156177
new_treasurer: Member,
157178
):
158-
"""Permet de faire la passation d'un club lors de la reprise"""
159179
await interaction.response.defer(thinking=True)
160180
db_club = Club.get_or_none(Club.sith_id == club.id)
161181
guild = interaction.guild
@@ -184,20 +204,21 @@ async def handover(
184204
)
185205
await interaction.followup.send("Passation effectuée")
186206

187-
@app_commands.command(name="arret")
207+
@app_commands.command(
208+
name="arret", description="Désactive le club et retire tous ses membres."
209+
)
188210
@app_commands.autocomplete(club=autocomplete_existing_club)
189211
@app_commands.checks.has_permissions(manage_guild=True)
212+
@app_commands.describe(club="le club à désactiver")
190213
async def stop_club(
191214
self, interaction: Interaction, club: Transform[ClubSchema, ClubTransformer]
192215
):
193-
"""Permet de mettre un club en inactif"""
194216
await interaction.response.defer(thinking=True)
195217
db_club = Club.get_or_none(Club.sith_id == club.id)
196218
await self.club_service.stop_club(db_club, interaction.guild)
197219
annonce = await self.club_service.get_channel(
198220
interaction.guild, db_club.category_id, f"annonces {club.name}".lower()
199221
)
200-
201222
if annonce:
202223
await annonce.send(
203224
"Le club, n'ayant pas été repris, est "

src/commands/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111

1212
class MiscCog(commands.Cog):
13-
@app_commands.command(name="ping")
13+
@app_commands.command(name="ping", description="Ping le bot")
1414
async def ping(self, interaction: Interaction[AeBot]):
1515
await interaction.response.send_message("pong")

0 commit comments

Comments
 (0)