# joseangelbmt/paper_checker architecture

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

- Interactive diagram: https://gitdiagram.com/joseangelbmt/paper_checker
- Repository: https://github.com/joseangelbmt/paper_checker

## Overview

##### Project Type and Purpose
- Project Type: A lightweight Python-based Discord bot.
- Purpose: To periodically update a specified Discord channel with the last stable version of the Minecraft Paper server.
- Key Use Cases: Monitoring the latest stable Minecraft Paper version and posting updates automatically in a Discord channel.

##### File Structure
- Files present:
– .gitignore: Project configuration for ignoring files.
– README.md: Contains the project’s overview.
– checker.py: Likely the main executable script that implements the bot’s functionality.
– requirements.txt: Lists the Python dependencies (probably including libraries like discord.py).
– version.txt: Likely used to store the current known stable version.
- The simple flat structure indicates that the app is a standalone script rather than a multi-tiered application, making it easier to isolate its core components.

##### Main Components
a. Discord Bot Component:
– This is the primary component (implemented in checker.py) handling the connection to Discord and posting/updating messages.
– It interfaces with the Discord API (external service) to send messages to the designated channel.
b. Version Checking Module:
– Integrated within the main script, it is responsible for managing and verifying the “stable version” data.
– Reads from or writes to version.txt to keep track of the latest version.
– May include logic to compare a newly fetched value (if there’s an external source call to the Minecraft Paper server’s metadata) against what is stored.
c. External Service Integration:
– Discord’s API: for posting/updating messages in the channel.
– (If applicable) Minecraft Paper server or its website endpoint: to fetch the latest stable version (even if not explicitly shown in the file structure, it is implied by the bot’s purpose).
d. Dependencies & Environment Configuration:
– The requirements.txt file signifies the third-party Python libraries the project relies on (e.g., discord.py for interfacing with Discord).

##### Relationships and Interactions
- The Discord Bot initiates the process:
– On startup, it establishes a connection with Discord using the provided API tokens.
– A scheduled task or trigger within the bot checks for updates by invoking the Version Checking Module.
- The Version Checking Module:
– Reads the current stable version from version.txt.
– (Optionally) Makes an external call to determine if there is an update.
– If an update is found, the module triggers the bot to send an updated message to the Discord channel.
- Data Flow:
– Input flows: from external endpoints (e.g., Paper server info) into the checker module.
– Output flows: from the bot module to the Discord channel.

##### Architectural Patterns and Design Principles
- Although simple, the design follows a modular approach by separating concerns:
– Bot connectivity and messaging are isolated from the version checking logic.
- Emphasis on external integrations:
– Clearly distinguish between the internal modules (checker.py, version.txt usage) and external resources (Discord API and Paper server endpoint).

## Diagram (Mermaid)

```mermaid
flowchart TD
    Main["Peper Version Checker Bot"]:::main

    subgraph "Internal Modules"
        Bot["Discord Bot Module (checker.py)"]:::internal
        VerCheck["Version Checking Module"]:::internal
        Store["Stored Version Data (version.txt)"]:::internalfile
    end

    subgraph "External Services"
        DiscordAPI["Discord API"]:::external
        PaperAPI["Minecraft Paper Server Endpoint"]:::external
    end

    Support["Environment & Dependency Configuration (requirements.txt)"]:::config
    Doc["Project Overview & Documentation (README.md)"]:::docs

    Main -->|"initiates"| Bot
    Main -->|"invokes"| VerCheck
    VerCheck -->|"reads/writes"| Store
    Bot -->|"sendsUpdate"| DiscordAPI
    VerCheck -->|"fetchesVersion"| PaperAPI
    Main -->|"configuredBy"| Support
    Main -->|"documentedIn"| Doc

    click Bot "https://github.com/joseangelbmt/paper_checker/blob/master/checker.py"
    click Store "https://github.com/joseangelbmt/paper_checker/blob/master/version.txt"
    click Support "https://github.com/joseangelbmt/paper_checker/blob/master/requirements.txt"
    click Doc "https://github.com/joseangelbmt/paper_checker/blob/master/README.md"

    classDef main fill:#ffef96,stroke:#b58900,stroke-width:2px;
    classDef internal fill:#ace7ff,stroke:#0077b6,stroke-width:2px;
    classDef external fill:#d0f0c0,stroke:#2d6a4f,stroke-width:2px;
    classDef config fill:#ffffc7,stroke:#b58900,stroke-width:2px;
    classDef docs fill:#ffe4e1,stroke:#d33682,stroke-width:2px;
    classDef internalfile fill:#ffd699,stroke:#ff7f50,stroke-width:2px;
```
