- Notifications
You must be signed in to change notification settings - Fork11
an event-based, reddit moderation bot built on top of snoowrap and written in typescript
License
FoxxMD/context-mod
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
title | nav_order |
---|---|
Home | 1 |
Context Mod (CM) is an event-based,reddit moderation bot built on top ofsnoowrap and written intypescript.
It is designed to help fill in the gaps forautomoderator in regard to more complex behavior with a focus onuser-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 inN 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) inN 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 forModerators:
- Complete botautonomy. YAML config isstored in your subreddit's wiki (like automoderator)
- Simple rule-action behavior can be combined to createcomplex behavior detection
- Support Activity filtering based on:
- Author criteria (name, css flair/text, age, karma, moderator status,Toolbox User Notes, and more!)
- Activity state (removed, locked, distinguished, etc...)
- State of Subreddit Activity is inSubreddit (nsfw, name, profile, etc...)
- Rules and Actions supportnamed references --write once, reference anywhere
- Powerfullogic control (if, then, goto)
- Delay/re-process activities using arbitrary rules
- Image Comparisons via fingerprinting and/or pixel differences
- Repost detection with support for external services (youtube, etc...)
- Event notification via Discord
- Web interface for monitoring, administration, and oauth bot authentication
- Placeholders (like automoderator) can be configured via a wiki page or raw text and supportsmustache templating
- Partial Configurations -- offload parts of your configuration to shared locations to consolidate logic between multiple subreddits
- Guest Access enables collaboration and easier setup by allowing temporary access
- Toxic content prediction usingmoderatehatespeech.com machine learning model
Feature highlights forDevelopers and Hosting (Operators):
- Server/client architecture
- 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-levelcaching of Reddit APIs responses and CM results
- Database Persistence using SQLite, MySql, or Postgres
- Audit trails for bot activity
- Historical statistics
- Docker container anddocker-compose support
- Easy, UI-basedOAuth authentication for adding Bots and moderator dashboard
- Integration withInfluxDB for detailedtime-series metrics and a pre-builtGrafanadashboard
Each subreddit using the RCB bot configures its behavior via their own wiki page.
When a monitoredActivity (new comment/submission, new modqueue item, etc.) is detected the bot runs through a list ofChecks to determine what to do with theActivity from that Event. EachCheck consists of :
Is this check for a submission or comment?
A list ofRules to run against theActivity. Triggered Rules can cause the whole Check to trigger and run itsActions
A list ofActions that describe what the bot should do with theActivity orAuthor of the activity (comment, remove, approve, etc.). The bot will runall Actions in this list.
TheChecks for a subreddit are split up intoSubmission Checks andComment Checks based on theirkind. 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.
This guide is for users who want torun their own bot on a ContextMod instance.
See theOperator's Getting Started Guide
This guide is forreddit moderators who want to configure an existing CM bot to run on their subreddit.
See theModerator's Getting Started Guide
Context Bot's configuration can be written in YAML (like automoderator) orJSON5. Its schema conforms toJSON Schema Draft 7. Additionally, manyoperator settings can be passed via command line or environmental variables.
- Foroperators (running the bot instance) see theOperator Configuration guide
- Formoderators consult theSubreddit Configuration Docs
Check the full docs for in-depth explanations of all concepts and examples
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 administrationper 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
- Viewreal-time logs of what the bot is doing on your subreddit
- Run bot on any permalink
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 view/invite link generation:
Moderator view/invite and authorization:
A similar helper and invitation experience is available for addingsubreddits to an existing bot.
A built-in editor usingmonaco-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
- 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
About
an event-based, reddit moderation bot built on top of snoowrap and written in typescript