mirror of
https://github.com/p08dev/cogs.git
synced 2026-06-17 04:33:51 +02:00
indentation
This commit is contained in:
@ -23,7 +23,7 @@ class ExclusiveRoles(Cog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.group(aliases=["exclusiverole"])
|
@commands.group(aliases=["exclusiveroles"])
|
||||||
async def exclusive(self, ctx):
|
async def exclusive(self, ctx):
|
||||||
"""Base command for managing exclusive roles"""
|
"""Base command for managing exclusive roles"""
|
||||||
|
|
||||||
@ -102,15 +102,15 @@ class ExclusiveRoles(Cog):
|
|||||||
|
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
role_set = set(await self.config.guild(after.guild).role_list())
|
role_set = set(await self.config.guild(after.guild).role_list())
|
||||||
new_exclusive_roles = [role for role in after.roles if role.id in role_set]
|
new_exclusive_roles = [role for role in after.roles if role.id in role_set]
|
||||||
|
|
||||||
if len(new_exclusive_roles) > 1:
|
if len(new_exclusive_roles) > 1:
|
||||||
added_roles = [role for role in new_exclusive_roles if role not in before.roles]
|
added_roles = [role for role in new_exclusive_roles if role not in before.roles]
|
||||||
keep_role = added_roles[-1] if added_roles else new_exclusive_roles[-1]
|
keep_role = added_roles[-1] if added_roles else new_exclusive_roles[-1]
|
||||||
roles_to_remove = [role for role in new_exclusive_roles if role != keep_role]
|
roles_to_remove = [role for role in new_exclusive_roles if role != keep_role]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await after.remove_roles(*roles_to_remove)
|
await after.remove_roles(*roles_to_remove)
|
||||||
except discord.Forbidden:
|
except discord.Forbidden:
|
||||||
pass
|
pass
|
||||||
Reference in New Issue
Block a user