# itsasarya/druid architecture

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

- Interactive diagram: https://gitdiagram.com/itsasarya/druid
- Repository: https://github.com/itsasarya/druid

## Overview

Druid is a Discord bot whose main workflow is to accept Discord commands and events, apply feature logic, persist or retrieve guild data, and respond or change Discord state. Its major branches are temporary voice channels, word-based moderation, XP and leveling, and utility commands. MongoDB access is centralized in database/__init__.py. The excerpts show the bot startup and most feature interactions; some temporary-voice behavior and feature details are documented but not fully sampled.

Main entry points: [`database/__init__.py`](https://github.com/itsasarya/druid/blob/main/database/__init__.py) (Feature data access), [`src/__init__.py`](https://github.com/itsasarya/druid/blob/main/src/__init__.py) (Bot setup and loader), [`src/cogs/temp_voice.py`](https://github.com/itsasarya/druid/blob/main/src/cogs/temp_voice.py) (Channel lifecycle), [`src/cogs/auto_moderation.py`](https://github.com/itsasarya/druid/blob/main/src/cogs/auto_moderation.py) (Word moderation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot Runtime"]
  node_main["Process entrypoint<br/>[main.py]"]
  node_bot["Bot setup and loader<br/>[__init__.py]"]
  node_core["Utility commands<br/>[core.py]"]
end

subgraph group_voice["Temporary Voice"]
  node_voice_lifecycle["Channel lifecycle<br/>[temp_voice.py]"]
  node_voice_controls["Owner controls<br/>[temp_voice.py]"]
end

subgraph group_moderation["Auto Moderation"]
  node_automod["Word moderation<br/>[auto_moderation.py]"]
end

subgraph group_xp["XP and Leveling"]
  node_level_activity["Activity XP<br/>[levelling.py]"]
  node_level_commands["XP commands<br/>[levelling.py]"]
end

node_user(("Discord users"))
node_discord(("Discord platform"))
node_database["Feature data access<br/>[__init__.py]"]
node_mongo[("MongoDB")]

node_user -->|"issues commands"| node_discord
node_main -->|"starts bot"| node_bot
node_bot -->|"loads extension"| node_core
node_bot -->|"loads extension"| node_voice_lifecycle
node_bot -->|"loads extension"| node_automod
node_bot -->|"loads extension"| node_level_activity
node_discord -->|"routes commands"| node_core
node_discord -->|"routes commands"| node_voice_lifecycle
node_discord -->|"routes controls"| node_voice_controls
node_discord -->|"delivers messages"| node_automod
node_discord -->|"delivers activity"| node_level_activity
node_discord -->|"routes commands"| node_level_commands
node_voice_lifecycle -->|"reads and writes"| node_database
node_voice_controls -->|"reads and writes"| node_database
node_voice_lifecycle -->|"manages channels"| node_discord
node_voice_controls -->|"changes channel settings"| node_discord
node_automod -->|"reads and writes rules"| node_database
node_automod -->|"deletes messages"| node_discord
node_level_activity -->|"updates XP"| node_database
node_level_activity -->|"announces level-ups"| node_discord
node_level_commands -->|"reads and updates XP"| node_database
node_database -->|"reads and writes"| node_mongo
node_core -->|"responds to commands"| node_discord

click node_main "https://github.com/itsasarya/druid/blob/main/main.py"
click node_bot "https://github.com/itsasarya/druid/blob/main/src/__init__.py"
click node_core "https://github.com/itsasarya/druid/blob/main/src/cogs/core.py"
click node_voice_lifecycle "https://github.com/itsasarya/druid/blob/main/src/cogs/temp_voice.py"
click node_voice_controls "https://github.com/itsasarya/druid/blob/main/src/cogs/temp_voice.py"
click node_automod "https://github.com/itsasarya/druid/blob/main/src/cogs/auto_moderation.py"
click node_level_activity "https://github.com/itsasarya/druid/blob/main/src/cogs/levelling.py"
click node_level_commands "https://github.com/itsasarya/druid/blob/main/src/cogs/levelling.py"
click node_database "https://github.com/itsasarya/druid/blob/main/database/__init__.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_main,node_bot,node_core,node_user toneBlue
class node_voice_lifecycle,node_voice_controls,node_mongo toneAmber
class node_automod toneMint
class node_level_activity,node_level_commands toneRose
class node_discord toneIndigo
class node_database toneTeal
```

## Components

### Bot Runtime

- [Process entrypoint](https://github.com/itsasarya/druid/blob/main/main.py): `main.py`
- [Bot setup and loader](https://github.com/itsasarya/druid/blob/main/src/__init__.py): `src/__init__.py`
- [Utility commands](https://github.com/itsasarya/druid/blob/main/src/cogs/core.py): `src/cogs/core.py`

### Temporary Voice

- [Channel lifecycle](https://github.com/itsasarya/druid/blob/main/src/cogs/temp_voice.py): `src/cogs/temp_voice.py`
- [Owner controls](https://github.com/itsasarya/druid/blob/main/src/cogs/temp_voice.py): `src/cogs/temp_voice.py`

### Auto Moderation

- [Word moderation](https://github.com/itsasarya/druid/blob/main/src/cogs/auto_moderation.py): `src/cogs/auto_moderation.py`

### XP and Leveling

- [Activity XP](https://github.com/itsasarya/druid/blob/main/src/cogs/levelling.py): `src/cogs/levelling.py`
- [XP commands](https://github.com/itsasarya/druid/blob/main/src/cogs/levelling.py): `src/cogs/levelling.py`

### Other components

- **Discord users**
- **Discord platform**
- [Feature data access](https://github.com/itsasarya/druid/blob/main/database/__init__.py): `database/__init__.py`
- **MongoDB**

## Connections

- Discord users → Discord platform: issues commands (evidence: `README.md`)
- Process entrypoint → Bot setup and loader: starts bot (evidence: `main.py`)
- Bot setup and loader → Utility commands: loads extension (evidence: `src/__init__.py`)
- Bot setup and loader → Channel lifecycle: loads extension (evidence: `src/__init__.py`)
- Bot setup and loader → Word moderation: loads extension (evidence: `src/__init__.py`)
- Bot setup and loader → Activity XP: loads extension (evidence: `src/__init__.py`)
- Discord platform → Utility commands: routes commands (evidence: `src/cogs/core.py`)
- Discord platform → Channel lifecycle: routes commands (evidence: `README.md`)
- Discord platform → Owner controls: routes controls (evidence: `README.md`)
- Discord platform → Word moderation: delivers messages (evidence: `src/cogs/auto_moderation.py`)
- Discord platform → Activity XP: delivers activity (evidence: `src/cogs/levelling.py`)
- Discord platform → XP commands: routes commands (evidence: `README.md`)
- Channel lifecycle → Feature data access: reads and writes (evidence: `src/cogs/temp_voice.py`)
- Owner controls → Feature data access: reads and writes (evidence: `src/cogs/temp_voice.py`)
- Channel lifecycle → Discord platform: manages channels (evidence: `src/cogs/temp_voice.py`)
- Owner controls → Discord platform: changes channel settings (evidence: `src/cogs/temp_voice.py`)
- Word moderation → Feature data access: reads and writes rules (evidence: `src/cogs/auto_moderation.py`)
- Word moderation → Discord platform: deletes messages (evidence: `src/cogs/auto_moderation.py`)
- Activity XP → Feature data access: updates XP (evidence: `src/cogs/levelling.py`)
- Activity XP → Discord platform: announces level-ups (evidence: `src/cogs/levelling.py`)
- XP commands → Feature data access: reads and updates XP (evidence: `src/cogs/levelling.py`)
- Feature data access → MongoDB: reads and writes (evidence: `database/__init__.py`)
- Utility commands → Discord platform: responds to commands (evidence: `src/cogs/core.py`)
