Skip to content

Adjust rich_embeds filter so it doesn't catch edge case #1379

@bast0006

Description

@bast0006

Right now, discord converts twitter links when applying the standard twitter embed treatment. Our check for rich embeds determines whether an embed is autogenerated or not by checking if the embed link is present within the source message here

async def _has_rich_embed(msg: Message) -> Union[bool, List[discord.Embed]]:
, but this does not account for discords transformation of mobile.twitter.com links to twitter.com links, and thus a message with mobile.twitter.com in it is falsely detected as a rich embed for the watchlist.

This is probably fixable by detecting if the link goes to twitter.com and there is a link to mobile.twitter.com with the same parameters. That may get a little tricky, but twitter links aren't complex links so perhaps simple string operations will suffice.

We may also want to consider writing an "apply_link_transformations" function that will extract and transform relative links within a message to compare against the embed.

Metadata

Metadata

Assignees

Labels

a: filtersRelated to message filters: (antimalware, antispam, filtering, token_remover)l: 1 - intermediatep: 2 - normalNormal Priorityt: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions