fix(moderation): moderationset list works in dms now

This commit is contained in:
Seaswimmer 2023-12-14 19:20:01 -05:00
parent 92f32fd739
commit d62ea24bd9
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -1180,8 +1180,8 @@ class Moderation(commands.Cog):
@moderationset.command(name='list') @moderationset.command(name='list')
async def moderationset_list(self, ctx: commands.Context): async def moderationset_list(self, ctx: commands.Context):
"""List all moderation settings.""" """List all moderation settings."""
if ctx.guild:
guild_settings = await self.config.guild(ctx.guild).all() guild_settings = await self.config.guild(ctx.guild).all()
user_settings = await self.config.user(ctx.author).all()
guild_settings_string = "" guild_settings_string = ""
for setting in guild_settings: for setting in guild_settings:
@ -1193,12 +1193,14 @@ class Moderation(commands.Cog):
else: else:
guild_settings_string += f"**{setting}**: {guild_settings[setting]}\n" guild_settings_string += f"**{setting}**: {guild_settings[setting]}\n"
user_settings = await self.config.user(ctx.author).all()
user_settings_string = "" user_settings_string = ""
for setting in user_settings: for setting in user_settings:
user_settings_string += f"**{setting}**: {user_settings[setting]}\n" user_settings_string += f"**{setting}**: {user_settings[setting]}\n"
embed = discord.Embed(color=await self.bot.get_embed_color(None)) embed = discord.Embed(color=await self.bot.get_embed_color(None))
embed.set_author(icon_url=ctx.guild.icon.url, name=f"{ctx.guild.name} Moderation Settings") embed.set_author(icon_url=ctx.guild.icon.url, name=f"{ctx.guild.name} Moderation Settings")
if ctx.guild:
embed.add_field(name="Guild Settings", value=guild_settings_string) embed.add_field(name="Guild Settings", value=guild_settings_string)
embed.add_field(name="User Settings", value=user_settings_string) embed.add_field(name="User Settings", value=user_settings_string)