Discussions AbuseFilter has a user-friendly way of defining rules. They are made up of three parts:
- Attribute: a characteristic of a Discussions post
- Operator: a way to compare an attribute to some set of values
- Value: a list of values you want to compare to.
Rule attribute
Rule attribute are attributes or characteristics of a post.
| Type | Name | Notes |
|---|---|---|
| string | Post text | The text version of the body of a post, not including the title. |
| Post title | The title of the post. For article comments, the post title is always an empty string. | |
| Post category |
| |
| Username | The user who created or edited the post | |
| string list | Post links | Only included if it is an actual link (not just text). Includes open graph links. |
| User groups | This uses the raw name for each user group. Most commonly known user groups: bot, bureaucrat, sysop, content-moderator, threadmoderator, rollback
| |
| select | Post format |
|
| Post content type |
| |
| Post action |
| |
| integer | User registration date | The number of seconds since registration |
| boolean | Post has images | Whether the post has attached images or not |
| Post has mentions | Whether the post mentions a user using the @ notation.
|
Rule operators
Rule operators are ways to compare or target a rule definition.
| Type | Operator | Notes | Example |
|---|---|---|---|
| string | is one of | Exactly matches one of the values. | post title is one of ["hello", "help"] Match: "hello" Doesn't match: "hello there" |
| is not one of | Does not exactly match any of the values. | post title is not one of ["hello", "help"] Match: "hello there" Doesn't match: "hello" | |
| starts with | Starts with any of the values. | post title starts with ["hello", "help"] Match: "hello there" Doesn't match: "good day" | |
| does not start with | Does not start with any of the values. | post title does not start with ["hello", "help"] Match: "good day" Doesn't match: "hello there" | |
| contains | Contains any of the values. | post title contains ["hello", "help"] Match: "oh hello there" Doesn't match: "bye" | |
| does not contain | Does not contain any of the values. | post title does not contain ["hello", "help"] Match: "bye" Doesn't match: "oh hello there" | |
| is empty | The string is empty. Note that a post containing only an image will have an empty post text. | post text is empty Match: "" Doesn't match: "hello". | |
| matches regex | The string matches any of the regex strings. The filter uses re2 syntax, documented here. |
post text matches regex ["you\\s*suck"] Match: "you suck" Doesn't match: "hello" | |
| string list | exactly matches | is exactly the same as the list of values | user groups exactly matches ["sysop"] Match: ["sysop"] Doesn't match: ["sysop", "rollback"] |
| contains all of | the attribute's values all contain the list of values | post links contains all of ["google.com", "fandom.com"] Match: ["google.com", "community.fandom.com"] Doesn't match: ["fandom.com"] | |
| contains any of | at least one of the attribute's values contain a value | post links contains any of ["google.com", "fandom.com"] Match: ["community.fandom.com"] Doesn't match: ["en.wikipedia.org"] | |
| contains none of | none of the attribute's values contain a value | post links contains none of ["google.com", "fandom.com"] Match: ["en.wikipedia.org"] Doesn't match: ["community.fandom.com"] |