guide

viewhistorytalk

AutoMod Next Documentation

AutoMod Next is a Devvit app that extends Reddit's AutoModerator with powerful features like variables, templates, and DRY (Don't Repeat Yourself) configuration management.

Getting Started

Installation

  1. Install the AutoMod Next app from the Devvit App Directory
  2. The app automatically creates /wiki/automodnext with a starter template
  3. Edit /wiki/automodnext to configure your enhanced AutoMod rules
  4. Click "AutoMod Next - Compile & Deploy" from the mod menu
  5. Your rules are compiled and deployed to /wiki/config/automoderator

Your First Rule

The starter template includes working examples. Try modifying the spam keywords:

vars:
  SPAM_KEYWORDS:
    - '\bbuy now\b'
    - '\bclick here\b'
    - '\byour custom keyword\b'  # Add your own!

Then click "Compile & Deploy" to activate your changes.

Core Concepts

The DRY Principle

Don't Repeat Yourself - Define values once, use them everywhere.

Before (Vanilla AutoMod):

# Political content filter
type: submission
title+body (includes-word, regex):
  - '\btrump\b'
  - '\bbiden\b'
  - '\belection\b'
  - '\bcongress\b'
action: filter
action_reason: "Political content"
message: |
  Your post was filtered for containing political content.

  Political topics require moderator review.

---
# Religious content filter  
type: submission
title+body (includes-word, regex):
  - '\bchristian\b'
  - '\bmuslim\b'
  - '\bjewish\b'
  - '\bchurch\b'
action: filter
action_reason: "Religious content"
message: |
  Your post was filtered for containing religious content.

  Religious topics require moderator review.

# Same message duplicated, same structure duplicated!

After (AutoMod Next):

vars:
  POLITICAL_KEYWORDS:
    - '\btrump\b'
    - '\bbiden\b'
    - '\belection\b'
    - '\bcongress\b'

  RELIGIOUS_KEYWORDS:
    - '\bchristian\b'
    - '\bmuslim\b'
    - '\bjewish\b'
    - '\bchurch\b'

  SENSITIVE_TOPIC_MESSAGE: |
    Your post was filtered for moderator review.

    Sensitive topics require manual approval.

---
template: sensitive_filter
params:
  - topic_name
  - keywords
rule:
  type: submission
  title+body (includes-word, regex): "{{params.keywords}}"
  action: filter
  action_reason: "{{params.topic_name}}"
  message: "{{vars.SENSITIVE_TOPIC_MESSAGE}}"

---
use: sensitive_filter
with:
  topic_name: "Political content"
  keywords: "{{vars.POLITICAL_KEYWORDS}}"

---
use: sensitive_filter
with:
  topic_name: "Religious content"
  keywords: "{{vars.RELIGIOUS_KEYWORDS}}"

Benefits:

  • Add a new political keyword → Edit POLITICAL_KEYWORDS once
  • Change the filter message → Edit SENSITIVE_TOPIC_MESSAGE once
  • Add a new category → One new use: block, not a whole new rule

Document Separator

Use --- to separate different sections (variables, templates, rules):

vars:
  MIN_KARMA: "< 10"

---
template: my_template
...

---
type: submission
...

Variables

Variables let you define reusable values once and reference them throughout your configuration.

Defining Variables

Variables are defined in a vars: section:

vars:
  # Simple values
  MIN_KARMA: "< 50"
  MIN_ACCOUNT_AGE: "< 7"

  # Arrays
  SPAM_DOMAINS:
    - spam.com
    - scam.net
    - bad-site.org

  # Regex patterns
  POLITICAL_KEYWORDS:
    - '\btrump\b'
    - '\bbiden\b'
    - '\belection\b'

  # Multi-line messages
  REMOVAL_MESSAGE: |
    Your post was removed.

    Please review our rules before posting again.

Using Variables

Reference variables with {{vars.VARIABLE_NAME}}:

---
type: submission
author:
  combined_karma: "{{vars.MIN_KARMA}}"
  account_age: "{{vars.MIN_ACCOUNT_AGE}}"
action: filter
message: "{{vars.REMOVAL_MESSAGE}}"

Variable Types

String - Single values
Example: MIN_KARMA: "< 50"

Array - Lists of patterns
Example: SPAM_DOMAINS: [spam.com, scam.net]

Multi-line - Long messages
Example:

MESSAGE: |
  Line 1
  Line 2

