Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'DMChannel' object has no attribute 'mention' #2727

Open
sentry-io bot opened this issue Aug 21, 2023 · 5 comments
Open

AttributeError: 'DMChannel' object has no attribute 'mention' #2727

sentry-io bot opened this issue Aug 21, 2023 · 5 comments
Labels
a: filters Related to message filters: (antimalware, antispam, filtering, token_remover) p: 1 - high High Priority s: planning Discussing details t: bug Something isn't working

Comments

@sentry-io
Copy link

sentry-io bot commented Aug 21, 2023

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!
@ChrisLovering ChrisLovering added t: bug Something isn't working p: 1 - high High Priority a: filters Related to message filters: (antimalware, antispam, filtering, token_remover) status: approved The issue has received a core developer's approval labels Aug 21, 2023
@mbaruh
Copy link
Member

mbaruh commented Aug 21, 2023

Antispam should just ignore the DM channel honestly, that has several issues now that I think about it.

So around this line

relevant_messages = list(
we can filter out DM messages.

@ChrisLovering
Copy link
Member

ChrisLovering commented Aug 21, 2023

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?

@mbaruh
Copy link
Member

mbaruh commented Aug 21, 2023

yeah the cache is used for other stuff so it shouldn't be filtered out there. Not sure what you mean by the caller

@mbaruh
Copy link
Member

mbaruh commented Feb 10, 2024

Looking back at this I'm not entirely sure what's going on. None of the filters in this list trigger on DMs.

@Esther-Goldberg
Copy link
Member

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.

@wookie184 wookie184 added s: planning Discussing details and removed status: approved The issue has received a core developer's approval labels Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: filters Related to message filters: (antimalware, antispam, filtering, token_remover) p: 1 - high High Priority s: planning Discussing details t: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants