# ragxxv/bumpr architecture

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

- Interactive diagram: https://gitdiagram.com/ragxxv/bumpr
- Repository: https://github.com/ragxxv/bumpr

## Overview

##### Project type and purpose
- This is a small open-source Discord “self-bot” automation tool (“Bumpr”) written in a single Python file (bot.py).
- Its sole purpose is to listen for a ping or reminder and then automatically issue the Disboard “/bump” slash command on a schedule.

##### File structure
- Top level:
- README.md – documentation
- bot.py – the entire implementation
- There are no separate frontend/backend directories or databases. Configuration and code are co-located in bot.py.

##### README for additional insights
- Key requirements: a Discord bot account, a bump-reminder bot in DMs, open DMs with Disboard.
- Workflow: operator sends an initial ping → bot sends “/bump” → bot loops the command at the required interval.

##### Components
a. Main components
- Operator (Discord user)
- bumpr.py (the Python script)
- Discord Gateway & REST API endpoints (discord.com)
- Disboard Bot (the external slash-command recipient)
- Scheduler/timer inside bot.py
b. Relationships & interactions
1. Operator ⇢ bot.py: sends a mention DM or slash-ping to the self-bot.
2. bot.py ⇢ Discord Gateway (WebSocket): listens for incoming events (message, mention).
3. Scheduler within bot.py: triggers every X hours.
4. bot.py ⇢ Discord REST API: issues the “/bump” command directed at the Disboard Bot.
5. Disboard Bot ⇢ Discord REST API: responds to the slash command, increments bump counter.
c. Architectural patterns & principles
- Event-driven (react to Discord events over WebSocket).
- Internal scheduler loop for timing.
- Single-process, single-responsibility script.
d. Key technologies/frameworks
- Python 3.x
- A Discord library (e.g., discord.py or nextcord) for Gateway & HTTP.
- Native Python scheduler (asyncio.sleep or built-in loop).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entities
    Operator["Operator<br/>(Discord User)"]:::operator
    DiscordGateway["Discord Gateway<br/>(WebSocket)"]:::external
    DiscordREST["Discord REST API<br/>(HTTP)"]:::external
    DisboardBot["Disboard Bot"]:::external

    %% Documentation
    README["README.md"]:::code

    %% Bot Script Subgraph
    subgraph "Bumpr Script (bot.py)"
        direction TB
        Config["Configuration Loader"]:::code
        GatewayClient["Gateway Integration"]:::code
        RestClient["REST API Integration"]:::code
        Scheduler["Scheduler Module"]:::scheduler
    end

    %% Flows
    Operator -->|DM Mention| DiscordGateway
    DiscordGateway -->|MESSAGE_CREATE| GatewayClient
    Config -->|provides tokens/IDs| GatewayClient
    Config -->|provides tokens/IDs| RestClient
    Scheduler -->|every 2h trigger| RestClient
    RestClient -->|POST /applications/.../commands| DiscordREST
    DiscordREST -->|slash command invocation| DisboardBot

    %% Initialization Flow
    README -.->|startup info| Config

    %% Click Events
    click Config "https://github.com/ragxxv/bumpr/blob/main/bot.py"
    click GatewayClient "https://github.com/ragxxv/bumpr/blob/main/bot.py"
    click RestClient "https://github.com/ragxxv/bumpr/blob/main/bot.py"
    click Scheduler "https://github.com/ragxxv/bumpr/blob/main/bot.py"
    click README "https://github.com/ragxxv/bumpr/blob/main/README.md"

    %% Styles
    classDef operator fill:#ccffcc,stroke:#336633,stroke-width:1px;
    classDef code fill:#cce5ff,stroke:#336699,stroke-width:1px;
    classDef external fill:#f2f2f2,stroke:#999999,stroke-width:1px;
    classDef scheduler fill:#ffe0b3,stroke:#cc8400,stroke-width:1px;
```
