# urekd/steam-workshop-monitor architecture

> Architecture diagram of the GitHub repository urekd/steam-workshop-monitor, 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/urekd/steam-workshop-monitor
- Repository: https://github.com/urekd/steam-workshop-monitor

## Overview

Steam-Workshop-Monitor is a Discord bot for tracking Steam Workshop mods. In the principal workflow, guild members use slash commands to manage monitored mods; the bot checks Steam for update times, compares them with stored state, and notifies Discord. The current bot also manages guild, channel, role, and mod data across MySQL and Redis. A separate older, file-backed bot remains in the repository, as does a statistics badge generator. Some runtime sections were not excerpted, so only documented or directly visible relationships are shown.

Main entry points: [`WorkshopMonitor.py`](https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py) (Slash commands), [`Old-No-DB/WorkshopMonitor.py`](https://github.com/urekd/steam-workshop-monitor/blob/main/Old-No-DB/WorkshopMonitor.py) (File-backed bot), [`stats/stats.py`](https://github.com/urekd/steam-workshop-monitor/blob/main/stats/stats.py) (Stats generator), [`Old-No-DB/data/config.json`](https://github.com/urekd/steam-workshop-monitor/blob/main/Old-No-DB/data/config.json) (JSON mod config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discord["Discord Bot"]
  node_slash_commands["Slash commands<br/>[WorkshopMonitor.py]"]
  node_guild_lifecycle["Guild lifecycle<br/>[WorkshopMonitor.py]"]
  node_notifications["Notifications<br/>[WorkshopMonitor.py]"]
end

subgraph group_monitoring["Workshop Monitoring"]
  node_monitor_cycle["Monitor cycle<br/>[WorkshopMonitor.py]"]
  node_mod_checks["Mod checks<br/>[WorkshopMonitor.py]"]
  node_collection_import["Collection import<br/>[WorkshopMonitor.py]"]
end

subgraph group_storage["Persistent State"]
  node_mysql[("MySQL data<br/>[WorkshopMonitor.py]")]
  node_redis[("Redis cache<br/>[WorkshopMonitor.py]")]
end

subgraph group_legacy["Legacy Bot"]
  node_legacy_bot["File-backed bot<br/>[WorkshopMonitor.py]"]
  node_legacy_config["JSON mod config<br/>[config.json]"]
end

subgraph group_stats["Statistics"]
  node_stats_generator["Stats generator<br/>[stats.py]"]
  node_stats_database[("Stats database<br/>[stats.py]")]
  node_stats_output["Badge output<br/>[stats.py]"]
end

node_members(("Guild members"))
node_discord_platform(("Discord"))
node_steam_api{{"Steam API"}}

node_members -->|"uses"| node_slash_commands
node_slash_commands -->|"responds through"| node_discord_platform
node_monitor_cycle -->|"checks mods"| node_mod_checks
node_mod_checks -->|"queries updates"| node_steam_api
node_mod_checks -->|"compares stored times"| node_mysql
node_monitor_cycle -->|"reports updates"| node_notifications
node_notifications -->|"sends alerts"| node_discord_platform
node_slash_commands -->|"manages mod data"| node_mysql
node_slash_commands -->|"imports collection"| node_collection_import
node_collection_import -->|"fetches collection"| node_steam_api
node_collection_import -->|"stores imported mods"| node_mysql
node_slash_commands -->|"refills cache"| node_redis
node_guild_lifecycle -->|"updates guild records"| node_mysql
node_guild_lifecycle -->|"clears guild keys"| node_redis
node_discord_platform -->|"signals membership changes"| node_guild_lifecycle
node_legacy_bot -->|"reads and writes"| node_legacy_config
node_legacy_bot -->|"checks Workshop"| node_steam_api
node_legacy_bot -->|"sends notifications"| node_discord_platform
node_stats_generator -->|"queries counts"| node_stats_database
node_stats_generator -->|"renders badge"| node_stats_output

click node_slash_commands "https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py"
click node_guild_lifecycle "https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py"
click node_notifications "https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py"
click node_monitor_cycle "https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py"
click node_mod_checks "https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py"
click node_collection_import "https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py"
click node_mysql "https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py"
click node_redis "https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py"
click node_legacy_bot "https://github.com/urekd/steam-workshop-monitor/blob/main/Old-No-DB/WorkshopMonitor.py"
click node_legacy_config "https://github.com/urekd/steam-workshop-monitor/blob/main/Old-No-DB/data/config.json"
click node_stats_generator "https://github.com/urekd/steam-workshop-monitor/blob/main/stats/stats.py"
click node_stats_database "https://github.com/urekd/steam-workshop-monitor/blob/main/stats/stats.py"
click node_stats_output "https://github.com/urekd/steam-workshop-monitor/blob/main/stats/stats.py"

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_slash_commands,node_guild_lifecycle,node_notifications toneBlue
class node_monitor_cycle,node_mod_checks,node_collection_import toneAmber
class node_mysql,node_redis,node_steam_api toneMint
class node_legacy_bot,node_legacy_config toneRose
class node_stats_generator,node_stats_database,node_stats_output,node_members,node_discord_platform toneIndigo
```

## Components

### Discord Bot

- [Slash commands](https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py): `WorkshopMonitor.py`
- [Guild lifecycle](https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py): `WorkshopMonitor.py`
- [Notifications](https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py): `WorkshopMonitor.py`

### Workshop Monitoring

- [Monitor cycle](https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py): `WorkshopMonitor.py`
- [Mod checks](https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py): `WorkshopMonitor.py`
- [Collection import](https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py): `WorkshopMonitor.py`

### Persistent State

- [MySQL data](https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py): `WorkshopMonitor.py`
- [Redis cache](https://github.com/urekd/steam-workshop-monitor/blob/main/WorkshopMonitor.py): `WorkshopMonitor.py`

### Legacy Bot

- [File-backed bot](https://github.com/urekd/steam-workshop-monitor/blob/main/Old-No-DB/WorkshopMonitor.py): `Old-No-DB/WorkshopMonitor.py`
- [JSON mod config](https://github.com/urekd/steam-workshop-monitor/blob/main/Old-No-DB/data/config.json): `Old-No-DB/data/config.json`

### Statistics

- [Stats generator](https://github.com/urekd/steam-workshop-monitor/blob/main/stats/stats.py): `stats/stats.py`
- [Stats database](https://github.com/urekd/steam-workshop-monitor/blob/main/stats/stats.py): `stats/stats.py`
- [Badge output](https://github.com/urekd/steam-workshop-monitor/blob/main/stats/stats.py): `stats/stats.py`

### Other components

- **Guild members**
- **Discord**
- **Steam API**

## Connections

- Guild members → Slash commands: uses (evidence: `README.md`)
- Slash commands → Discord: responds through (evidence: `WorkshopMonitor.py`)
- Monitor cycle → Mod checks: checks mods (evidence: `WorkshopMonitor.py`)
- Mod checks → Steam API: queries updates (evidence: `WorkshopMonitor.py`)
- Mod checks → MySQL data: compares stored times (evidence: `README.md`)
- Monitor cycle → Notifications: reports updates (evidence: `README.md`)
- Notifications → Discord: sends alerts (evidence: `README.md`)
- Slash commands → MySQL data: manages mod data (evidence: `WorkshopMonitor.py`)
- Slash commands → Collection import: imports collection (evidence: `WorkshopMonitor.py`)
- Collection import → Steam API: fetches collection (evidence: `WorkshopMonitor.py`)
- Collection import → MySQL data: stores imported mods (evidence: `WorkshopMonitor.py`)
- Slash commands → Redis cache: refills cache (evidence: `WorkshopMonitor.py`)
- Guild lifecycle → MySQL data: updates guild records (evidence: `WorkshopMonitor.py`)
- Guild lifecycle → Redis cache: clears guild keys (evidence: `WorkshopMonitor.py`)
- Discord → Guild lifecycle: signals membership changes (evidence: `WorkshopMonitor.py`)
- File-backed bot → JSON mod config: reads and writes (evidence: `Old-No-DB/WorkshopMonitor.py`)
- File-backed bot → Steam API: checks Workshop (evidence: `Old-No-DB/WorkshopMonitor.py`)
- File-backed bot → Discord: sends notifications (evidence: `Old-No-DB/WorkshopMonitor.py`)
- Stats generator → Stats database: queries counts (evidence: `stats/stats.py`)
- Stats generator → Badge output: renders badge (evidence: `stats/stats.py`)
