From db01c69da35de292ea4787c57a1df1e265d657f4 Mon Sep 17 00:00:00 2001 From: bobloy Date: Mon, 22 Oct 2018 09:57:47 -0400 Subject: [PATCH] Add list command, fix no_pm to guild_only --- exclusiverole/exclusiverole.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/exclusiverole/exclusiverole.py b/exclusiverole/exclusiverole.py index d579e91..bd8a38d 100644 --- a/exclusiverole/exclusiverole.py +++ b/exclusiverole/exclusiverole.py @@ -19,7 +19,8 @@ class ExclusiveRole(Cog): 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): """Base command for managing exclusive roles""" @@ -54,6 +55,21 @@ class ExclusiveRole(Cog): 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): role_set = set(await self.config.guild(guild).role_list()) for member in guild.members: