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

add keyword blacklisting #2

Closed
matmen opened this issue Dec 5, 2017 · 2 comments
Closed

add keyword blacklisting #2

matmen opened this issue Dec 5, 2017 · 2 comments

Comments

@matmen
Copy link

matmen commented Dec 5, 2017

thank you very much good sir

no, do it.

@PassTheMayo
Copy link

OwO it's matmen

@jagrosh
Copy link
Owner

jagrosh commented Feb 4, 2019

This is going to be a long comment, but here is my outline/thoughts on this. Feel free to provide your input and I'll try to keep this post updated accordingly.

Overview

Having blacklisted keywords should be easy/trivial to set up and should make sense, yet fine-tuned enough to meet specific needs. Allowing regexes would allow for very specific blacklisting rules, but regexes can be confusing to the "average" server admin. Setting plain words (instead of regexes) would be much easier, but is not nearly as useful, as an admin would have to add all variations of a word, and some specific cases can't be feasibly covered (ex: blacklist any word that contains the same letter/symbol more than 5 times in a row).

Filters

To balance ease-of-use with ability to be specific, I think the best solution involves having multiple types of filters available. These are as follows:

Word Filter

  • Default; if no extra surrounding syntax is used, this type of filter is used
  • Matches words; a 'word' cannot contain spaces, and ends of words are taken into account
  • Glob-like characters:
    • ? denotes any single character
    • * denotes any number of any character
    • [] can be used to match any character listed or in the provided range
  • Examples:
    • fu* would apply to He ate some fudge and This is fun but not to That bot is helpful
    • hunter[0-9] would apply to My password is hunter2 but not Check out the monster hunters
    • apple would apply to I ate apple pie but not I drank a snapple

(Exact) Phrase Filter

  • Text surrounded by double quotes (") will be treated as an Exact Phrase
  • Matches only if the exact phrase (except for case-sensitivity) is found within the message
  • Can contain spaces
  • Examples:
    • "erica" would apply to Thats hysterical and I talked with Erica about that
    • "leave me" would apply to Don't leave me and Leave me alone

Regex Filter

  • Text surrounded by the grave accent (`) will be treated as a Regex
  • Matches if the regex matches any part of the message
  • Can contain spaces
  • Examples:
    • `(.)\1{4}` would apply to reeeeeee and ayyyyy nice but not Woweee
    • `<a:[a-zA-Z0-9_-]{2,32}:\d{17,20}>` would apply to animated emotes but not regular emotes

Filter Groupings

Another issue is how to list filters and how to assign strike values to them. Doing this on a filter-by-filter basis would be time-consuming and annoying. Additionally, having filters all separate would have consequences on the modlog. Either the filter content would be listed (which might be in poor taste, as it might effectively be re-sending what was filtered), or a generic 'blacklisted word' message would be used (which would not be descriptive).

The solution to this is to use filter groups. A group of filters can contain multiple word, phrase, and regex filters (mixing and matching is fine). A group of filters also has a name (settable) that is used for editing the group as well as being displayed in the modlog.

An example of a server's filters might be:

InfinityWar [1 strike]: thanos "spiderman dies" "the snap"
Memes [2 strikes]: "lost the game" 
Spammy [1 strike]: `(.)\1{4}` 

Notice that easy group has a name, a strike count, and a (space-separated) list of filters. Setting the filters for a group could be as easy as:

>>blacklist InfinityWar thanos "spiderman dies" "the snap"

Potential Commands

Show the current blacklist:
>>blacklist
Create/Edit a group:
>>blacklist <groupname> <filter> [more filters...]
Delete a group:
>>blacklist remove <groupname>
Set the strikes for a group:
>>blacklist strikes <groupname> <strikes>

@matmen matmen closed this as completed Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants