|
@@ -65,14 +65,24 @@ class promotion(commands.Cog):
|
|
|
if rank in user_roles:
|
|
if rank in user_roles:
|
|
|
user_rank = rank
|
|
user_rank = rank
|
|
|
break
|
|
break
|
|
|
|
|
+ author_roles = ctx.author.roles
|
|
|
|
|
+ author_rank = None
|
|
|
|
|
+ for rank in ranks:
|
|
|
|
|
+ if rank in author_roles:
|
|
|
|
|
+ author_rank = rank
|
|
|
|
|
+ break
|
|
|
if user_rank is None:
|
|
if user_rank is None:
|
|
|
await ctx.respond("The selected user does not have a rank that can be promoted!", ephemeral=True)
|
|
await ctx.respond("The selected user does not have a rank that can be promoted!", ephemeral=True)
|
|
|
return
|
|
return
|
|
|
current_rank_index = ranks.index(user_rank)
|
|
current_rank_index = ranks.index(user_rank)
|
|
|
|
|
+ author_rank_index = ranks.index(author_rank)
|
|
|
if current_rank_index == len(ranks) - 1:
|
|
if current_rank_index == len(ranks) - 1:
|
|
|
await ctx.respond("The selected user is already at the highest rank!", ephemeral=True)
|
|
await ctx.respond("The selected user is already at the highest rank!", ephemeral=True)
|
|
|
return
|
|
return
|
|
|
- new_rank = ranks[current_rank_index + 1]
|
|
|
|
|
|
|
+ elif current_rank_index >= author_rank_index:
|
|
|
|
|
+ await ctx.respond("You cannot promote a user with an equal or higher rank than yourself!", ephemeral=True)
|
|
|
|
|
+ return
|
|
|
|
|
+ new_rank = ranks[current_rank_index + 1]
|
|
|
if new_rank == ranks[6]:
|
|
if new_rank == ranks[6]:
|
|
|
await user.add_roles(command_role)
|
|
await user.add_roles(command_role)
|
|
|
elif new_rank == ranks[4]:
|
|
elif new_rank == ranks[4]:
|