Compare commits

..

53 Commits
edge ... 0.13.3

Author SHA1 Message Date
FoxxMD
74925fa8d8 Merge branch 'edge' 2022-11-01 09:23:38 -04:00
FoxxMD
d02d70ded3 Merge branch 'edge' 2022-10-17 15:33:15 -04:00
FoxxMD
80f83bf84b Merge branch 'edge' 2022-10-05 08:57:04 -04:00
FoxxMD
7933f77764 Merge branch 'edge' 2022-10-05 08:55:39 -04:00
FoxxMD
3bcc3d78e8 Merge branch 'edge' 2022-09-28 09:28:38 -04:00
FoxxMD
296f1c8dee Merge branch 'edge' 2022-09-14 15:30:27 -04:00
FoxxMD
e32ac60db5 Merge branch 'edge' 2022-09-14 15:29:13 -04:00
FoxxMD
859680dca8 Merge branch 'edge' 2022-09-01 09:03:27 -04:00
FoxxMD
ffa1e423b2 Merge branch 'edge' 2022-08-23 09:49:23 -04:00
FoxxMD
09cb08492c Merge branch 'edge' 2022-08-23 09:47:59 -04:00
FoxxMD
d9ab81ab8c Merge branch 'edge' 2022-07-27 09:19:30 -04:00
FoxxMD
98691bd19c Merge branch 'edge' 2022-07-15 09:27:22 -04:00
FoxxMD
8123c34463 Merge branch 'edge' 2022-06-21 16:13:54 -04:00
FoxxMD
3292d011fa Merge branch 'edge' 2022-06-21 10:03:14 -04:00
FoxxMD
661a0ae440 Merge branch 'edge' 2022-05-26 09:59:32 -04:00
FoxxMD
05f477b67d Merge branch 'edge' 2022-05-12 12:27:51 -04:00
Matt Foxx
1317a5916c Merge pull request #86 from wchristian/example_fix
trying to use names key in authorfilter causes config parse failure
2022-04-05 16:55:56 -04:00
Christian Walde
e9135ec1ef trying to use names key in authorfilter causes config parse failure 2022-04-05 13:49:41 +02:00
FoxxMD
e58a0f8f21 Merge branch 'edge' 2022-03-14 12:39:05 -04:00
FoxxMD
f7cebc013b Merge branch 'edge' 2022-03-08 09:48:06 -05:00
FoxxMD
ae8e11feb4 Merge branch 'edge' 2022-02-22 11:11:46 -05:00
FoxxMD
e07b8cc291 Merge branch 'edge' 2022-02-18 11:58:28 -05:00
FoxxMD
fc51928054 Merge branch 'edge' 2022-02-02 16:59:56 -05:00
FoxxMD
e2590e50f8 Merge branch 'edge' 2022-01-28 17:27:51 -05:00
FoxxMD
aaed0d3419 Merge branch 'edge' 2022-01-21 10:46:11 -05:00
FoxxMD
bc7eff8928 Merge branch 'edge' 2022-01-14 15:27:09 -05:00
FoxxMD
d6954533a0 Merge branch 'edge' 2022-01-10 12:32:14 -05:00
FoxxMD
ba53233640 Merge branch 'edge' 2022-01-07 09:31:14 -05:00
FoxxMD
1ac7ad4724 Merge branch 'edge' 2022-01-03 16:35:01 -05:00
FoxxMD
2a282a0d6f Merge branch 'edge' 2021-12-21 09:35:21 -05:00
FoxxMD
fd5a92758d Merge branch 'edge' 2021-11-28 19:43:20 -05:00
FoxxMD
39daa11f2d Merge branch 'edge' 2021-11-15 12:53:28 -05:00
FoxxMD
dac6541e28 Merge branch 'edge' 2021-11-01 16:12:43 -04:00
FoxxMD
97906281e6 Merge branch 'edge' 2021-11-01 14:55:10 -04:00
FoxxMD
487f13f704 Merge branch 'edge' 2021-10-12 11:56:51 -04:00
FoxxMD
631e21452c Merge branch 'edge' 2021-09-28 16:36:13 -04:00
FoxxMD
4f3685a1f5 Merge branch 'edge' 2021-09-21 15:18:38 -04:00
FoxxMD
d2d945db2c Merge branch 'edge' 2021-09-21 15:08:28 -04:00
FoxxMD
910f7f79ef Merge branch 'edge' 2021-09-20 10:54:32 -04:00
FoxxMD
a11b667d5e Merge branch 'edge' 2021-09-13 16:16:55 -04:00
FoxxMD
885e3fa765 Merge branch 'edge' 2021-08-26 16:04:01 -04:00
FoxxMD
465c3c9acf Merge branch 'edge' 2021-08-20 15:02:24 -04:00
FoxxMD
161251a943 Merge branch 'edge' 2021-08-05 14:40:06 -04:00
FoxxMD
ce4cb96d9a Merge branch 'edge' 2021-08-03 23:39:14 -04:00
FoxxMD
c317f95953 Merge branch 'edge' 2021-08-03 22:43:02 -04:00
FoxxMD
d0e0515990 Merge branch 'edge' 2021-08-02 15:44:57 -04:00
FoxxMD
cdddd8de48 Merge branch 'edge' 2021-07-30 18:17:38 -04:00
FoxxMD
f598215d88 Merge branch 'edge' 2021-07-30 14:46:51 -04:00
FoxxMD
0c7218571c Merge branch 'edge' 2021-07-29 13:25:16 -04:00
FoxxMD
acc7c49e0e Merge branch 'edge' 2021-07-29 11:27:42 -04:00
FoxxMD
01839512d5 Merge branch 'edge' 2021-07-29 11:14:33 -04:00
FoxxMD
4680640b0c Merge branch 'develop' 2021-07-28 16:58:36 -04:00
Matt Foxx
b813ebdd96 Create dockerhub.yml 2021-07-28 11:27:04 -04:00
144 changed files with 701 additions and 2205 deletions

View File

