Skip to content
All projects

Case study 04Automation · Security · Discord

HALLGuard

Moderation and management for Discord communities.

A Discord moderation and server-management system focused on security: automated protection against spam and raids, configurable rules, and an audit trail for every action.

Visit sitehallguard.org(opens in a new tab)
Role
Design and engineering — bot, rule engine, dashboard
Platform
Discord + web panel
Stack
Discord APIGateway eventsPythonREST APIsWeb dashboard

What it does

  • Blocks phishing links, stops raids and locks out compromised moderator accounts
  • 47 commands across 24 modules — tickets, modmail, levels, giveaways and invite tracking in one bot
  • Graduated responses: warn → timeout → kick → ban
  • Role-hierarchy-aware permission checks
  • Full audit log of automated and manual actions
hallguard.org / dashboard

Overview

HALLGuard keeps Discord servers safe without requiring moderators to be online around the clock. It listens to server events, evaluates them against per-server rules, acts proportionally, and records everything so humans stay in control.

Problem

Community moderation breaks at the edges: raids at 3 a.m., spam waves faster than people can click, and permission setups so complex that admins accidentally lock themselves out.

Goals

  1. React to abuse in seconds, at any hour
  2. Avoid false positives that punish real members
  3. Make powerful configuration approachable
  4. Keep every automated decision explainable

My role

Design and engineering — bot, rule engine, dashboard.

  • Bot architecture and Discord gateway event handling
  • Rule engine design and detection heuristics
  • Permission model and safety checks
  • Dashboard and website

Technology

Bot
Discord APIGateway eventsPython
Platform
REST APIsPersistent configuration store
Web
Dashboardhallguard.org

Architecture

Events flow one way — observe, evaluate, act, record — which keeps the system predictable and auditable.

  1. Gateway events

    Messages, joins, role and channel changes stream in from Discord

  2. Router

    Normalises events and attaches per-server configuration

  3. Rule engine

    Sliding-window detectors for spam, raids, links and mentions

  4. Actions

    Proportional responses checked against role hierarchy before executing

  5. Audit log

    Every decision recorded with the reason, visible to moderators

Challenges & solutions

Raids arrive as bursts

Challenge

Dozens of accounts can join and post within seconds; per-message rules miss the pattern.

Solution

Sliding-window detectors that reason about rates across the server, with a lockdown mode that engages and releases automatically.

False positives cost trust

Challenge

An over-eager bot that bans real members is worse than no bot.

Solution

Graduated responses and per-server thresholds, so the first signal warns and only repeated or severe behaviour escalates.

Permission edge cases

Challenge

Discord's role hierarchy means an action can silently fail — or succeed against the wrong person.

Solution

Pre-flight checks on every action against the bot's and target's role positions, with clear errors in the log.

Screens

  • hallguard.org / dashboard
    a.Server overview — protection status and recent activity
  • hallguard.org / log
    b.Audit log — every action with its reason
  • hallguard.org
    HALLGuard website home page with a Discord chat showing the bot blocking a phishing link
    c.hallguard.org — the live product site

Results

  • Live at hallguard.org
  • Automated moderation that runs continuously without moderator presence
  • An auditable trail that keeps human moderators in control
Visit sitehallguard.org(opens in a new tab)

Lessons learned

“Security tooling lives or dies by its false-positive rate.”

“Proportional responses beat binary rules.”

“If an automated action can't explain itself, it shouldn't run.”