bot
bot copied to clipboard
AttributeError: 'DMChannel' object has no attribute 'mention'
Sentry Issue: BOT-3KT
AttributeError: 'DMChannel' object has no attribute 'mention'
File "bot/exts/filtering/_filter_lists/antispam.py", line 131, in process_deletion_context
await deletion_context.send_alert(self)
File "bot/exts/filtering/_filter_lists/antispam.py", line 192, in send_alert
embed = await build_mod_alert(new_ctx, {antispam_list: messages})
File "bot/exts/filtering/_ui/ui.py", line 96, in build_mod_alert
triggered_in += f"**Channels:** {', '.join(channel.mention for channel in ctx.related_channels)}\n"
File "bot/exts/filtering/_ui/ui.py", line 96, in <genexpr>
triggered_in += f"**Channels:** {', '.join(channel.mention for channel in ctx.related_channels)}\n"
Error in task Task-131617 140431955642880!
Antispam should just ignore the DM channel honestly, that has several issues now that I think about it.
So around this line https://github.com/python-discord/bot/blob/4f4eef6c1701b844a4bb1bc21e6de2b53aa72843/bot/exts/filtering/_filter_lists/antispam.py#L69 we can filter out DM messages.
Antispam should just ignore the DM channel honestly, that has several issues now that I think about it.
Is there a way to filter those messages out of the FilterContext.message_cache before this function even gets hit, or is the caller of this function in a generic super class?
yeah the cache is used for other stuff so it shouldn't be filtered out there. Not sure what you mean by the caller
Looking back at this I'm not entirely sure what's going on. None of the filters in this list trigger on DMs.
Looks like we already have some code regarding filtering DMs https://github.com/python-discord/bot/blob/577c8da66e618666891eaf237c4e0ca33750230f/bot/exts/filtering/_settings_types/validations/filter_dm.py but it looks like this isn't being used except in a test.