# crafterje/autowhatssender architecture

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

- Interactive diagram: https://gitdiagram.com/crafterje/autowhatssender
- Repository: https://github.com/crafterje/autowhatssender

## Overview

A review of the file tree and README indicates that AutoWhatsSender is a Python-based, single-executable bot designed to automatically send messages via the WhatsApp Desktop application. It is built with a graphical interface (likely leveraging Tkinter, as evidenced by the presence of extensive Tcl/Tk data) and is packaged into an executable using tools like PyInstaller (reflected in the .spec file and the “build” and “dist” folders).

##### Project Type and Purpose
- This project is an automation tool (bot) focused on sending messages via the WhatsApp Desktop application.
- Its purpose is to automate message sending by interacting with the WhatsApp Desktop client on Windows.
- The README clarifies that an executable is provided, and that it relies on the desktop version of WhatsApp on Windows.

##### Analyzing the File Structure
- The top-level files include the main Python script (AutoWhatsSender.py), its PyInstaller spec file, a configuration file (config.json), and standard documentation (LICENSE, README.md).
- The “build” and “dist” directories contain packaged versions of the application together with complex internal libraries and resources, especially Tcl/Tk data indicating a GUI built using Tkinter.
- The distribution package bundles numerous internal modules (such as numpy, Pythonwin, and a wide range of Tcl/Tk encodings/data) that support the execution environment of the GUI.

##### Key Components
a. User Interface (GUI) Layer:
- Main component: The GUI as developed in Python, likely implemented using Tkinter.
- Resources: Tcl/Tk data stored in the “_tk_data” folders, as well as image assets and other GUI-related resources.
b. Core Application Logic:
- The main script (AutoWhatsSender.py) houses the business logic.
- This module reads configuration details from config.json and handles input validation, timing, and control flows (e.g., scheduling message intervals).
c. WhatsApp Desktop Integration:
- Although not directly part of the project’s code, the application is built to interact with the external WhatsApp Desktop client.
d. Packaging & Build Process:
- The conversion of Python code into an executable (via PyInstaller) is an important design facet. Include a “Build Process” or “Packaging” component that uses the spec file to generate the build and dist packages.
e. Configuration:
- The “config.json” file acts as an input for settings such as message intervals or specific recipient details. Represent it as a component that feeds required configuration data into the core application.

##### Relationships and Data Flow
- “GUI” to the “Core Application Logic” component that processes the input and retrieves configuration from “config.json.”
- A component for “Packaging & Build Process” that creates the final executable deployed to users.

##### Architectural Patterns and Design Principles
- The project is a monolithic desktop application where the separation of concerns is maintained between UI, business logic, and external interfacing.
- That although all parts reside in one executable, proper modularization (e.g., a layered architecture: UI layer, logic layer, and integration with external systems) is followed.
- Use of PyInstaller as a tool for packaging and dependency management.

## Diagram (Mermaid)

```mermaid
graph TD
    user("User"):::user
    guiLayer("GUI Layer (Tkinter)"):::gui
    coreLogic("Core Application Logic (AutoWhatsSender.py)"):::core
    configManager("Configuration Manager (config.json)"):::config
    whatsapp("WhatsApp Desktop Client (External)"):::external
    packagingProcess("Packaging & Build Process (AutoWhatsSender.spec, build, dist)"):::packaging

    user -->|"providesInput"| guiLayer
    guiLayer -->|"triggers"| coreLogic
    coreLogic -->|"readsConfig"| configManager
    coreLogic -->|"sendsCommands"| whatsapp
    packagingProcess -->|"packages"| coreLogic
    packagingProcess -->|"deliversExecutable"| user

    click guiLayer "https://github.com/crafterje/autowhatssender/tree/main/dist/AutoWhatsSender/_internal/_tk_data"
    click coreLogic "https://github.com/crafterje/autowhatssender/blob/main/AutoWhatsSender.py"
    click configManager "https://github.com/crafterje/autowhatssender/blob/main/config.json"
    click packagingProcess "https://github.com/crafterje/autowhatssender/blob/main/AutoWhatsSender.spec"
    click packagingProcess "https://github.com/crafterje/autowhatssender/tree/main/build"
    click packagingProcess "https://github.com/crafterje/autowhatssender/tree/main/dist"

    classDef gui fill:#d0e7ff,stroke:#0275d8,stroke-width:2px;
    classDef core fill:#f9e79f,stroke:#f39c12,stroke-width:2px;
    classDef config fill:#e6f7e6,stroke:#28a745,stroke-width:2px;
    classDef packaging fill:#fddde6,stroke:#d63384,stroke-width:2px;
    classDef external fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef user fill:#ffffff,stroke:#000000,stroke-width:2px;
```