@@ -1,10 +1,7 @@
.git
logs
.github
_site
.bundle
vendor
docs/.jekyll-cache
docs
node_modules
coverage
.nyc_output
@@ -25,5 +22,3 @@ coverage
!.mocharc.json
!tsconfig.json
!package*.json
!docker/config/**
!_config.yml

View File

@@ -1,53 +0,0 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v1
- run: bundle exec jekyll build --baseurl ${{ steps.pages.outputs.base_path }} # defaults output to '/_site'
- name: Upload artifact
uses: actions/upload-pages-artifact@v1 # This will automatically upload an artifact from the '/_site' directory
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

12
.gitignore vendored
View File

@@ -381,17 +381,6 @@ dist
.yarn/install-state.gz
.pnp.*
# Copied from https://github.com/github/gitignore/blob/main/Jekyll.gitignore
# Ignore metadata generated by Jekyll
_site/
.sass-cache/
.jekyll-cache/
.jekyll-metadata
# Ignore folders generated by Bundler
.bundle/
vendor/
**/src/**/*.js
**/tests/**/*.js
**/tests/**/*.map
@@ -407,4 +396,3 @@ vendor/
!docs/**/*.json5
!docs/**/*.yaml
!docs/**/*.json
!docker/config/**

View File

@@ -9,9 +9,6 @@
<excludeFolder url="file://$MODULE_DIR$/src/logs" />
<excludeFolder url="file://$MODULE_DIR$/coverage" />
<excludeFolder url="file://$MODULE_DIR$/.nyc_output" />
<excludeFolder url="file://$MODULE_DIR$/_site" />
<excludeFolder url="file://$MODULE_DIR$/docs/.jekyll-cache" />
<excludeFolder url="file://$MODULE_DIR$/vendor" />
</content>
<content url="file://$MODULE_DIR$/node_modules" />
<orderEntry type="inheritedJdk" />

View File

@@ -96,26 +96,11 @@ WORKDIR /app
FROM base as build
# copy NPM dependencies and install
COPY --chown=abc:abc package*.json ./
COPY --chown=abc:abc tsconfig.json .
RUN npm install
# copy bundle/jekyll dependencies and docs folder
COPY --chown=abc:abc Gemfile Gemfile.lock _config.yml ./
COPY --chown=abc:abc docs ./docs/
# sassc (a jekll dependency) is very slow to compile bc there are no alpine binaries
# https://github.com/sass/sassc-ruby/issues/189#issuecomment-629758948
# so for now sync used jekyll version with prebuilt binary available in alpine repo
RUN apk add --no-cache --virtual .build-deps \
ruby-jekyll \
&& bundle install \
&& jekyll build -b /docs \
&& apk del .build-deps \
&& rm -rf docs
COPY --chown=abc:abc . /app
RUN npm run build && rm -rf node_modules

19
Gemfile
View File

@@ -1,19 +0,0 @@
source 'https://rubygems.org'
# sassc (a jekll dependency) is very slow to compile bc there are no alpine binaries
# https://github.com/sass/sassc-ruby/issues/189#issuecomment-629758948
# so for now sync used jekyll version with prebuilt binary available in alpine repo
gem "jekyll", "4.2.2" # installed by `gem jekyll`
# gem "webrick" # required when using Ruby >= 3 and Jekyll <= 4.2.2
gem "just-the-docs", "0.4.0.rc3" # currently the latest pre-release
# gem "just-the-docs" # the latest release - currently 0.3.3
gem "jekyll-readme-index"
gem 'jekyll-default-layout'
gem 'jekyll-titles-from-headings'
gem 'jekyll-relative-links'
group :jekyll_plugins do
gem 'jekyll-optional-front-matter'
end

View File

@@ -1,90 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0)
concurrent-ruby (1.1.10)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.15.5)
forwardable-extended (2.6.0)
http_parser.rb (0.8.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
jekyll (4.2.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 2.0)
jekyll-default-layout (0.1.5)
jekyll (>= 3.0, < 5.0)
jekyll-optional-front-matter (0.3.2)
jekyll (>= 3.0, < 5.0)
jekyll-readme-index (0.3.0)
jekyll (>= 3.0, < 5.0)
jekyll-relative-links (0.6.1)
jekyll (>= 3.3, < 5.0)
jekyll-sass-converter (2.2.0)
sassc (> 2.0.1, < 3.0)
jekyll-seo-tag (2.8.0)
jekyll (>= 3.8, < 5.0)
jekyll-titles-from-headings (0.5.3)
jekyll (>= 3.3, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
just-the-docs (0.4.0.rc3)
jekyll (>= 3.8.5)
jekyll-seo-tag (>= 2.0)
rake (>= 12.3.1)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.0)
rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (3.30.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.8.0)
PLATFORMS
x86_64-linux
DEPENDENCIES
jekyll (= 4.2.2)
jekyll-default-layout
jekyll-optional-front-matter
jekyll-readme-index
jekyll-relative-links
jekyll-titles-from-headings
just-the-docs (= 0.4.0.rc3)
BUNDLED WITH
2.3.25

View File

@@ -1,13 +1,9 @@
---
title: Home
nav_order: 1
---
# ContextMod [![Latest Release](https://img.shields.io/github/v/release/foxxmd/context-mod)](https://github.com/FoxxMD/context-mod/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Docker Pulls](https://img.shields.io/docker/pulls/foxxmd/context-mod)](https://hub.docker.com/r/foxxmd/context-mod)
<img src="/docs/logo.png" align="right"
alt="ContextMod logo" width="180" height="176">
[**Context Mod**](https://contextmod.dev/) (CM) is an event-based, [reddit](https://reddit.com) moderation bot built on top of [snoowrap](https://github.com/not-an-aardvark/snoowrap) and written in [typescript](https://www.typescriptlang.org/).
**Context Mod** (CM) is an event-based, [reddit](https://reddit.com) moderation bot built on top of [snoowrap](https://github.com/not-an-aardvark/snoowrap) and written in [typescript](https://www.typescriptlang.org/).
It is designed to help fill in the gaps for [automoderator](https://www.reddit.com/wiki/automoderator/full-documentation) in regard to more complex behavior with a focus on **user-history based moderation.**
@@ -20,27 +16,27 @@ An example of the above that Context Bot can do:
Feature Highlights for **Moderators:**
* Complete bot **autonomy**. YAML config is [stored in your subreddit's wiki](/docs/moderators/gettingStarted.md#setup-wiki-page) (like automoderator)
* Complete bot **autonomy**. YAML config is [stored in your subreddit's wiki](/docs/subreddit/gettingStarted.md#setup-wiki-page) (like automoderator)
* Simple rule-action behavior can be combined to create **complex behavior detection**
* Support Activity filtering based on:
* [Author criteria](docs/subreddit-configuration/in-depth/filters/README.md#author-filter) (name, css flair/text, age, karma, moderator status, [Toolbox User Notes](https://www.reddit.com/r/toolbox/wiki/docs/usernotes), and more!)
* [Activity state](docs/subreddit-configuration/in-depth/filters/README.md#item-filter) (removed, locked, distinguished, etc...)
* State of Subreddit Activity is in [Subreddit](docs/subreddit-configuration/in-depth/filters/README.md#subreddit-filter) (nsfw, name, profile, etc...)
* Rules and Actions support [named references](docs/subreddit-configuration/README.md#named-rules) -- **write once, reference anywhere**
* Powerful [logic control](docs/subreddit-configuration/advancedConcepts/flowControl.md) (if, then, goto)
* [Delay/re-process activities](docs/subreddit-configuration/README.md#dispatch) using arbitrary rules
* [**Image Comparisons**](docs/subreddit-configuration/imageComparison.md) via fingerprinting and/or pixel differences
* [**Repost detection**](docs/subreddit-configuration/in-depth/repost) with support for external services (youtube, etc...)
* [Author criteria](/docs/subreddit/components/README.md#author-filter) (name, css flair/text, age, karma, moderator status, [Toolbox User Notes](https://www.reddit.com/r/toolbox/wiki/docs/usernotes), and more!)
* [Activity state](/docs/subreddit/components/README.md#item-filter) (removed, locked, distinguished, etc...)
* State of Subreddit Activity is in [Subreddit](/docs/subreddit/components/README.md#subreddit-filter) (nsfw, name, profile, etc...)
* Rules and Actions support [named references](/docs/subreddit/components/README.md#named-rules) -- **write once, reference anywhere**
* Powerful [logic control](/docs/subreddit/components/advancedConcepts/flowControl.md) (if, then, goto)
* [Delay/re-process activities](/docs/subreddit/components/README.md#dispatch) using arbitrary rules
* [**Image Comparisons**](/docs/imageComparison.md) via fingerprinting and/or pixel differences
* [**Repost detection**](/docs/subreddit/components/repost) with support for external services (youtube, etc...)
* Event notification via Discord
* [**Web interface**](#web-ui-and-screenshots) for monitoring, administration, and oauth bot authentication
* [**Placeholders**](docs/subreddit-configuration/actionTemplating.md) (like automoderator) can be configured via a wiki page or raw text and supports [mustache](https://mustache.github.io) templating
* [**Partial Configurations**](docs/subreddit-configuration/README.md#partial-configurations) -- offload parts of your configuration to shared locations to consolidate logic between multiple subreddits
* [Guest Access](docs/moderators/README.md#guest-access) enables collaboration and easier setup by allowing temporary access
* [Toxic content prediction](docs/subreddit-configuration/README.md#moderatehatespeechcom-predictions) using [moderatehatespeech.com](https://moderatehatespeech.com) machine learning model
* [**Placeholders**](/docs/subreddit/actionTemplating.md) (like automoderator) can be configured via a wiki page or raw text and supports [mustache](https://mustache.github.io) templating
* [**Partial Configurations**](/docs/subreddit/components/README.md#partial-configurations) -- offload parts of your configuration to shared locations to consolidate logic between multiple subreddits
* [Guest Access](/docs/subreddit/README.md#guest-access) enables collaboration and easier setup by allowing temporary access
* [Toxic content prediction](/docs/subreddit/components/README.md#moderatehatespeechcom-predictions) using [moderatehatespeech.com](https://moderatehatespeech.com) machine learning model
Feature highlights for **Developers and Hosting (Operators):**
* [Server/client architecture](/docs/operator/serverClientArchitecture.md)
* [Server/client architecture](/docs/serverClientArchitecture.md)
* Default/no configuration runs "All In One" behavior
* Additional configuration allows web interface to connect to multiple servers
* Each server instance can run multiple reddit accounts as bots
@@ -48,7 +44,7 @@ Feature highlights for **Developers and Hosting (Operators):**
* [Database Persistence](/docs/operator/database.md) using SQLite, MySql, or Postgres
* Audit trails for bot activity
* Historical statistics
* [Docker container](/docs/operator/installation.md#docker-recommended) and [docker-compose](/docs/operator/installation.md#docker-compose) support
* [Docker container support](/docs/operator/installation.md#docker-recommended)
* Easy, UI-based [OAuth authentication](/docs/operator/addingBot.md) for adding Bots and moderator dashboard
* Integration with [InfluxDB](https://www.influxdata.com) for detailed [time-series metrics](/docs/operator/database.md#influx) and a pre-built [Grafana](https://grafana.com) [dashboard](/docs/operator/database.md#grafana)
@@ -63,7 +59,7 @@ Feature highlights for **Developers and Hosting (Operators):**
Each subreddit using the RCB bot configures its behavior via their own wiki page.
When a monitored **Activity** (new comment/submission, new modqueue item, etc.) is detected the bot runs through a list of [**Checks**](docs/subreddit-configuration/README.md#checks) to determine what to do with the **Activity** from that Event. Each **Check** consists of :
When a monitored **Activity** (new comment/submission, new modqueue item, etc.) is detected the bot runs through a list of [**Checks**](/docs/subreddit/components/README.md#checks) to determine what to do with the **Activity** from that Event. Each **Check** consists of :
#### Kind
@@ -71,11 +67,11 @@ Is this check for a submission or comment?
#### Rules
A list of [**Rules**](docs/subreddit-configuration/README.md#rules) to run against the **Activity**. Triggered Rules can cause the whole Check to trigger and run its **Actions**
A list of [**Rules**](/docs/subreddit/components/README.md#rules) to run against the **Activity**. Triggered Rules can cause the whole Check to trigger and run its **Actions**
#### Actions
A list of [**Actions**](docs/subreddit-configuration/README.md#actions) that describe what the bot should do with the **Activity** or **Author** of the activity (comment, remove, approve, etc.). The bot will run **all** Actions in this list.
A list of [**Actions**](/docs/subreddit/components/README.md#actions) that describe what the bot should do with the **Activity** or **Author** of the activity (comment, remove, approve, etc.). The bot will run **all** Actions in this list.
___
@@ -99,14 +95,14 @@ See the [Operator's Getting Started Guide](/docs/operator/gettingStarted.md)
This guide is for **reddit moderators** who want to configure an existing CM bot to run on their subreddit.
See the [Moderator's Getting Started Guide](/docs/moderators/gettingStarted.md)
See the [Moderator's Getting Started Guide](/docs/subreddit/gettingStarted.md)
## Configuration and Documentation
Context Bot's configuration can be written in YAML (like automoderator) or [JSON5](https://json5.org/). Its schema conforms to [JSON Schema Draft 7](https://json-schema.org/). Additionally, many **operator** settings can be passed via command line or environmental variables.
* For **operators** (running the bot instance) see the [Operator Configuration](/docs/operator/configuration.md) guide
* For **moderators** consult the [Subreddit Configuration Docs](/docs/subreddit-configuration/README.md)
* For **moderators** consult the [app schema and examples folder](/docs/README.md#configuration-and-usage)
[**Check the full docs for in-depth explanations of all concepts and examples**](/docs)

View File

@@ -1,45 +0,0 @@
title: ContextMod
description: Documentation for ContextMod
theme: just-the-docs
source: docs
url: https://contextmod.dev
color_scheme: dark
mermaid:
version: "9.1.3"
aux_links:
Github: https://github.com/foxxmd/context-mod
plugins:
- jekyll-readme-index
- jekyll-default-layout
- jekyll-titles-from-headings
- jekyll-optional-front-matter
- jekyll-relative-links
titles_from_headings:
enabled: true
strip_title: false
collections: false
readme_index:
enabled: true
remove_originals: true
with_frontmatter: true
optional_front_matter:
remove_originals: true
defaults:
- scope:
path: ""
values:
has_toc: false
- scope:
path: "images"
values:
image: true

View File

@@ -1,62 +0,0 @@
version: '3.7'
services:
app:
image: foxxmd/context-mod:latest
# use the settings below, instead of 'image', if running context-mod from the repository (developing local changes)
# build:
# context: .
volumes:
# Location of config file to use with CM
# The path BEFORE the colon (:) is the path on the host machine
# which defaults to a folder named 'data' in the same directory this file is run in.
- './data:/config'
# For a new installation you should use the config from the repository included for use with docker-compose
# https://github.com/FoxxMD/context-mod/blob/master/docker/config/docker-compose/config.yaml
# Copy config.yaml to /(this directory)/data/config.yaml and then modify to match any changed settings below (see comments on config.yaml)
ports:
- "${CM_WEB-8085}:8085"
environment:
IS_DOCKER: true
# If using a linux host, uncomment these and set them accordingly https://github.com/FoxxMD/context-mod/blob/master/docs/operator/installation.md#linux-host
# PUID: 1000
# PGID: 1000
cache:
image: 'redis:7-alpine'
volumes:
# on linux will need to make sure this directory has correct permissions for container to access
- './data/cache:/data'
database:
image: 'mariadb:10.9.3'
environment:
MYSQL_ROOT_PASSWORD: CHANGE_THIS
MYSQL_USER: cmuser
# this should match the password set in config.yaml
MYSQL_PASSWORD: CHANGE_THIS
MYSQL_DATABASE: ContextMod
volumes:
- './data/db:/var/lib/mysql'
influx:
image: 'influxdb:latest'
volumes:
- './data/influx:/var/lib/influxdb2'
ports:
- "${INFLUX_WEB:-8086}:8086"
profiles:
- full
grafana:
image: 'grafana/grafana'
volumes:
- './data/grafana:/var/lib/grafana'
ports:
- "${GRAFANA_WEB:-3000}:3000"
environment:
GF_SECURITY_ADMIN_PASSWORD: CHANGE_THIS
depends_on:
- influx
profiles:
- full

View File

@@ -1,43 +0,0 @@
operator:
name: CHANGE_THIS #YOUR REDDIT USERNAME HERE
logging:
# default level for all transports
level: debug
file:
# override default level
level: warn
# true -> log folder at projectDir/log
dirname: true
caching:
provider:
store: redis
host: cache
port: 6379
prefix: prod
databaseConfig:
migrations:
continueOnAutomatedBackup: true
#force: true # uncomment this to make cm run new migrations without confirmation
#logging: ['query', 'error', 'warn', 'log'] # uncomment this to get typeorm to log EVERYTHING
connection:
type: 'mariadb'
host: 'database'
username: 'cmuser'
# This should match the password set in docker-compose.yaml
password: 'CHANGE_THIS'
database: 'ContextMod'
web:
credentials:
redirectUri: 'http://localhost:8085/callback'
session:
storage: cache
port: 8085
#
# Influx/Grafana requires additional configuration. See https://github.com/FoxxMD/context-mod/blob/master/docs/operator/database.md#influx
#
#influxConfig:
# credentials:
# url: 'http://influx:8086'
# token: 'YourInfluxToken'
# org: YourInfluxOrg
# bucket: contextmod

View File

@@ -1,8 +1,4 @@
---
title: Overview
permalink: /overview.html
nav_order: 2
---
# Documentation
# Table of Contents
@@ -26,8 +22,8 @@ nav_order: 2
Review **at least** the **How It Works** and **Concepts** below, then:
* For **Operators** (running a bot instance) refer to [**Operator Getting Started**](operator/gettingStarted.md) guide
* For **Moderators** (configuring an existing bot for your subreddit) refer to the [**Moderator Getting Started**](moderators/gettingStarted.md) guide
* For **Operators** (running a bot instance) refer to [**Operator Getting Started**](/docs/operator/gettingStarted.md) guide
* For **Moderators** (configuring an existing bot for your subreddit) refer to the [**Moderator Getting Started**](/docs/subreddit/gettingStarted.md) guide
## How It Works
@@ -37,10 +33,10 @@ Where possible Context Mod (CM) uses the same terminology as, and emulates the b
Expand the section below for a simplified flow diagram of how CM processes an incoming Activity. Then refer the text description of the diagram below as well as [Concepts](#Concepts) for descriptions of individual components.
<details markdown="block">
<details>
<summary>Diagram</summary>
![Flow Diagram](images/diagram-highlevel.jpg)
![Flow Diagram](/docs/images/diagram-highlevel.jpg)
</details>
@@ -96,7 +92,7 @@ An example of Runs:
Both group of Checks are independent of each other (don't have any patterns or actions in common).
[Full Documentation for Runs](subreddit-configuration/README.md#runs)
[Full Documentation for Runs](/docs/subreddit/components/README.md#runs)
### Checks
@@ -109,7 +105,7 @@ A Run can be made up of one or more **Checks** that are processed **in the order
Once a Check is **triggered** (its Rules are satisfied and Actions performed) all subsequent Checks are skipped.
[Full Documentation for Checks](subreddit-configuration/README.md#checks)
[Full Documentation for Checks](/docs/subreddit/components/README.md#checks)
### Rule
@@ -117,11 +113,11 @@ A **Rule** is some set of **criteria** (conditions) that are tested against an A
CM has different **Rules** that can test against different types of behavior and aspects of a User, their history, and the Activity (submission/common) being checked.
[Full Documentation for Rules](subreddit-configuration/README.md#rules)
[Full Documentation for Rules](/docs/subreddit/components/README.md#rules)
#### Available Rules
All available rules can be found in the [components documentation](subreddit-configuration/README.md#rules)
All available rules can be found in the [components documentation](/docs/subreddit/components/README.md#rules)
### Rule Set
@@ -131,7 +127,7 @@ Rule Sets can be used interchangeably with other **Rules** and **Rule Sets** in
They allow you to create more complex trigger behavior by combining multiple rules into one "parent rule".
[Rule Sets Documentation](subreddit-configuration/README.md#rule-sets)
[Rule Sets Documentation](/docs/subreddit/components/README.md#rule-sets)
### Action
@@ -139,7 +135,7 @@ An **Action** is some action the bot can take against the checked Activity (comm
#### Available Actions
[Available Actions Documentation](subreddit-configuration/README.md#list-of-actions)
[Available Actions Documentation](/docs/subreddit/components/README.md#list-of-actions)
### Filters
@@ -150,14 +146,14 @@ An **Action** is some action the bot can take against the checked Activity (comm
* When the filter test **passes** the thing being tested continues to process as usual
* When the filter test **fails** the thing being tested **fails**.
[Full Documentation for Filters](subreddit-configuration/README.md#filters)
[Full Documentation for Filters](/docs/subreddit/components/README.md#filters)
## Configuration And Usage
* For **Operator/Bot maintainers** see **[Operation Guide](operator/README.md)**
* For **Operator/Bot maintainers** see **[Operation Guide](/docs/operator/README.md)**
* For **Moderators**
* Start with the [Subreddit/Moderator docs](moderators/README.md) or [Moderator Getting Started guide](moderators/gettingStarted.md)
* Refer to the [Subreddit Components Documentation](subreddit-configuration) or the [subreddit-ready examples](subreddit-configuration/cookbook)
* Start with the [Subreddit/Moderator docs](/docs/subreddit/README.md) or [Moderator Getting Started guide](/docs/subreddit/gettingStarted.md)
* Refer to the [Subreddit Components Documentation](/docs/subreddit/components) or the [subreddit-ready examples](/docs/subreddit/components/cookbook)
* as well as the [schema](https://json-schema.app/view/%23?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FApp.json) which has
* fully annotated configuration data/structure
* generated examples in json/yaml

View File

@@ -1,36 +1,12 @@
---
nav_order: 7
---
# Development
# Serving Docs Locally
Requirements:
* [Jeykll](https://jekyllrb.com/) installed
* Ruby 2.5.0 or higher and [RubyGems](https://rubygems.org/pages/download) (usually bundled)
* [Bundler](https://bundler.io/) installed
## Install Doc Dependencies
```bash
npm run docs-install
```
## Serve Docs
```bash
npm run docs-start
```
TODO add more development sections...
# Developing/Testing Github Actions
Use [act](https://github.com/nektos/act) to run Github actions locally.
An example secrets file can be found in the project working directory at [act.env.example](../act.env.example)
An example secrets file can be found in the project working directory at [act.env.example](act.env.example)
Modify [push-hook-sample.json](../.github/push-hook-sample.json) to point to the local branch you want to run a `push` event trigger on, then run this command from the project working directory:
Modify [push-hook-sample.json](.github/push-hook-sample.json) to point to the local branch you want to run a `push` event trigger on, then run this command from the project working directory:
```bash
act -e .github/push-hook-sample.json --secret-file act.env
@@ -52,7 +28,7 @@ Map port `1080:1080` -- acts as both the proxy port and the UI endpoint with the
http(s)://localhost:1080/mockserver/dashboard
```
In your [operator configuration](operator/configuration.md) define a proxy for snoowrap at the top-level:
In your [operator configuration](/docs/operator/operatorConfiguration.md) define a proxy for snoowrap at the top-level:
```yaml
snoowrap:
@@ -83,7 +59,7 @@ Content-Length: 155
--data-raw '{
"httpRequest": {},
"priority": 0,
"httpForward": {
"httpForward": {
"host": "oauth.reddit.com",
"port": 443,
"scheme": "HTTPS"
@@ -119,7 +95,7 @@ The lifecycle of a mock call I do:
Content-Type: application/json
Content-Length: 1757
```
```
</details>
@@ -202,7 +178,7 @@ Content-Length: 1757
```
</details>
#### All Responses Timeout
<details>
@@ -284,7 +260,7 @@ curl --location --request PUT 'http://localhost:8010/mockserver/expectation' \
### Clearing Behavior
```HTTP
```HTTP
PUT /mockserver/clear?type=EXPECTATIONS HTTP/1.1
Host: localhost:8010
Content-Type: application/json
@@ -311,7 +287,7 @@ Content-Length: 251
</details>
<details markdown="block">
<details>
<summary>CURL</summary>
```bash
@@ -337,7 +313,7 @@ curl --location --request PUT 'http://localhost:8010/mockserver/expectation' \
#### All Responses Drop After Delay (Connection Closed by Server)
<details markdown="block">
<details>
<summary>HTTP</summary>
```HTTP
@@ -364,7 +340,7 @@ Content-Length: 234
</details>
<details markdown="block">
<details>
<summary>CURL</summary>
```bash
@@ -402,7 +378,7 @@ Content-Length: 26
}
```
<details markdown="block">
<details>
<summary>CURL</summary>
```bash

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,13 +1,8 @@
---
title: Image Comparison
parent: Subreddit Configuration
---
# Overview
ContextMod supports comparing image content, for the purpose of detecting duplicates, with two different but complimentary systems. Image comparison behavior is available for the following rules:
* [Recent Activity](in-depth/recentActivity)
* [Recent Activity](/docs/subreddit/components/recentActivity)
* Repeat Activity (In-progress)
To enable comparisons reference the example below (at the top-level of your rule) and configure as needed:
@@ -44,7 +39,6 @@ YAML
```yaml
name: ruleWithImageDetection
kind: recentActivity
imageDetection:
enable: true
threshold: 5
fetchBehavior: extension

View File

@@ -1,169 +0,0 @@
---
title: Home
nav_order: 1
---
# ContextMod [![Latest Release](https://img.shields.io/github/v/release/foxxmd/context-mod)](https://github.com/FoxxMD/context-mod/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Docker Pulls](https://img.shields.io/docker/pulls/foxxmd/context-mod)](https://hub.docker.com/r/foxxmd/context-mod)
<img src="/logo.png" align="right"
alt="ContextMod logo" width="180" height="176">
[**Context Mod**](https://contextmod.dev/) (CM) is an event-based, [reddit](https://reddit.com) moderation bot built on top of [snoowrap](https://github.com/not-an-aardvark/snoowrap) and written in [typescript](https://www.typescriptlang.org/).
It is designed to help fill in the gaps for [automoderator](https://www.reddit.com/wiki/automoderator/full-documentation) in regard to more complex behavior with a focus on **user-history based moderation.**
An example of the above that Context Bot can do:
> * On a new submission, check if the user has also posted the same link in **N** number of other subreddits within a timeframe/# of posts
> * On a new submission or comment, check if the user has had any activity (sub/comment) in **N** set of subreddits within a timeframe/# of posts
>
>In either instance Context Bot can then perform any action a moderator can (comment, report, remove, lock, etc...) against that user, comment, or submission.
Feature Highlights for **Moderators:**
* Complete bot **autonomy**. YAML config is [stored in your subreddit's wiki](moderators/gettingStarted.md#setup-wiki-page) (like automoderator)
* Simple rule-action behavior can be combined to create **complex behavior detection**
* Support Activity filtering based on:
* [Author criteria](subreddit-configuration/in-depth/filters/README.md#author-filter) (name, css flair/text, age, karma, moderator status, [Toolbox User Notes](https://www.reddit.com/r/toolbox/wiki/usernotes), and more!)
* [Activity state](subreddit-configuration/in-depth/filters/README.md#item-filter) (removed, locked, distinguished, etc...)
* State of Subreddit Activity is in [Subreddit](subreddit-configuration/in-depth/filters/README.md#subreddit-filter) (nsfw, name, profile, etc...)
* Rules and Actions support [named references](subreddit-configuration/README.md#named-rules) -- **write once, reference anywhere**
* Powerful [logic control](subreddit-configuration/advancedConcepts/flowControl.md) (if, then, goto)
* [Delay/re-process activities](subreddit-configuration/README.md#dispatch) using arbitrary rules
* [**Image Comparisons**](subreddit-configuration/imageComparison.md) via fingerprinting and/or pixel differences
* [**Repost detection**](subreddit-configuration/in-depth/repost) with support for external services (youtube, etc...)
* Event notification via Discord
* [**Web interface**](#web-ui-and-screenshots) for monitoring, administration, and oauth bot authentication
* [**Placeholders**](subreddit-configuration/actionTemplating.md) (like automoderator) can be configured via a wiki page or raw text and supports [mustache](https://mustache.github.io) templating
* [**Partial Configurations**](subreddit-configuration/README.md#partial-configurations) -- offload parts of your configuration to shared locations to consolidate logic between multiple subreddits
* [Guest Access](moderators/README.md#guest-access) enables collaboration and easier setup by allowing temporary access
* [Toxic content prediction](subreddit-configuration/README.md#moderatehatespeechcom-predictions) using [moderatehatespeech.com](https://moderatehatespeech.com) machine learning model
Feature highlights for **Developers and Hosting (Operators):**
* [Server/client architecture](operator/serverClientArchitecture.md)
* Default/no configuration runs "All In One" behavior
* Additional configuration allows web interface to connect to multiple servers
* Each server instance can run multiple reddit accounts as bots
* Global/subreddit-level [**caching**](operator/caching.md) of Reddit APIs responses and CM results
* [Database Persistence](operator/database.md) using SQLite, MySql, or Postgres
* Audit trails for bot activity
* Historical statistics
* [Docker container](operator/installation.md#docker-recommended) and [docker-compose](operator/installation.md#docker-compose) support
* Easy, UI-based [OAuth authentication](operator/addingBot.md) for adding Bots and moderator dashboard
* Integration with [InfluxDB](https://www.influxdata.com) for detailed [time-series metrics](operator/database.md#influx) and a pre-built [Grafana](https://grafana.com) [dashboard](operator/database.md#grafana)
# Table of Contents
* [How It Works](#how-it-works)
* [Getting Started](#getting-started)
* [Configuration And Documentation](#configuration-and-documentation)
* [Web UI and Screenshots](#web-ui-and-screenshots)
### How It Works
Each subreddit using the RCB bot configures its behavior via their own wiki page.
When a monitored **Activity** (new comment/submission, new modqueue item, etc.) is detected the bot runs through a list of [**Checks**](subreddit-configuration/README.md#checks) to determine what to do with the **Activity** from that Event. Each **Check** consists of :
#### Kind
Is this check for a submission or comment?
#### Rules
A list of [**Rules**](subreddit-configuration/README.md#rules) to run against the **Activity**. Triggered Rules can cause the whole Check to trigger and run its **Actions**
#### Actions
A list of [**Actions**](subreddit-configuration/README.md#actions) that describe what the bot should do with the **Activity** or **Author** of the activity (comment, remove, approve, etc.). The bot will run **all** Actions in this list.
___
The **Checks** for a subreddit are split up into **Submission Checks** and **Comment Checks** based on their **kind**. Each list of checks is run independently based on when events happen (submission or comment).
When an Event occurs all Checks of that type are run in the order they were listed in the configuration. When one check is triggered (an Action is performed) the remaining checks will not be run.
___
[Learn more about the RCB lifecycle and core concepts in the docs.](/README.md#how-it-works)
## Getting Started
#### Operators
This guide is for users who want to **run their own bot on a ContextMod instance.**
See the [Operator's Getting Started Guide](operator/gettingStarted.md)
#### Moderators
This guide is for **reddit moderators** who want to configure an existing CM bot to run on their subreddit.
See the [Moderator's Getting Started Guide](moderators/gettingStarted.md)
## Configuration and Documentation
Context Bot's configuration can be written in YAML (like automoderator) or [JSON5](https://json5.org/). Its schema conforms to [JSON Schema Draft 7](https://json-schema.org/). Additionally, many **operator** settings can be passed via command line or environmental variables.
* For **operators** (running the bot instance) see the [Operator Configuration](operator/configuration.md) guide
* For **moderators** consult the [Subreddit Configuration Docs](subreddit-configuration/README.md)
[**Check the full docs for in-depth explanations of all concepts and examples**](/docs)
## Web UI and Screenshots
### Dashboard
CM comes equipped with a dashboard designed for use by both moderators and bot operators.
* Authentication via Reddit OAuth -- only accessible if you are the bot operator or a moderator of a subreddit the bot moderates
* Connect to multiple ContextMod instances (specified in configuration)
* Monitor API usage/rates
* Monitoring and administration **per subreddit:**
* Start/stop/pause various bot components
* View statistics on bot usage (# of events, checks run, actions performed) and cache usage
* View various parts of your subreddit's configuration and manually update configuration
* View **real-time logs** of what the bot is doing on your subreddit
* **Run bot on any permalink**
![Subreddit View](images/subredditStatus.jpg)
### Bot Setup/Authentication
A bot oauth helper allows operators to define oauth credentials/permissions and then generate unique, one-time invite links that allow moderators to authenticate their own bots without operator assistance. [Learn more about using the oauth helper.](operator/addingBot.md#cm-oauth-helper-recommended)
Operator view/invite link generation:
![Oauth View](images/oauth.jpg)
Moderator view/invite and authorization:
![Invite View](images/oauth-invite.jpg)
A similar helper and invitation experience is available for adding **subreddits to an existing bot.**
![Subreddit Invite View](images/subredditInvite.jpg)
### Configuration Editor
A built-in editor using [monaco-editor](https://microsoft.github.io/monaco-editor/) makes editing configurations easy:
* Automatic JSON or YAML syntax validation and formatting
* Automatic Schema (subreddit or operator) validation
* All properties are annotated via hover popups
* Unauthenticated view via `yourdomain.com/config`
* Authenticated view loads subreddit configurations by simple link found on the subreddit dashboard
* Switch schemas to edit either subreddit or operator configurations
![Configuration View](images/editor.jpg)
### [Grafana Dashboard](operator/database.md#grafana)
* Overall stats (active bots/subreddits, api calls, per second/hour/minute activity ingest)
* Over time graphs for events, per subreddit, and for individual rules/check/actions
![Grafana Dashboard](images/grafana.jpg)
## License
[MIT](/LICENSE)

View File

@@ -1,9 +1,4 @@
---
has_children: true
nav_order: 4
---
# Operator
# Operator Guide
An **Operator** is the user **running the ContextMod software.**
@@ -11,18 +6,18 @@ They are responsible for configuring the software at a high-level and managing a
* Creating cache/database servers and configuring their connections in CM
* Provisioning the [Reddit Clients](#provisioning-a-reddit-client) needed to run bots and the CM UI
* Providing [global-level configuration](configuration.md) that affects general bot/subreddit behavior
* Providing [global-level configuration](/docs/operator/configuration.md) that affects general bot/subreddit behavior
* Onboarding new bots/subreddits
# Table of Contents
* [Overview](#overview)
* [Client-Server Architecture](serverClientArchitecture.md)
* [Getting Started](gettingStarted.md)
* [Installation](installation.md)
* [Client-Server Architecture](/docs/serverClientArchitecture.md)
* [Getting Started](/docs/operator/gettingStarted.md)
* [Installation](/docs/operator/installation.md)
* [Provisioning a Reddit Client](#provisioning-a-reddit-client)
* [Configuration](configuration.md)
* [Adding A Bot](addingBot.md)
* [Configuration](/docs/operator/configuration.md)
* [Adding A Bot](/docs/operator/addingBot.md)
# Overview
@@ -33,13 +28,13 @@ CM is composed of two applications that operate independently but are packaged t
Both applications authenticate, and are primarily operated, by using [Reddit's API through OAuth.](https://github.com/reddit-archive/reddit/wiki/OAuth2) The **Client** uses OAuth to verify the identity of moderators logging into the web interface. The **Server** uses oauth tokens to interact with Reddit's API and operate all the configured bots.
In its default mode of operation CM takes care of all the interaction between **Server** and **Client** for you so that you can effectively treat it as a monolithic application. Learn more about CM's architecture and other operation modes in the [Server-Client Architecture documentation.](../serverClientArchitecture.md)
In its default mode of operation CM takes care of all the interaction between **Server** and **Client** for you so that you can effectively treat it as a monolithic application. Learn more about CM's architecture and other operation modes in the [Server-Client Architecture documentation.](/docs/serverClientArchitecture.md)
# [Getting Started](gettingStarted.md)
# [Getting Started](/docs/operator/gettingStarted.md)
The [Getting Started](gettingStarted.md) guide serves as a straight-forward "how-to" for standing up a CM server from scratch with minimal explanation.
The [Getting Started](/docs/operator/gettingStarted.md) guide serves as a straight-forward "how-to" for standing up a CM server from scratch with minimal explanation.
# [Installation](installation.md)
# [Installation](/docs/operator/installation.md)
CM has many installation options:
@@ -47,7 +42,7 @@ CM has many installation options:
* Built/pulled from a Docker image hosted on Dockerhub
* Deployed to Heroku with a Quick Deploy template (experimental)
Refer to the [Installation](installation.md) docs for more information.
Refer to the [Installation](/docs/operator/installation.md) docs for more information.
# Provisioning A Reddit Client
@@ -65,18 +60,18 @@ Click **create app**.
Then write down your **Client ID, Client Secret, and Redirect Uri** somewhere
# [Configuration](configuration.md)
# [Configuration](/docs/operator/configuration.md)
The [Configuration](configuration.md) documentation covers:
The [Configuration](/docs/operator/configuration.md) documentation covers:
* How CM's configuration can be defined
* How to create and define location for a config file
* Running CM from the command line
* Documentation for configuration on Bots, the web client, API, and more...
# [Adding A Bot](addingBot.md)
# [Adding A Bot](/docs/operator/addingBot.md)
The [Adding A Bot](addingBot.md) documentation covers:
The [Adding A Bot](/docs/operator/addingBot.md) documentation covers:
* What is a Bot?
* What is needed to add a Bot to CM?

View File

@@ -1,10 +1,3 @@
---
parent: Operator
nav_order: 4
---
# Adding A Bot
# Table of Contents
* [What is a Bot?](#what-is-a-bot)
@@ -26,7 +19,7 @@ There is nothing special about the account! What's special is how its used -- th
These things need to be done before a Bot can be added to CM:
* [Provisioned a Reddit Client](README.md#provisioning-a-reddit-client)
* [Provisioned a Reddit Client](/docs/operator/README.md#provisioning-a-reddit-client)
* You or the person who controls the Bot account must have account credentials (username/password). Logging in to reddit is part of the setup process.
* If the bot does not exist **create a reddit account for it.**
* If the bot does exist make sure you are in communication with the owner of the account.
@@ -45,7 +38,7 @@ This method will use CM's built in oauth flow. It is recommended because:
If this is your **first time adding a bot** you must make sure you have
* done the [prerequisites](#prerequisites)
* created a [minimum operator configuration](configuration.md#minimum-config)
* created a [minimum operator configuration](/docs/operator/configuration.md#minimum-config)
* that specifies the client id/secret from provisioning your reddit client
* specified **Operator Name** in the configuration
@@ -63,14 +56,14 @@ Follow the directions in the helper to create a **Bot Invite Link.**
Visit the **Bot Invite Link** while **logged in to reddit as the bot account** to begin the onboarding process. Refer to the [Onboarding Your Bot]() subreddit documentation for more information on this process.
At the end of the onboarding process the bot should be automatically added to your operator configuration. If there is an issue with automatically adding it then the oauth credentials will be displayed at the end of onboarding and can be [manually added to the configuration.](configuration.md#manually-adding-a-bot)
At the end of the onboarding process the bot should be automatically added to your operator configuration. If there is an issue with automatically adding it then the oauth credentials will be displayed at the end of onboarding and can be [manually added to the configuration.](/docs/operator/configuration.md#manually-adding-a-bot)
## Aardvark OAuth Helper
This method should only be used if you cannot use the [CM OAuth Helper method.](#cm-oauth-helper-recommended)
* Visit [https://not-an-aardvark.github.io/reddit-oauth-helper/](https://not-an-aardvark.github.io/reddit-oauth-helper/) and follow the instructions given.
* **Note:** You will need to update the **redirect uri** you set when [provisioning your reddit client.](README.md#provisioning-a-reddit-client)
* **Note:** You will need to update the **redirect uri** you set when [provisioning your reddit client.](/docs/operator/README.md#provisioning-a-reddit-client)
* Input your **Client ID** and **Client Secret** in the text boxes with those names.
* Choose scopes. **It is very important you check everything on this list or CM may not work correctly**
* edit
@@ -89,5 +82,5 @@ This method should only be used if you cannot use the [CM OAuth Helper method.](
* wikiread
* wikiedit (if you are using Toolbox User Notes)
* Click **Generate tokens**, you will get a popup asking you to approve access (or login) -- **the account you approve access with is the account that Bot will control.**
* After approving an **Access Token** and **Refresh Token** will be shown at the bottom of the page. Use these to [manually add a bot to your operator configuration.](configuration.md#manually-adding-a-bot)
* After approving an **Access Token** and **Refresh Token** will be shown at the bottom of the page. Use these to [manually add a bot to your operator configuration.](/docs/operator/configuration.md#manually-adding-a-bot)
* After adding the bot you will need to restart CM.

View File

@@ -1,9 +1,3 @@
---
parent: Operator
---
# Caching
# Table of Contents
* [Overview](#overview)

View File

@@ -1,10 +1,3 @@
---
parent: Operator
nav_order: 3
---
# Configuration
The **Operator** configuration refers to configuration used configure to the actual application/bot. This is different
from the **Subreddit** configuration that is defined in each Subreddit's wiki and determines the rules/actions for
activities the Bot runs on.
@@ -36,14 +29,14 @@ configuration.
* **FILE** -- Values specified in a YAML/JSON configuration file using the structure [in the schema](https://json-schema.app/view/%23?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FOperatorConfig.json)
* When reading the **schema** if the variable is available at a level of configuration other than **FILE** it will be
noted with the same symbol as above. The value shown is the default.
* **ARG** -- Values specified as CLI arguments to the program (see [CLI Usage](#cli-usage) below)
* **ARG** -- Values specified as CLI arguments to the program (see [ClI Usage](#cli-usage) below)
## File Configuration (Recommended)
Using a file has many benefits over using ARG or ENV:
* CM can automatically update your configuration
* CM can automatically add bots via the [CM OAuth Helper](addingBot.md#cm-oauth-helper-recommended)
* CM can automatically add bots via the [CM OAuth Helper](/docs/operator/addingBot.md#cm-oauth-helper-recommended)
* CM has a built-in configuration editor that can help you build and validate your configuration file
* File config is **required** if adding multiple bots to CM
@@ -51,8 +44,8 @@ Using a file has many benefits over using ARG or ENV:
By default CM will look for `config.yaml` or `config.json` in the `DATA_DIR` directory:
* [Local installation](installation.md#locally) -- `DATA_DIR` is the root of your installation directory (same folder as `package.json`)
* [Docker](installation.md#docker-recommended) -- `DATA_DIR` is at `/config` in the container
* [Local installation](/docs/operator/installation.md#locally) -- `DATA_DIR` is the root of your installation directory (same folder as `package.json`)
* [Docker](/docs/operator/installation.md#docker-recommended) -- `DATA_DIR` is at `/config` in the container
The `DATA_DIR` directory can be changed by passing `DATA_DIR` as an environmental variable EX `DATA_DIR=/path/to/directory`
@@ -72,7 +65,7 @@ One ContextMod instance can
However, the default configuration (using **ENV/ARG**) assumes your intention is to run one bot (one reddit account) on one CM instance without these additional features. This is to make this mode of operation easier for users with this intention.
To take advantage of this additional features you **must** use a **FILE** configuration. Learn about how this works and how to configure this scenario in the [Architecture Documentation.](serverClientArchitecture.md)
To take advantage of this additional features you **must** use a **FILE** configuration. Learn about how this works and how to configure this scenario in the [Architecture Documentation.](/docs/serverClientArchitecture.md)
## CLI Usage
@@ -86,7 +79,7 @@ node src/index.js run
Run `node src/index.js run help` to get a list of available command line options (denoted by **ARG** above):
<details markdown="block">
<details>
```
Usage: index [options] [command]
@@ -131,11 +124,11 @@ Options:
# Minimum Configuration
The minimum configuration required to run CM assumes you have no bots and want to use CM to [add your first bot.](addingBot.md#cm-oauth-helper-recommended)
The minimum configuration required to run CM assumes you have no bots and want to use CM to [add your first bot.](/docs/operator/addingBot.md#cm-oauth-helper-recommended)
You will need have this information available:
* From [provision a reddit client](README.md#provisioning-a-reddit-client)
* From [provision a reddit client](/docs/operator/README.md#provisioning-a-reddit-client)
* Client ID
* Client Secret
* Redirect URI (if different from default `http://localhost:8085/callback`)
@@ -160,7 +153,7 @@ Configured using the `bots` top-level property. Bot configuration can override a
## Adding A Bot
If you use the [CM OAuth Helper](addingBot.md#cm-oauth-helper-recommended) and it works successfully then the configuration for the Bot will be automatically added.
If you use the [CM OAuth Helper](/docs/operator/addingBot.md#cm-oauth-helper-recommended) and it works successfully then the configuration for the Bot will be automatically added.
### Manually Adding a Bot
@@ -173,7 +166,7 @@ Minimum information required for a valid bot:
* Refresh Token
* Access Token
<details markdown="block">
<details>
<summary>Example</summary>
```yaml
@@ -218,7 +211,7 @@ Below are examples of the minimum required config to run the application using a
Using **FILE**
<details markdown="block">
<details>
See [Specify File Location](#specify-file-location) for where this file would be located.
@@ -255,7 +248,7 @@ JSON (`config.json5`)
Using **ENV** (`.env`)
<details markdown="block">
<details>
```
OPERATOR=YourRedditUsername
@@ -268,7 +261,7 @@ REDIRECT_URI=http://localhost:8085/callback
Using **ARG**
<details markdown="block">
<details>
```
node src/index.js run --clientId=f4b4df1c7b2 --clientSecret=34v5q1c56ub --redirectUri=http://localhost:8085/callback
@@ -282,7 +275,7 @@ An example of using multiple configuration levels together IE all are provided t
**FILE**
<details markdown="block">
<details>
```json
{
@@ -303,7 +296,7 @@ logging:
**ENV** (`.env`)
<details markdown="block">
<details>
```
CLIENT_SECRET=34v5q1c56ub
@@ -315,7 +308,7 @@ PORT=9008
**ARG**
<details markdown="block">
<details>
```
node src/index.js run --subreddits=sub1 --clientId=34v5q1c56ub
@@ -335,9 +328,9 @@ log level: debug
## Configuring Client for Many Instances
See the [Architecture Docs](erverClientArchitecture.md) for more information.
See the [Architecture Docs](/docs/serverClientArchitecture.md) for more information.
<details markdown="block">
<details>
YAML
@@ -408,8 +401,8 @@ JSON
# Cache Configuration
See the [Cache Configuration](caching.md) documentation.
See the [Cache Configuration](/docs/operator/caching.md) documentation.
# Database Configuration
See the [Database Configuration](database.md) documentation.
See the [Database Configuration](/docs/operator/database.md) documentation.

View File

@@ -1,9 +1,3 @@
---
parent: Operator
---
# Database
# Overview
CM uses a database to store three types of data:
@@ -37,16 +31,16 @@ databaseConfig:
## SQLite
When using a [local installation](installation.md#locally) the default database is `sqljs`, which requires no binary dependencies. When using [docker](installation.md#docker-recommended) the default is `better-sqlite3`.
When using a [local installation](/docs/installation.md#locally) the default database is `sqljs`, which requires no binary dependencies. When using [docker](/docs/operator/installation.md#docker-recommended) the default is `better-sqlite3`.
**NOTE:** It is **NOT RECOMMENDED** to use `sqljs` in a production environment for performance reasons. You should at least switch to `better-sqlite3` or preferably MySql/Postgres.
* [`sqljs` connection options](https://typeorm.io/data-source-options#sqljs-data-source-options)
* [`better-sqlite3` connection options](https://typeorm.io/data-source-options#better-sqlite3-data-source-options)
For both sqlite types, if no database/location is specified, it will be created in the [`DATA_DIR` directory.](configuration.md#specify-file-location)
For both sqlite types, if no database/location is specified, it will be created in the [`DATA_DIR` directory.](/docs/operator/configuration.md#specify-file-location)
If CM detects it cannot **read and write** to the database files, or directory if no files exist, it will fallback to using an in-memory database that will be lost when CM restarts. If you have trouble with r/w permissions and are using docker make sure [file permissions are correct for your mounted volume.](installation.md#linux-host)
If CM detects it cannot **read and write** to the database files, or directory if no files exist, it will fallback to using an in-memory database that will be lost when CM restarts. If you have trouble with r/w permissions and are using docker make sure [file permissions are correct for your mounted volume.](/docs/operator/installation.md#linux-host)
## MySQL/MariaDB
@@ -178,7 +172,7 @@ influxConfig:
A pre-built dashboard for [Grafana](https://grafana.com) can be imported to display overall metrics/stats using InfluxDB data.
![Grafana Dashboard](../images/grafana.jpg)
![Grafana Dashboard](/docs/images/grafana.jpg)
* Create a new Data Source using **InfluxDB** type
* Choose **Flux** for the **Query Language**
@@ -187,7 +181,7 @@ A pre-built dashboard for [Grafana](https://grafana.com) can be imported to disp
* Click **Save and test**
* Import Dashboard
* **Browse** the Dashboard pane
* Click **Import** and **upload** the [grafana dashboard json file](grafana.json)
* Click **Import** and **upload** the [grafana dashboard json file](/docs/operator/grafana.json)
* Chose the data source you created from the **InfluxDB CM** dropdown
* Click **Import**

View File

@@ -1,11 +1,4 @@
---
parent: Operator
nav_order: 1
---
# Getting Started
This getting started guide is for **Operators** -- that is, someone who wants to run the actual software for a ContentMod bot. If you are a **Moderator** check out the [moderator getting started](/docs/moderators/gettingStarted.md) guide instead.
This getting started guide is for **Operators** -- that is, someone who wants to run the actual software for a ContentMod bot. If you are a **Moderator** check out the [moderator getting started](/docs/subreddit/gettingStarted.md) guide instead.
# Table of Contents
@@ -18,11 +11,11 @@ This getting started guide is for **Operators** -- that is, someone who wants to
# Installation
Follow the [installation](installation.md) documentation. It is recommended to use **Docker** since it is self-contained.
Follow the [installation](/docs/operator/installation.md) documentation. It is recommended to use **Docker** since it is self-contained.
# Create a Reddit Client
[Create a reddit client](README.md#provisioning-a-reddit-client)
[Create a reddit client](/docs/operator/README.md#provisioning-a-reddit-client)
# Start ContextMod
@@ -34,11 +27,11 @@ The First Time Setup page will ask you to input:
* Client Secret (from [Create a Reddit Client](#create-a-reddit-client))
* Operator -- this is the username of your main Reddit account.
**Write Config** and then restart CM. You have now created the [minimum configuration](configuration.md#minimum-configuration) required to run CM.
**Write Config** and then restart CM. You have now created the [minimum configuration](/docs/operator/configuration.md#minimum-configuration) required to run CM.
# Add A Bot to CM
You should automatically be directed to the [Bot Invite Helper](addingBot.md#cm-oauth-helper-recommended) used to authorize and add a Bot to your CM instance.
You should automatically be directed to the [Bot Invite Helper](/docs/operator/addingBot.md#cm-oauth-helper-recommended) used to authorize and add a Bot to your CM instance.
Follow the directions here and **create an Authorization Invite** at the bottom of the page.
@@ -54,8 +47,8 @@ To monitor the behavior of bots running on your instance visit http://localhost:
# What's Next?
As an operator you should familiarize yourself with how the [operator configuration](configuration.md) you made works. This will help you understand how to get the most of your CM instance by leveraging the [Cache](caching.md) and [Database](database.md) effectively as well as provide you will all possible options for configuring CM using the [schema.](https://json-schema.app/view/%23?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FOperatorConfig.json)
As an operator you should familiarize yourself with how the [operator configuration](/docs/operator/configuration.md) you made works. This will help you understand how to get the most of your CM instance by leveraging the [Cache](/docs/oeprator/caching.md) and [Database](/docs/operator/database.md) effectively as well as provide you will all possible options for configuring CM using the [schema.](https://json-schema.app/view/%23?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FOperatorConfig.json)
If you are also the moderator of the subreddit the bot will be running you should check out the [moderator getting started guide.](../moderators/gettingStarted.md#setup-wiki-page)
If you are also the moderator of the subreddit the bot will be running you should check out the [moderator getting started guide.](/docs/subreddit/gettingStarted.md#setup-wiki-page)
You might also be interested in these [quick tips for using the web interface](../webInterface.md). Additionally, on the dashboard click the **Help** button at the top of the page to get a guided tour of the dashboard.
You might also be interested in these [quick tips for using the web interface](/docs/webInterface.md). Additionally, on the dashboard click the **Help** button at the top of the page to get a guided tour of the dashboard.

View File

@@ -1,8 +1,3 @@
---
parent: Operator
nav_order: 2
---
# Installation
In order to run a ContextMod instance you must first you must install it somewhere.
@@ -18,7 +13,7 @@ Images available from these registeries:
* [Dockerhub](https://hub.docker.com/r/foxxmd/context-mod) - `docker.io/foxxmd/context-mod`
* [GHCR](https://github.com/foxxmd/context-mod/pkgs/container/context-mod) - `ghcr.io/foxxmd/context-mod`
An example of starting the container using the [minimum configuration](configuration.md#minimum-config):
An example of starting the container using the [minimum configuration](/docs/operator/configuration.md#minimum-config):
* Bind the directory where your config file, logs, and database are located on your host machine into the container's default `DATA_DIR` by using `-v /host/path/folder:/config`
* Note: **You must do this** or else your configuration will be lost next time your container is updated.
@@ -45,34 +40,6 @@ To get the UID and GID for the current user run these commands from a terminal:
docker run -d -v /host/path/folder:/config -p 8085:8085 -e PUID=1000 -e PGID=1000 ghcr.io/foxxmd/context-mod:latest
```
### Docker-Compose
The included [`docker-compose.yml`](/docker-compose.yml) provides production-ready dependencies for CM to use:
* [Redis](https://redis.io/) for caching
* [MariaDB](https://mariadb.org/) for database
* Optionally, [Influx/Grafana](database.md#influx) instances
#### Setup
The included `docker-compose.yml` file is written for **Docker Compose v2.**
For new installations copy [`config.yaml`](/docker/config/docker-compose/config.yaml) into a folder named `data` in the same folder `docker-compose.yml` will be run from. For users migrating their existing CM instances to docker-compose, copy your existing `config.yaml` into the same `data` folder.
Read through the comments in both `docker-compose.yml` and `config.yaml` and makes changes to any relevant settings (passwords, usernames, etc...). Ensure that any settings used in both files (EX mariaDB passwords) match.
To build and start CM:
```bash
docker compose up -d
```
To include Grafana/Influx dependencies run:
```bash
docker compose --profile full up -d
```
## Locally
Requirements:
@@ -90,7 +57,7 @@ npm install
tsc -p .
```
An example of running CM using the [minimum configuration](configuration.md#minimum-config) with a [configuration file](configuration.md#file-configuration-recommended):
An example of running CM using the [minimum configuration](/docs/operator/configuration.md#minimum-config) with a [configuration file](/docs/operator/configuration.md#file-configuration-recommended):
```bash
node src/index.js run

View File

@@ -1,9 +1,3 @@
---
parent: Operator
---
# Architecture
# Overview
ContextMod's high-level functionality is separated into two **independently run** applications.

View File

@@ -1,9 +0,0 @@
---
parent: Subreddit Configuration
has_children: true
has_toc: true
---
# In Depth
Further details and examples for CM components.

View File

@@ -1,457 +0,0 @@
---
grand_parent: Subreddit Configuration
parent: In Depth
title: Filters
---
# Table of Contents
* [Filters](#filters)
* [Criteria](#criteria)
* [Filter Shapes](#filter-shapes)
* [Simple Object](#simple-object)
* [Simple List](#simple-list)
* [Filter Types](#filter-types)
* [Author Filter](#author-filter)
* [Mod Actions/Notes Filter](#mod-actionsnotes-filter)
* [Toolbox UserNotes Filter](#toolbox-usernotes-filter)
* [Item Filter](#item-filter)
* [Subreddit Filter](#subreddit-filter)
* [Named Filters](#named-filters)
* [Examples](#examples)
* [General Usage](#general-usage)
* [Usage in a Run](#usage-in-a-run)
* [Usage in a Check](#usage-in-a-check)
* [Usage in a Rule](#usage-in-a-rule)
* [Usage in an Action](#usage-in-an-action)
* [Using Author and Item Filter](#using-author-and-item-filter)
* [Filter Shapes Usage](#filter-shapes-usage)
* [Using a Simple Object](#using-a-simple-object)
* [Using a Simple List](#using-a-simple-list)
* [Using a Full Anonymous Filter](#using-a-full-anonymous-filter)
* [Using a Full Anonymous Filter with Exclude](#using-a-full-anonymous-filter-with-exclude)
* [Using a Full Named Filter](#using-a-full-named-filter)
* [Author Filter Examples](#author-filter-examples)
* [New User](#new-user)
* [New User with pattern in Name](#new-user-with-pattern-in-name)
* [User has pattern in their profile description](#user-has-pattern-in-their-profile-description)
* [Exclude moderators AND users by name](#exclude-moderators-and-users-by-name)
* [Item Filter Examples](#item-filter-examples)
* [Unmoderated comment by non-op](#unmoderated-comment-by-non-op)
* [Submission is self post with no flair](#submission-is-self-post-with-no-flair)
# Filters
**Filters** are an additional channel for determining if an Event should be processed by ContextMod. They differ from [**Rules**](../../README.md#rules) in several key ways:
* **Runs, Checks, Rules, and Actions** can **all** have Filters
* Filters test against the **current state** of the Activity (or its Author) being processed, rather than looking at history/context/etc...
* Filter test results only determine if the Run, Check, Rule, or Action **should run** -- rather than triggering it
* When the filter test **passes** the thing being tested continues to process as usual
* When the filter test **fails** the thing being tested **fails**.
A Filter has these properties:
* `include` -- An optional list of Filter Criteria. If **any** passes the filter passes.
* `exclude` -- An optional list of Filter Criteria. All **must NOT** pass for the filter to pass. Ignored if `include` is present.
* `excludeCondition` -- A [condition](../../README.md#conditions) that determines how the list of Filter Criteria are tested together
## Criteria
A **criteria** is some property of a thing (Activity or Author) can be tested, and what the expected outcome is EX:
`age: '> 2 months'` => Author is older than 2 months
**Filter Criteria** is one of more **criteria** combined together to form a set of conditions that must all be true together for the Filter Criteria to be true EX
```yaml
age: '> 2 months'
verified: true
```
The above Filter Criteria is true if:
* the Author's account is older than 2 months AND
* they have a verified email
## Filter Shapes
Generically, a "full" Filter looks like this:
```yaml
include: #optional
- name: AFilterCriteria
criteria:
#...
#...one or more Filter Criteria
exclude: #optional
#...one or more Filter Criteria
excludeCondition: OR or AND
```
But for convenience a Filter's shape can be simplified with a few assumptions:
### Simple Object
When a Filter is an object, the object is assumed to be a [Filter Criteria](#criteria) which is used in `include`
```yaml
itemIs:
approved: false
```
### Simple List
When a Filter is a list, the list is assumed to be a list of [Filter Criteria](#criteria) and used in `include`
```yaml
itemIs:
- approved: false
filtered: false
- is_self: true
```
## Filter Types
There are two types of Filter. Both types have the same "shape" in the configuration with the differences between them being:
* what they are testing on
* what criteria are available to test
### Author Filter
Test the Author of an Activity. See [Schema documentation](https://json-schema.app/view/%23%2Fdefinitions%2FAuthorCriteria?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json) for all possible Author Criteria
#### Mod Actions/Notes Filter
See [Mod Actions/Notes](../modActions/README.md#mod-action-filter) documentation.
#### Toolbox UserNotes Filter
See [UserNotes](../userNotes/README.md) documentation
### Item Filter
Test for properties of an Activity:
* [Comment Criteria](https://json-schema.app/view/%23%2Fdefinitions%2FCommentState?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json)
* [Submission Criteria](https://json-schema.app/view/%23%2Fdefinitions%2FSubmissionState?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json)
### Subreddit Filter
Test for properties of the Subreddit an Activity belongs to. See [Schema documentation](https://json-schema.app/view/%23%2Fdefinitions%2FSubredditCriteria?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json)
## Named Filters
**Named Filters** work the same as [**Named Rules**](../../README.md#named-rules) and [**Named Actions:**](../../README.md#named-actions)
**Filter Criteria** may be given a `name`. A named **Filter Criteria** can **re-used anywhere in the configuration regardless of location.** This is done by:
* specifying a name on a **Filter Criteria** **once** EX: `name: MyFilterCriteria`
* using the Filter Criteria name in place of a Filter Criteria object
```yaml
runs:
- name: MyFirstRun
checks:
- name: MyFirstCheck
kind: submission
itemIs:
- MyFilterCriteria
rules:
#...
actions:
#...
- name: MySecondCheck
kind: submission
itemIs:
include:
- name: MyFilterCriteria
criteria:
approved: false
rules:
#...
actions:
#...
```
# Examples
## General Usage
Below are examples of where filters can be used
### Usage in a Run
```yaml
runs:
# this run will only be processed if author is a contributor
- name: MyRun
authorIs:
- isContributor: true
checks:
# - ...
```
### Usage in a Check
```yaml
runs:
- name: MyRun
checks:
# check will only be processed if author is a contributor
- name: MyCheck
kind: submission
authorIs:
- isContributor: true
rules:
# ...
actions:
# ...
```
### Usage in a Rule
```yaml
runs:
- name: MyRun
checks:
- name: MyCheck
kind: submission
rules:
# rule will only run if author is a contributor
- name: MyFirstRule
kind: recentActivity
authorIs:
- isContributor: true
thresholds:
# ...
actions:
# ...
```
### Usage in an Action
```yaml
runs:
- name: MyRun
checks:
- name: MyCheck
kind: submission
rules:
- name: MyFirstRule
# ...
actions:
# action will only run if author is a contributor
- kind: approve
authorIs:
- isContributor: true
```
### Using Author and Item Filter
```yaml
runs:
- name: MyRun
checks:
# Check will only process if author is a contributor AND submission is not approved
- name: MyCheck
kind: submission
authorIs:
- isContributor: true
itemIs:
- approved: false
rules:
# ...
actions:
# ...
```
## Filter Shapes Usage
Below are examples of how filters can be structured using [filter shapes](#filter-shapes)
### Using a Simple Object
```yaml
runs:
- name: MyRun
checks:
- name: MyCheck
kind: submission
# check is only processed if submission is not approved AND not marked as nsfw
itemIs:
approved: false
over_18: false
rules:
# ...
actions:
# ...
```
### Using a Simple List
```yaml
runs:
- name: MyRun
checks:
- name: MyCheck
kind: submission
# check is only processed if submission is EITHER:
# -> not approved AND not marked as nsfw
# -> not approved AND marked as nsfw AND has flair text 'Mildly NSFW;
itemIs:
# each '-' denotes a NEW set of criteria
- approved: false
over_18: false
- link_flair_text: Mildly NSFW
over_18: true
approved: false
rules:
# ...
actions:
# ...
```
### Using a Full Anonymous Filter
```yaml
runs:
- name: MyRun
checks:
- name: MyCheck
kind: submission
# check is only processed if submission is EITHER:
# -> not approved AND not marked as nsfw
# -> not approved AND marked as nsfw AND has flair text 'Mildly NSFW;
itemIs:
include:
- approved: false
over_18: false
- link_flair_text: Mildly NSFW
over_18: true
approved: false
rules:
# ...
actions:
# ...
```
### Using a Full Anonymous Filter with Exclude
```yaml
runs:
- name: MyRun
checks:
- name: MyCheck
kind: submission
# check is only processed if submission is NOT approved
itemIs:
exclude:
- approved: true
rules:
# ...
actions:
# ...
```
### Using a Full Named Filter
```yaml
runs:
- name: MyRun
checks:
- name: MyCheck
kind: submission
# check is only processed if submission is:
# -> not approved AND not marked as nsfw
itemIs:
include:
- name: sfwNotApproved
criteria:
- approved: false
over_18: false
rules:
# ...
actions:
# ...
```
## Author Filter Examples
### New User
```yaml
# author's account is less than 30 days old AND has less than 30 comment karma
authorIs:
include:
- name: newUser
criteria:
age: < 30 days
commentKarma: < 30
```
### New User with pattern in Name
```yaml
# author's account is less than 30 days old AND has less than 30 comment karma AND has 'nsfw' in their account name
authorIs:
include:
- name: newUser
criteria:
age: < 30 days
commentKarma: < 30
name: '/nsfw/i'
```
### User has pattern in their profile description
```yaml
authorIs:
include:
- description:
- '/Add Me On Snapchat/i'
- '/Add my snapchat/i'
- '/Dm me for content/i'
- '/Will Verify/i'
```
### Exclude moderators AND users by name
Useful when CM should not run if the author is from a list of users or a moderator
```yaml
authorIs:
excludeCondition: AND
exclude:
# will not run if user is a mod or is automoderator
- isMod: true
# will not run if the user is in the list below
- name:
- User1
- User2
- User3
```
## Item Filter Examples
### Unmoderated comment by non-op
```yaml
itemIs:
- removed: false
approved: false
op: false
```
### Submission is self post with no flair
```yaml
itemIs:
- is_self: true
link_flair_text: false
```

View File

@@ -1,12 +1,6 @@
---
has_children: true
title: Moderators
nav_order: 3
---
This section is for **reddit moderators**. It covers how to use a CM bot for your subreddit.
If you are trying to run a ContextMod instance (the actual software) please refer to the [operator section](../operator/README.md).
If you are trying to run a ContextMod instance (the actual software) please refer to the [operator section](/docs/operator/README.md).
# Table of Contents
@@ -24,7 +18,7 @@ If you are trying to run a ContextMod instance (the actual software) please refe
The Context Mod **software** can manage multiple **bots** (reddit accounts used as bots, like `/u/MyCMBot`). Each bot can manage (run) multiple **subreddits** which is determined by the subreddits the account is a moderator of.
You, the moderator of a subreddit a CM bot runs in, can access/manage the Bot using the CM software's [web interface](../images/subredditStatus.jpg) and control its behavior using the [web editor.](../images/editor.jpg)
You, the moderator of a subreddit a CM bot runs in, can access/manage the Bot using the CM software's [web interface](/docs/images/subredditStatus.jpg) and control its behavior using the [web editor.](/docs/images/editor.jpg)
## Your Relationship to CM
@@ -48,7 +42,7 @@ Unlike reddit, though, there is a greater level of trust required between you an
Your bot is like an **invite-only version of Automoderator**:
* Unlike automoderator, you **must** interact with the Operator in order to get the bot working. It is not public for anyone to use.
* Like automoderator, you **must** create a [configuration](../subreddit-configuration/README.md) for it do anything.
* Like automoderator, you **must** create a [configuration](/docs/subreddit/components/README.md) for it do anything.
* The bot does not come pre-configured for you. It is a blank slate and requires user input to be useful.
* Also like automoderator, you are **entirely in control of the bot.**
* You can start, stop, and edit its behavior at any time without needing to communicate with the Operator.
@@ -57,11 +51,11 @@ Your bot is like an **invite-only version of Automoderator**:
# Getting Started
The [Getting Started](gettingStarted.md) guide lays out the steps needed to go from nothing to a working Bot. If you are a moderator new to Context Mod this is where you want to begin.
The [Getting Started](/docs/subreddit/gettingStarted.md) guide lays out the steps needed to go from nothing to a working Bot. If you are a moderator new to Context Mod this is where you want to begin.
# Accessing The Bot
All bot management and editing is done through the [web interface.](/../images/subredditStatus.jpg) The URL used for accessing this interface is given to you by the **Operator** once they have agreed to host your bot/subreddit.
All bot management and editing is done through the [web interface.](/docs/images/subredditStatus.jpg) The URL used for accessing this interface is given to you by the **Operator** once they have agreed to host your bot/subreddit.
NOTE: This interface is **only access to moderators of your subreddit** and [guests.](#guest-access) You must login to the web interface **with your moderator account** in order to access it.
@@ -69,9 +63,9 @@ A **guided tour** that helps show how to manage the bot at a high-level is avail
## Editing The Bot
Find the [editor in the web interface](../webInterface.md#editingupdating-your-config) to access the built-in editor for the bot.
Find the [editor in the web interface](/docs/webInterface.md#editingupdating-your-config) to access the built-in editor for the bot.
[The editor](../images/editor.jpg) should be your all-in-one location for viewing and editing your bot's behavior. **It is equivalent to Automoderator's editor page.**
[The editor](/docs/images/editor.jpg) should be your all-in-one location for viewing and editing your bot's behavior. **It is equivalent to Automoderator's editor page.**
The editor features:
@@ -82,11 +76,11 @@ The editor features:
# Configuration
Use the [Configuration Reference](../subreddit-configuration/README.md) to learn about all the different components available for building a CM configuration.
Use the [Configuration Reference](/docs/subreddit/components/README.md) to learn about all the different components available for building a CM configuration.
Additionally, refer to [How It Works](../README.md#how-it-works) and [Core Concepts](../README.md#concepts) to learn the basic of CM configuration.
Additionally, refer to [How It Works](/docs/README.md#how-it-works) and [Core Concepts](/docs/README.md#concepts) to learn the basic of CM configuration.
After you have the basics under your belt you could use the [subreddit configurations cookbook](../subreddit-configuration/cookbook) to familiarize yourself with a complete configuration and ways to use CM.
After you have the basics under your belt you could use the [subreddit configurations cookbook](/docs/subreddit/components/cookbook) to familiarize yourself with a complete configuration and ways to use CM.
# Guest Access
@@ -98,4 +92,4 @@ Guests can do everything a regular mod can except view/add/remove Guest. They ca
**Guests are helpful if you are new to CM and know reddit users that can help you get started.**
[Add guests from the Subreddit tab in the main interface.](../images/guests.jpg)
[Add guests from the Subreddit tab in the main interface.](/docs/images/guests.jpg)

View File

@@ -1,9 +1,3 @@
---
parent: Subreddit Configuration
---
# Action Templating
Actions that can submit text (Report, Comment, UserNote, Message, Ban, Submission) will have their `content` values run through a [Mustache Template](https://mustache.github.io/). This means you can insert data generated by Rules into your text before the Action is performed.
See here for a [cheatsheet](https://gist.github.com/FoxxMD/d365707cf99fdb526a504b8b833a5b78) and [here](https://www.tsmean.com/articles/mustache/the-ultimate-mustache-tutorial/) for a more thorough tutorial.
@@ -57,42 +51,17 @@ All Actions with `content` have access to this data:
| `title` | As comments => the body of the comment. As Submission => title | Test post please ignore |
| `shortTitle` | The same as `title` but truncated to 15 characters | test post pleas... |
#### Common Author
Additionally, `author` has these properties accessible:
| Name | Description | Example |
|----------------|-----------------------------------------------------------------------------------|------------|
| `age` | (Approximate) Age of account | 3 months |
| `linkKarma` | Amount of link karma | 10 |
| `commentKarma` | Amount of comment karma | 3 |
| `totalKarma` | Combined link+comment karma | 13 |
| `verified` | Does account have a verified email? | true |
| `flairText` | The text of the Flair assigned to the Author in this subreddit, if one is present | Test Flair |
NOTE: Accessing these properties may require an additional API call so use sparingly on high-volume comments
##### Example Usage
```
The user {{item.author}} has been a redditor for {{item.author.age}}
```
Produces:
> The user FoxxMD has been a redditor for 3 months
### Submissions
If the **Activity** is a Submission these additional properties are accessible:
| Name | Description | Example |
|-------------------|-----------------------------------------------------------------|-------------------------|
| `upvoteRatio` | The upvote ratio | 100% |
| `nsfw` | If the submission is marked as NSFW | true |
| `spoiler` | If the submission is marked as a spoiler | true |
| `url` | If the submission was a link then this is the URL for that link | http://example.com |
| `title` | The title of the submission | Test post please ignore |
| `link_flair_text` | The flair text assigned to this submission | Test Flair |
| Name | Description | Example |
|---------------|-----------------------------------------------------------------|-------------------------|
| `upvoteRatio` | The upvote ratio | 100% |
| `nsfw` | If the submission is marked as NSFW | true |
| `spoiler` | If the submission is marked as a spoiler | true |
| `url` | If the submission was a link then this is the URL for that link | http://example.com |
| `title` | The title of the submission | Test post please ignore |
### Comments

View File

@@ -1,9 +1,3 @@
---
parent: Subreddit Configuration
---
# Activities `window`
# Table Of Contents
* [Overview](#overview)
@@ -30,13 +24,13 @@ parent: Subreddit Configuration
# Overview
An **Activity Window** (`window`) is a group of properties that describe a **range** of [**Activities**](../README.md#activity) to retrieve from Reddit and how to **filter** them.
An **Activity Window** (`window`) is a group of properties that describe a **range** of [**Activities**](/docs/README.md#activity) to retrieve from Reddit and how to **filter** them.
The main components of an Activity Window:
* **Range** -- How many Activities ([`count`](#count)) or what time period ([`duration`](#duration)) of Activities to fetch
* **Type of Activities** -- When **fetching** from an Author's history, should it return overview (any Activities), just Submissions, or just Comments?
* **Filters** -- How the retrieved Activities should be [filtered](README.md#filters) before returning them to a Rule
* **Filters** -- How the retrieved Activities should be [filtered](/docs/subreddit/components/README.md#filters) before returning them to a Rule
As an example, if you want to run a **Recent Activity Rule** to check if a user has had activity in /r/mealtimevideos you also need to define what range of activities you want to look at from that user's history.
@@ -220,7 +214,7 @@ window:
# Filters
Activity Window can also specify [Item and Subreddit Filters](README.md#filters) to filter the Activities retrieved from Reddit before they are returned to a Rule.
Activity Window can also specify [Item and Subreddit Filters](/docs/subreddit/components/README.md#filters) to filter the Activities retrieved from Reddit before they are returned to a Rule.
Activities can be filtered **during** (`pre`) retrieval or **after** (`post`) retrieval. **When**, during the window **lifecycle**, the Activities are filtered can change the set of Activities returned to a Rule drastically.
@@ -228,10 +222,10 @@ Activities can be filtered **during** (`pre`) retrieval or **after** (`post`) re
Regardless of when you are filtering Activities the shape of the filter is the same. Filter properties:
* `subreddits` -- A [Filter Shape](README.md#filter-shapes) for filtering by the [Subreddit Criteria](README.md#subreddit-filter) of each Activity
* `submissionState` -- A [Filter Shape](README.md#filter-shapes) for [Submission Criteria](README.md#item-filter). Will run only if filtering a Submission.
* `commentState` -- A [Filter Shape](README.md#filter-shapes) for [Comment Criteria](README.md#item-filter). Will run only if filtering a Comment.
* `activityState` -- A [Filter Shape](README.md#filter-shapes) for either [Submission or Comment Criteria](README.md#item-filter). Will run only if `submissionState` or `commentState` is not defined for their respective Activity types.
* `subreddits` -- A [Filter Shape](/docs/subreddit/components/README.md#filter-shapes) for filtering by the [Subreddit Criteria](/docs/subreddit/components/README.md#subreddit-filter) of each Activity
* `submissionState` -- A [Filter Shape](/docs/subreddit/components/README.md#filter-shapes) for [Submission Criteria](/docs/subreddit/components/README.md#item-filter). Will run only if filtering a Submission.
* `commentState` -- A [Filter Shape](/docs/subreddit/components/README.md#filter-shapes) for [Comment Criteria](/docs/subreddit/components/README.md#item-filter). Will run only if filtering a Comment.
* `activityState` -- A [Filter Shape](/docs/subreddit/components/README.md#filter-shapes) for either [Submission or Comment Criteria](/docs/subreddit/components/README.md#item-filter). Will run only if `submissionState` or `commentState` is not defined for their respective Activity types.
In this example the filter only returns Activities:

View File

@@ -1,10 +1,3 @@
---
has_children: true
nav_order: 5
---
# Subreddit Configuration
High level overviews, important features of, and example usage for significant components in a subreddit's configuration are found here.
This list is not exhaustive. [For complete documentation on a subreddit's configuration consult the schema.](https://json-schema.app/view/%23?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fmaster%2Fsrc%2FSchema%2FApp.json)
@@ -52,6 +45,13 @@ This list is not exhaustive. [For complete documentation on a subreddit's config
* [Toolbox UserNote](#usernote)
* [Mod Note](#mod-note)
* [Filters](#filters)
* [Filter Types](#filter-types)
* [Author Filter](#author-filter)
* [Mod Notes/Actions](#mod-actionsnotes-filter)
* [Toolbox UserNotes](#toolbox-usernotes-filter)
* [Item Filter](#item-filter)
* [Subreddit Filter](#subreddit-filter)
* [Named Filters](#named-filters)
* [Common Patterns](#common-patterns)
* [Conditions](#conditions)
* [Activities `window`](#activities-window)
@@ -75,7 +75,7 @@ This list is not exhaustive. [For complete documentation on a subreddit's config
# Runs
A **Run** is made up of a set of [**Checks**](#checks) that represent a group of related behaviors the bot should check for or perform. Checks within a Run are processed in the order they are listed. Refer to the [How It Works](../README.md#how-it-works) section to see how Runs fit into CM's lifecycle.
A **Run** is made up of a set of [**Checks**](#checks) that represent a group of related behaviors the bot should check for or perform. Checks within a Run are processed in the order they are listed. Refer to the [How It Works](/docs/README.md#how-it-works) section to see how Runs fit into CM's lifecycle.
**Runs** are the largest unit of behavior in a subreddit's configuration and are defined at the top level of the configuration like so:
@@ -135,13 +135,13 @@ A **Check** is a set of:
* Zero or more [**Rules**](#rules) that define what conditions should **trigger** this Check.
* Zero or more [**Actions**](#actions) that define what the bot should do once the Check is **triggered**.
Refer to the [How It Works](../README.md#how-it-works) section to see how Checks fit into CM's lifecycle.
Refer to the [How It Works](/docs/README.md#how-it-works) section to see how Checks fit into CM's lifecycle.
* If a Check has no Rules and passes any [Filters](#filters) it is automatically triggered
* If a Check is triggered and has no Actions it is only [recorded](#recording-options)
* **Checks must have explicitly defined:**
* **name**
* **kind** -- what type of [Activity](../README.md#activity) (`submission` or `comment`) it should process
* **kind** -- what type of [Activity](/docs/README.md#activity) (`submission` or `comment`) it should process
```yaml
runs:
@@ -217,11 +217,11 @@ This enables a user to arbitrarily configure how CM responds to the triggering (
Each Check will **always** have these properties defined -- either explicitly or passed down as defaults from a [Run](#flow-control-defaults-using-runs), [Subreddit](#filter-defaults), or Operator configuration.
Refer to the main [**Flow Control** documentation](advancedConcepts/flowControl.md) for an in-depth explanation and all possible options.
Refer to the main [**Flow Control** documentation](/docs/subreddit/components/advancedConcepts/flowControl.md) for an in-depth explanation and all possible options.
## Recording Options
`postFail` and `postTrigger` also enable specifying if/how an [Event](../README.md#event) is recorded. Valid options for recording:
`postFail` and `postTrigger` also enable specifying if/how an [Event](/docs/README.md#event) is recorded. Valid options for recording:
* `false` -- do not record this Event
* `true` -- record Event to all available outputs
@@ -251,7 +251,7 @@ When an Activity has finished being processed CM will aggregate all Recording Op
# Rules
A **Rule** is some set of **criteria** (conditions) that are tested against an [Activity](../README.md#activity), a User, or a User's history. A Rule is considered **triggered** when the **criteria** for that rule are found to be **true** for whatever is being tested against.
A **Rule** is some set of **criteria** (conditions) that are tested against an [Activity](/docs/README.md#activity), a User, or a User's history. A Rule is considered **triggered** when the **criteria** for that rule are found to be **true** for whatever is being tested against.
Rules must have a `kind` that identifies what kind of Rule they are.
@@ -294,13 +294,13 @@ runs:
Named Rules are essential building blocks of a readable and effective configuration. If you find yourself repeating the same Rule many times it's a sign you should give it a name and replace it's usage with references to it.
See **Rule Name Reuse Examples [YAML](advancedConcepts/ruleNameReuse.yaml) | [JSON](advancedConcepts/ruleNameReuse.json5)**
See **Rule Name Reuse Examples [YAML](/docs/subreddit/components/advancedConcepts/ruleNameReuse.yaml) | [JSON](/docs/subreddit/components/advancedConcepts/ruleNameReuse.json5)**
## List of Rules
### Attribution
[**Full Documentation**](in-depth/attribution)
[**Full Documentation**](/docs/subreddit/components/attribution)
The **Attribution** rule will aggregate an Author's content Attributions (youtube channels, twitter, website domains, etc.) and can check on their totals or percentages of all Activities over a time period:
@@ -311,7 +311,7 @@ The **Attribution** rule will aggregate an Author's content Attributions (youtub
### Recent Activity
[**Full Documentation**](in-depth/recentActivity)
[**Full Documentation**](/docs/subreddit/components/recentActivity)
Given a list subreddit criteria, the **Recent Activity** rule finds Activities matching those criteria in the Author's history over [window](#activities-window) and then allows for comparing different facets of the results:
@@ -323,14 +323,14 @@ The above can also be expressed as a percentage of all activities found, instead
The search can also be modified in a number of ways:
* Filter found activities using an [Item Filter](in-depth/filters#item-filter)
* Filter found activities using an [Item Filter](#item-filter)
* Only return activities that match the Activity from the Event being processed
* Using [image detection](imageComparison.md) (pixel or perceptual hash matching)
* Using [image detection](/docs/imageComparison.md) (pixel or perceptual hash matching)
* Only return certain types of activities (only submission or only comments)
### Repeat Activity
[**Full Documentation**](in-depth/repeatActivity)
[**Full Documentation**](/docs/subreddit/components/repeatActivity)
The **Repeat Activity** rule will check for patterns of repetition in an Author's Activity history over a [window](#activities-window). When comparing submissions it checks a composite of the submissions' title and content.
@@ -345,7 +345,7 @@ Some of the ways the rule can be modified:
### History
[**Full Documentation**](in-depth/history)
[**Full Documentation**](/docs/subreddit/components/history)
The **History** rule can check an Author's submission/comment statistics over a time period:
@@ -355,33 +355,33 @@ The **History** rule can check an Author's submission/comment statistics over a
### Author
[**Full Documentation**](in-depth/author)
[**Full Documentation**](/docs/subreddit/components/author)
The **Author** rule behaves the same as the [Author Filter](in-depth/filters#author-filter). It can be used when you want to test Author state alongside other rules to create more complex behavior than would be possible by only applying to individual Rules or an entire check.
The **Author** rule behaves the same as the [Author Filter](#author-filter). It can be used when you want to test Author state alongside other rules to create more complex behavior than would be possible by only applying to individual Rules or an entire check.
### Regex
[**Full Documentation**](in-depth/regex)
[**Full Documentation**](/docs/subreddit/components/regex)
The **Regex** rule matches on text content from an Activity in the same way automod uses regex. However, it can also be used to match on content from the Author's Activity history over a [window](#activities-window).
### Repost
[**Full Documentation**](in-depth/repost)
[**Full Documentation**](/docs/subreddit/components/repost)
The **Repost** rule is used to find reposts for both **Submissions** and **Comments**, depending on what type of **Check** it is used on.
This rule is for searching **all of Reddit** for reposts, as opposed to just the history of the Author of the Activity being checked. If you only want to check for reposts by the Author of the Activity being checked you should use the [Repeat Activity](repeatActivity) rule.
This rule is for searching **all of Reddit** for reposts, as opposed to just the history of the Author of the Activity being checked. If you only want to check for reposts by the Author of the Activity being checked you should use the [Repeat Activity](/docs/subreddit/components/repeatActivity) rule.
### Sentiment Analysis
[**Full Documentation**](in-depth/sentiment)
[**Full Documentation**](/docs/subreddit/components/sentiment)
The **Sentiment Rule** is used to determine the overall emotional intent (negative, neutral, positive) of a Submission or Comment by analyzing the actual text content of the Activity.
### ModerateHateSpeech.com Predictions
[**Full Documentation**](in-depth/mhs)
[**Full Documentation**](/docs/subreddit/components/mhs)
ContextMod integrates with [moderatehatespeech.com](https://moderatehatespeech.com/) (MHS) [toxic content machine learning model](https://moderatehatespeech.com/framework/) through their API. This rule sends an Activity's content (title or body) to MHS which returns a prediction on whether the content is toxic and actionable by a moderator. Their model is [specifically trained for reddit content.](https://www.reddit.com/r/redditdev/comments/xdscbo/updated_bot_backed_by_moderationoriented_ml_for/)
@@ -420,7 +420,7 @@ runs:
...
```
See **ruleSets [YAML](advancedConcepts/ruleSets.yaml) | [JSON](advancedConcepts/ruleSets.json5)** for a complete example as well as consulting the [schema](https://json-schema.app/view/%23%2Fdefinitions%2FRuleSetJson?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FApp.json).
See **ruleSets [YAML](/docs/subreddit/components/advancedConcepts/ruleSets.yaml) | [JSON](/docs/subreddit/components/advancedConcepts/ruleSets.json5)** for a complete example as well as consulting the [schema](https://json-schema.app/view/%23%2Fdefinitions%2FRuleSetJson?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FApp.json).
# Actions
@@ -432,7 +432,7 @@ Actions are performed in the order they are listed in the **Check.**
## Named Actions
**Named Actions** work the same as [**Named Rules**](#named-rules) and [**Named Filters:**](in-depth/filters#named-filters)
**Named Actions** work the same as [**Named Rules**](#named-rules) and [**Named Filters:**](#named-filters)
Actions may be given a `name`. If an Action is named it can **re-used anywhere in the configuration regardless of location.** This is done by:
@@ -464,7 +464,7 @@ runs:
Actions that can submit text (Report, Comment, UserNote) will have their `content` values run through a [Mustache Template](https://mustache.github.io/). This means you can insert data generated by Rules into your text before the Action is performed.
[**Action Templating Documentation**](actionTemplating.md)
[**Action Templating Documentation**](/docs/subreddit/actionTemplating.md)
## List of Actions
@@ -736,7 +736,7 @@ actions:
Remove the Activity being processed. [Schema Documentation](https://json-schema.app/view/%23/%23%2Fdefinitions%2FSubmissionCheckJson/%23%2Fdefinitions%2FRemoveActionJson?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json)
* **note** can be [templated](#templating)
* **reasonId** IDs can be found in the [editor](../../webInterface.md) using the **Removal Reasons** popup
* **reasonId** IDs can be found in the [editor](/docs/webInterface.md) using the **Removal Reasons** popup
If neither note nor reasonId are included then no removal reason is added.
@@ -764,7 +764,7 @@ actions:
Add a Toolbox User Note to the Author of the Activity. [Schema Documentation](https://json-schema.app/view/%23/%23%2Fdefinitions%2FSubmissionCheckJson/%23%2Fdefinitions%2FUserNoteActionJson?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json)
Your subreddit must have [Toolbox UserNotes](in-depth/userNotes) enabled for this action to work.
Your subreddit must have [Toolbox UserNotes](/docs/subreddit/components/userNotes) enabled for this action to work.
* `type` is required
* `content` can be [templated](#templating) and use [URL Tokens](#url-tokens)
@@ -779,7 +779,7 @@ actions:
### Mod Note
[**Full Documentation**](in-depth/modActions/README.md#mod-note-action)
[**Full Documentation**](/docs/subreddit/components/modActions/README.md#mod-note-action)
Add a [Mod Note](https://www.reddit.com/r/modnews/comments/t8vafc/announcing_mod_notes/) for the Author of the Activity.
@@ -808,17 +808,133 @@ actions:
* **Runs, Checks, Rules, and Actions** can **all** have Filters
* Filters test against the **current state** of the Activity (or it's Author) being processed, rather than looking at history/context/etc...
* CM supports filters for:
* [Author](in-depth/filters#author-filter) - age, verified email, profile description, flair...
* [Item (Submission/Comment)](in-depth/filters#item-filter) - sticked, # of reports, removed, flair, score...
* [Subreddit](in-depth/filters#subreddit-filter) - name, nsfw, quarantined...
* [Toolbox Usernotes](in-depth/filters#toolbox-usernotes-filter)
* [Mod Notes](in-depth/filters#mod-actionsnotes-filter)
* Filter test results only determine if the Run, Check, Rule, or Action **should run** -- rather than triggering it
* When the filter test **passes** the thing being tested continues to process as usual
* When the filter test **fails** the thing being tested **fails**.
[**Refer to the full Filter documentation for more**](in-depth/filters)
A Filter has these properties:
* `include` -- An optional list of Filter Criteria. If **any** passes the filter passes.
* `exclude` -- An optional list of Filter Criteria. All **must NOT** pass for the filter to pass. Ignored if `include` is present.
* `excludeCondition` -- A [condition](#conditions) that determines how the list of Filter Criteria are tested together
## Filter Criteria
A **criteria** is some property of a thing can be tested, and what the expected outcome is EX
`age: '> 2 months'` => Author is older than 2 months
**Filter Criteria** is one of more **criteria** combined together to form a set of criteria that must all be true together for the Filter Criteria to be true EX
```yaml
age: '> 2 months'
verified: true
```
The above Filter Criteria is true if the Author's account is older than 2 months AND they have a verified email
### Filter Shapes
Generically, a "full" Filter looks like this:
```yaml
include: #optional
- name: AFilterCriteria
criteria:
...
... #one or more filter criteria
exclude: #optional
... # one or more filter criteria
excludeCondition: OR or AND
```
But for convenience a Filter's shape can be simplified with a few assumptions
#### Simple Object
When a Filter is an object, the object is assumed to be a Filter Criteria which is used in `include`
```yaml
itemIs:
approved: false
```
#### Simple List
When a Filter is a list, the list is assumed to be a list of Filter Criteria and used in `include`
```yaml
itemIs:
- approved: false
filtered: false
- is_self: true
```
## Filter Types
There are two types of Filter. Both types have the same "shape" in the configuration with the differences between them being:
* what they are testing on
* what criteria are available to test
### Author Filter
Test the Author of an Activity. See [Schema documentation](https://json-schema.app/view/%23%2Fdefinitions%2FAuthorCriteria?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json) for all possible Author Criteria
#### Mod Actions/Notes Filter
See [Mod Actions/Notes](/docs/subreddit/components/modActions/README.md#mod-action-filter) documentation.
#### Toolbox UserNotes Filter
See [UserNotes](/docs/subreddit/components/userNotes/README.md) documentation
### Item Filter
Test for properties of an Activity:
* [Comment Criteria](https://json-schema.app/view/%23%2Fdefinitions%2FCommentState?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json)
* [Submission Criteria](https://json-schema.app/view/%23%2Fdefinitions%2FSubmissionState?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json)
### Subreddit Filter
Test for properties of the Subreddit an Activity belongs to. See [Schema documentation](https://json-schema.app/view/%23%2Fdefinitions%2FSubredditCriteria?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Freddit-context-bot%2Fedge%2Fsrc%2FSchema%2FApp.json)
## Named Filters
**Named Filters** work the same as [**Named Rules**](#named-rules) and [**Named Actions:**](#named-actions)
**Filter Criteria** may be given a `name`. A named **Filter Criteria** can **re-used anywhere in the configuration regardless of location.** This is done by:
* specifying a name on a **Filter Criteria** **once** EX: `name: MyFitlerCriteria`
* using the Filter Criteria's name in place of a Filter Criteria object
```yaml
runs:
- name: MyFirstRun
checks:
- name: MyFirstCheck
kind: submission
itemIs:
- MyFilterCriteria
rules:
...
actions:
...
- name: MySecondCheck
kind: submission
itemIs:
include:
- name: MyFilterCriteria
criteria:
approved: false
rules:
...
actions:
...
```
# Common Patterns
@@ -858,7 +974,7 @@ These conditions can be combined together to evaluate to either true or false us
Most **Rules** have a `window` property somewhere within their configuration. This property defines the range of **Activities** (submission and/or comments) that should be retrieved for checking the criteria of the Rule.
[Full Activities `window` documentation](activitiesWindow.md)
[Full Activities `window` documentation](/docs/subreddit/activitiesWindow.md)
## URL Tokens
@@ -920,7 +1036,7 @@ Some criteria accept an optional **duration** to compare against:
The duration value compares a time range from **now** to `duration value` time in the past.
Refer to [duration values in activity window documentation](activitiesWindow.md#duration) as well as the individual rule/criteria schema to see what this duration is comparing against.
Refer to [duration values in activity window documentation](/docs/subreddit/activitiesWindow.md#duration-values) as well as the individual rule/criteria schema to see what this duration is comparing against.
## Filter Defaults
@@ -954,7 +1070,7 @@ In other words -- Checks will not run if the Author of the Activity being proces
## Flow Control Defaults
See [Flow Control Documentation](advancedConcepts/flowControl.md#default-behaviors)
See [Flow Control Documentation](/docs/subreddit/components/advancedConcepts/flowControl.md#default-behaviors)
# Subreddit-Level Configuration
@@ -964,7 +1080,7 @@ See [Filter Defaults](#filter-defaults) and [Flow Control Defaults](#flow-contro
## Polling
**Polling** is how ContextMod creates [Events](../README.md#event) from new Activities in a Subreddit. CM monitors one or more polling sources and processes any new Activities it discovers.
**Polling** is how ContextMod creates [Events](/docs/README.md#event) from new Activities in a Subreddit. CM monitors one or more polling sources and processes any new Activities it discovers.
### Polling Sources
@@ -1096,7 +1212,7 @@ Re-use will result in less API calls and faster Check times.
PROTIP: You can monitor the re-use of cache in the `Cache` section of your subreddit on the web interface. See the tooltips in that section for a better breakdown of cache statistics.
[Learn more about how Caching works](../operator/caching.md)
[Learn more about how Caching works](/docs/operator/caching.md)
## Partial Configurations
@@ -1280,4 +1396,4 @@ runs:
# Subreddit-Ready Examples
Refer to the [Subreddit Cookbook Examples](cookbook) section to find ready-to-use configurations for common scenarios (spam, freekarma blocking, etc...). This is also a good place to familiarize yourself with what complete configurations look like.
Refer to the [Subreddit Cookbook Examples](/docs/subreddit/components/cookbook) section to find ready-to-use configurations for common scenarios (spam, freekarma blocking, etc...). This is also a good place to familiarize yourself with what complete configurations look like.

View File

@@ -1,10 +1,3 @@
---
parent: Subreddit Configuration
has_toc: false
---
# Flow Control
Context Mod's behavior after a **Check** has been processed can be configured by a user. This allows a subreddit to control exactly what Runs/Checks will be processed based on the outcome (triggered or not) of a Check.
# Table of Contents
@@ -28,7 +21,7 @@ Context Mod's behavior after a **Check** has been processed can be configured by
When a Check is finished processing it can be in one of two states:
* **Triggered** -- The **Rules** defined in the Check were **triggered** which caused the **Actions** for the Check to be run
* **Failure** -- The **Rules** defined in the check were **not triggered**, based on the conditions that were set (either from the [Check condition](../README.md#Checks) or Rule Sets, and no **Actions** were run
* **Failure** -- The **Rules** defined in the check were **not triggered**, based on the conditions that were set (either from the [Check condition](/docs/README.md#Checks) or [Rule Sets](/docs/subreddit/components/advancedConcepts/README.md#Rule-Sets)), and no **Actions** were run
The behavior CM follows is based on which state it is in. The behavior can be specified **by one or both** of these **state properties** on the Check configuration:

View File

@@ -1,9 +1,4 @@
---
grand_parent: Subreddit Configuration
parent: In Depth
---
# Attribution Rule
# Attribution
The **Attribution** rule will aggregate an Author's content Attribution (youtube channels, twitter, website domains, etc.) and can check on their totals or percentages of all Activities over a time period:
* Total # of attributions
@@ -13,7 +8,7 @@ The **Attribution** rule will aggregate an Author's content Attribution (youtube
Consult the [schema](https://json-schema.app/view/%23/%23%2Fdefinitions%2FCheckJson/%23%2Fdefinitions%2FAttributionJSONConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FApp.json) for a complete reference of the rule's properties.
# [Template Variables](../../actionTemplating.md)
# [Template Variables](/docs/subreddit/actionTemplating.md)
| Name | Description | Example |
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
@@ -32,5 +27,5 @@ Consult the [schema](https://json-schema.app/view/%23/%23%2Fdefinitions%2FCheckJ
# Examples
* Self Promotion as percentage of all Activities [YAML](redditSelfPromoAll.yaml) | [JSON](redditSelfPromoAll.json5) - Check if Author is submitting much more than they comment.
* Self Promotion as percentage of Submissions [YAML](redditSelfPromoSubmissionsOnly.yaml) | [JSON](redditSelfPromoSubmissionsOnly.json5) - Check if any of Author's aggregated submission origins are >10% of their submissions
* Self Promotion as percentage of all Activities [YAML](/docs/subreddit/components/attribution/redditSelfPromoAll.yaml) | [JSON](/docs/subreddit/components/attribution/redditSelfPromoAll.json5) - Check if Author is submitting much more than they comment.
* Self Promotion as percentage of Submissions [YAML](/docs/subreddit/components/attribution/redditSelfPromoSubmissionsOnly.yaml) | [JSON](/docs/examplesm/attribution/redditSelfPromoSubmissionsOnly.json5) - Check if any of Author's aggregated submission origins are >10% of their submissions

View File

@@ -1,8 +1,3 @@
---
grand_parent: Subreddit Configuration
parent: In Depth
---
# Author
## Rule
@@ -14,7 +9,7 @@ The **Author** rule triggers if any [AuthorCriteria](https://json-schema.app/vie
* author's subreddit flair text
* author's subreddit flair css
* author's subreddit mod status
* [Toolbox User Notes](../userNotes)
* [Toolbox User Notes](/docs/subreddit/components/userNotes)
The Author **Rule** is best used in conjunction with other Rules to short-circuit a Check based on who the Author is. It is easier to use a Rule to do this then to write **author filters** for every Rule (and makes Rules more re-useable).
@@ -23,10 +18,10 @@ Consult the [schema](https://json-schema.app/view/%23%2Fdefinitions%2FAuthorRule
### Examples
* Basic examples
* Flair new user Submission [YAML](flairNewUserSubmission.yaml) | [JSON](flairNewUserSubmission.json5) - If the Author does not have the `vet` flair then flair the Submission with `New User`
* Flair vetted user Submission [YAML](flairNewUserSubmission.yaml) | [JSON](flairNewUserSubmission.json5) - If the Author does have the `vet` flair then flair the Submission with `Vetted`
* Flair new user Submission [YAML](/docs/subreddit/components/author/flairNewUserSubmission.yaml) | [JSON](/docs/subreddit/components/author/flairNewUserSubmission.json5) - If the Author does not have the `vet` flair then flair the Submission with `New User`
* Flair vetted user Submission [YAML](/docs/subreddit/components/author/flairNewUserSubmission.yaml) | [JSON](/docs/subreddit/components/author/flairNewUserSubmission.json5) - If the Author does have the `vet` flair then flair the Submission with `Vetted`
* Used with other Rules
* Ignore vetted user [YAML](flairNewUserSubmission.yaml) | [JSON](flairNewUserSubmission.json5) - Short-circuit the Check if the Author has the `vet` flair
* Ignore vetted user [YAML](/docs/subreddit/components/author/flairNewUserSubmission.yaml) | [JSON](/docs/subreddit/components/author/flairNewUserSubmission.json5) - Short-circuit the Check if the Author has the `vet` flair
## Filter
@@ -40,7 +35,7 @@ All **Rules** and **Checks** have an optional `authorIs` property that takes an
### Examples
* Skip recent activity check based on author [YAML](authorFilter.yaml) | [JSON](authorFilter.json5) - Skip a Recent Activity check for a set of subreddits if the Author of the Submission has any set of flairs.
* Skip recent activity check based on author [YAML](/docs/subreddit/components/author/authorFilter.yaml) | [JSON](/docs/subreddit/components/author/authorFilter.json5) - Skip a Recent Activity check for a set of subreddits if the Author of the Submission has any set of flairs.
## Flair users and submissions
@@ -50,4 +45,4 @@ Consult [User Flair schema](https://json-schema.app/view/%23%2Fdefinitions%2FUse
### Examples
* OnlyFans submissions [YAML](onlyfansFlair.yaml) | [JSON](onlyfansFlair.json5) - Check whether submitter has typical OF keywords in their profile and flair both author + submission accordingly.
* OnlyFans submissions [YAML](/docs/subreddit/components/author/onlyfansFlair.yaml) | [JSON](/docs/subreddit/components/author/onlyfansFlair.json5) - Check whether submitter has typical OF keywords in their profile and flair both author + submission accordingly.

View File

@@ -40,7 +40,7 @@
// for this to pass the Author of the Submission must not have the flair "Supreme Memer" and have the name "user1" or "user2"
{
"flairText": ["Supreme Memer"],
"names": ["user1","user2"]
"name": ["user1","user2"]
},
{
// for this to pass the Author of the Submission must not have the flair "Decent Memer"

View File

@@ -30,7 +30,7 @@ runs:
# for this to pass the Author of the Submission must not have the flair "Supreme Memer" and have the name "user1" or "user2"
- flairText:
- Supreme Memer
names:
name:
- user1
- user2
# for this to pass the Author of the Submission must not have the flair "Decent Memer"

View File

@@ -1,8 +1,4 @@
---
parent: Subreddit Configuration
---
# Cookbook
# ContextMod Cookbook
Here you will find useful configs for CM that provide real-world functionality. This is where you should look first for **"how do i..."** questions.
@@ -17,7 +13,7 @@ If the type is **Check** or **Run** the recipe contents will have instructions i
### As Config Fragment
**Checks, Runs, Actions, and Rule** recipes can be referenced in your config without copy-pasting by using them as [Config Fragments.](../README.md#partial-configurations) These need to be placed in the correct spot in your config, just like copy-pasting, but only require the URL of the recipe instead of all the code.
**Checks, Runs, Actions, and Rule** recipes can be referenced in your config without copy-pasting by using them as [Config Fragments.](/docs/subreddit/components/README.md#partial-configurations) These need to be placed in the correct spot in your config, just like copy-pasting, but only require the URL of the recipe instead of all the code.
To use a recipe as a fragment **copy** the URL of the config and insert into your config like this:
@@ -27,7 +23,7 @@ To use a recipe as a fragment **copy** the URL of the config and insert into you
EXAMPLE: Using the **Config** link from the [Free Karma](#remove-submissions-from-users-who-have-used-freekarma-subs-to-bypass-karma-checks) check below -- copy the **Config** link and insert it into a full subreddit config like this:
<details markdown="block">
<details>
<summary>Config</summary>
```yaml
@@ -51,42 +47,42 @@ runs:
### Remove submissions from users who have used 'freekarma' subs to bypass karma checks
* Type: **Check**
* [Config](freekarma.yaml)
* [Config](/docs/subreddit/components/cookbook/freekarma.yaml)
If the user has any activity (comment/submission) in known freekarma subreddits in the past (100 activities) then remove the submission.
### Remove submissions that are consecutively spammed by the author
* Type: **Check**
* [Config](crosspostSpam.yaml)
* [Config](/docs/subreddit/components/cookbook/crosspostSpam.yaml)
If the user has crossposted the same submission in the past (100 activities) 4 or more times in a row then remove the submission.
### Remove submissions if users is flooding new
* Type: **Check**
* [Config](floodingNewSubmissions.yaml)
* [Config](/docs/subreddit/components/cookbook/floodingNewSubmissions.yaml)
If the user has made more than 4 submissions in your subreddit in the last 24 hours than new submissions are removed and user is tagged with a modnote.
### Remove submissions posted in diametrically-opposed subreddit
* Type: **Check**
* [Config](diametricSpam.yaml)
* [Config](/docs/subreddit/components/cookbook/diametricSpam.yaml)
If the user makes the same submission to another subreddit(s) that are "thematically" opposed to your subreddit it is probably spam. This check removes it. Detects all types of submissions (including images).
### Remove comments that are consecutively spammed by the author
* Type: **Check**
* [Config](commentSpam.yaml)
* [Config](/docs/subreddit/components/cookbook/commentSpam.yaml)
If the user made the same comment (with some fuzzy matching) 4 or more times in a row in the past (100 activities or 6 months) then remove the comment.
### Remove comment if it is a chat invite link spam
* Type: **Check**
* [Config](chatSpam.yaml)
* [Config](/docs/subreddit/components/cookbook/chatSpam.yaml)
This rule goes a step further than automod can by being more discretionary about how it handles this type of spam.
@@ -105,7 +101,7 @@ This way ContextMod can more easily distinguish between these use cases for a us
### Remove comments reposted from youtube video submissions
* Type: **Check**
* [Config](youtubeCommentRepost.yaml)
* [Config](/docs/subreddit/components/cookbook/youtubeCommentRepost.yaml)
**Requires bot has an API Key for Youtube.**
@@ -114,7 +110,7 @@ Removes comment on reddit if the same comment is found on the youtube video the
### Remove comments reposted from reddit submissions
* Type: **Check**
* [Config](commentRepost.yaml)
* [Config](/docs/subreddit/components/cookbook/commentRepost.yaml)
Checks top-level comments on submissions younger than 30 minutes:
* Finds other reddit submissions based on crosspost/duplicates/title/URL, takes top 10 submissions based # of upvotes
@@ -123,7 +119,7 @@ Checks top-level comments on submissions younger than 30 minutes:
### Remove reposted reddit submission
* Type: **Check**
* [Config](submissionRepost.yaml)
* [Config](/docs/subreddit/components/cookbook/submissionRepost.yaml)
Checks reddit for top posts with a **Title** that is 90% or more similar to the submission being checked and removes it, if found.
@@ -132,7 +128,7 @@ Checks reddit for top posts with a **Title** that is 90% or more similar to the
### Remove link submissions where the user's history is comprised of 10% or more of the same link
* Type: **Check**
* [Config](selfPromo.yaml)
* [Config](/docs/subreddit/components/cookbook/selfPromo.yaml)
If the link origin (youtube author, twitter author, etc. or regular domain for non-media links)
@@ -144,7 +140,7 @@ then remove the submission
### Remove submissions posted in 'newtube' subreddits
* Type: **Check**
* [Config](newtube.yaml)
* [Config](/docs/subreddit/components/cookbook/newtube.yaml)
If the user makes the same submission to a 'newtube' or self-promotional subreddit it is removed and a modnote is added.
@@ -153,14 +149,14 @@ If the user makes the same submission to a 'newtube' or self-promotional subredd
### Remove comments on brigaded submissions when user has no history
* Type: **Check**
* [Config](brigadingNoHistory.yaml)
* [Config](/docs/subreddit/components/cookbook/brigadingNoHistory.yaml)
The users of comments on a brigaded submission (based on a special submission flair) have their comment history checked -- if they have no participation in your subreddit then the comment is removed.
### Remove submissions from users with a history of sex solicitation
* Type: **Check**
* [Config](sexSolicitationHistory.yaml)
* [Config](/docs/subreddit/components/cookbook/sexSolicitationHistory.yaml)
If the author of a submission has submissions in their history that match common reddit "sex solicitation" tags (MFA, R4F, M4F, etc...) the submission is removed and a modnote added.
@@ -173,7 +169,7 @@ The check can be modified to removed comments by changing `kind: submission` to
### Verify users from r/TranscribersOfReddit
* Type: **Check**
* [Config](transcribersOfReddit.yaml)
* [Config](/docs/subreddit/components/cookbook/transcribersOfReddit.yaml)
[r/TranscribersOfReddit](https://www.reddit.com/r/transcribersofreddit) is a community of volunteers transcribing images and videos, across reddit, into plain text.
@@ -182,14 +178,14 @@ This Check detects their standard transcription template and also checks they ha
### Require submission authors have prior subreddit participation
* Type: **Check**
* [Config](requireNonOPParticipation.yaml)
* [Config](/docs/subreddit/components/cookbook/requireNonOPParticipation.yaml)
Submission is removed if the author has **less than 5 non-OP comments** in your subreddit prior to making the submission.
### Require submission authors make a top-level comment with 15 minutes of posting
* Type: **Check**
* [Config](requireNonOPParticipation.yaml)
* [Config](/docs/subreddit/components/cookbook/requireNonOPParticipation.yaml)
After making a submission the author must make a top-level comment with a regex-checkable pattern within X minutes. If the comment is not made the submission is removed.
@@ -198,7 +194,7 @@ After making a submission the author must make a top-level comment with a regex-
### Sticky a comment on popular submissions
* Type: **Run**
* [Config](popularSubmissionMonitoring.yaml)
* [Config](/docs/subreddit/components/cookbook/popularSubmissionMonitoring.yaml)
This **Run** should come after any other Runs you have that may remove a Submission.

View File

@@ -1,9 +1,4 @@
---
grand_parent: Subreddit Configuration
parent: In Depth
---
# History Rule
# History
The **History** rule can check an Author's submission/comment statistics over a time period:
@@ -16,7 +11,7 @@ Consult the [schema](https://json-schema.app/view/%23%2Fdefinitions%2FHistoryJSO
## Ratio
Use the `ratio` property in Criteria to test the [number of activities](../../activitiesWindow.md) found in the parent criteria against the number of activities from _another_ [activity window](../../activitiesWindow.md) defined in the ratio.
Use the `ratio` property in Criteria to test the [number of activities](/docs/subreddit/activitiesWindow.md) found in the parent criteria against the number of activities from _another_ [activity window](/docs/subreddit/activitiesWindow.md) defined in the ratio.
Example:
@@ -51,10 +46,10 @@ Example:
### Examples
* Low Comment Engagement [YAML](lowEngagement.yaml) | [JSON](lowEngagement.json5) - Check if Author is submitting much more than they comment.
* OP Comment Engagement [YAML](opOnlyEngagement.yaml) | [JSON](opOnlyEngagement.json5) - Check if Author is mostly engaging only in their own content
* Low Comment Engagement [YAML](/docs/subreddit/components/history/lowEngagement.yaml) | [JSON](/docs/subreddit/components/history/lowEngagement.json5) - Check if Author is submitting much more than they comment.
* OP Comment Engagement [YAML](/docs/subreddit/components/history/opOnlyEngagement.yaml) | [JSON](/docs/subreddit/components/history/opOnlyEngagement.json5) - Check if Author is mostly engaging only in their own content
# [Template Variables](../../actionTemplating.md)
# [Template Variables](/docs/subreddit/actionTemplating.md)
| Name | Description | Example |
|----------------------|------------------------------------------------------------------------|----------------------------------------------------|

View File

@@ -1,10 +1,3 @@
---
grand_parent: Subreddit Configuration
parent: In Depth
---
# ModerateHateSpeech.com Rule
# Table of Contents
* [Overview](#overview)
@@ -108,7 +101,7 @@ rules:
#### Historical Matching
Like the [Sentiment](../sentiment#historical) and [Regex](../regex#historical) rules CM can also use MHS predictions to check content from the Author's history.
Like the [Sentiment](/docs/subreddit/components/sentiment#historical) and [Regex](/docs/subreddit/components/regex#historical) rules CM can also use MHS predictions to check content from the Author's history.
Example
@@ -123,7 +116,7 @@ rules:
criteria: #... if specified, overrides parent-level criteria
```
# [Template Variables](../../actionTemplating.md)
# [Template Variables](/docs/subreddit/actionTemplating.md)
| Name | Description | Example |

View File

@@ -1,10 +1,3 @@
---
grand_parent: Subreddit Configuration
parent: In Depth
---
# Mod Actions
# Table of Contents
* [Overview](#overview)
@@ -16,9 +9,9 @@ parent: In Depth
# Overview
[Mod Notes](https://www.reddit.com/r/modnews/comments/t8vafc/announcing_mod_notes/) is a feature for New Reddit that allow moderators to add short, categorizable notes to Users of their subreddit, optionally associating te note with a submission/comment the User made. They are inspired by [Toolbox User Notes](https://www.reddit.com/r/toolbox/wiki/docs/usernotes) which are also [supported by ContextMod.](../userNotes) Reddit's **Mod Notes** also combine [Moderation Log](https://mods.reddithelp.com/hc/en-us/articles/360022402312-Moderation-Log) actions (**Mod Actions**) for the selected User alongside moderator notes, enabling a full "overview" of moderator interactions with a User in their subreddit.
[Mod Notes](https://www.reddit.com/r/modnews/comments/t8vafc/announcing_mod_notes/) is a feature for New Reddit that allow moderators to add short, categorizable notes to Users of their subreddit, optionally associating te note with a submission/comment the User made. They are inspired by [Toolbox User Notes](https://www.reddit.com/r/toolbox/wiki/docs/usernotes) which are also [supported by ContextMod.](/docs/subreddit/components/userNotes) Reddit's **Mod Notes** also combine [Moderation Log](https://mods.reddithelp.com/hc/en-us/articles/360022402312-Moderation-Log) actions (**Mod Actions**) for the selected User alongside moderator notes, enabling a full "overview" of moderator interactions with a User in their subreddit.
ContextMod supports adding **Mod Notes** to an Author using an [Action](../../README.md#mod-note) and using **Mod Actions/Mod Notes** as a criteria in an [Author Filter](../../README.md#author-filter)
ContextMod supports adding **Mod Notes** to an Author using an [Action](/docs/subreddit/components/README.md#mod-note) and using **Mod Actions/Mod Notes** as a criteria in an [Author Filter](/docs/subreddit/components/README.md#author-filter)
# Mod Note Action
@@ -44,7 +37,7 @@ actions:
# Mod Action Filter
ContextMod can use **Mod Actions** (from moderation log) and **Mod Notes** in an [Author Filter](../../../README.md#author-filter).
ContextMod can use **Mod Actions** (from moderation log) and **Mod Notes** in an [Author Filter](/docs/subreddit/components/README.md#author-filter).
## API Usage
@@ -68,15 +61,15 @@ Mod Action Filtering Used
In general,**do not** use Mod Actions in a Filter if:
* The filter is on a [**Comment** Check](../../README.md#checks) and your subreddit has a high volume of Comments
* The filter is on a [Run](../../README.md#runs) and your subreddit has a high volume of Activities
* The filter is on a [**Comment** Check](/docs/subreddit/components/README.md#checks) and your subreddit has a high volume of Comments
* The filter is on a [Run](/docs/subreddit/components/README.md#runs) and your subreddit has a high volume of Activities
If you need Mod Notes-like functionality for a high volume subreddit consider using [Toolbox UserNotes](../userNotes) instead.
If you need Mod Notes-like functionality for a high volume subreddit consider using [Toolbox UserNotes](/docs/subreddit/components/userNotes) instead.
In general, **do** use Mod Actions in a Filter if:
* The filter is on a [**Submission** Check](../../README.md#checks)
* The filter is part of an [Author **Rule**](../../README.md#author) that is processed as **late as possible in the rule order for a Check**
* The filter is on a [**Submission** Check](/docs/subreddit/components/README.md#checks)
* The filter is part of an [Author **Rule**](/docs/subreddit/components/README.md#author) that is processed as **late as possible in the rule order for a Check**
* Your subreddit has a low volume of Activities (less than 100 combined submissions/comments in a 10 minute period, for example)
* The filter is on an Action

View File

@@ -1,11 +1,6 @@
---
grand_parent: Subreddit Configuration
parent: In Depth
---
# Recent Activity
# Recent Activity Rule
Given a list subreddit criteria, the **Recent Activity** rule finds Activities matching those criteria in the Author's history over [window](../../activitiesWindow.md) and then allows for comparing different facets of the results.
Given a list subreddit criteria, the **Recent Activity** rule finds Activities matching those criteria in the Author's history over [window](#activities-window) and then allows for comparing different facets of the results.
Subreddit criteria can be:
@@ -32,10 +27,10 @@ Consult the [schema](https://json-schema.app/view/%23%2Fdefinitions%2FRecentActi
### Examples
* Free Karma Subreddits [YAML](freeKarma.yaml) | [JSON](freeKarma.json5) - Check if the Author has recently posted in any "free karma" subreddits
* Submission in Free Karma Subreddits [YAML](freeKarmaOnSubmission.yaml) | [JSON](freeKarmaOnSubmission.json5) - Check if the Author has posted the Submission this check is running on in any "free karma" subreddits recently
* Free Karma Subreddits [YAML](/docs/subreddit/components/recentActivity/freeKarma.yaml) | [JSON](/docs/subreddit/components/recentActivity/freeKarma.json5) - Check if the Author has recently posted in any "free karma" subreddits
* Submission in Free Karma Subreddits [YAML](/docs/subreddit/components/recentActivity/freeKarmaOnSubmission.yaml) | [JSON](/docs/subreddit/components/recentActivity/freeKarmaOnSubmission.json5) - Check if the Author has posted the Submission this check is running on in any "free karma" subreddits recently
# [Template Variables](../../actionTemplating.md)
# [Template Variables](/docs/subreddit/actionTemplating.md)
| Name | Description | Example |
|----------------------|------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|

View File

@@ -1,15 +1,8 @@
---
grand_parent: Subreddit Configuration
parent: In Depth
---
# Regex Rule
The **Regex** rule matches on text content from a comment or submission in the same way automod uses regex. The rule, however, provides additional functionality automod does not:
* Can set the **number** of matches that trigger the rule (`matchThreshold`)
Which can then be used in conjunction with a [`window`](../../activitiesWindow.md) to match against activities from the history of the Author of the Activity being checked (including the Activity being checked):
Which can then be used in conjunction with a [`window`](https://github.com/FoxxMD/context-mod/blob/master/docs/activitiesWindow.md) to match against activities from the history of the Author of the Activity being checked (including the Activity being checked):
* Can set the **number of Activities** that meet the `matchThreshold` to trigger the rule (`activityMatchThreshold`)
* Can set the **number of total matches** across all Activities to trigger the rule (`totalMatchThreshold`)
@@ -18,17 +11,17 @@ Which can then be used in conjunction with a [`window`](../../activitiesWindow.m
### Examples
* Trigger if regex matches against the current activity - [YAML](matchAnyCurrentActivity.yaml) | [JSON](matchAnyCurrentActivity.json5)
* Trigger if regex matches 5 times against the current activity - [YAML](matchThresholdCurrentActivity.yaml) | [JSON](matchThresholdCurrentActivity.json5)
* Trigger if regex matches against any part of a Submission - [YAML](matchSubmissionParts.yaml) | [JSON](matchSubmissionParts.json5)
* Trigger if regex matches any of Author's last 10 activities - [YAML](matchHistoryActivity.yaml) | [JSON](matchHistoryActivity.json5)
* Trigger if regex matches at least 3 of Author's last 10 activities - [YAML](matchActivityThresholdHistory.json5) | [JSON](matchActivityThresholdHistory.json5)
* Trigger if there are 5 regex matches in the Author's last 10 activities - [YAML](matchTotalHistoryActivity.yaml) | [JSON](matchTotalHistoryActivity.json5)
* Trigger if there are 5 regex matches in the Author's last 10 comments - [YAML](matchSubsetHistoryActivity.yaml) | [JSON](matchSubsetHistoryActivity.json5)
* Remove comments that are spamming discord links - [YAML](removeDiscordSpam.yaml) | [JSON](removeDiscordSpam.json5)
* Trigger if regex matches against the current activity - [YAML](/docs/subreddit/components/regex/matchAnyCurrentActivity.yaml) | [JSON](/docs/subreddit/components/regex/matchAnyCurrentActivity.json5)
* Trigger if regex matches 5 times against the current activity - [YAML](/docs/subreddit/components/regex/matchThresholdCurrentActivity.yaml) | [JSON](/docs/subreddit/components/regex/matchThresholdCurrentActivity.json5)
* Trigger if regex matches against any part of a Submission - [YAML](/docs/subreddit/components/regex/matchSubmissionParts.yaml) | [JSON](/docs/subreddit/components/regex/matchSubmissionParts.json5)
* Trigger if regex matches any of Author's last 10 activities - [YAML](/docs/subreddit/components/regex/matchHistoryActivity.yaml) | [JSON](/docs/subreddit/components/regex/matchHistoryActivity.json5)
* Trigger if regex matches at least 3 of Author's last 10 activities - [YAML](/docs/subreddit/components/regex/matchActivityThresholdHistory.json5) | [JSON](/docs/subreddit/components/regex/matchActivityThresholdHistory.json5)
* Trigger if there are 5 regex matches in the Author's last 10 activities - [YAML](/docs/subreddit/components/regex/matchTotalHistoryActivity.yaml) | [JSON](/docs/subreddit/components/regex/matchTotalHistoryActivity.json5)
* Trigger if there are 5 regex matches in the Author's last 10 comments - [YAML](/docs/subreddit/components/regex/matchSubsetHistoryActivity.yaml) | [JSON](/docs/subreddit/components/regex/matchSubsetHistoryActivity.json5)
* Remove comments that are spamming discord links - [YAML](/docs/subreddit/components/regex/removeDiscordSpam.yaml) | [JSON](/docs/subreddit/components/regex/removeDiscordSpam.json5)
* Differs from just using automod because this config can allow one-off/organic links from users who DO NOT spam discord links but will still remove the comment if the user is spamming them
# [Template Variables](../../actionTemplating.md)
# [Template Variables](/docs/subreddit/actionTemplating.md)
| Name | Description | Example |
|---------------|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|

View File

@@ -1,9 +1,4 @@
---
grand_parent: Subreddit Configuration
parent: In Depth
---
# Repeat Activity Rule
# Repeat Activity
The **Repeat Activity** rule will check for patterns of repetition in an Author's Submission/Comment history. Consult the [schema](https://json-schema.app/view/%23%2Fdefinitions%2FRepeatActivityJSONConfig?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FApp.json) for a complete reference of the rule's properties.
@@ -52,10 +47,10 @@ With only `gapAllowance: 2` this rule **would trigger** because the the 1 and 2
## Examples
* Crosspost Spamming [JSON](crosspostSpamming.json5) | [YAML](crosspostSpamming.yaml) - Check if an Author is spamming their Submissions across multiple subreddits
* Burst-posting [JSON](burstPosting.json5) | [YAML](burstPosting.yaml) - Check if Author is crossposting their Submissions in short bursts
* Crosspost Spamming [JSON](/docs/subreddit/components/repeatActivity/crosspostSpamming.json5) | [YAML](/docs/subreddit/components/repeatActivity/crosspostSpamming.yaml) - Check if an Author is spamming their Submissions across multiple subreddits
* Burst-posting [JSON](/docs/subreddit/components/repeatActivity/burstPosting.json5) | [YAML](/docs/subreddit/components/repeatActivity/burstPosting.yaml) - Check if Author is crossposting their Submissions in short bursts
# [Template Variables](../../actionTemplating.md)
# [Template Variables](/docs/subreddit/actionTemplating.md)
| Name | Description | Example |
|-----------------------|---------------------------------------------------------|-------------------------------------------------------------|

Some files were not shown because too many files have changed in this diff Show More