Add list command, fix no_pm to guild_only

bangame-develop
bobloy 6 years ago
parent 3a70f7db5f
commit db01c69da3

@ -19,7 +19,8 @@ class ExclusiveRole(Cog):
self.config.register_guild(**default_guild) self.config.register_guild(**default_guild)
@commands.group(no_pm=True, aliases=["exclusiverole"]) @commands.guild_only()
@commands.group(aliases=["exclusiverole"])
async def exclusive(self, ctx): async def exclusive(self, ctx):
"""Base command for managing exclusive roles""" """Base command for managing exclusive roles"""
@ -54,6 +55,21 @@ class ExclusiveRole(Cog):
await ctx.send("Exclusive role removed") await ctx.send("Exclusive role removed")
@exclusive.command(name="list")
@checks.mod_or_permissions(administrator=True)
async def exclusive_list(self, ctx):
"""List current exclusive roles"""
role_list = await self.config.guild(ctx.guild).role_list()
guild: discord.Guild = ctx.guild
role_list = [guild.get_role(role_id) for role_id in role_list]
out = "**Exclusive roles**\n\n"
for role in role_list:
out += "{}\n".format(role)
await ctx.send(out)
async def check_guild(self, guild: discord.Guild): async def check_guild(self, guild: discord.Guild):
role_set = set(await self.config.guild(guild).role_list()) role_set = set(await self.config.guild(guild).role_list())
for member in guild.members: for member in guild.members:

Loading…
Cancel
Save