Skip to content

Inserting multiple rules

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

Instead of inserting a single rule per message, it is also possible to set multiple rules at once, by sending an array of JSON objects instead of a single objects.

An array is delimited by [ ] square brackets. Its elements are separated by , commas.

An array may contain all kinds of AutoMod configurations, so long as they are valid as per the previous pages of this documentation.

Example: instead of sending three separate messages to set a Comment rule, a Post rule and an Exception rule; it is also possible to wrap these three rules inside an array and send that as a single message.

More practically:

{
    "rule": "comment",
    "community": "general",
    "match": "/fudge|dang/i",
    "type": "regex",
    "whitelist_exempt": true,
    "mod_exempt": false,
    "message": null,
    "removal_reason": null
}
{
    "rule": "post",
    "community": "general",
    "field": "title+body",
    "type": "regex",
    "match": "/frick/i",
    "whitelist_exempt": true,
    "mod_exempt": false,
    "message": null,
    "removal_reason": null
}
{
    "rule": "exception",
    "user_actor_id": "https://lemmy.ml/u/Bob",
    "community": "general"
}

may also be written as:

[
    {
        "rule": "comment",
        "community": "general",
        "match": "/fudge|dang/i",
        "type": "regex",
        "whitelist_exempt": true,
        "mod_exempt": false,
        "message": null,
        "removal_reason": null
    }, {
        "rule": "post",
        "community": "general",
        "field": "title+body",
        "type": "regex",
        "match": "/frick/i",
        "whitelist_exempt": true,
        "mod_exempt": false,
        "message": null,
        "removal_reason": null
    }, {
        "rule": "exception",
        "user_actor_id": "https://lemmy.ml/u/Bob",
        "community": "general"
    }
]

in case of errors with any of the provided configurations, each single rule will be treated singularly as detailed in the Error handling section.

Clone this wiki locally