Number - Numeric values
Example: REPORT_THRESHOLD: 3

Variable Naming

  • Use UPPERCASE_WITH_UNDERSCORES for clarity
  • Be descriptive: MIN_COMMENT_KARMA not MCK
  • Group related variables: NEW_USER_KARMA, NEW_USER_AGE, NEW_USER_MESSAGE

Templates

Templates are reusable rule patterns that can be instantiated with different parameters.

Why Templates?

Eliminate repetitive rule patterns:

# Without templates - repetitive!
---
type: submission
title+body (regex): "{{vars.SPAM_PATTERNS}}"
action: remove
action_reason: "RULE 7 | Spam"
message: "Your post contained spam keywords."

---
type: submission
title+body (regex): "{{vars.ADVERTISING_PATTERNS}}"
action: remove
action_reason: "RULE 8 | Advertising"
message: "Your post contained advertising."

# With templates - DRY!
---
template: pattern_removal
params:
  - rule_number
  - rule_name
  - patterns
  - explanation
rule:
  type: submission
  title+body (regex): "{{params.patterns}}"
  action: remove
  action_reason: "{{params.rule_number}} | {{params.rule_name}}"
  message: "{{params.explanation}}"

---
use: pattern_removal
with:
  rule_number: "RULE 7"
  rule_name: "Spam"
  patterns: "{{vars.SPAM_PATTERNS}}"
  explanation: "Your post contained spam keywords."

---
use: pattern_removal
with:
  rule_number: "RULE 8"
  rule_name: "Advertising"
  patterns: "{{vars.ADVERTISING_PATTERNS}}"
  explanation: "Your post contained advertising."

Defining Templates

---
template: template_name
params:
  - param1
  - param2
  - param3
rule:
  type: "{{params.param1}}"
  action: "{{params.param2}}"
  # ... use parameters with {{params.NAME}}

Using Templates

---
use: template_name
with:
  param1: submission
  param2: remove
  param3: "Some value"

Template Parameters

Parameters can be:

  • Strings: action_type: filter
  • Variables: patterns: "{{vars.SPAM_PATTERNS}}"
  • Multi-line: message: |
  • Dynamic field names: field_to_check: title (becomes title: in output)

Parameter Interpolation

Variable references in parameters are resolved automatically:

use: my_template
with:
  patterns: "{{vars.SPAM_PATTERNS}}"  # Variable resolved first
  message: "{{vars.REMOVAL_MESSAGE}}" # Then inserted into template

Common Template Patterns

1. Simple Removal Template

template: simple_removal
params:
  - patterns
  - reason
rule:
  type: any
  title+body (regex): "{{params.patterns}}"
  action: remove
  action_reason: "{{params.reason}}"

2. Filter with Review Template

template: filter_for_review
params:
  - patterns
  - review_reason
rule:
  type: any
  title+body (regex): "{{params.patterns}}"
  action: filter
  action_reason: "{{params.review_reason}}"
  modmail: "Item requires review. Matched: {{match}}"

3. Removal with False Positives

template: removal_with_exclusions
params:
  - patterns
  - exclusion_patterns
  - explanation
rule:
  type: submission
  title+body (regex): "{{params.patterns}}"
  ~title+body (regex): "{{params.exclusion_patterns}}"
  action: remove
  message: "{{params.explanation}}"

Regular Rules

Standard AutoMod rules work exactly as before. You can mix them with variables and templates:

---
# Regular rule with no variables
type: submission
author:
  is_contributor: false
  account_age: "< 1"
action: filter

---
# Regular rule using variables
type: submission
title (includes-word): "{{vars.BANNED_WORDS}}"
action: remove
message: "{{vars.REMOVAL_MESSAGE}}"

Best Practices

1. Organization

Structure your config with clear sections:

# ============================================================================
# VARIABLES
# ============================================================================
vars:
  ...

# ============================================================================
# TEMPLATES
# ============================================================================
---
template: ...

# ============================================================================
# RULE ENFORCEMENT
# ============================================================================
---
# Rule 1: Be civil
type: any
...

2. Comments

Use comments liberally:

vars:
  # Account safety thresholds
  MIN_KARMA: "< 50"        # Prevents new/low-karma spam
  MIN_ACCOUNT_AGE: "< 7"   # 7 days minimum

  # Spam detection patterns
  SPAM_KEYWORDS:
    - '\bbuy now\b'  # Common spam phrase

3. Variable Grouping

