Skip to content

Ktiseos-Nyx/PromptInspectorBot

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

180 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Prompt Inspector πŸ”Ž

Inspect AI image generation metadata from Discord uploads. Enhanced fork with powerful security features and streamlined setup.

Deploy on Railway

πŸ“‘ Table of Contents


Features

Core Features

  • πŸ” Comprehensive Metadata Parsing - Supports Forge/A111, 200+ ComfyUI nodes (FLUX, PixArt, Griptape, etc.) as well as SwarmUI etc.
  • ✨ JPG Upload Support Where Discord fails, there is a R2 bucketing support for Jpeg/WebP Upload/Processing support.
  • 1️⃣2️⃣3️⃣ Multiple Interaction Styles - Numbered emoji reactions, slash commands, or context menus
  • πŸ“¦ Batch Processing - Handle 6+ images with a single reaction
  • πŸ‘₯ PluralKit Support - Automatically resolves proxied messages
  • πŸ’Ύ Lightweight - Runs metadata parser in separate process (~100MB RAM)

AI Features

  • ✨ /describe - Generate AI descriptions (Danbooru tags or natural language)
  • πŸ’¬ /ask - Conversational AI with context memory
  • πŸ’¬ /coder - Coding Help with AI context.
  • πŸ’¬ /techsupport - Will ask you if you turned it off and on again.
  • πŸ”„ Multi-Provider - Gemini + Claude with automatic fallback

Security Features

  • πŸ›‘οΈ Anti-Scam Detection - Behavior-based crypto/wallet spam detection
  • 🚫 Cross-Posting Protection - Instant ban for spam across multiple channels
  • πŸ”’ Malware Prevention - Magic bytes check on attachments and embeds
  • πŸ“Š Smart Scoring - Context-aware detection (allows emotional spam from trusted users)

Screenshots & Examples

Bot in Action

Metadata extraction and display Metadata Extraction
View comprehensive metadata from AI-generated images with clean embeds
Settings management Per-Server Settings
Configure features per-server with an intuitive settings UI
Fun commands Fun Commands
Interactive commands like /goodnight with random GIFs and messages
AI commands AI-Powered Commands
/describe, /ask, /coder, /techsupport with Gemini + Claude integration
Context menus and reactions
Multiple Interaction Styles
Use emoji reactions, slash commands, or right-click context menus

Quick Start

Local Setup
# Clone and setup
git clone https://github.com/Ktiseos-Nyx/PromptInspectorBot.git
cd PromptInspectorBot
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

# Configure
cp config.example.toml config.toml
# Edit config.toml with your settings

# Run (new modular version)
python3 main.py
Docker Deployment
# Build
docker build -t prompt-inspector-bot .

# Run with .env file
docker run -d --env-file .env prompt-inspector-bot
Environment Variables (Required)
BOT_TOKEN=your_discord_bot_token

# Optional but recommended
GEMINI_API_KEY=your_gemini_key
ANTHROPIC_API_KEY=your_claude_key

How to Use

Metadata Inspection

  1. Post an image in a monitored channel
  2. Click emoji reactions:
    • 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ - View individual image metadata (1-5 images)
    • πŸ“¦ - Download all metadata as files (6+ images)
  3. Or use commands:
    • /metadata <image> - Parse uploaded image
    • Right-click image β†’ "View Prompt"

AI Features

  • /ask <question> - Chat with AI (remembers context per user)
  • /describe <image> <style> - Generate AI tags/descriptions

Security System

πŸ›‘οΈ Anti-Scam Features

What It Detects

