# pineoverlay/pine_bot architecture

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

- Interactive diagram: https://gitdiagram.com/pineoverlay/pine_bot
- Repository: https://github.com/pineoverlay/pine_bot

## Overview

Jeremy Stream Bot is a Discord bot whose main workflow is receiving a Discord command, applying bot state and configuration, and producing a reply or media result. Its command set spans AI chat and search, image/video and audio processing, games, and server utilities. README-documented integrations extend that workflow to local Ollama models, SearXNG, the JG Node API, VLC, Stammer, Demucs, and RVC. The graph reflects the sampled startup and utility relationships; several command and event implementations were not sampled, so their internal call paths are not asserted.

Main entry points: [`src/commands/external`](https://github.com/pineoverlay/pine_bot/tree/main/src/commands/external) (Media commands), [`src/index.js`](https://github.com/pineoverlay/pine_bot/blob/main/src/index.js) (Client startup), [`src/commands/ai`](https://github.com/pineoverlay/pine_bot/tree/main/src/commands/ai) (AI commands), [`src/util/utility.js`](https://github.com/pineoverlay/pine_bot/blob/main/src/util/utility.js) (Command utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_startup["Client startup<br/>[index.js]"]
  node_eventloader["Event loading<br/>[handleEvents.js]"]
  node_messageevents["Client events"]
  node_commandutil["Command utilities<br/>[utility.js]"]
  node_config["Bot configuration<br/>[config.js]"]
  node_env["Environment settings<br/>[env-util.js]"]
end

subgraph group_commands["Discord commands"]
  node_commandsets["Command sets"]
  node_textcommands["Text and utility commands"]
  node_economy["Economy commands"]
  node_character[("Character manager")]
  node_lua["Lua execution<br/>[lua.js]"]
end

subgraph group_ai["AI and search"]
  node_aicommands["AI commands"]
  node_aichat["AI chat commands"]
  node_ollamamodels["Ollama models<br/>[ollama-models.js]"]
  node_ollamatools["Ollama tools<br/>[ollama-tools.js]"]
  node_search["SearXNG search<br/>[searxng.js]"]
end

subgraph group_media["Media processing"]
  node_mediacommands["Media commands"]
  node_video["Video modifiers<br/>[videomodifier.js]"]
  node_ffmpeg["FFmpeg utilities<br/>[ffmpeg-util.js]"]
  node_threads["Worker dispatch<br/>[multi-thread.js]"]
  node_cellular["Cellular automata<br/>[lifeLike.js]"]
  node_temp["Temporary files<br/>[temp-folder.js]"]
end

subgraph group_integrations["Integrations and state"]
  node_api["JG Node API<br/>[fetch-nodeapi.js]"]
  node_vlc["VLC integration"]
  node_stammer["Stammer integration<br/>[stammer.js]"]
  node_demucs["Demucs integration<br/>[demucs.js]"]
  node_rvc["RVC integration<br/>[rvc.js]"]
end

node_users(("Discord users"))
node_discord(("Discord platform"))
node_ollama(("Local Ollama"))
node_searxservice(("SearXNG service"))

node_users -.->|"send commands"| node_discord
node_discord -.->|"connects client"| node_startup
node_startup -->|"loads events"| node_eventloader
node_startup -->|"sets state"| node_commandutil
node_startup -->|"reads settings"| node_env
node_eventloader -.->|"loads listeners"| node_messageevents
node_commandutil -->|"reads configuration"| node_config
node_commandutil -->|"reads settings"| node_env
node_commandsets -.->|"reply to commands"| node_discord
node_character -->|"builds Lua context"| node_lua
node_aicommands -->|"searches web"| node_search
node_aicommands -->|"uses models"| node_ollamamodels
node_aicommands -->|"searches web"| node_search
node_ollamamodels -->|"loads tools"| node_ollamatools
node_ollamamodels -.->|"queries models"| node_ollama
node_search -->|"requests results"| node_searxservice
node_mediacommands -.->|"processes media"| node_ffmpeg
node_video -->|"dispatches work"| node_threads
node_cellular -.->|"runs simulation"| node_threads
node_mediacommands -.->|"uses overlays"| node_api
node_mediacommands -.->|"uses playback integration"| node_vlc
node_mediacommands -.->|"uses speech tool"| node_stammer
node_mediacommands -.->|"separates audio"| node_demucs
node_mediacommands -.->|"runs voice dubbing"| node_rvc

click node_startup "https://github.com/pineoverlay/pine_bot/blob/main/src/index.js"
click node_eventloader "https://github.com/pineoverlay/pine_bot/blob/main/src/handleEvents.js"
click node_messageevents "https://github.com/pineoverlay/pine_bot/tree/main/src/events/client"
click node_commandutil "https://github.com/pineoverlay/pine_bot/blob/main/src/util/utility.js"
click node_config "https://github.com/pineoverlay/pine_bot/blob/main/src/config.js"
click node_env "https://github.com/pineoverlay/pine_bot/blob/main/src/util/env-util.js"
click node_commandsets "https://github.com/pineoverlay/pine_bot/tree/main/src/commands"
click node_textcommands "https://github.com/pineoverlay/pine_bot/tree/main/src/commands/generic"
click node_economy "https://github.com/pineoverlay/pine_bot/tree/main/src/commands/economy"
click node_character "https://github.com/pineoverlay/pine_bot/blob/main/src/util/character-manager.js"
click node_lua "https://github.com/pineoverlay/pine_bot/blob/main/src/util/lua.js"
click node_aicommands "https://github.com/pineoverlay/pine_bot/tree/main/src/commands/ai"
click node_aichat "https://github.com/pineoverlay/pine_bot/tree/main/src/commands/aichat"
click node_ollamamodels "https://github.com/pineoverlay/pine_bot/blob/main/src/util/ollama-models.js"
click node_ollamatools "https://github.com/pineoverlay/pine_bot/blob/main/src/util/ollama-tools.js"
click node_search "https://github.com/pineoverlay/pine_bot/blob/main/src/util/searxng.js"
click node_mediacommands "https://github.com/pineoverlay/pine_bot/tree/main/src/commands/external"
click node_video "https://github.com/pineoverlay/pine_bot/blob/main/src/basecommands/videomodifier.js"
click node_ffmpeg "https://github.com/pineoverlay/pine_bot/blob/main/src/util/ffmpeg-util.js"
click node_threads "https://github.com/pineoverlay/pine_bot/blob/main/src/util/multi-thread.js"
click node_cellular "https://github.com/pineoverlay/pine_bot/blob/main/src/util/cellularAutomata/lifeLike.js"
click node_temp "https://github.com/pineoverlay/pine_bot/blob/main/src/util/temp-folder.js"
click node_api "https://github.com/pineoverlay/pine_bot/blob/main/src/util/fetch-nodeapi.js"
click node_vlc "https://github.com/pineoverlay/pine_bot/blob/main/src/util/vlc-media-player.js"
click node_stammer "https://github.com/pineoverlay/pine_bot/blob/main/src/util/stammer.js"
click node_demucs "https://github.com/pineoverlay/pine_bot/blob/main/src/util/demucs.js"
click node_rvc "https://github.com/pineoverlay/pine_bot/blob/main/src/util/rvc.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_startup,node_eventloader,node_messageevents,node_commandutil,node_config,node_env,node_users toneBlue
class node_commandsets,node_textcommands,node_economy,node_character,node_lua toneAmber
class node_aicommands,node_aichat,node_ollamamodels,node_ollamatools,node_search toneMint
class node_mediacommands,node_video,node_ffmpeg,node_threads,node_cellular,node_temp toneRose
class node_api,node_vlc,node_stammer,node_demucs,node_rvc,node_discord,node_ollama,node_searxservice toneIndigo
```

## Components

### Bot runtime

- [Client startup](https://github.com/pineoverlay/pine_bot/blob/main/src/index.js): `src/index.js`
- [Event loading](https://github.com/pineoverlay/pine_bot/blob/main/src/handleEvents.js): `src/handleEvents.js`
- [Client events](https://github.com/pineoverlay/pine_bot/tree/main/src/events/client): `src/events/client`
- [Command utilities](https://github.com/pineoverlay/pine_bot/blob/main/src/util/utility.js): `src/util/utility.js`
- [Bot configuration](https://github.com/pineoverlay/pine_bot/blob/main/src/config.js): `src/config.js`
- [Environment settings](https://github.com/pineoverlay/pine_bot/blob/main/src/util/env-util.js): `src/util/env-util.js`

### Discord commands

- [Command sets](https://github.com/pineoverlay/pine_bot/tree/main/src/commands): `src/commands`
- [Text and utility commands](https://github.com/pineoverlay/pine_bot/tree/main/src/commands/generic): `src/commands/generic`
- [Economy commands](https://github.com/pineoverlay/pine_bot/tree/main/src/commands/economy): `src/commands/economy`
- [Character manager](https://github.com/pineoverlay/pine_bot/blob/main/src/util/character-manager.js): `src/util/character-manager.js`
- [Lua execution](https://github.com/pineoverlay/pine_bot/blob/main/src/util/lua.js): `src/util/lua.js`

### AI and search

- [AI commands](https://github.com/pineoverlay/pine_bot/tree/main/src/commands/ai): `src/commands/ai`
- [AI chat commands](https://github.com/pineoverlay/pine_bot/tree/main/src/commands/aichat): `src/commands/aichat`
- [Ollama models](https://github.com/pineoverlay/pine_bot/blob/main/src/util/ollama-models.js): `src/util/ollama-models.js`
- [Ollama tools](https://github.com/pineoverlay/pine_bot/blob/main/src/util/ollama-tools.js): `src/util/ollama-tools.js`
- [SearXNG search](https://github.com/pineoverlay/pine_bot/blob/main/src/util/searxng.js): `src/util/searxng.js`

### Media processing

- [Media commands](https://github.com/pineoverlay/pine_bot/tree/main/src/commands/external): `src/commands/external`
- [Video modifiers](https://github.com/pineoverlay/pine_bot/blob/main/src/basecommands/videomodifier.js): `src/basecommands/videomodifier.js`
- [FFmpeg utilities](https://github.com/pineoverlay/pine_bot/blob/main/src/util/ffmpeg-util.js): `src/util/ffmpeg-util.js`
- [Worker dispatch](https://github.com/pineoverlay/pine_bot/blob/main/src/util/multi-thread.js): `src/util/multi-thread.js`
- [Cellular automata](https://github.com/pineoverlay/pine_bot/blob/main/src/util/cellularAutomata/lifeLike.js): `src/util/cellularAutomata/lifeLike.js`
- [Temporary files](https://github.com/pineoverlay/pine_bot/blob/main/src/util/temp-folder.js): `src/util/temp-folder.js`

### Integrations and state

- [JG Node API](https://github.com/pineoverlay/pine_bot/blob/main/src/util/fetch-nodeapi.js): `src/util/fetch-nodeapi.js`
- [VLC integration](https://github.com/pineoverlay/pine_bot/blob/main/src/util/vlc-media-player.js): `src/util/vlc-media-player.js`
- [Stammer integration](https://github.com/pineoverlay/pine_bot/blob/main/src/util/stammer.js): `src/util/stammer.js`
- [Demucs integration](https://github.com/pineoverlay/pine_bot/blob/main/src/util/demucs.js): `src/util/demucs.js`
- [RVC integration](https://github.com/pineoverlay/pine_bot/blob/main/src/util/rvc.js): `src/util/rvc.js`

### Other components

- **Discord users**
- **Discord platform**
- **Local Ollama**
- **SearXNG service**

## Connections

- Discord users → Discord platform: send commands
- Discord platform → Client startup: connects client
- Client startup → Event loading: loads events (evidence: `src/index.js`)
- Client startup → Command utilities: sets state (evidence: `src/index.js`)
- Client startup → Environment settings: reads settings (evidence: `src/index.js`)
- Event loading → Client events: loads listeners
- Command utilities → Bot configuration: reads configuration (evidence: `src/util/utility.js`)
- Command utilities → Environment settings: reads settings (evidence: `src/util/utility.js`)
- Command sets → Discord platform: reply to commands
- Character manager → Lua execution: builds Lua context (evidence: `src/util/character-manager.js`)
- AI commands → SearXNG search: searches web (evidence: `src/commands/ai/search.js`)
- AI commands → Ollama models: uses models (evidence: `src/commands/ai/searchai.js`)
- AI commands → SearXNG search: searches web (evidence: `src/commands/ai/searchai.js`)
- Ollama models → Ollama tools: loads tools (evidence: `src/util/ollama-models.js`)
- Ollama models → Local Ollama: queries models
- SearXNG search → SearXNG service: requests results (evidence: `src/util/searxng.js`)
- Media commands → FFmpeg utilities: processes media (evidence: `src/commands/external/robertloggia.js`)
- Video modifiers → Worker dispatch: dispatches work (evidence: `src/basecommands/videomodifier.js`)
- Cellular automata → Worker dispatch: runs simulation
- Media commands → JG Node API: uses overlays
- Media commands → VLC integration: uses playback integration
- Media commands → Stammer integration: uses speech tool
- Media commands → Demucs integration: separates audio
- Media commands → RVC integration: runs voice dubbing
