Various fixes for log_ignore

This commit is contained in:
Zeva Rose 2022-08-15 19:16:30 -06:00
parent 1bc99520db
commit 07f88376ae

View file

@ -173,7 +173,7 @@ class SettingsCog(Extension):
await ctx.send("Channel already ignored", ephemeral=True)
return
setting.value.append(channel.id)
await setting.commit()
await setting.commit(replace=True)
await ctx.send("Channel added to ActivityLog ignore list")
# Unset
@ -261,7 +261,7 @@ class SettingsCog(Extension):
if not setting:
return {}
channels = [ctx.guild.get_channel(x) for x in setting.value]
channels = {c.name: c.id for c in channels}
channels = {c.name: c.id for c in channels if c}
options = process.extract(channel, list(channels.keys()), limit=25)
await ctx.send(choices=[{"name": c[0], "value": str(channels[c[0]])} for c in options])
@ -297,6 +297,13 @@ class SettingsCog(Extension):
value += "\n" + nvalue.mention
else:
value += "\n||`[redacted]`||"
elif setting.setting == "log_ignore":
names = []
for v in setting.value:
channel = ctx.guild.get_channel(v)
if channel:
names.append(channel.mention)
value = ", ".join(names) if names else "None"
fields.append(EmbedField(name=setting.setting, value=str(value) or "N/A", inline=False))
embed = build_embed(title="Current Settings", description="", fields=fields)