Skip to content

Commit fda9165

Browse files
TitouanDorimperosol
authored andcommitted
add permission to create club
1 parent b0a694a commit fda9165

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

src/commands/club.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,17 @@ async def create_club(
109109
self, interaction: Interaction, club: Transform[ClubSchema, ClubTransformer]
110110
):
111111
await interaction.response.defer(thinking=True)
112-
serv = interaction.guild
113-
114-
# look if the club is already create
115-
if club.name not in self.club_service.club_discord:
116-
await self.club_service.create_club(club.name, serv)
117-
await interaction.followup.send(f"Le club : {club.name} à été créé")
112+
is_pres = utils.get(interaction.guild.roles, name="Présidence AE")
113+
if is_pres in interaction.user.roles:
114+
serv = interaction.guild
115+
# look if the club is already create
116+
if club.name not in self.club_service.club_discord:
117+
await self.club_service.create_club(club.name, serv)
118+
await interaction.followup.send(f"Le club : {club.name} à été créé")
118119

120+
else:
121+
await interaction.followup.send(f"Le club : {club.name} existe déjà...")
119122
else:
120-
await interaction.followup.send(f"Le club : {club.name} existe déjà...")
123+
await interaction.followup.send(
124+
"Vous n'avez pas les permission pour créer un club"
125+
)

0 commit comments

Comments
 (0)