Skip to content

BonkerBot ๐Ÿ”จ โ€‹

An open-source Discord scam filter with global reputation scoring, OCR on images, pattern learning, and community-driven training.

"Because Discord won't do jack shit."

Running your own instance โ€‹

This repository is the bot: commands, moderation flows, scoring, the trust score maths, appeals, audit logging, retention. Everything that decides what happens to a person is here and auditable.

What is not here is the scam pattern library. A published detection list is a bypass checklist, so ours stays private. Two consequences for self-hosting:

  • Bring your own patterns. A fresh instance starts with no detection rules. The training tools are included; the rules are not.
  • You are not on the trust network. A self-hosted instance cannot read or write the global reputation scores. We have no way to verify what an instance we do not operate reports to us โ€” the code is modifiable by definition, so accepting that data would let anyone poison reputations network-wide. Your instance keeps its own local scores instead.

Full reasoning: https://bonkerbot.app/docs/open-source

Features โ€‹

๐Ÿ” Multi-Layer Scam Detection โ€‹

  • Text Analysis โ€” Pattern-matching engine with rules for phishing, crypto scams, fake services, impersonation, urgency tactics, malware links, and more
  • Link Analysis โ€” URL extraction, blocked domain lists, typosquatting detection (Levenshtein distance), phishing domain patterns
  • Image OCR โ€” Tesseract.js-powered OCR with sharp preprocessing, detects scam text in screenshot/image-based scams
  • Perceptual Image Hashing โ€” Same scam image detected instantly across all servers after first confirmation

๐Ÿ“Š Global Trust Scoring โ€‹

  • Every user gets a trust score from 0.0 to 10.0
  • Scores follow users across all BonkerBot-protected servers
  • Velocity-capped adjustments prevent abuse (max -3.0/24h from automation)
  • Trust score history with graph visualization

๐ŸŽฏ Right-Click Reporting โ€‹

  • Context menu "Report Message" โ€” any user can report suspicious messages
  • Rate-limited to prevent abuse (3 reports per 10 minutes)
  • Reports enriched with automated detection results
  • Mod review embeds with Confirm/Dismiss/Escalate/Add Note buttons

๐Ÿง  Community Training System โ€‹

  • Core Trainers (owner-appointed) โ€” submissions auto-accepted, full trust
  • Loose Trainers (500+ member server owners) โ€” submissions reviewed before acceptance
  • Pattern extraction from confirmed scams (keywords, n-grams, URLs)
  • ๐Ÿ“– See the Training Guide for a walkthrough on training the bot to detect AI scams and other emerging patterns

๐Ÿ”จ Auto-Actions โ€‹

  • Configurable per-server thresholds for warn/mute/kick/ban
  • Actions logged with undo buttons for moderators
  • Emergency pause (kill switch) to disable all auto-actions instantly

๐Ÿ“ˆ Campaign Detection โ€‹

  • Clusters similar scam reports into campaigns
  • Tracks involved users and affected servers
  • Auto-resolves stale campaigns

๐Ÿ›ก๏ธ Additional Features โ€‹

  • Honeypot channel detection (scam bots posting in trap channels)
  • Join-spam detection (multiple new accounts joining rapidly)
  • Low-trust join alerts for moderators
  • Channel allowlists (skip scanning in trusted channels)
  • Trend monitoring and alert system
  • Full audit logging
  • Privacy-first: data export and deletion via /privacy

Tech Stack โ€‹

ComponentTechnology
RuntimeNode.js 20+ (ESM)
LanguageTypeScript (strict)
Discorddiscord.js v14
DatabasePostgreSQL + Prisma ORM
OCRtesseract.js + sharp
Chartschartjs-node-canvas
Typosquatfastest-levenshtein
Image Hashimghash
APIExpress (health/metrics)
Loggingpino
Testingvitest
CI/CDGitHub Actions โ†’ SSH/rsync โ†’ pm2

Setup โ€‹

Prerequisites โ€‹

  • Node.js 20+
  • PostgreSQL 14+
  • A Discord bot application with:
    • MESSAGE_CONTENT privileged intent
    • GUILD_MEMBERS privileged intent
    • applications.commands scope

Installation โ€‹

bash
git clone https://github.com/Orange-Cat-Associated/BonkerBot.git
cd BonkerBot
npm install
cp .env.example .env
# Edit .env with your values

Database Setup โ€‹

bash
npx prisma generate
npx prisma migrate dev
npm run db:seed   # Optional: seed blocked domains

Running โ€‹

bash
# Development
npm run dev

# Production
npm run build
npm start

# Deploy commands to Discord
npm run deploy:commands

# With pm2
pm2 start ecosystem.config.cjs

Required Bot Permissions โ€‹

Send Messages
Embed Links
Attach Files
Read Message History
Moderate Members (timeout)
Kick Members
Ban Members
Use Application Commands

Discord Developer Portal Setup โ€‹

  1. Create a new application at discord.com/developers
  2. Go to Bot โ†’ Enable MESSAGE CONTENT INTENT and SERVER MEMBERS INTENT
  3. Go to OAuth2 โ†’ URL Generator โ†’ Select bot + applications.commands
  4. Select the permissions listed above
  5. Use the generated URL to invite the bot

Commands โ€‹

Full reference: bonkerbot.app/docs/commands

Slash Commands โ€‹

CommandDescriptionPermission
/helpCommand and feature reference, in-channelEveryone
/karma [user]Global Karma (trust) score and historyEveryone (self) / Moderator (others)
/appealSubmit a ban appeal, or check its statusEveryone (list is Moderator)
/privacyView privacy policy, export/delete dataEveryone
/scoreboardLowest-Karma users in the serverModerator
/statsScam detection statistics for the serverModerator
/setup-serverGuided setup, and targeted re-configurationAdmin
/botconfigChannels, roles, modules, thresholds, tuningAdmin
/adminBot administration (admin guild only)Bot Admin
/setup-admin-guildOne-time admin guild channel creationBot Admin
/youtube-authYouTube OAuth2 for transcript accessBot Admin
/youtube-trainExtract scam patterns from YouTube videosBot Admin

Context Menus (Right-Click) โ€‹

CommandDescriptionPermission
Report MessageReport a suspicious messageEveryone
Train as ScamSubmit a message as a scam sampleTrainer

Environment Variables โ€‹

See .env.example for all available configuration options.

Deployment โ€‹

The bot is designed for bare-metal deployment with pm2 and GitHub Actions CI/CD.

See .github/workflows/deploy.yml for the CI/CD pipeline.

GitHub Secrets Required โ€‹

  • DEPLOY_HOST โ€” Server hostname/IP
  • DEPLOY_USER โ€” SSH username
  • DEPLOY_KEY โ€” SSH private key
  • DEPLOY_PATH โ€” Absolute path on server (e.g., /home/bonkerbot/app)

License โ€‹

MIT โ€” see LICENSE for details.

Contributing โ€‹

Contributions are welcome for the public half of the project โ€” commands, UI and embeds, setup flows, database and performance work, tests, docs, bug fixes. Please open an issue first to discuss what you would like to change.

Detection patterns cannot be accepted as public contributions: a scam rule that arrives in a public pull request has already been published by the time anyone reviews it. Those go through a private review path instead.

The bot is open source; the scam pattern library is not. BonkerBot is not affiliated with Discord Inc. โ€” Terms ยท Privacy