Skip to content

Moderation

Tommaso Ornato edited this page Sep 6, 2023 · 17 revisions

Only moderators may set AutoMod rules and only for communities where they are a mod themselves.

Example:
Bob is a mod in c/memes. Bob is allowed to enable the AutoMod and set its rules in c/memes.
However Bob is NOT a moderator in c/general, so he won't be able to set any rules in that community.

Prerequisites

Before any AutoMod configuration rule can be submitted, the bot needs to be a moderator in the target community. As a pre-release measure, it will be necessary to manually comment on the target community from the AutoMod's account and manually appoint it as a moderator. This process will be automated in further releases.

Interacting with the bot

Interaction happens through Lemmy DMs, accessible through the "Send Message" button (not "Send Secure Message"!) on the bot's profile. immagine

Configurations should be set up in the form of JSON objects. The content of the object will be discussed in the syntax paragraph.

Once an object containing one or more rules has been written, it should be pasted in the message box without any further formatting. The bot will then process it and reply to the message with either an error message or a confirmation. Error messages will be discussed in the error handling paragraph. immagine

Syntax

The syntax of configurations follows a strict set of rules to unambiguously highlight what is a valid configuration and what isn't.

Currently, the AutoMod allows four configuration options:

  • comment.json, dictates the removal of comments
  • post.json, dictates the removal of posts
  • exception.json, lists exceptions to the two aforementioned rules
  • mention.json, describes commands available to the moderators to easily "pin" and "lock" posts

Each of these configurations has to follow a JSON schema, available in the repository. It is advisable to write new rules in a code editor like Visual Studio Code, as it will automatically check for any errors in the configuration as it's being written. An online editor is also available at this link (requires a GitHub account).

Various examples of valid configurations are available in the lemmy-automoderator-examples repository.

All rules include a $schema field, used internally to validate the configuration and a rule field, describing the kind of rule (can be one of comment,post,exception,mention.

Comment

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

{
    "$schema": "https://raw.githubusercontent.com/ornato-t/lemmy-automoderator/master/src/schemas/comment.json",
    "rule": "comment",
    "community": "memes",
    "match": "pizza",
    "type": "exact",
    "whitelist_exempt": false,
    "mod_exempt": false,
    "message": "Your comment has been removed because discussions about pizza are prohibited in this community",
    "removal_reason": "Said the word 'pizza'"
}
  • community
  • match
  • type
  • whitelist_exempt
  • mod_exempt
  • message
  • removal_reason

Error handling

Clone this wiki locally