From e71b9bc0257a0d866ed4c96a3769480ee32ac671 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 14 Dec 2023 19:11:22 -0500 Subject: [PATCH] feat(moderation): added moderationset_list command --- moderation/moderation.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/moderation/moderation.py b/moderation/moderation.py index 91ee486..3fc0dba 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -1177,6 +1177,33 @@ class Moderation(commands.Cog): async def moderationset(self, ctx: commands.Context): """Manage moderation commands.""" + @moderationset.command(name='list') + async def moderationset_list(self, ctx: commands.Context): + """List all moderation settings.""" + guild_settings = await self.config.guild(ctx.guild).all() + user_settings = await self.config.user(ctx.author).all() + + guild_settings_string = "" + for setting in guild_settings: + if 'mysql' in setting: + continue + if setting == 'log_channel': + channel = ctx.guild.get_channel(guild_settings[setting]) + guild_settings_string += f"**{setting}**: {channel.mention}\n" + else: + guild_settings_string += f"**{setting}**: {guild_settings[setting]}\n" + + user_settings_string = "" + for setting in user_settings: + user_settings_string += f"**{setting}**: {user_settings[setting]}\n" + + embed = discord.Embed(color=await self.bot.get_embed_color(ctx.channel)) + embed.set_author(icon_url=ctx.guild.icon.url, name=f"{ctx.guild.name} Moderation Settings") + embed.add_field(name="Guild Settings", value=guild_settings_string) + embed.add_field(name="User Settings", value=user_settings_string) + + await ctx.send(embed=embed) + @moderationset.group(autohelp=True, name='history') async def moderationset_history(self, ctx: commands.Context): """Manage configuration for the /history command."""