Discord Bot
Phase 2 feature. Lightweight Discord bot interface for FlowDice, powered by the MCP Server and integrated with the dice engine.
Design
Stateless, self-hostable bot using Discord slash commands (not legacy ! prefix, which is reserved for Exploding Dice). Acts as a thin interface layer between Discord and the FlowDice engine — all logic lives in the engine, bot just handles Discord interactions.
Deployment: single Node.js process running discord.js + MCP Client SDK. Connects to your FlowDice instance via MCP (local or remote). No database required.
Core Commands
/roll [notation]— Roll the given notation. Returns result with individual die values in an embed./roll [name]— If name matches a Favorites entry (fetched vialist_favoritesMCP), roll that favorite.
Interactive Parameters
After posting a roll result, Discord buttons appear for Named Parameters. Examples:
Attack Flow with Damage Options:
- Roll
/roll longsword(notation:d20+5 -> d8+3) - Result embeds shows attack roll and prompt for damage modifiers
- Buttons below:
Smite(adds+2d8),Sneak Attack(adds+3d6),GWM(adds+10flat) - Click → re-evaluate flow segment with modifier enabled
- New damage total posts as a follow-up message
Advantage Toggling:
- Initial roll:
2d20kh+5(advantage D&D 5e) - Buttons:
Roll as Normal,Roll as Disadvantage(or toggle between) - Clicking changes the notation mid-stream, re-rolls that segment
Button interactions are transient — they disappear after ~5 min or first click. Stateless design means the bot doesn’t track session state; the user’s follow-up click sends the modified notation back through the engine.
Implementation
Uses discord.js v14+ with slash command registration. MCP Client library wraps roll_flow, list_favorites, and parse calls to the FlowDice engine.
Interaction handler:
- User inputs
/roll longsword→ bot callslist_favorites→ confirms it’s a favorite - Parse notation → call
roll_flowwith empty parameters - Post result embed with buttons for each
<name>parameter in the flow - User clicks button → bot calls
roll_flowwith modified parameters - Post follow-up or edit message
No caching of user preferences, rolls, or state. Each command is independent.
Self-Hosting
- Clone bot repo,
npm install - Provide Discord bot token and FlowDice MCP Server URL (local or remote)
npm start- Register slash commands (one-time per server)
- Invite bot to your Discord server
Requirements: Node.js 18+, FlowDice instance with MCP Server running.
See also: MCP Server, Named Parameters, Flows, Architecture