# 0xstarlabs/starlabs-discord architecture

> Architecture diagram of the GitHub repository 0xstarlabs/starlabs-discord, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0xstarlabs/starlabs-discord
- Repository: https://github.com/0xstarlabs/starlabs-discord

## Overview

##### Main Components Identification
- Entry Point & Configuration: Mark the two main starting points, i.e., main.py (and process.py if used for auxiliary flows). Also include config.yaml as the configuration engine and accounts.xlsx (and message/picture directories) as external data inputs.
– The Discord Module: This includes submodules like account_editor, button_presser, chatter, inviter, leave_guild, reaction_presser, send_chat_message, token_checker, and utility scripts that interact with Discord.
– The Captcha Submodule: Represent the captcha folder (with capsolver and nocaptcha) as a specialized helper that the Discord actions call upon.
– The GPT Module: Represent src/model/gpt with its components (gpt and prompts) handling AI chat integration.
– Data Preparation & Start Logic: The prepare_data.py and start.py script can be depicted as initial processing before operations begin.

##### Architectural Patterns & Design Principles
- Modular Design: Emphasize how the project separates concerns by keeping core Discord actions, AI operations, captcha solving, and utilities in distinct modules under src/model and src/utils.
- External Data Integration: Capture how the system integrates with external Excel data and media resources (messages, pictures) to drive the automation behaviors.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Point & Configuration
    subgraph "Entry Point & Configuration"
        main["main.py"]:::entry
        process["process.py"]:::entry
        config["config.yaml"]:::entry
        accounts["accounts.xlsx"]:::external
        messages["messages (dir)"]:::external
        pictures["pictures (dir)"]:::external
    end

    %% Core Business Logic
    subgraph "Core Business Logic"
        %% Discord Module Subgraph
        subgraph "Discord Module"
            accEd["account_editor"]:::module
            btnPress["button_presser"]:::module
            chatter["chatter"]:::module
            getAcc["get_account_info"]:::module
            getSrv["get_all_servers"]:::module
            inviter["inviter"]:::module
            leaveGuild["leave_guild"]:::module
            reactPress["reaction_presser"]:::module
            sendChat["send_chat_message"]:::module
            tokenCheck["token_checker"]:::module
            discordUtils["discord_utils"]:::module
        end

        %% Captcha Submodule
        subgraph "Captcha Submodule"
            capsolver["capsolver"]:::module
            nocaptcha["nocaptcha"]:::module
        end

        %% GPT Module
        subgraph "GPT Module"
            gpt["gpt"]:::module
            prompts["prompts"]:::module
        end

        %% Data Preparation & Start Logic
        subgraph "Data Preparation & Start Logic"
            prepareData["prepare_data"]:::engine
            start["start"]:::engine
        end
    end

    %% Utilities
    subgraph "Utilities"
        utilConfig["config"]:::util
        reader["reader"]:::util
        writer["writer"]:::util
        githubVer["check_github_version"]:::util
        client["client"]:::util
        constants["constants"]:::util
        output["output"]:::util
    end

    %% External API Integration
    openai["OpenAI API"]:::service

    %% Connections from Entry Point & Configuration to external data and core logic
    main -->|"loadsConfig"| config
    main -->|"readsAccounts"| accounts
    main -->|"readsMessages"| messages
    main -->|"readsPictures"| pictures

    %% From Entry Point to Core Business Logic modules (initiates tasks)
    main -->|"initDiscord"| accEd
    main -->|"initCaptcha"| capsolver
    main -->|"initGPT"| gpt
    main -->|"prepareData"| prepareData

    %% Internal interactions within Discord Module
    accEd -->|"utilizes"| discordUtils
    btnPress -->|"utilizes"| discordUtils
    chatter -->|"utilizes"| discordUtils
    inviter -->|"utilizes"| discordUtils
    leaveGuild -->|"utilizes"| discordUtils
    reactPress -->|"utilizes"| discordUtils
    sendChat -->|"utilizes"| discordUtils
    tokenCheck -->|"utilizes"| discordUtils

    %% GPT Module integration with external API
    gpt -->|"calls"| openai

    %% All modules use utilities for support (example arrows)
    accEd -->|"uses"| utilConfig
    btnPress -->|"logs"| reader
    prepareData -->|"reads config"| utilConfig
    start -->|"writes output"| writer
    gpt -->|"checksVersion"| githubVer

    %% Multi-threading annotation (conceptual)
    main ---|"Multi-threaded execution based on config.yaml"| process

    %% Click Events for Entry Point & Configuration
    click main "https://github.com/0xstarlabs/starlabs-discord/blob/main/main.py"
    click process "https://github.com/0xstarlabs/starlabs-discord/blob/main/process.py"
    click config "https://github.com/0xstarlabs/starlabs-discord/blob/main/config.yaml"
    click accounts "https://github.com/0xstarlabs/starlabs-discord/blob/main/data/accounts.xlsx"
    click messages "https://github.com/0xstarlabs/starlabs-discord/tree/main/data/messages"
    click pictures "https://github.com/0xstarlabs/starlabs-discord/tree/main/data/pictures"

    %% Click Events for Discord Module files
    click accEd "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/account_editor.py"
    click btnPress "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/button_presser.py"
    click chatter "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/chatter.py"
    click getAcc "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/get_account_info.py"
    click getSrv "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/get_all_servers.py"
    click inviter "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/inviter.py"
    click leaveGuild "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/leave_guild.py"
    click reactPress "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/reaction_presser.py"
    click sendChat "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/send_chat_message.py"
    click tokenCheck "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/token_checker.py"
    click discordUtils "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/utils.py"

    %% Click Events for Captcha Submodule files
    click capsolver "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/captcha/capsolver.py"
    click nocaptcha "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/discord/captcha/nocaptcha.py"

    %% Click Events for GPT Module files
    click gpt "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/gpt/gpt.py"
    click prompts "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/gpt/prompts.py"

    %% Click Events for Data Preparation & Start Logic files
    click prepareData "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/prepare_data.py"
    click start "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/model/start.py"

    %% Click Events for Utilities
    click utilConfig "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/utils/config.py"
    click reader "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/utils/reader.py"
    click writer "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/utils/writer.py"
    click githubVer "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/utils/check_github_version.py"
    click client "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/utils/client.py"
    click constants "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/utils/constants.py"
    click output "https://github.com/0xstarlabs/starlabs-discord/blob/main/src/utils/output.py"

    %% Styles
    classDef entry fill:#FFCC00,stroke:#333,stroke-width:2px;
    classDef external fill:#FF9999,stroke:#333,stroke-width:2px;
    classDef module fill:#8FBC8F,stroke:#333,stroke-width:2px,rx:5,ry:5;
    classDef engine fill:#F4A460,stroke:#333,stroke-width:2px,rx:5,ry:5;
    classDef util fill:#ADD8E6,stroke:#333,stroke-width:2px,rx:5,ry:5;
    classDef service fill:#DDA0DD,stroke:#333,stroke-width:2px,rx:5,ry:5;
```