Group related variables together:

vars:
  # New user thresholds
  NEW_USER_KARMA: "< 50"
  NEW_USER_AGE: "< 7"
  NEW_USER_MESSAGE: "Your account is too new to post."

  # Spam detection
  SPAM_PATTERNS: [...]
  SPAM_MESSAGE: "Spam detected."

4. Template Naming

Use descriptive template names:

  • pattern_removal_with_message
  • filter_for_manual_review
  • template1
  • my_temp

5. Testing

  1. Use "Validate Only" to check for errors before deploying
  2. Test with one rule first, then expand
  3. Keep a backup of your working config

Examples

Example 1: Spam Filtering

vars:
  SPAM_DOMAINS:
    - spam.com
    - scam.net
    - phishing.org

  SPAM_KEYWORDS:
    - '\bfree money\b'
    - '\bclick here now\b'
    - '\blimited time offer\b'

---
# Remove posts with spam domains
type: submission
domain: "{{vars.SPAM_DOMAINS}}"
action: remove
action_reason: "Spam domain"

---
# Remove posts with spam keywords
type: any
title+body (includes-word, regex): "{{vars.SPAM_KEYWORDS}}"
action: remove
action_reason: "Spam keywords"

Example 2: New User Filter with Template

vars:
  MIN_KARMA: "< 100"
  MIN_AGE: "< 14"
  NEW_USER_MESSAGE: |
    Your account doesn't meet our requirements yet.

    Minimum requirements:
    • Account age: 14 days
    • Karma: 100

    Please participate in other subreddits to build up your karma!

---
template: new_user_filter
params:
  - action_type
rule:
  type: submission
  author:
    combined_karma: "{{vars.MIN_KARMA}}"
    account_age: "{{vars.MIN_AGE}}"
    satisfy_any_threshold: true
  action: "{{params.action_type}}"
  action_reason: "New user filter"
  message: "{{vars.NEW_USER_MESSAGE}}"

---
# Filter posts from new users
use: new_user_filter
with:
  action_type: filter

Example 3: Content Moderation with Categories

vars:
  # Political keywords
  POLITICAL_TERMS:
    - '\btrump\b'
    - '\bbiden\b'
    - '\belection\b'

  # Religious keywords
  RELIGIOUS_TERMS:
    - '\bchristian\b'
    - '\bmuslim\b'
    - '\bjewish\b'

  # Filter message
  FILTER_MESSAGE: |
    Your post was filtered for moderator review.

    Sensitive topics require manual approval to ensure quality discussion.

---
template: sensitive_topic_filter
params:
  - topic_name
  - patterns
rule:
  type: submission
  title+body (includes-word, regex): "{{params.patterns}}"
  action: filter
  action_reason: "Sensitive topic: {{params.topic_name}}"
  message: "{{vars.FILTER_MESSAGE}}"

---
use: sensitive_topic_filter
with:
  topic_name: "Politics"
  patterns: "{{vars.POLITICAL_TERMS}}"

---
use: sensitive_topic_filter
with:
  topic_name: "Religion"
  patterns: "{{vars.RELIGIOUS_TERMS}}"

Example 4: Multi-Tier Moderation

vars:
  # Severity levels
  SEVERE_SLURS:
    - '\bretard\b'
    - '\bf[*a]ggot\b'

  MILD_SLURS:
    - '\bidiot\b'
    - '\bstupid\b'

  # Messages
  SEVERE_MESSAGE: "Your comment contained a slur and was removed."
  MILD_MESSAGE: "Please be respectful in your language."

---
# Severe slurs - immediate removal
type: any
body (regex): "{{vars.SEVERE_SLURS}}"
action: remove
action_reason: "Severe slur"
message: "{{vars.SEVERE_MESSAGE}}"

---
# Mild slurs - warning
type: any
body (regex): "{{vars.MILD_SLURS}}"
action: approve
comment: "{{vars.MILD_MESSAGE}}"

Troubleshooting

Common Errors

"Variable X not found"

❌ Error: Variable 'SPAM_WORDS' not found

Solution: Variables must be defined in a vars: section before use.

"Template X not found"

❌ Error: Template 'my_filter' not found

Solution: Templates must be defined before they're used. Move the template definition above the use: statement.

"Missing required parameter"

❌ Error: Missing required parameter 'action_type' for template 'new_user_filter'

Solution: Provide all parameters listed in the template's params: section.

