# studylions/studylion architecture

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

- Interactive diagram: https://gitdiagram.com/studylions/studylion
- Repository: https://github.com/studylions/studylion

## Overview

LionBot is a Discord study and productivity bot. Members invoke commands and interactive features to track study/work activity, view statistics, and use productivity tools; server administrators configure moderation, rooms, and other guild features. The graph preserves the README’s major capability branches and the sampled runtime foundation. Several feature implementations were not sampled, so their internal calls and persistence links are omitted rather than inferred.

Main entry points: [`src/meta/LionBot.py`](https://github.com/studylions/studylion/blob/master/src/meta/LionBot.py) (Command runtime), [`src/modules/schedule`](https://github.com/studylions/studylion/tree/master/src/modules/schedule) (Scheduled sessions), [`src/modules/moderation`](https://github.com/studylions/studylion/tree/master/src/modules/moderation) (Moderation), [`src/core/data.py`](https://github.com/studylions/studylion/blob/master/src/core/data.py) (Core data models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_lionbot["Command runtime<br/>[LionBot.py]"]
  node_context["Command context<br/>[LionContext.py]"]
end

subgraph group_tracking["Tracking and insights"]
  node_voice_tracking["Voice tracking"]
  node_text_tracking["Text tracking"]
  node_statistics["Statistics and cards"]
  node_ranks["Study tiers"]
  node_achievements["Achievements<br/>[achievements.py]"]
end

subgraph group_productivity["Productivity tools"]
  node_pomodoro["Pomodoro timers"]
  node_tasklist["To-do lists"]
  node_reminders["Reminders"]
  node_schedule["Scheduled sessions"]
end

subgraph group_community["Community features"]
  node_rooms["Private and workout rooms"]
  node_video_channels["Camera-only rooms"]
  node_economy["Economy and shop"]
  node_moderation["Moderation"]
  node_rolemenus["Role menus"]
end

subgraph group_foundation["Shared foundation"]
  node_core_data["Core data models<br/>[data.py]"]
  node_database[("Database access<br/>[database.py]")]
  node_babel["Localization<br/>[translator.py]"]
  node_settings["Settings framework"]
  node_wards["Permission checks<br/>[wards.py]"]
  node_analytics["Analytics service"]
  node_sharding["Shard coordination<br/>[sharding.py]"]
end

node_member(("Discord member"))

node_member -->|"invokes commands"| node_lionbot
node_lionbot -->|"builds context"| node_context
node_lionbot -->|"loads extension"| node_voice_tracking
node_lionbot -->|"loads extension"| node_text_tracking
node_lionbot -->|"loads extension"| node_statistics
node_lionbot -->|"loads extension"| node_pomodoro
node_lionbot -->|"loads extension"| node_schedule
node_member -->|"views stats"| node_statistics
node_member -->|"starts timers"| node_pomodoro
node_member -->|"manages tasks"| node_tasklist
node_member -->|"sets reminders"| node_reminders
node_member -->|"books sessions"| node_schedule
node_member -->|"rents rooms"| node_rooms
node_member -->|"uses rooms"| node_video_channels
node_member -->|"views tiers"| node_ranks
node_member -->|"earns rewards"| node_achievements
node_member -->|"spends coins"| node_economy
node_member -->|"interacts with"| node_moderation
node_member -.->|"selects roles"| node_rolemenus
node_lionbot -->|"uses translator"| node_babel
node_lionbot -->|"uses shard config"| node_sharding
node_core_data -->|"uses data layer"| node_database
node_analytics -->|"imports core data"| node_core_data
node_schedule -.->|"uses settings"| node_settings
node_moderation -.->|"checks permissions"| node_wards

click node_lionbot "https://github.com/studylions/studylion/blob/master/src/meta/LionBot.py"
click node_context "https://github.com/studylions/studylion/blob/master/src/meta/LionContext.py"
click node_voice_tracking "https://github.com/studylions/studylion/tree/master/src/tracking/voice"
click node_text_tracking "https://github.com/studylions/studylion/tree/master/src/tracking/text"
click node_statistics "https://github.com/studylions/studylion/tree/master/src/modules/statistics"
click node_ranks "https://github.com/studylions/studylion/tree/master/src/modules/ranks"
click node_achievements "https://github.com/studylions/studylion/blob/master/src/modules/statistics/achievements.py"
click node_pomodoro "https://github.com/studylions/studylion/tree/master/src/modules/pomodoro"
click node_tasklist "https://github.com/studylions/studylion/tree/master/src/modules/tasklist"
click node_reminders "https://github.com/studylions/studylion/tree/master/src/modules/reminders"
click node_schedule "https://github.com/studylions/studylion/tree/master/src/modules/schedule"
click node_rooms "https://github.com/studylions/studylion/tree/master/src/modules/rooms"
click node_video_channels "https://github.com/studylions/studylion/tree/master/src/modules/video_channels"
click node_economy "https://github.com/studylions/studylion/tree/master/src/modules/economy"
click node_moderation "https://github.com/studylions/studylion/tree/master/src/modules/moderation"
click node_rolemenus "https://github.com/studylions/studylion/tree/master/src/modules/rolemenus"
click node_core_data "https://github.com/studylions/studylion/blob/master/src/core/data.py"
click node_database "https://github.com/studylions/studylion/blob/master/src/data/database.py"
click node_babel "https://github.com/studylions/studylion/blob/master/src/babel/translator.py"
click node_settings "https://github.com/studylions/studylion/tree/master/src/settings"
click node_wards "https://github.com/studylions/studylion/blob/master/src/wards.py"
click node_analytics "https://github.com/studylions/studylion/tree/master/src/analytics"
click node_sharding "https://github.com/studylions/studylion/blob/master/src/meta/sharding.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_lionbot,node_context toneBlue
class node_voice_tracking,node_text_tracking,node_statistics,node_ranks,node_achievements toneAmber
class node_pomodoro,node_tasklist,node_reminders,node_schedule toneMint
class node_rooms,node_video_channels,node_economy,node_moderation,node_rolemenus toneRose
class node_core_data,node_database,node_babel,node_settings,node_wards,node_analytics,node_sharding,node_member toneIndigo
```

## Components

### Bot runtime

- [Command runtime](https://github.com/studylions/studylion/blob/master/src/meta/LionBot.py): `src/meta/LionBot.py`
- [Command context](https://github.com/studylions/studylion/blob/master/src/meta/LionContext.py): `src/meta/LionContext.py`

### Tracking and insights

- [Voice tracking](https://github.com/studylions/studylion/tree/master/src/tracking/voice): `src/tracking/voice`
- [Text tracking](https://github.com/studylions/studylion/tree/master/src/tracking/text): `src/tracking/text`
- [Statistics and cards](https://github.com/studylions/studylion/tree/master/src/modules/statistics): `src/modules/statistics`
- [Study tiers](https://github.com/studylions/studylion/tree/master/src/modules/ranks): `src/modules/ranks`
- [Achievements](https://github.com/studylions/studylion/blob/master/src/modules/statistics/achievements.py): `src/modules/statistics/achievements.py`

### Productivity tools

- [Pomodoro timers](https://github.com/studylions/studylion/tree/master/src/modules/pomodoro): `src/modules/pomodoro`
- [To-do lists](https://github.com/studylions/studylion/tree/master/src/modules/tasklist): `src/modules/tasklist`
- [Reminders](https://github.com/studylions/studylion/tree/master/src/modules/reminders): `src/modules/reminders`
- [Scheduled sessions](https://github.com/studylions/studylion/tree/master/src/modules/schedule): `src/modules/schedule`

### Community features

- [Private and workout rooms](https://github.com/studylions/studylion/tree/master/src/modules/rooms): `src/modules/rooms`
- [Camera-only rooms](https://github.com/studylions/studylion/tree/master/src/modules/video_channels): `src/modules/video_channels`
- [Economy and shop](https://github.com/studylions/studylion/tree/master/src/modules/economy): `src/modules/economy`
- [Moderation](https://github.com/studylions/studylion/tree/master/src/modules/moderation): `src/modules/moderation`
- [Role menus](https://github.com/studylions/studylion/tree/master/src/modules/rolemenus): `src/modules/rolemenus`

### Shared foundation

- [Core data models](https://github.com/studylions/studylion/blob/master/src/core/data.py): `src/core/data.py`
- [Database access](https://github.com/studylions/studylion/blob/master/src/data/database.py): `src/data/database.py`
- [Localization](https://github.com/studylions/studylion/blob/master/src/babel/translator.py): `src/babel/translator.py`
- [Settings framework](https://github.com/studylions/studylion/tree/master/src/settings): `src/settings`
- [Permission checks](https://github.com/studylions/studylion/blob/master/src/wards.py): `src/wards.py`
- [Analytics service](https://github.com/studylions/studylion/tree/master/src/analytics): `src/analytics`
- [Shard coordination](https://github.com/studylions/studylion/blob/master/src/meta/sharding.py): `src/meta/sharding.py`

### Other components

- **Discord member**

## Connections

- Discord member → Command runtime: invokes commands
- Command runtime → Command context: builds context (evidence: `src/meta/LionBot.py`)
- Command runtime → Voice tracking: loads extension (evidence: `src/meta/LionBot.py`)
- Command runtime → Text tracking: loads extension (evidence: `src/meta/LionBot.py`)
- Command runtime → Statistics and cards: loads extension (evidence: `src/meta/LionBot.py`)
- Command runtime → Pomodoro timers: loads extension (evidence: `src/meta/LionBot.py`)
- Command runtime → Scheduled sessions: loads extension (evidence: `src/meta/LionBot.py`)
- Discord member → Statistics and cards: views stats
- Discord member → Pomodoro timers: starts timers
- Discord member → To-do lists: manages tasks
- Discord member → Reminders: sets reminders
- Discord member → Scheduled sessions: books sessions
- Discord member → Private and workout rooms: rents rooms
- Discord member → Camera-only rooms: uses rooms
- Discord member → Study tiers: views tiers
- Discord member → Achievements: earns rewards
- Discord member → Economy and shop: spends coins
- Discord member → Moderation: interacts with
- Discord member → Role menus: selects roles
- Command runtime → Localization: uses translator (evidence: `src/meta/LionBot.py`)
- Command runtime → Shard coordination: uses shard config (evidence: `src/meta/LionBot.py`)
- Core data models → Database access: uses data layer (evidence: `src/core/data.py`)
- Analytics service → Core data models: imports core data (evidence: `src/analytics/server.py`)
- Scheduled sessions → Settings framework: uses settings
- Moderation → Permission checks: checks permissions
