Skip to content

Comment

Tommaso Ornato edited this page Sep 7, 2023 · 4 revisions

A Comment rule prescribes the automated removal of a comment, based on its content.

{
    "rule": "comment",
    "community": "memes",
    "match": "pizza",
    "type": "exact",
    "whitelist_exempt": false,
    "mod_exempt": false,
    "message": "Your comment has been removed because I don't like pizza",
    "removal_reason": "Said the word 'pizza'"
}

Explanation:
This rule removes all comments containing the word "pizza" posted in the community c/memes. The bot will then reply to the removed comment explaining that it was removed because discussion about pizza are prohibited. Lastly, it will report the removal in the modlog giving "Said the word 'pizza'" as a removal reason. This rule will be valid for all users, including whitelisted users and moderators.

Keys

Field Name Type Description
community string Community where the rule will be active
match string Depending on the value of type it should be either a string or a Regular Expression
type string, either "regex" or "exact" Type of filter applied in match. If the filter is set to "regex", match will be treated as a Regular Expression; if set to "exact" all comments containing the string specified in match will be removed
whitelist_exempt boolean, either true or false Set to true if whitelisted users should be exempt from the rule. See Exception for more information on the whitelist
mod_exempt boolean, either true or false Set to true if community moderators should be exempt from the rule
message string or null The message with which the bot will reply to the removed content. If set to null no reply will be sent
removal_reason string or null The removal reason which will appear in the modlog. If set to null the reason will be left empty

Note: when type is set to "exact", the search will NOT be CaSe SeNsItIvE. In other words, comments including the word "pizza" will get removed, but comments including the word "Pizza" will NOT.

Additional examples

Bad words

{
    "rule": "comment",
    "community": "general",
    "match": "/stink|fudge/",
    "type": "regex",
    "whitelist_exempt": true,
    "mod_exempt": false,
    "message": "Watch your language!",
    "removal_reason": null
}

Explanation:
This rule removes all comments containing either the word "stink" or the word "fudge" posted in the c/general community. When it does so, it also warns telling them to watch their language. The removal reason in the modlog is left blank. Whitelisted users are immune to this rule, so they will be able to use the words "stink" and fudge" freely, however moderators are not, so their comments will be removed.
This example uses a match based on a Regular Expression.

Prequel posting

{
    "rule": "comment",
    "community": "starwars",
    "match": "/high ground/i",
    "type": "regex",
    "whitelist_exempt": false,
    "mod_exempt": true,
    "message": null,
    "removal_reason": null
}

Explanation:
This rule removes all comments containing the string "high ground", case insensitive. If the user is a moderator in the community their comment will NOT be removed, otherwise it will, even if the user is among those whitelisted in the community. The bot will NOT comment under the removed comment, nor specify a removal reason in the modlog.