Discord Webhook Integration

Integration

Server-side throttled embeds, security alerts, moderation logs, and rate-limit queue management.

# Overview

R Anti-Cheat can forward critical security incidents and administrative moderation actions directly to a staff Discord channel.

To protect your server from HTTP throttling and Discord API rate limits, DiscordService.luau incorporates an asynchronous FIFO queue, automatic @everyone mention sanitization, and a minimum 2-second rate-limiting throttle between outbound posts.

       Security Incident Triggered
                    │
                    ▼
     DiscordService.SendDetectionAlert(...)
                    │
                    ▼
     [ Sanitize @everyone / @here ]
                    │
                    ▼
        [ Enqueue into messageQueue ]
                    │
                    ▼
           [ Asynchronous Worker ]
     (Ensures >= 2.0s between HTTP calls)
                    │
                    ▼
        HttpService:PostAsync(...)
                    │
                    ▼
       [ Formatted Discord Embed ]

# Configuration

In ServerScriptService/RAC/config.luau:

Config.Discord = {
    Enabled = true,
    WebhookURL = "https://discord.com/api/webhooks/123456789/your-webhook-token",
    DetectionAlerts = true,       -- Stream high-confidence cheat alerts
    HighRiskAlerts = true,        -- Alert when player enters High/Critical risk
    WarningAlerts = true,         -- Log in-game warnings
    KickAlerts = true,            -- Log player kicks
    BanAlerts = true,             -- Log permanent and temporary bans
    RateLimitPerMinute = 30,      -- Maximum webhook dispatches per minute
}

[!IMPORTANT] Ensure Allow HTTP Requests is enabled in Roblox Studio Game Settings > Security, otherwise HttpService will reject outbound requests.


# Embed Color Palette & Types

Outbound embeds are dynamically color-coded to allow moderators to assess urgency at a glance:

Alert Level Color Hex Color Preview Description
Critical #EF4444 🔴 Red Honeypots, Kill-All scripts, verified script injections.
High #F97316 🟠 Orange Movement manipulation suites, speed & flight clustering.
Medium #EAB308 🟡 Yellow Repeated unverified anomalies or damage spikes.
Punishment #8B5CF6 🟣 Purple Kick and Ban moderation action receipts.

# Mention Sanitization Security

Exploiters frequently attempt to include @everyone or @here strings in their player display names to trigger mass pings in staff Discord channels.

RAC's sanitize function injects a zero-width space (\xE2\x80\x8B) into every mention string before constructing the JSON payload, neutralizing the exploit while preserving readability.


# Next Steps