Skip to content

Commit 5674ff1

Browse files
committed
feat: club add_member command
1 parent f4eaa7d commit 5674ff1

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/commands/club.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,26 @@ async def club_infos(
4747
):
4848
await interaction.response.defer(thinking=True)
4949
await interaction.followup.send(embed=self.club_service.embed(club))
50+
51+
@app_commands.command(name="add_member")
52+
@app_commands.autocomplete(club=autocomplete_club)
53+
async def add_club_member(
54+
self,
55+
interaction: Interaction,
56+
club: int,
57+
member: Member,
58+
):
59+
await interaction.response.defer(thinking=True)
60+
club = next(
61+
(c for _id, c in self.settings.guild.clubs.items() if _id == club), None
62+
)
63+
if not club:
64+
await interaction.followup.send("Ce club n'a pas été trouvé")
65+
return
66+
if not interaction.user.get_role(club.president_role_id):
67+
await interaction.followup.send(
68+
"Seul le président du club peut utiliser cette commande"
69+
)
70+
return
71+
await member.add_roles(interaction.guild.get_role(club.member_role_id))
72+
await interaction.followup.send("Rôle attribué :thumbs_up:")

0 commit comments

Comments
 (0)