# Stop AI - AI Detection Bot

A Reddit Devvit app that automatically detects and moderates AI-generated content in your subreddit.

## What It Does

This bot monitors all new posts in your subreddit and uses advanced detection methods to identify AI-generated content:

- **Compression Analysis**: Analyzes how well text compresses to detect AI patterns

- **Linguistic Analysis**: Examines writing patterns, vocabulary, and sentence structure

- **Combined Scoring**: Uses multiple detection methods for accurate results

## Features

### Manual Detection

- **User-Accessible**: All users can check posts/comments for AI content

- **One-Time Check**: Each post/comment can only be checked once to prevent abuse

- **Moderator Override**: Moderators can re-check previously analyzed content

- **Dual Detection Methods**: Uses compression and linguistic analysis for accuracy

- **Configurable Threshold**: Adjustable confidence level (default: 20%)

- **Clear Feedback**: Displays "Previously flagged as AI/Human" for already-checked content

- **Anonymous Reporting**: User reports are marked as "User-reported" without storing reporter identity (GDPR compliant)

### Moderation Actions

- **Remove Posts**: Automatically removes detected AI content (optional)

- **Assign Flairs**: Tags users with AI/BOT or HUMAN flairs (required for tracking)

- **Create Mod Notes**: Adds moderator notes for tracking (optional)

- **Discord Notifications**: Optional webhook integration

- **User Banning**: Optional automatic banning of detected AI users

### Smart Filtering

- **Abuse Prevention**: One-time check policy prevents spam

- **Processed Tracking**: 30-day tracking period for checked content

- **UNAI Support**: Moderators can reverse incorrect flags and allow re-checking

- **Moderator Privileges**: Moderators bypass one-time check restrictions

## Installation

1. Install the app to your subreddit through the Devvit App Directory

2. Configure settings in the app's settings panel

## How It Works

### Manual Processing (User & Moderator Tools)

The bot processes content when manually triggered to avoid rate limiting issues:

#### Post Menu Action

- **Location**: On any post

- **Function**: "Check for AI"

- **Who Can Use**: All users (including non-moderators)

- **Action**: Runs AI detection on the post and applies moderation actions

- **One-Time Check**: Each post can only be checked once per user to prevent abuse

- **Result Display**: Shows "Previously flagged as AI" or "Previously flagged as Human" if already checked

- **Moderator Override**: Moderators can re-check posts that have already been processed

- **Ban Behavior**: User reports only trigger bans if "Allow User Reports to Trigger Bans" is enabled

#### Comment Menu Action

- **Location**: On any comment

- **Function**: "Check for AI"

- **Who Can Use**: All users (including non-moderators)

- **Action**: Runs AI detection on the comment and creates mod notes

- **One-Time Check**: Each comment can only be checked once per user to prevent abuse

- **Result Display**: Shows "Previously flagged as AI" or "Previously flagged as Human" if already checked

- **Moderator Override**: Moderators can re-check comments that have already been processed

- **Ban Behavior**: User reports only trigger bans if "Allow User Reports to Trigger Bans" is enabled

#### Batch UNAI Processing

- **Location**: Subreddit menu (moderators only)

- **Function**: "Process UNAI Commands"

- **Format**: `username1,username2,username3`

- **Action**: Reverses AI detection actions for multiple users and clears processed flags

- **UNAI Meaning**: "Undo Non-Authentic Intelligence" - clears users from AI detection systems

- **Re-check Enabled**: After UNAI, content can be re-checked by users

### Operation Mode

The bot operates in **manual-only mode** to respect rate limits and prevent abuse:

- **On-demand Processing**: Users and moderators can select specific posts/comments to analyze

- **Controlled Usage**: Each post/comment can only be analyzed once (unless by a moderator)

- **Abuse Prevention**: Prevents spamming of AI checks on the same content

- **Moderator Control**: Moderators can override the one-time limit and re-process content

- **Processed Tracking**: Results are stored for 30 days to maintain the one-time check policy

## Configuration

### Detection Settings

- **AI Detection Threshold**: Confidence level for AI detection (0-100%, default: 20%)

- **Enable Detection Methods**: Toggle individual detection methods

