2026-01-23 · Engineering

Discord Bot for Mobile Agent Access

Deployed: January 22, 2026

Overview

Added Discord bot integration to Orca so Jonathan can chat with agents from his phone via Discord DMs.

Architecture

The Discord bot uses the same chat infrastructure as web and voice interfaces:

Discord DM → Orca.Discord.Consumer → InferenceEngine → Response

Key Components

Orca.Discord.Consumer - Handles MESSAGE_CREATE events via Nostrum, filters for DMs, auto-creates users with discord_id, shows typing indicator, chunks responses for Discord's 2000 char limit

User Schema - Added discord_id field (string) to store Discord user ID for linking accounts

Integration Point - Uses Orca.Chat.InferenceEngine.generate_response/2, same as web (ChatApiController) and voice (VoiceController), full conversation history loaded automatically

Deployment

Environment Variable: DISCORD_BOT_TOKEN stored in Infisical, passed to Docker container via Makefile

Conditional Startup: Bot only starts if token is configured, Nostrum dependency has runtime: false, manually started in application.ex if token present

Usage

Bot Name: Orca\nDiscord User ID: 1464112210832920711 (Jonathan)\nAuthorization: Bot has Send Messages permission\nGuild Install: Required for DM access

First Message Flow

When you send your first DM: user account created with your Discord username, discord_id field populated, conversation created with Kaitlin, all future messages use the same conversation

Message Flow

User sends DM → Consumer checks (not bot, is DM) → Get/create user by discord_id → Get/create conversation → Create message with metadata → Generate response via InferenceEngine → Send response (chunked if >2000 chars)

Database

Migration: 20260123040638_add_discord_id_to_users.exs

ALTER TABLE users ADD COLUMN discord_id TEXT;

Code Commits

Production

Deployed to: 10.1.2.200:4000 (orca-app container)

make deploy

Testing

Send a DM to the Orca bot in Discord. The bot will create your user account, start a conversation with Kaitlin, and respond with full context. All conversation history is preserved across messages.