# sennyru/nosookbot architecture

> Architecture diagram of the GitHub repository sennyru/nosookbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sennyru/nosookbot
- Repository: https://github.com/sennyru/nosookbot

## Overview

##### Project type and purpose
- This is a full-stack “service” bot for Discord written in Python.
- Purpose: Fetch and display voice call log data in channels, maintain real-time timeline embeds, and expose bot info via slash commands.

##### File structure
- Top-level files:
- main.py / nosookbot.py – entrypoints that initialize the bot and register Cogs
- Dockerfile – containerization
- .github/workflows/deploy.yml – CI/CD pipeline for automatic deployment
- requirements.txt – library dependencies (Pycord, firebase-admin, etc.)
- Cogs/ directory:
- core.py – commands for /노숙봇, /타임라인
- call_log.py – logic for /리얼타임 (real-time timeline) and retrieving/storing call logs
- README.md describes the bot’s features, tech stack (Python, Pycord, Firebase), and usage.

##### README for additional insights
- Key external dependencies:
- Discord API (via Pycord)
- Firebase (for persisting call logs and real-time channel configuration)

a. Main components
- External Services (left side):
– Discord API
– Firebase Realtime Database / Firestore
- Bot Application (center):
– Docker Container or runtime environment
– Entry point (main.py / nosookbot.py)
– Cogs modules: core, call_log
– Dependency manager (requirements.txt)
- CI/CD Pipeline (top/right):
– GitHub Actions ─ triggers Docker build & deploy
- Deployment Target (bottom/right):
– Hosting environment (could be a VM, Kubernetes cluster, AWS ECS, etc.)
b. Relationships and interactions
- Discord API ↔ Bot Application:
– Bot subscribes to events (slash commands, voice channel updates)
– Bot sends messages and embeds back to Discord
- Bot Application ↔ Firebase:
– Reads/writes call log records
– Stores “real-time timeline channel” configuration
- CI/CD Pipeline → Docker Container:
– On push to main, build Docker image and deploy to target
c. Architectural patterns and design principles
- Modular architecture via Cogs – separation of command handling from core logic
- Single responsibility: each Cog handles a distinct feature set
- Containerization for consistent runtime
- Event-driven interactions with external APIs
d. Key technologies
- Python 3.x, Pycord for Discord interactions
- firebase-admin SDK in call_log.py
- Docker for packaging
- GitHub Actions for CI/CD

##### IMPORTANT
- Be very detailed: include each Cog as a sub-component.
- Architectural elements: container boundary, config files, CI pipeline.
- Do not overcrowd—group related Cogs but label them individually.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Services
    subgraph "External Services"
        direction TB
        DiscordAPI(("Discord API")):::external
        FirebaseDB(("Firebase DB")):::external
    end

    %% Bot Application
    subgraph "Bot Application"
        direction TB
        BotContainer["Bot Container"]:::container
        entry1["Entry Point: main.py"]:::code
        entry2["Entry Point: nosookbot.py"]:::code
        requirements["Dependency Manager: requirements.txt"]:::code
        subgraph "Cogs"
            direction TB
            CoreCog["Core Commands Cog"]:::code
            CallLogCog["Call Log & Real-Time Timeline Cog"]:::code
        end
    end

    %% CI/CD & Deployment
    subgraph "CI/CD & Deployment"
        direction TB
        GitHubActions(("GitHub Actions")):::ci
        DockerfileNode["Dockerfile"]:::code
        ProductionHost(("Production Host")):::prod
        README["Project Documentation: README.md"]:::code
        Gitignore["Git Ignore: .gitignore"]:::code
    end

    %% Relationships
    DiscordAPI -->|"Events & Commands"| BotContainer
    BotContainer -->|"API Calls"| DiscordAPI
    FirebaseDB -->|"Read/Write Call Logs"| BotContainer
    BotContainer -->|"Persistence"| FirebaseDB

    BotContainer --> entry1
    BotContainer --> entry2
    BotContainer --> requirements
    BotContainer --> CoreCog
    BotContainer --> CallLogCog

    GitHubActions -->|"Build & Deploy"| DockerfileNode
    DockerfileNode --> ProductionHost

    %% Click Events
    click entry1 "https://github.com/sennyru/nosookbot/blob/main/main.py"
    click entry2 "https://github.com/sennyru/nosookbot/blob/main/nosookbot.py"
    click CoreCog "https://github.com/sennyru/nosookbot/blob/main/Cogs/core.py"
    click CallLogCog "https://github.com/sennyru/nosookbot/blob/main/Cogs/call_log.py"
    click requirements "https://github.com/sennyru/nosookbot/blob/main/requirements.txt"
    click DockerfileNode "https://github.com/sennyru/nosookbot/tree/main/Dockerfile"
    click GitHubActions "https://github.com/sennyru/nosookbot/blob/main/.github/workflows/deploy.yml"
    click README "https://github.com/sennyru/nosookbot/blob/main/README.md"
    click Gitignore "https://github.com/sennyru/nosookbot/blob/main/.gitignore"

    %% Styles
    classDef external fill:#aadaff,stroke:#333,stroke-width:1px
    classDef container fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef code fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef ci fill:#ffcc99,stroke:#333,stroke-width:1px
    classDef prod fill:#ffcc99,stroke:#333,stroke-width:1px
```
