Discord Bot Setup
Connect aidaemon to Discord via the gateway API.
Pre-built Binaries
If you installed via the one-line script or Homebrew, Discord support is already included. Just configure
config.toml below. The feature flag is only needed when building from source.Create a Discord Application
- Go to the Discord Developer Portal
- Click New Application and name it (e.g., “aidaemon”)
- Under Bot, click Add Bot
- Copy the Bot Token — this is your
bot_token - Enable these Privileged Gateway Intents:
Message Content Intent— read message textServer Members Intent— resolve user info
- Under OAuth2 → URL Generator, select scopes
botandapplications.commands, then permissions: Send Messages, Read Message History, Attach Files, Use Slash Commands - Use the generated URL to invite the bot to your server
Configuration
config.toml
[discord]
bot_token = "MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.AbCdEf.xxxxx"
allowed_user_ids = [123456789012345678]
guild_id = 987654321098765432| Key | Type | Default | Description |
|---|---|---|---|
bot_token | string | — | Discord bot token from the Developer Portal. Supports "keychain". |
allowed_user_ids | array | [] | Discord user IDs (snowflake integers) allowed to interact. Empty = no restriction. |
guild_id | integer | null | Optional server/guild ID. If set, the bot only responds in that server. |
Get Your Discord User ID
Enable Developer Mode in Discord settings (Appearance → Advanced), then right-click your username and select Copy User ID.
Features
- Gateway connection — real-time WebSocket connection via serenity framework
- Slash commands — registered application commands (see Commands)
- Interactive buttons — approval flow with clickable buttons (see Approval Flow)
- File transfer — send and receive files as Discord attachments
- Message splitting — long responses split to respect Discord’s 2000-char message limit
- Auto-reconnect — exponential backoff on connection failure (5s → 60s cap)
- User allowlist — per-bot token access control
- Multi-bot support — run multiple Discord bots with separate configs
Session Model
Discord sessions are identified by channel:
- Channel message:
discord:{channel_id}
Each channel maintains its own conversation history, working memory, and facts context.
Access Control
If
allowed_user_ids is empty, anyone who can message the bot can interact with it. Always set this in production.