-
Notifications
You must be signed in to change notification settings - Fork 0
Moderation
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.
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.
Interaction happens through Lemmy DMs, accessible through the "Send Message" button (not "Send Secure Message"!) on the bot's profile.
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.
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
.
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'"
}
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.
-
community
: string, community where the rule will be active. -
match
: string, content to be removed. Depending on the value oftype
it should be either a string or a Regular Expression. -
type
: string, either"regex"
or"exact"
. Type of filter applied inmatch
. 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 inmatch
will be removed. -
whitelist_exempt
: boolean, eithertrue
orfalse
. Set to true if whitelisted users should be exempt from the rule. See Exception for more information on the whitelist. -
mod_exempt
: boolean, eithertrue
orfalse
. Set to true if community moderators should be exempt from the rule. -
message
: either string ornull
. The message with which the bot will reply to the removed content. If set tonull
no reply will be sent. -
removal_reason
: either string ornull
. The removal reason which will appear in the modlog. If set tonull
the reason will be left empty.
The AutoMod for Lemmy is an open source project published with the GPL-3.0 license by Tommaso Ornato, built for the Based Count Lemmy instance.