Inspiration

Modern Discord communities are under constant attack from spam bots, phishing links, scam messages, and coordinated abuse.
At the same time, a critical security issue has emerged in the ecosystem — public security, music, and entertainment bots frequently suffer token leaks due to insecure hosting, exposed environment variables, or compromised deployments.

When a bot token is leaked, attackers gain full bot-level permissions, which allows them to:

  • Delete channels and roles
  • Ban or kick members
  • Deface or completely nuke servers within seconds

Because of this growing risk, many server owners have stopped adding public moderation bots altogether, leaving communities vulnerable to abuse.

This project was inspired by the need to solve both moderation and infrastructure security at the same time.


What It Does

SentinelAI is a self-hosted, AI-powered Discord moderation system designed to protect communities without relying on risky third-party public bots.

The system focuses on:

  • Intelligent spam and scam detection
  • Context-aware abuse analysis
  • Progressive, risk-based enforcement
  • CAPTCHA-first bot mitigation
  • Complete elimination of third-party bot token exposure

Server owners host and control the bot themselves, ensuring full ownership of tokens, data, and infrastructure.


How It Works (Technical Overview)

The system is built using a hybrid moderation architecture.

Event Ingestion

  • Integrates directly with the Discord Gateway API
  • Listens to message events, member joins, and interaction events in real time

Risk Evaluation Pipeline

Each event passes through a scoring engine that computes a dynamic risk score (0–100) using:

  • AI-based semantic analysis of message content
  • Spam frequency and repetition detection
  • Account age and server join time
  • Historical warnings and moderation signals

Risk levels are categorized as:

  • 0–30: Safe
  • 31–70: Suspicious
  • 71–100: High Risk

Actions are applied progressively instead of immediate punishment.


CAPTCHA-First Mitigation Strategy

When a user crosses a defined risk threshold:

  • The user is temporarily restricted
  • A CAPTCHA challenge is issued
  • Successful verification instantly restores access

This approach:

  • Effectively blocks automated attacks
  • Minimizes false positives
  • Protects legitimate users
  • Reduces moderator workload

Security & Privacy Design

Security is treated as a first-class feature, not an afterthought.

  • Bot tokens are stored only in environment variables
  • No secrets are logged or transmitted externally
  • Moderation logs are stored in Supabase with Row Level Security
  • No raw message content is stored — only hashed metadata and risk indicators

This ensures privacy-first, auditable, and secure moderation.

Challenges Faced

  • Designing a fair and explainable risk-scoring system
  • Balancing aggressive detection with low false positives
  • Maintaining low latency with real-time AI analysis
  • Ensuring secure secret handling within hackathon constraints

Impact

SentinelAI enables communities to:

  • Run secure self-hosted moderation
  • Avoid the risk of public bot token leaks
  • Protect servers from mass compromise and nukes
  • Maintain fairness through progressive enforcement
  • Scale moderation safely for large communities

Built With

  • ai/nlp-api
  • captcha-service
  • discord-gateway-api
  • discord.js
  • environment-variables
  • node.js
  • rest-api
  • row-level-security
  • supabase-postgresql
Share this project:

Updates

Submission history