# ashyboxy/bread architecture

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

- Interactive diagram: https://gitdiagram.com/ashyboxy/bread
- Repository: https://github.com/ashyboxy/bread

## Overview

##### Main Components

a. Core Bot Infrastructure
- Entry Point (index.ts)
- Framework Layer (src/framework)
- Event Handler System (src/Events)
- Command Handler System (src/Commands)

b. Feature Modules
- Command Categories (fun, mod, config, special, test)
- Utility Services (src/Utils)
- Data Management (data directory)

c. Internationalization System
- String Management (src/strings)
- Language Files (english.json, french.json)

##### Component Relationships

**[Bot Core Layer]**

- [Framework Layer]

- [Event System]
- [Command Handler]

- [Feature Modules]

- [Command Categories]
- Fun Commands
- Moderation Commands
- Config Commands
- Special Commands

- [Utility Services]
- Bible Utils
- React Utils
- General Utils

- [I18n System]
- String Manager
- Language Resources

##### Implementation Details to Note

- Relationship between Commands and their respective interfaces
- How the string management system interfaces with commands
- Demonstrate the event flow from Discord events through the bot's event system
- Configuration system and its interaction with other components

##### Data Flow Indicators

- Command input flow
- Event propagation
- Language resource loading
- Data persistence paths

For this specific Discord bot project, focus on showing how the command handling, event system, and internationalization components interact while highlighting the modular nature of the command structure and the planned improvements mentioned in the README.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core
        Entry["Bot Entry Point"]
        Framework["Framework Layer"]
        EventSystem["Event Handler System"]
        CmdHandler["Command Handler System"]
    end

    subgraph Features
        subgraph CommandCategories
            Fun["Fun Commands"]
            Mod["Moderation Commands"]
            Cfg["Config Commands"]
            Special["Special Commands"]
            Test["Test Commands"]
        end

        subgraph Utils
            BibleUtil["Bible Utils"]
            ReactUtil["React Utils"]
            GenUtil["General Utils"]
        end
    end

    subgraph I18n
        StringMgr["String Manager"]
        LangRes["Language Resources"]
        StrIndex["Strings Entry Point"]
        English["English Strings"]
        French["French Strings"]
    end

    subgraph Data
        DataMgmt["Data Management"]
        subgraph Interfaces
            BibleInt["Bible Interfaces"]
            UserInt["User Data Interface"]
            BreadInt["Bread Data Interface"]
        end
    end

    subgraph Config
        ExConfig["Example Config"]
        Constants["Constants"]
    end

    Entry --> Framework
    Framework --> EventSystem
    Framework --> CmdHandler

    CmdHandler --> CommandCategories
    EventSystem --> ReactUtil

    CommandCategories --> StringMgr
    StringMgr --> LangRes
    StrIndex --> StringMgr
    LangRes --> English
    LangRes --> French

    Utils --> Interfaces
    CommandCategories --> Utils

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef core fill:#b3d1ff,stroke:#333
    classDef feature fill:#90EE90,stroke:#333
    classDef i18n fill:#FFB366,stroke:#333
    classDef data fill:#DDA0DD,stroke:#333
    classDef config fill:#FFD700,stroke:#333

    class Entry,Framework,EventSystem,CmdHandler core
    class Fun,Mod,Cfg,Special,Test,Utils,BibleUtil,ReactUtil,GenUtil feature
    class StringMgr,LangRes,StrIndex,English,French i18n
    class DataMgmt,Interfaces,BibleInt,UserInt,BreadInt data
    class ExConfig,Constants config

    click Entry "https://github.com/AshyBoxy/bread/blob/master/src/index.ts"
    click Framework "https://github.com/AshyBoxy/bread/tree/master/src/framework/"
    click EventSystem "https://github.com/AshyBoxy/bread/tree/master/src/Events/"
    click CmdHandler "https://github.com/AshyBoxy/bread/tree/master/src/Commands/"
    click Fun "https://github.com/AshyBoxy/bread/tree/master/src/Commands/fun/"
    click Mod "https://github.com/AshyBoxy/bread/tree/master/src/Commands/mod/"
    click Cfg "https://github.com/AshyBoxy/bread/tree/master/src/Commands/config/"
    click Special "https://github.com/AshyBoxy/bread/tree/master/src/Commands/special/"
    click Test "https://github.com/AshyBoxy/bread/tree/master/src/Commands/test/"
    click BibleUtil "https://github.com/AshyBoxy/bread/blob/master/src/Utils/bible.ts"
    click ReactUtil "https://github.com/AshyBoxy/bread/blob/master/src/Utils/react.ts"
    click GenUtil "https://github.com/AshyBoxy/bread/blob/master/src/Utils/index.ts"
    click DataMgmt "https://github.com/AshyBoxy/bread/tree/master/data/"
    click StringMgr "https://github.com/AshyBoxy/bread/blob/master/src/strings/Strings.ts"
    click English "https://github.com/AshyBoxy/bread/blob/master/src/strings/english.json"
    click French "https://github.com/AshyBoxy/bread/blob/master/src/strings/french.json"
    click StrIndex "https://github.com/AshyBoxy/bread/blob/master/src/strings/index.ts"
    click BibleInt "https://github.com/AshyBoxy/bread/blob/master/src/Interfaces/BibleBook.ts"
    click UserInt "https://github.com/AshyBoxy/bread/blob/master/src/Interfaces/UserData.ts"
    click BreadInt "https://github.com/AshyBoxy/bread/blob/master/src/Interfaces/BreadData.ts"
    click ExConfig "https://github.com/AshyBoxy/bread/blob/master/src/example-config.ts"
    click Constants "https://github.com/AshyBoxy/bread/blob/master/src/constants.ts"
```
