Skip to content

Strip spoiler tags for watchlist triggers#530

Merged
lemonsaurus merged 11 commits into
masterfrom
spoiler-check
Mar 17, 2020
Merged

Strip spoiler tags for watchlist triggers#530
lemonsaurus merged 11 commits into
masterfrom
spoiler-check

Conversation

@jerbob
Copy link
Copy Markdown
Contributor

@jerbob jerbob commented Oct 13, 2019

Closes #299

Comment thread bot/cogs/filtering.py Outdated
Copy link
Copy Markdown
Contributor

@eivl eivl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to match

n||F||o||U||t||C||h||K||i||Y||n||O||g||U||

@scragly
Copy link
Copy Markdown
Contributor

scragly commented Nov 15, 2019

I played around and wrote a possible method to split things up into "interpretations" of text messed up with spoilers:

SPOILER_RE = re.compile(r"\|\|", re.DOTALL)

def process_spoilers(text):
    split_text = SPOILER_RE.split(text)
    public_text = "".join(split_text[0:][::2])
    spoiler_text = "".join(split_text[1:][::2])
    cleaned_text =  "".join(split_text)
    return public_text, spoiler_text, cleaned_text

@eivl's example would give:

('nothing', 'FUCKYOU', 'nFoUtChKiYnOgU')

@scragly scragly added a: filters Related to message filters: (antimalware, antispam, filtering, token_remover) p: 2 - normal Normal Priority type: Enhancement s: WIP Work In Progress and removed status: Awaiting Response labels Nov 15, 2019
@jerbob
Copy link
Copy Markdown
Contributor Author

jerbob commented Nov 28, 2019

Thanks @scragly, I'll add it in

@lemonsaurus
Copy link
Copy Markdown
Contributor

@AnonGuy what's the status on this? is it done? it's still labeled WIP.

@lemonsaurus lemonsaurus added t: feature New feature or request and removed type: enhancement labels Dec 15, 2019
@jerbob jerbob marked this pull request as ready for review February 27, 2020 22:16
@jerbob jerbob requested a review from a team as a code owner February 27, 2020 22:16
@jerbob jerbob requested review from jb3 and manusaurio and removed request for a team February 27, 2020 22:16
@MarkKoz MarkKoz added status: needs review and removed s: WIP Work In Progress labels Feb 28, 2020
@lemonsaurus
Copy link
Copy Markdown
Contributor

lemonsaurus commented Feb 29, 2020

@AnonGuy Looks like this is a good start, but there are multiple cases that this PR does not resolve, so it feels a bit like a half measure.

This PR does catch the simplest, ||badword||, but beyond that it does not catch most of the stuff discussed in this PR and in the issue this was based on.

For example, have a look at this embed:

image

Sure, the filter does match it, but the username is spoilered, the location has spoilers, and the original message has spoilers.

It would be better her to display these with the pipes escaped. Can we add a content.replace("|", "\|") in some tactical location so the embeds display correctly?

It also does not catch the cases that @eivl touched on earlier here, stuff like n||B||o||A||t||D||h||W||i||O||n||R||g||D||. Did we decide not to do that? I'll take it up in #dev-core After discussing this in #dev-core, we don't want to look for these obfuscated cases, so don't worry about this.

Comment thread bot/cogs/filtering.py
@lemonsaurus lemonsaurus added the s: waiting for author Waiting for author to address a review or respond to a comment label Feb 29, 2020
@jerbob jerbob requested a review from lemonsaurus March 15, 2020 16:48
@jerbob jerbob added status: needs review and removed s: waiting for author Waiting for author to address a review or respond to a comment labels Mar 16, 2020
Copy link
Copy Markdown
Contributor

@eivl eivl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine, just surprised that there are no more changes then this :D

Copy link
Copy Markdown
Contributor

@lemonsaurus lemonsaurus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hell yeah, let's merge this bad boy

@lemonsaurus lemonsaurus merged commit 4a10284 into master Mar 17, 2020
@lemonsaurus lemonsaurus deleted the spoiler-check branch March 17, 2020 16:37
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: 2 - normal Normal Priority t: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strip spoiler tags for watchlist triggers

5 participants