### Moderation Settings

- **Remove AI Posts**: Automatically remove detected content (optional)

- **AI/BOT Flair Template ID**: Flair ID for AI-detected users (required for tracking)

- **HUMAN Flair Template ID**: Flair ID for human-verified users (required for UNAI)

- **Create Mod Notes**: Add moderator notes for tracking (optional)

- **Mod Note Labels**: Choose label types for AI and human verification notes

- **Enable User Banning**: Automatically ban users detected as AI (optional)

- **Ban Message Template**: Custom message sent to banned users

- **Ban Note Message**: Internal moderator note for bans

- **Allow User Reports to Trigger Bans**: Enable regular users to indirectly trigger bans through AI reports (default: disabled)

### Advanced Settings

- **Skip Moderators**: Don't analyze moderator posts

- **Skip Approved Contributors**: Don't analyze contributor posts

- **Discord Webhook**: Optional notification integration

## How It Works

1. **Post Analysis**: When a new post is submitted, the bot analyzes the text content

2. **Detection Scoring**: Multiple detection methods provide confidence scores

3. **Combined Assessment**: Scores are weighted and combined for final decision

4. **Moderation Actions**: If AI is detected above threshold, moderation actions are taken

5. **Human Verification**: Users with low AI scores receive human verification

## Accuracy

- **Flexible Threshold**: Configurable threshold (default 20%) allows fine-tuning

- **Dual Methods**: Multiple detection approaches improve accuracy

- **Human Verification**: Low-confidence users are marked as human

## Support

### For Users

- **AI Detection**: Any user can check posts/comments for AI content using the "Check for AI" menu action

- **One Check Per Item**: Each post or comment can only be checked once to prevent abuse

- **Incorrect Flags**: If you believe you've been incorrectly flagged, contact the moderator team

- **UNAI Reversals**: Moderators can use the UNAI command to reverse incorrect AI detection actions

### For Moderators

- **Re-check Ability**: Moderators can re-check posts/comments that have already been processed

- **UNAI Command**: Use "Process UNAI Commands" from the subreddit menu to reverse AI flags

- **Batch Processing**: Process multiple usernames at once (comma-separated)

- **Clear Processed Flags**: UNAI automatically clears processed flags, allowing content to be re-checked

- **User Report Ban Control**: Configure whether user reports can trigger bans via the "Allow User Reports to Trigger Bans" setting

### User Report Ban Behavior

The app provides granular control over how user reports affect banning:

**When "Allow User Reports to Trigger Bans" is DISABLED (default):**

- User reports will still remove posts/comments (if removal is enabled)

- User reports will still create mod notes (if mod notes are enabled)

- User reports will still assign flairs

- User reports will **NOT** trigger user bans

- Only moderator-initiated checks can trigger bans

- Moderators maintain full control over ban decisions

**When "Allow User Reports to Trigger Bans" is ENABLED:**

- User reports can trigger bans if AI is detected

- All other actions (removal, mod notes, flairs) still apply

- Ban notes will show "User-reported" to indicate origin

- Users can indirectly cause bans, so enable with caution

- Moderators can still reverse with UNAI command

## Privacy & GDPR Compliance

This bot is designed with privacy and GDPR compliance in mind:

- **Public Content Only**: Only analyzes publicly posted content, no access to private user data

- **Anonymous Reporting**: When users report content, their identity is never stored or logged

- **User Report Indicator**: Mod notes and ban logs indicate "User-reported" without revealing reporter identity

- **Local Processing**: All analysis is performed within Reddit's infrastructure

- **Time-Limited Storage**: Processed flags are stored for 30 days, then automatically expire

- **Right to Erasure**: UNAI command allows moderators to reverse actions and clear flags

### User Reporting Privacy

When a regular user (non-moderator) uses the "Check for AI" feature:

- The system only records whether the check was initiated by a moderator or a user

- The specific username of the reporter is never logged or stored

- Mod notes show "User-reported" tag without any identifying information

- This ensures GDPR compliance and protects reporter privacy

---

If you run into problems with the app itself, please create a post in https://reddit.com/r/bricksapps with the issue(s). Thank you!