Type 1: Wallet Scammers

  • Currency symbols in username (Β£, €, Β₯, β‚Ώ)
  • Hoisting characters (=, !, #)
  • ALL CAPS crypto spam
  • Keywords: WALLET, SOL, PAY, DEAD TOKENS

Type 2: Screenshot Spammers

  • 4+ images cross-posted to multiple channels
  • Gibberish text or empty messages
  • Auto-generated usernames (word.word1234_5678)

How It Works

Score Action
100+ Instant Ban - User banned, all messages deleted
75-99 Delete + Alert - Message removed, admins notified
50-74 Watchlist - Logged for monitoring

Detection Methods

βœ… Magic Bytes Check - Scans attachments AND embeds for malware βœ… Cross-Posting - Same message in 2+ channels = ban βœ… Gibberish Detection - Context-aware (allows "AAAA" from users with roles) βœ… Username Analysis - Hoisting, currency symbols, auto-generated patterns βœ… Role Tracking - CATCHER role exploitation detection

Configuration

# config.toml
CATCHER_ROLE_ID = 1336289642789470228  # Self-assignable role scammers exploit
TRUSTED_USER_IDS = [123456789]         # Bypass security (mods, bots)
ADMIN_CHANNEL_ID = 1234567890          # Ban notification channel

Automatic Bypasses:

  • βœ… Server owners
  • βœ… Trusted users (configured above)

AI Provider Setup

πŸ€– Multi-Provider System

The bot supports both Gemini and Claude with automatic fallback!

Quick Setup

# Set API keys for providers you want
GEMINI_API_KEY=your_gemini_key
ANTHROPIC_API_KEY=your_claude_key

# Provider priority (tries first, falls back to next)
LLM_PROVIDER_PRIORITY=claude,gemini

Gemini Configuration

GEMINI_PRIMARY_MODEL=gemini-flash-latest
GEMINI_FALLBACK_MODELS=gemini-flash-latest,gemini-2.5-pro,gemini-2.5-flash

Model Recommendations:

Model Speed Quality Free Tier Best For
gemini-flash-latest ⚑⚑⚑ Good 15/min Recommended
gemini-2.5-pro ⚑ Excellent 2/min Complex tasks
gemini-2.5-flash ⚑⚑⚑ Good 15/min ⚠️ Overly strict

Claude Configuration

CLAUDE_PRIMARY_MODEL=claude-3-5-haiku-20241022

Model Recommendations:

Model Speed Cost (per 1M tokens) Best For
claude-3-5-haiku-20241022 ⚑⚑⚑ $0.25 / $1.25 Recommended
claude-3-5-sonnet-20241022 ⚑⚑ $3 / $15 Higher quality

Budget tip: $5 starter credit = ~1,500 image descriptions with Haiku!

NSFW/Artistic Content Mode

If Gemini blocks artistic content (PG-13/R-rated, not NC-17):

NSFW_PROVIDER_OVERRIDE=claude

This skips Gemini entirely for /describe and uses only Claude.


R2 Upload Feature (Optional)

πŸ“€ Cloudflare R2 Integration

Upload JPEG/WebP files to extract metadata without Discord stripping it.

Features

  • πŸ”’ Rate Limited - Generous rate limiting to prevent CPU overload.
  • πŸ—‘οΈ Auto-Delete - 30-day retention
  • πŸ“ Size Limited - 10MB max to keep to Non-Nitro.

Setup

  1. Create R2 Bucket in Cloudflare
  2. Set environment variables:
R2_ACCOUNT_ID=your_account_id
R2_ACCESS_KEY_ID=your_access_key
R2_SECRET_ACCESS_KEY=your_secret_key
R2_BUCKET_NAME=your_bucket_name
UPLOADER_URL=https://your-pages.pages.dev/uploader.html
  1. Deploy uploader.html to Cloudflare Pages
  2. Set lifecycle rule for 30-day auto-deletion:
    • Prefix: uploads/
    • Action: Delete object
    • Days: 30

Security

  • βœ… Rate limiting (5/day per user)
  • βœ… File validation (10MB, JPEG/WebP only)
  • βœ… Presigned URL expiry (1 hour)
  • βœ… Auto-deletion (30 days)
  • ⚠️ Users warned about security risks

Configuration

βš™οΈ Full Configuration Options

Server & Channel Configuration

# Allowed servers (empty = all servers)
ALLOWED_GUILD_IDS = [123456789, 987654321]

# Monitored channels (empty = all channels)
MONITORED_CHANNEL_IDS = []

# Per-channel features
[channel_features]
1234567890 = ["metadata", "describe"]
9876543210 = ["ask"]

Bot Behavior

REACT_ON_NO_METADATA = false
EMOJI_METADATA_FOUND = "πŸ”Ž"
EMOJI_NO_METADATA = "β›”"
SCAN_LIMIT_BYTES = 10485760  # 10MB

AI Configuration

LLM_PROVIDER_PRIORITY = ["claude", "gemini"]
GEMINI_PRIMARY_MODEL = "gemini-flash-latest"
CLAUDE_PRIMARY_MODEL = "claude-3-5-haiku-20241022"

Security Configuration

CATCHER_ROLE_ID = 1336289642789470228
TRUSTED_USER_IDS = []
ADMIN_CHANNEL_ID = 0

Permissions

Core Permissions (Required)

  • βœ… Read Messages/View Channel
  • βœ… Send Messages
  • βœ… Read Message History
  • βœ… Add Reactions
  • βœ… Attach Files

Security Permissions (Optional)

  • πŸ›‘οΈ Ban Members - Auto-ban scammers
  • πŸ›‘οΈ Manage Messages - Delete spam

Troubleshooting

Common Issues

Bot not responding:

  • Check bot is online
  • Verify permissions (see above)
  • Check logs for errors

Describe feature not working:

  • Ensure GEMINI_API_KEY or ANTHROPIC_API_KEY is set
  • Check API quotas
  • Review logs for API errors

Images not processed:

  • Check file format (PNG, JPEG, WebP)
  • Verify size is under SCAN_LIMIT_BYTES
  • Ensure channel is in MONITORED_CHANNEL_IDS (if configured)

Security system banning legit users:

  • Add user ID to TRUSTED_USER_IDS
  • Server owners are automatically trusted
  • Users with roles can post emotional spam ("AAAA")

Forking This Bot

🍴 Important Notes for Forks

If you're forking this bot for your own use, please update the following:

Required Changes

  1. Ko-fi Links - Replace with your own: - uploader.html: Lines 112, 114

    • bot_enhanced.py: Search for ko-fi.com/OTNAngel and ko-fi.com/duskfallcrew
    • Update to your Ko-fi/donation links
  2. Discord Invite - Replace with your server:

    • uploader.html: Line 117 - discord.gg/HhBSvM9gBY
    • bot_enhanced.py: Search for discord.gg/HhBSvM9gBY
    • Update to your support server invite
  3. Ko-fi Role ID - Set your role ID:

    • config.toml: Add KOFI_SUPPORTER_ROLE_ID = your_role_id
    • Get from Discord β†’ Server Settings β†’ Roles β†’ Right-click role β†’ Copy ID

Optional (But Appreciated)

  • Keep the Ko-fi link in uploader.html if you want to support the original developer
  • Credit this fork in your README
  • Share improvements back via pull requests!

Rate Limits (Configurable)

You can adjust these in bot_enhanced.py:

MAX_UPLOADS_PER_MINUTE = 10  # Burst protection
MAX_UPLOADS_PER_DAY_FREE = 100  # Free users
MAX_UPLOADS_PER_DAY_SUPPORTER = 500  # Ko-fi supporters

Legal

Quick Summary:

  • βœ… Extract metadata, send to you
  • βœ… Delete images immediately after processing
  • ❌ Don't store images or metadata
  • ❌ Don't track or sell data

πŸ€– This bot is a fork of PromptInspectorBot with significant enhancements.

About

A discord bot that allows users to easily view the prompts of images that other users send, enhanced with dataset tools CLI.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.3%
  • Other 0.7%