Skip to content

Commit 03550aa

Browse files
committed
request change
1 parent 698b366 commit 03550aa

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/services/club.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,13 @@ async def handover(
182182
await new_pres.add_roles(role_pres, reason=f"Passation du club : {club.name}")
183183
await new_treso.add_roles(role_treso, reason=f"Passation du club : {club.name}")
184184
category = utils.get(guild.categories, id=club.category_id)
185-
if category.name == club.name + " [inactif]":
186-
await category.edit(position=4, name=club.name)
187-
188-
await category.edit(position=4)
185+
if category.name.endswith("[inactif]"):
186+
await category.edit(name=club.name)
187+
highest_inactive = utils.find(
188+
lambda c: c.name.endswith("[inactif]"),
189+
sorted(guild.categories, key=lambda c: c.position),
190+
)
191+
await category.move(above=highest_inactive)
189192
# why 4 ? because in our server we have 3 prime categories
190193

191194
async def stop_club(self, club: DiscordClub, guild: Guild):

0 commit comments

Comments
 (0)