AI-powered Discord bot that interviews the server owner, generates a validated JSON blueprint, and builds an entire server structure (roles, categories, channels, permissions, embeds, community features) automatically.
- Owner DM interview → Few-shot AI → Self-healed JSON blueprint
- Ajv schema validation with repair attempts
- Automated roles, categories, channels with emoji/theme formatting
- Advanced permission presets (public-readonly, staff-private, mods-only, announcement-lock)
- Category privacy inheritance + per-channel overrides
- Channel ordering + forum channels + voice + announcement + media types
- Thread locking & auto-archive durations (forum)
- Styled info embeds (Welcome, Rules, About, FAQ) with gold theme
- Community / welcome screen scaffolding
/setupslash command with cooldowns & reset confirmation- Progress DMs + build summary metrics
- Simulation harness (offline test) & example blueprint
- Persistent blueprint storage (reapply / export / rollback)
- Interactive onboarding (buttons + select menus)
- Webhook auto-creation for announcement/media channels
- Branding system (emoji + color applied to embeds & channel names)
- Template packs (default, gaming, crypto, streamer, degen)
- Usage logging (append-only metrics per build)
- Guild config caching (stores last blueprint & metrics)
- Additional slash subcommands: export / import / reapply / preview
- Save blueprint as custom template (
/setup save-template <name>) for reuse - Edit channel description/topic and pin/unpin messages (
/setup edit-channel)
pnpm install
cp src/config/env.example .env
pnpm startInvite the bot to a server; it will DM the owner and guide setup.
| Variable | Description |
|---|---|
DISCORD_TOKEN |
Discord bot token |
AI_GATEWAY_URL |
AI Gateway / OpenAI endpoint URL |
AI_GATEWAY_KEY / AI_GATEWAY_API_KEY / OPEN_AI_API_KEY |
One of these will be used as the AI bearer key (fallback order) |
DEBUG |
Set to 1 to enable debug logs |
If you see Used disallowed intents:
- Go to Discord Developer Portal → Application → Bot.
- Enable toggles for: SERVER MEMBERS INTENT and MESSAGE CONTENT INTENT.
- Save changes. Wait ~1 minute and restart the bot.
- If you do not need DM freeform answers, you can remove
MessageContentintent fromutils/bot.jsto avoid the requirement.
pnpm dev # Run with nodemon
pnpm simulate # Offline simulation using blueprint.example.json
pnpm dry-run # Validate & summarize any blueprint JSON (no mock guild)src/
bot.js # Entry wrapper
utils/bot.js # Client init & command registration
utils/ai/interviewFlow.js# Interview + AI generation + build
utils/ai/schemas.js # Ajv schema & validation helpers
utils/ai/gateway.js # AI request wrapper w/ retry
utils/applyBlueprint.js # Orchestrates build (progress + metrics)
utils/builder/ # Channels, messages, permissions, embeds
utils/commands/setup.js # /setup run/reset + cooldowns
utils/progress.js # sendProgress helper
- Fork / branch from
main. - Run
pnpm installandpnpm simulateto ensure baseline passes. - For new blueprint fields, update
schemas.jsand add few-shot example if needed. - Maintain JSDoc for all public functions.
- Run
pnpm simulateafter changes to verify no structural regressions. - Open a PR with a clear summary + test blueprint diff.
- ES Modules, async/await for all async flows.
- Minimal side effects; builder functions return maps/metrics.
- Use
log()/warn()/error()/debug()for diagnostics. - Avoid hardcoding permission constants outside
permissions.js.
pnpm simulate loads blueprint.example.json, mocks Discord guild objects, and runs the build pipeline. It prints role/channel counts & metrics—use this before live testing.
pnpm dry-run performs quick schema validation & counts via scripts/runLocalBlueprint.js without constructing mock guild objects.
See src/utils/ai/promptTemplate.md for the canonical generation instructions used to shape the JSON blueprint.
Use /setup run (subject to cooldown). To wipe channels (dangerous) use /setup reset and follow confirmation instructions.
- Bot joins → DM with Start/Help/Advanced buttons.
- Step-wise selects for server type, style, sections.
- Yes/No buttons for rules/about/FAQ & private channels.
- Role input (comma list) auto-infers colors & permission presets.
- Preview of blueprint with build confirmation buttons.
- Live progress DMs (roles, categories, channels, permissions, messages, finalize).
- Completion buttons: export template, reapply, branding (future), automations (future).
- Post-build message in a general channel advertising rerun command.
Built blueprints saved under data/blueprints/<guildId>.json. Latest preview stored for quick export/reapply.
data/guilds/<guildId>.json caches last blueprint, metrics, and timestamps (supports multi-server scaling).
Slash command lifecycle:
/setup export→ Serialize current guild (roles, categories, channel names/types, webhooks) → DM JSON file./setup import→ Validate attached blueprint JSON via schema → Store without building./setup reapply→ Build using last stored/imported blueprint (skips interview)./setup preview→ DM stored blueprint for inspection./setup save-template <name>→ Persist last stored blueprint totemplates/<name>.jsonfor future reuse or sharing./setup edit-channel <channel> [topic] [pin-message] [unpin-message]→ Edit channel description/topic or pin/unpin messages.
Current rollback deletes channels then reapplies last stored blueprint. Full differential rollback planned (track created IDs).
- Differential rollback (track IDs for precise restoration)
- Premium automation suite (branding, scheduled posts, smart analytics)
- Database persistence (PostgreSQL/SQLite instead of JSON files)
- Unit + integration tests (Vitest/Jest with discord.js mocks)
- Dynamic style packs & theme expansion
- Deeper export fidelity (permission overwrites, topics, slowmode, NSFW flags)
- Selective apply/diff (only create missing artifacts)
- Metrics dashboard & anomaly alerts
Made with 💸 neon-gold energy.