# shahinahmedrafi01-pro/discord-voice architecture

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

- Interactive diagram: https://gitdiagram.com/shahinahmedrafi01-pro/discord-voice
- Repository: https://github.com/shahinahmedrafi01-pro/discord-voice

## Overview

This is a single-file Discord bot for continuous Quran recitation in one configured voice channel. A staff member starts playback with `/playquran`; the bot connects, streams surahs in sequence, and loops. Runtime monitors handle reconnection and pausing when the channel is empty, while a small health server supports hosting. The README says there is no stop command, but the sampled `bot.py` excerpt documents and implements `/stopplay`; this graph reflects that sampled implementation. Internal details are limited to the excerpts provided.

Main entry points: [`bot.py`](https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py) (Voice Connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["Staff Commands"]
  node_play_command["Play Command<br/>[bot.py]"]
  node_stop_command["Stop Command<br/>[bot.py]"]
end

subgraph group_playback["Recitation Playback"]
  node_voice_connection["Voice Connection<br/>[bot.py]"]
  node_surah_loop["Surah Playback Loop<br/>[bot.py]"]
end

subgraph group_runtime["Runtime Operations"]
  node_empty_monitor["Empty Channel Monitor<br/>[bot.py]"]
  node_watchdog["Reconnect Watchdog<br/>[bot.py]"]
  node_startup["Bot Startup<br/>[bot.py]"]
  node_health_server["Health Server<br/>[bot.py]"]
end

node_staff(("Staff Member"))
node_discord["Discord"]
node_mp3quran["MP3 Quran Source"]
node_uptime(("Uptime Probe"))

node_staff -->|"invokes"| node_play_command
node_play_command -->|"connects"| node_voice_connection
node_play_command -->|"starts"| node_surah_loop
node_staff -->|"invokes"| node_stop_command
node_stop_command -->|"disconnects"| node_voice_connection
node_surah_loop -->|"uses"| node_voice_connection
node_surah_loop -->|"streams MP3"| node_mp3quran
node_voice_connection -->|"joins channel"| node_discord
node_startup -->|"starts"| node_watchdog
node_startup -->|"starts"| node_empty_monitor
node_watchdog -->|"reconnects"| node_voice_connection
node_startup -->|"starts"| node_health_server
node_uptime -.->|"checks"| node_health_server

click node_play_command "https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py"
click node_stop_command "https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py"
click node_voice_connection "https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py"
click node_surah_loop "https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py"
click node_empty_monitor "https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py"
click node_watchdog "https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py"
click node_startup "https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py"
click node_health_server "https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.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_play_command,node_stop_command toneBlue
class node_voice_connection,node_surah_loop toneAmber
class node_empty_monitor,node_watchdog,node_startup,node_health_server toneMint
class node_staff,node_discord,node_mp3quran,node_uptime toneIndigo
```

## Components

### Staff Commands

- [Play Command](https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py): `bot.py`
- [Stop Command](https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py): `bot.py`

### Recitation Playback

- [Voice Connection](https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py): `bot.py`
- [Surah Playback Loop](https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py): `bot.py`

### Runtime Operations

- [Empty Channel Monitor](https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py): `bot.py`
- [Reconnect Watchdog](https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py): `bot.py`
- [Bot Startup](https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py): `bot.py`
- [Health Server](https://github.com/shahinahmedrafi01-pro/discord-voice/blob/main/bot.py): `bot.py`

### Other components

- **Staff Member**
- **Discord**
- **MP3 Quran Source**
- **Uptime Probe**

## Connections

- Staff Member → Play Command: invokes (evidence: `README.md`)
- Play Command → Voice Connection: connects (evidence: `bot.py`)
- Play Command → Surah Playback Loop: starts (evidence: `bot.py`)
- Staff Member → Stop Command: invokes (evidence: `bot.py`)
- Stop Command → Voice Connection: disconnects (evidence: `bot.py`)
- Surah Playback Loop → Voice Connection: uses (evidence: `bot.py`)
- Surah Playback Loop → MP3 Quran Source: streams MP3 (evidence: `README.md`)
- Voice Connection → Discord: joins channel (evidence: `bot.py`)
- Bot Startup → Reconnect Watchdog: starts (evidence: `bot.py`)
- Bot Startup → Empty Channel Monitor: starts (evidence: `bot.py`)
- Reconnect Watchdog → Voice Connection: reconnects (evidence: `bot.py`)
- Bot Startup → Health Server: starts (evidence: `bot.py`)
- Uptime Probe → Health Server: checks (evidence: `README.md`)
