|
| 1 | +# Discord Integration |
| 2 | + |
| 3 | +AOF integrates with Discord through the Interactions API for community and team-based AI agent interactions. Perfect for developer communities, gaming studios, open source projects, and teams who prefer Discord for collaboration. |
| 4 | + |
| 5 | +## Why Discord? |
| 6 | + |
| 7 | +- **200M+ monthly active users** - Popular with developers and gaming communities |
| 8 | +- **Free to use** - No per-message costs unlike some enterprise platforms |
| 9 | +- **Slash commands** - Native command system with autocomplete |
| 10 | +- **Rich embeds** - Beautiful formatted responses |
| 11 | +- **Components** - Buttons, select menus, and modals |
| 12 | +- **Threads** - Organized conversation management |
| 13 | + |
| 14 | +## How It Works |
| 15 | + |
| 16 | +``` |
| 17 | +User sends command → Discord API → AOF Webhook |
| 18 | + ↓ |
| 19 | + Verify Signature |
| 20 | + ↓ |
| 21 | + Parse Interaction |
| 22 | + ↓ |
| 23 | + Execute Agent |
| 24 | + ↓ |
| 25 | +User receives response ← Discord API ← Format Response |
| 26 | +``` |
| 27 | + |
| 28 | +AOF receives interactions via Discord webhooks, verifies Ed25519 signatures, routes them to agents, and sends responses back through the Discord API. |
| 29 | + |
| 30 | +## Key Features |
| 31 | + |
| 32 | +### Slash Commands |
| 33 | + |
| 34 | +Discord's native command system with autocomplete: |
| 35 | + |
| 36 | +| Command | Description | Example | |
| 37 | +|---------|-------------|---------| |
| 38 | +| `/agent` | Manage AOF agents | `/agent action:run agent_id:k8s-ops` | |
| 39 | +| `/task` | Create and manage tasks | `/task action:create description:check pods` | |
| 40 | +| `/fleet` | Manage agent fleets | `/fleet action:status` | |
| 41 | +| `/flow` | Execute workflows | `/flow workflow:incident-response` | |
| 42 | + |
| 43 | +### Message Components |
| 44 | + |
| 45 | +Interactive elements in responses: |
| 46 | + |
| 47 | +| Type | Description | Use Case | |
| 48 | +|------|-------------|----------| |
| 49 | +| **Buttons** | Clickable action buttons | Quick actions, confirmations | |
| 50 | +| **Select Menus** | Dropdown selections | Environment, namespace selection | |
| 51 | +| **Modals** | Form popups | Input parameters, feedback | |
| 52 | + |
| 53 | +### Rich Embeds |
| 54 | + |
| 55 | +Beautifully formatted responses with: |
| 56 | +- Title and description |
| 57 | +- Color-coded status bars |
| 58 | +- Field layouts (inline and stacked) |
| 59 | +- Thumbnails and images |
| 60 | +- Footers with timestamps |
| 61 | + |
| 62 | +## Architecture |
| 63 | + |
| 64 | +### Platform Adapter |
| 65 | + |
| 66 | +The Discord platform adapter implements `TriggerPlatform`: |
| 67 | + |
| 68 | +``` |
| 69 | +DiscordPlatform |
| 70 | +├── parse_message() # Parse interaction payloads |
| 71 | +├── send_response() # Send embeds/components |
| 72 | +├── verify_signature() # Ed25519 verification |
| 73 | +├── register_commands() # Register slash commands |
| 74 | +└── create_*_command() # Command definitions |
| 75 | +``` |
| 76 | + |
| 77 | +### Interaction Flow |
| 78 | + |
| 79 | +1. **Interaction Received** - Discord sends interaction to webhook |
| 80 | +2. **Signature Verification** - Ed25519 signature check |
| 81 | +3. **Parse Interaction** - Extract command/component data |
| 82 | +4. **Execute Agent** - Route to appropriate agent |
| 83 | +5. **Send Response** - Reply via Discord API |
| 84 | + |
| 85 | +### Interaction Types |
| 86 | + |
| 87 | +| Type | Value | Description | |
| 88 | +|------|-------|-------------| |
| 89 | +| PING | 1 | Webhook verification | |
| 90 | +| APPLICATION_COMMAND | 2 | Slash command invocation | |
| 91 | +| MESSAGE_COMPONENT | 3 | Button/select interaction | |
| 92 | +| MODAL_SUBMIT | 5 | Modal form submission | |
| 93 | + |
| 94 | +## Use Cases |
| 95 | + |
| 96 | +### Developer Community Bot |
| 97 | + |
| 98 | +``` |
| 99 | +👤 User: /agent action:run agent_id:code-review |
| 100 | +
|
| 101 | +🤖 Bot: 📋 Code Review Agent Started |
| 102 | +
|
| 103 | + Status: ✅ Running |
| 104 | + Agent: code-review |
| 105 | + Task: Analyzing repository... |
| 106 | +
|
| 107 | + [View Progress] [Stop Agent] [View Logs] |
| 108 | +``` |
| 109 | + |
| 110 | +### DevOps Operations |
| 111 | + |
| 112 | +``` |
| 113 | +👤 User: /fleet action:status |
| 114 | +
|
| 115 | +🤖 Bot: 📊 Fleet Status |
| 116 | +
|
| 117 | + ┌────────────────────────────────┐ |
| 118 | + │ Active Fleets: 3 │ |
| 119 | + │ Total Agents: 12 │ |
| 120 | + │ Tasks Running: 5 │ |
| 121 | + └────────────────────────────────┘ |
| 122 | +
|
| 123 | + • rca-fleet: 4 agents (analyzing) |
| 124 | + • deploy-fleet: 3 agents (idle) |
| 125 | + • monitor-fleet: 5 agents (watching) |
| 126 | +
|
| 127 | + [Scale Up] [View Details] [Refresh] |
| 128 | +``` |
| 129 | + |
| 130 | +### Gaming/Community Management |
| 131 | + |
| 132 | +Perfect for: |
| 133 | +- Moderation automation |
| 134 | +- Server statistics |
| 135 | +- Event coordination |
| 136 | +- Bot management |
| 137 | + |
| 138 | +## Comparison with Slack |
| 139 | + |
| 140 | +| Feature | Discord | Slack | |
| 141 | +|---------|---------|-------| |
| 142 | +| User Base | 200M+ (community-focused) | 54M+ (enterprise) | |
| 143 | +| Pricing | Free | Free tier + paid | |
| 144 | +| Commands | Slash commands | Slash commands | |
| 145 | +| Interactive | Buttons, Selects, Modals | Block Kit | |
| 146 | +| Threading | Native threads | Native threads | |
| 147 | +| Reactions | Emoji reactions | Emoji reactions | |
| 148 | +| Signature | Ed25519 | HMAC-SHA256 | |
| 149 | +| Bots | Invite-based | Workspace install | |
| 150 | + |
| 151 | +## Security |
| 152 | + |
| 153 | +- **Ed25519 signature verification** - All interactions cryptographically verified |
| 154 | +- **Role-based access** - Restrict commands to specific roles |
| 155 | +- **Guild restrictions** - Limit to specific servers |
| 156 | +- **Rate limiting** - Built-in Discord rate limits |
| 157 | + |
| 158 | +## Getting Started |
| 159 | + |
| 160 | +1. **Discord Developer Portal** - Create app at [discord.com/developers](https://discord.com/developers) |
| 161 | +2. **Create Bot** - Add bot to your application |
| 162 | +3. **Get Credentials** - Note Application ID, Bot Token, Public Key |
| 163 | +4. **Configure AOF** - Add Discord platform to daemon config |
| 164 | +5. **Set Webhook** - Configure interactions endpoint URL |
| 165 | +6. **Register Commands** - Run command registration |
| 166 | + |
| 167 | +See the [Discord Quickstart Guide](../guides/quickstart-discord.md) for step-by-step setup. |
| 168 | + |
| 169 | +## Next Steps |
| 170 | + |
| 171 | +- [Discord Quickstart](../guides/quickstart-discord.md) - 10-minute setup guide |
| 172 | +- [Discord Tutorial](../tutorials/discord-ops-bot.md) - Build a complete ops bot |
| 173 | +- [Discord Reference](../reference/discord-integration.md) - Full API reference |
| 174 | +- [Slack Tutorial](../tutorials/slack-bot.md) - Enterprise alternative |
0 commit comments