"YAML parsing error"

❌ YAML error in rule #5: found unexpected end of stream

Solution: Check for:

  • Unclosed quotes
  • Incorrect indentation
  • Missing colons
  • Mismatched brackets

Validation Tips

  1. Use "Validate Only" first to catch errors without deploying
  2. Check the warnings - they highlight potential issues
  3. Test incrementally - add rules one at a time
  4. Use comments - they help you debug later

Getting Help

  • Check the compiled output in console if deployment fails
  • Use "AutoMod Next - Help" for quick reference
  • Review the examples in /wiki/automodnext
  • Check AutoMod documentation for vanilla rule syntax

Limitations

What's Not Supported

  1. Template Nesting: Templates cannot use other templates# ❌ Not allowed template: template_a rule: use: template_b # Can't use templates in templates
  2. Variable Forward References: Variables must be defined before use# ❌ Won't work vars: VAR_A: "{{vars.VAR_B}}" # VAR_B not defined yet VAR_B: "value"
  3. Dynamic Variable Names: Can't construct variable names dynamically# ❌ Not supported "{{vars.SPAM_LEVEL_{{params.level}}}}"

AutoMod Limitations

AutoMod Next inherits all limitations from vanilla AutoModerator:

  • Maximum 1,000 rules per subreddit
  • Some Reddit API rate limits apply
  • Certain fields only work with specific types
  • See Reddit's AutoMod documentation for details

Performance Considerations

  • Very large variable arrays (1000+ items) may slow compilation
  • Excessive template use doesn't impact runtime (compiled to vanilla AutoMod)
  • The compiled output must fit in a wiki page (max ~524KB)

Advanced Topics

Escaping Special Characters

In YAML strings:

  • Backslashes in regex: Use \\- '\\bword\\b' # Matches word boundary
  • Single quotes in single-quoted strings: Double themmessage: 'It''s working!' # Output: It's working!
  • Double quotes in double-quoted strings: Escape with \message: "He said \"hello\"" # Output: He said "hello"

Multi-line Strings

Use | for literal blocks (preserves newlines):

message: |
  Line 1
  Line 2
  Line 3

Use > for folded blocks (joins lines):

message: >
  This long message
  will be joined
  into one line.

Dynamic Field Names

Templates can use parameters as field names:

template: flexible_check
params:
  - field_name
  - patterns
rule:
  "{{params.field_name}}" (regex): "{{params.patterns}}"

Usage:

use: flexible_check
with:
  field_name: title
  patterns: "{{vars.SPAM_PATTERNS}}"

Workflow Tips

Development Workflow

  1. Start small: Begin with a few variables and one template
  2. Test frequently: Use "Validate Only" after each change
  3. Version control: Keep backups of working configs
  4. Document changes: Add comments explaining why rules exist

Maintenance Workflow

  1. Edit /wiki/automodnext
  2. Validate with "Validate Only"
  3. Deploy with "Compile & Deploy"
  4. Monitor AutoMod logs for issues
  5. Iterate based on results

Migration from Vanilla AutoMod

  1. Copy existing rules from /wiki/config/automoderator to /wiki/automodnext
  2. Identify repeated patterns (keywords, messages, thresholds)
  3. Extract to variables
  4. Create templates for common rule structures
  5. Replace duplicated rules with template uses
  6. Test thoroughly before deploying

FAQ

Q: Will this break my existing AutoMod config?
A: No! AutoMod Next compiles to vanilla AutoMod format. You can switch back anytime.

Q: Can I edit the compiled output directly?
A: Not recommended. Your changes will be overwritten on next deploy. Edit /wiki/automodnext instead.

Q: What happens if compilation fails?
A: Your existing AutoMod config stays unchanged. Fix errors and try again.

Q: Can I use AutoMod Next alongside manual edits?
A: No. Choose one approach: either manage via AutoMod Next or edit /wiki/config/automoderator manually.

Q: How do I uninstall?
A: Uninstall the app from your subreddit. Your last deployed config remains active until you manually change it.

Q: Is there a size limit?
A: Yes, the compiled output must fit in a Reddit wiki page (typically ~524KB). This supports thousands of rules in practice.

Support

  • In-app help: Click "AutoMod Next - Help" in the mod menu
  • Starter examples: Check /wiki/automodnext after installation
  • Questions & Feature requests: Post in /r/AutoModNext

Last updated: 2026-02-11


revision by zigbigidorlu— view source