AntiRaidAntiRaid

Builtins

Built-in modules and primitives available to AntiRaid templates and internal services.

Updated April 11, 2026

Builtins are the built-in functionality that AntiRaid exposes to the system — replacing what used to be hardcoded bot commands. Instead of adding a new slash command every time someone needs new functionality, that functionality is implemented as a builtin that templates can call directly.

What builtins provide

  • Common typesUser, GuildMember, Channel, Role, and other Discord entity types used across all services
  • Utility helpers — string manipulation, date/time formatting, permission calculations, and other shared functions
  • Template APIs — the plugin interfaces that Luau templates access via ctx and require

How they're used

Builtins are available by default inside the template worker. Templates access them via the @antiraid/* require namespace:

local discord = require "@antiraid/discord"
local kv = require "@antiraid/kv"
local interop = require "@antiraid/interop"

Internal services (bot, api, jobserver) also consume builtins directly via Rust/Go imports — they're not Luau-only.

Extending builtins

To add a new builtin:

  1. Implement the type or function in the builtins crate
  2. Register it with the template worker's plugin registry
  3. Add Luau-facing bindings if it needs to be accessible from templates
  4. Document it in the API Reference

For the full list of available template APIs, see the Templating API Reference.