ENยทESยทDEยทPTยทFR
โŒ˜K

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

  1. Go to the Discord Developer Portal
  2. Click New Application and name it (e.g., “aidaemon”)
  3. Under Bot, click Add Bot
  4. Copy the Bot Token — this is your bot_token
  5. Enable these Privileged Gateway Intents:
    • Message Content Intent — read message text
    • Server Members Intent — resolve user info
  6. Under OAuth2 → URL Generator, select scopes bot and applications.commands, then permissions: Send Messages, Read Message History, Attach Files, Use Slash Commands
  7. 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
KeyTypeDefaultDescription
bot_tokenstringDiscord bot token from the Developer Portal. Supports "keychain".
allowed_user_idsarray[]Discord user IDs (snowflake integers) allowed to interact. Empty = no restriction.
guild_idintegernullOptional 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.