# nxeiv/main-bot architecture

> Architecture diagram of the GitHub repository nxeiv/main-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nxeiv/main-bot
- Repository: https://github.com/nxeiv/main-bot

## Overview

The Cottage★ Main Bot is a Discord and Minecraft companion. Its main workflow starts with Discord commands or messages, which `index.js` routes to community, AI, reminder, summary, and administrative behavior; it also coordinates the Minecraft session and website status bridge. Minecraft connection management and AI request handling are distinct runtime layers. The README documents several integrations and capabilities not visible in the partial excerpts; those links are cited to the README rather than presented as inspected call sites.

Main entry points: [`index.js`](https://github.com/nxeiv/main-bot/blob/main/index.js) (Discord bot), [`minecraft.js`](https://github.com/nxeiv/main-bot/blob/main/minecraft.js) (Minecraft session), [`ai.js`](https://github.com/nxeiv/main-bot/blob/main/ai.js) (AI responses), [`summary.js`](https://github.com/nxeiv/main-bot/blob/main/summary.js) (Channel summaries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discord["Discord Community"]
  node_discord_entry["Discord bot<br/>[index.js]"]
  node_community_tools["Community tools<br/>[index.js]"]
  node_admin_actions["Admin actions<br/>[index.js]"]
  node_summaries["Channel summaries<br/>[summary.js]"]
  node_reminders[("Reminders<br/>[reminders.js]")]
end

subgraph group_minecraft["Minecraft SMP"]
  node_minecraft_session["Minecraft session<br/>[minecraft.js]"]
  node_chat_relay["Chat relay<br/>[index.js]"]
  node_player_welcomes["Player welcomes<br/>[index.js]"]
end

subgraph group_ai["AI and Presentation"]
  node_ai_service["AI responses<br/>[ai.js]"]
  node_known_answers["Known answers<br/>[ai.js]"]
  node_unicode_theme["Unicode theme<br/>[unicode.js]"]
end

subgraph group_operations["Operations"]
  node_status_bridge["Website status API<br/>[index.js]"]
  node_access_policy["Access policy<br/>[config.js]"]
  node_scheduled_admin["Scheduled admin actions<br/>[index.js]"]
  node_error_reporting["Error reporting<br/>[index.js]"]
end

node_member(("Community member"))
node_gemini{{"Gemini"}}
node_minecraft_server{{"Minecraft server"}}
node_website(("Cottage website"))

node_member -->|"uses commands"| node_discord_entry
node_discord_entry -->|"routes requests"| node_community_tools
node_discord_entry -->|"routes commands"| node_admin_actions
node_discord_entry -->|"invokes summaries"| node_summaries
node_summaries -->|"requests summary"| node_ai_service
node_summaries -->|"reads channel"| node_discord_entry
node_discord_entry -->|"manages reminders"| node_reminders
node_reminders -->|"delivers reminders"| node_discord_entry
node_discord_entry -->|"requests AI"| node_ai_service
node_ai_service -->|"checks locally"| node_known_answers
node_ai_service -->|"sends requests"| node_gemini
node_ai_service -->|"themes responses"| node_unicode_theme
node_discord_entry -->|"checks access"| node_access_policy
node_discord_entry -->|"starts session"| node_minecraft_session
node_admin_actions -->|"controls session"| node_minecraft_session
node_minecraft_session -->|"connects to"| node_minecraft_server
node_minecraft_session -->|"relays chat"| node_chat_relay
node_chat_relay -->|"sends messages"| node_discord_entry
node_minecraft_session -->|"triggers welcomes"| node_player_welcomes
node_discord_entry -->|"serves status"| node_status_bridge
node_website -->|"reads status"| node_status_bridge
node_discord_entry -->|"schedules actions"| node_scheduled_admin
node_scheduled_admin -->|"executes actions"| node_admin_actions
node_discord_entry -->|"reports failures"| node_error_reporting

click node_discord_entry "https://github.com/nxeiv/main-bot/blob/main/index.js"
click node_community_tools "https://github.com/nxeiv/main-bot/blob/main/index.js"
click node_admin_actions "https://github.com/nxeiv/main-bot/blob/main/index.js"
click node_summaries "https://github.com/nxeiv/main-bot/blob/main/summary.js"
click node_reminders "https://github.com/nxeiv/main-bot/blob/main/reminders.js"
click node_ai_service "https://github.com/nxeiv/main-bot/blob/main/ai.js"
click node_known_answers "https://github.com/nxeiv/main-bot/blob/main/ai.js"
click node_unicode_theme "https://github.com/nxeiv/main-bot/blob/main/unicode.js"
click node_minecraft_session "https://github.com/nxeiv/main-bot/blob/main/minecraft.js"
click node_chat_relay "https://github.com/nxeiv/main-bot/blob/main/index.js"
click node_player_welcomes "https://github.com/nxeiv/main-bot/blob/main/index.js"
click node_status_bridge "https://github.com/nxeiv/main-bot/blob/main/index.js"
click node_access_policy "https://github.com/nxeiv/main-bot/blob/main/config.js"
click node_scheduled_admin "https://github.com/nxeiv/main-bot/blob/main/index.js"
click node_error_reporting "https://github.com/nxeiv/main-bot/blob/main/index.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_discord_entry,node_community_tools,node_admin_actions,node_summaries,node_reminders toneBlue
class node_minecraft_session,node_chat_relay,node_player_welcomes toneAmber
class node_ai_service,node_known_answers,node_unicode_theme,node_minecraft_server toneMint
class node_status_bridge,node_access_policy,node_scheduled_admin,node_error_reporting toneRose
class node_member,node_gemini,node_website toneIndigo
```

## Components

### Discord Community

- [Discord bot](https://github.com/nxeiv/main-bot/blob/main/index.js): `index.js`
- [Community tools](https://github.com/nxeiv/main-bot/blob/main/index.js): `index.js`
- [Admin actions](https://github.com/nxeiv/main-bot/blob/main/index.js): `index.js`
- [Channel summaries](https://github.com/nxeiv/main-bot/blob/main/summary.js): `summary.js`
- [Reminders](https://github.com/nxeiv/main-bot/blob/main/reminders.js): `reminders.js`

### Minecraft SMP

- [Minecraft session](https://github.com/nxeiv/main-bot/blob/main/minecraft.js): `minecraft.js`
- [Chat relay](https://github.com/nxeiv/main-bot/blob/main/index.js): `index.js`
- [Player welcomes](https://github.com/nxeiv/main-bot/blob/main/index.js): `index.js`

### AI and Presentation

- [AI responses](https://github.com/nxeiv/main-bot/blob/main/ai.js): `ai.js`
- [Known answers](https://github.com/nxeiv/main-bot/blob/main/ai.js): `ai.js`
- [Unicode theme](https://github.com/nxeiv/main-bot/blob/main/unicode.js): `unicode.js`

### Operations

- [Website status API](https://github.com/nxeiv/main-bot/blob/main/index.js): `index.js`
- [Access policy](https://github.com/nxeiv/main-bot/blob/main/config.js): `config.js`
- [Scheduled admin actions](https://github.com/nxeiv/main-bot/blob/main/index.js): `index.js`
- [Error reporting](https://github.com/nxeiv/main-bot/blob/main/index.js): `index.js`

### Other components

- **Community member**
- **Gemini**
- **Minecraft server**
- **Cottage website**

## Connections

- Community member → Discord bot: uses commands (evidence: `README.md`)
- Discord bot → Community tools: routes requests (evidence: `README.md`)
- Discord bot → Admin actions: routes commands (evidence: `README.md`)
- Discord bot → Channel summaries: invokes summaries (evidence: `README.md`)
- Channel summaries → AI responses: requests summary (evidence: `summary.js`)
- Channel summaries → Discord bot: reads channel (evidence: `summary.js`)
- Discord bot → Reminders: manages reminders (evidence: `index.js`)
- Reminders → Discord bot: delivers reminders (evidence: `reminders.js`)
- Discord bot → AI responses: requests AI (evidence: `README.md`)
- AI responses → Known answers: checks locally (evidence: `ai.js`)
- AI responses → Gemini: sends requests (evidence: `README.md`)
- AI responses → Unicode theme: themes responses (evidence: `README.md`)
- Discord bot → Access policy: checks access (evidence: `README.md`)
- Discord bot → Minecraft session: starts session (evidence: `index.js`)
- Admin actions → Minecraft session: controls session (evidence: `README.md`)
- Minecraft session → Minecraft server: connects to (evidence: `minecraft.js`)
- Minecraft session → Chat relay: relays chat (evidence: `README.md`)
- Chat relay → Discord bot: sends messages (evidence: `README.md`)
- Minecraft session → Player welcomes: triggers welcomes (evidence: `README.md`)
- Discord bot → Website status API: serves status (evidence: `README.md`)
- Cottage website → Website status API: reads status (evidence: `README.md`)
- Discord bot → Scheduled admin actions: schedules actions (evidence: `index.js`)
- Scheduled admin actions → Admin actions: executes actions (evidence: `index.js`)
- Discord bot → Error reporting: reports failures (evidence: `index.js`)
