forked from cswimr/SeaCogs
fix(moderation): moderationset list works in dms now
This commit is contained in:
parent
92f32fd739
commit
d62ea24bd9
1 changed files with 15 additions and 13 deletions
|
@ -1180,26 +1180,28 @@ class Moderation(commands.Cog):
|
|||
@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()
|
||||
if ctx.guild:
|
||||
guild_settings = await self.config.guild(ctx.guild).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 = 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(None))
|
||||
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)
|
||||
if ctx.guild:
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue