+1
eslint.config.mjs
+1
eslint.config.mjs
+42
rules/README.md
+42
rules/README.md
···
1
+
# Example Rules Configuration
2
+
3
+
This directory contains example rule configurations for the moderation system.
4
+
5
+
## Setup
6
+
7
+
1. Copy this entire directory to create your production rules:
8
+
```bash
9
+
cp -r rules.example rules
10
+
```
11
+
12
+
2. Edit the files in `rules/` to configure your moderation rules:
13
+
- `accountAge.ts` - Rules for flagging accounts based on age
14
+
- `accountThreshold.ts` - Rules for flagging accounts that exceed thresholds
15
+
- `handles.ts` - Pattern matching rules for handles/usernames
16
+
- `posts.ts` - Pattern matching rules for post content
17
+
- `profiles.ts` - Pattern matching rules for profile descriptions
18
+
- `constants.ts` - Global allow lists and shared constants
19
+
20
+
3. The `rules/` directory is ignored by git to keep your moderation rules confidential.
21
+
22
+
## Rule Structure
23
+
24
+
Each rule type has a specific structure. See the example files for details on required fields and options.
25
+
26
+
### Common Fields
27
+
28
+
- `label` - The label to apply when the rule matches
29
+
- `comment` - Internal comment/reason for the action
30
+
- `reportAcct/reportPost` - Whether to create a report
31
+
- `commentAcct/commentPost` - Whether to add a comment
32
+
- `toLabel` - Whether to apply a label
33
+
- `check` - The pattern/condition to match against
34
+
35
+
### Optional Fields
36
+
37
+
- `whitelist` - Patterns that should override the main check (false positives)
38
+
- `ignoredDIDs` - DIDs exempt from this specific rule
39
+
40
+
## Security
41
+
42
+
Never commit the `rules/` directory to version control. Keep your moderation rules confidential.
-4
src/constants.example.ts
-4
src/constants.example.ts
-25
src/developing_checks.md
-25
src/developing_checks.md
···
1
-
# How to build checks for skywatch-automod
2
-
3
-
## Introduction
4
-
5
-
Constants.ts defines three types of types of checks: `HANDLE_CHECKS`, `POST_CHECKS`, and `PROFILE_CHECKS`.
6
-
7
-
For each check, users need to define a set of regular expressions that will be used to match against the content of the post, handle, or profile. A maximal example of a check is as follows:
8
-
9
-
```typescript
10
-
export const HANDLE_CHECKS: Checks[] = [
11
-
{
12
-
label: "example",
13
-
comment: "Example found in handle",
14
-
description: true, // Optional, only used in handle checks
15
-
displayName: true, // Optional, only used in handle checks
16
-
reportOnly: false, // it true, the check will only report the content against the account, not label.
17
-
commentOnly: false, // Poorly named, if true, will generate an account level comment from flagged posts, rather than a report. Intended for use when reportOnly is false, and on posts only where the flag may generate a high volume of reports..
18
-
check: new RegExp("example", "i"), // Regular expression to match against the content
19
-
whitelist: new RegExp("example.com", "i"), // Optional, regular expression to whitelist content
20
-
ignoredDIDs: ["did:plc:example"], // Optional, array of DIDs to ignore if they match the check. Useful for folks who reclaim words.
21
-
},
22
-
];
23
-
```
24
-
25
-
In the above example, any handle that contains the word "example" will be labeled with the label "example" unless the handle is `example.com` or the handle belongs to the user with the DID `did:plc:example`.