# testingknowledge/bot-obfuscator architecture

> Architecture diagram of the GitHub repository testingknowledge/bot-obfuscator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/testingknowledge/bot-obfuscator
- Repository: https://github.com/testingknowledge/bot-obfuscator

## Overview

The product is a Discord bot that accepts an attached Lua file, invokes the bundled Prometheus obfuscator with a selected preset, and returns the result; optional `load` mode publishes it to GitHub and returns a loadstring. The README also documents a health endpoint. The bot workflow is supported by sampled `bot.py`; the bundled engine’s detailed internal call wiring was not sampled, so its stages are shown conservatively.

Main entry points: [`bot.py`](https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py) (Message processing), [`prometheus/cli.lua`](https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/cli.lua) (Prometheus CLI), [`prometheus/src/prometheus/pipeline.lua`](https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/prometheus/pipeline.lua) (Transformation pipeline), [`prometheus/src/config.lua`](https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/config.lua) (Preset configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discord["Discord workflow"]
  node_command["Command handler<br/>[bot.py]"]
  node_message["Message processing<br/>[bot.py]"]
  node_attachment["Lua attachment<br/>[bot.py]"]
  node_temp["Temporary work files<br/>[bot.py]"]
  node_runner["Prometheus runner<br/>[bot.py]"]
  node_result["Obfuscated Lua<br/>[bot.py]"]
end

subgraph group_engine["Obfuscation engine"]
  node_cli["Prometheus CLI<br/>[cli.lua]"]
  node_config["Preset configuration<br/>[config.lua]"]
  node_parser["Lua parsing<br/>[parser.lua]"]
  node_pipeline["Transformation pipeline<br/>[pipeline.lua]"]
  node_steps["Obfuscation steps"]
  node_compiler["Code generation<br/>[compiler.lua]"]
  node_unparser["Lua output<br/>[unparser.lua]"]
end

subgraph group_integrations["Publishing and health"]
  node_github[("GitHub repository")]
  node_publisher["GitHub publisher<br/>[bot.py]"]
  node_health["Health endpoint<br/>[bot.py]"]
end

node_user(("Discord user"))
node_discord(("Discord"))
node_monitor(("Health monitor"))

node_user -->|"sends command"| node_discord
node_discord -->|"dispatches"| node_command
node_command -->|"calls"| node_message
node_message -->|"validates and saves"| node_attachment
node_message -->|"writes work files"| node_temp
node_message -->|"invokes"| node_runner
node_runner -->|"runs"| node_cli
node_cli -->|"loads preset"| node_config
node_cli -->|"obfuscates input"| node_parser
node_cli -->|"applies transformations"| node_pipeline
node_pipeline -->|"applies steps"| node_steps
node_cli -->|"generates code"| node_compiler
node_cli -->|"writes Lua output"| node_unparser
node_message -.->|"load mode invokes"| node_publisher
node_publisher -.->|"uploads output"| node_github
node_message -->|"returns file or loadstring"| node_result
node_result -->|"replies with result"| node_discord
node_monitor -->|"requests status"| node_health
node_health -->|"returns readiness"| node_monitor

click node_command "https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py"
click node_message "https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py"
click node_attachment "https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py"
click node_temp "https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py"
click node_runner "https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py"
click node_cli "https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/cli.lua"
click node_config "https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/config.lua"
click node_parser "https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/prometheus/parser.lua"
click node_pipeline "https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/prometheus/pipeline.lua"
click node_steps "https://github.com/testingknowledge/bot-obfuscator/tree/main/prometheus/src/prometheus/steps"
click node_compiler "https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/prometheus/compiler/compiler.lua"
click node_unparser "https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/prometheus/unparser.lua"
click node_publisher "https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py"
click node_health "https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py"
click node_result "https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_command,node_message,node_attachment,node_temp,node_runner,node_result,node_user toneBlue
class node_cli,node_config,node_parser,node_pipeline,node_steps,node_compiler,node_unparser toneAmber
class node_github,node_publisher,node_health toneMint
class node_discord,node_monitor toneIndigo
```

## Components

### Discord workflow

- [Command handler](https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py): `bot.py`
- [Message processing](https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py): `bot.py`
- [Lua attachment](https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py): `bot.py`
- [Temporary work files](https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py): `bot.py`
- [Prometheus runner](https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py): `bot.py`
- [Obfuscated Lua](https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py): `bot.py`

### Obfuscation engine

- [Prometheus CLI](https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/cli.lua): `prometheus/cli.lua`
- [Preset configuration](https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/config.lua): `prometheus/src/config.lua`
- [Lua parsing](https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/prometheus/parser.lua): `prometheus/src/prometheus/parser.lua`
- [Transformation pipeline](https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/prometheus/pipeline.lua): `prometheus/src/prometheus/pipeline.lua`
- [Obfuscation steps](https://github.com/testingknowledge/bot-obfuscator/tree/main/prometheus/src/prometheus/steps): `prometheus/src/prometheus/steps`
- [Code generation](https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/prometheus/compiler/compiler.lua): `prometheus/src/prometheus/compiler/compiler.lua`
- [Lua output](https://github.com/testingknowledge/bot-obfuscator/blob/main/prometheus/src/prometheus/unparser.lua): `prometheus/src/prometheus/unparser.lua`

### Publishing and health

- **GitHub repository**
- [GitHub publisher](https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py): `bot.py`
- [Health endpoint](https://github.com/testingknowledge/bot-obfuscator/blob/main/bot.py): `bot.py`

### Other components

- **Discord user**
- **Discord**
- **Health monitor**

## Connections

- Discord user → Discord: sends command
- Discord → Command handler: dispatches
- Command handler → Message processing: calls
- Message processing → Lua attachment: validates and saves
- Message processing → Temporary work files: writes work files
- Message processing → Prometheus runner: invokes
- Prometheus runner → Prometheus CLI: runs
- Prometheus CLI → Preset configuration: loads preset
- Prometheus CLI → Lua parsing: obfuscates input
- Prometheus CLI → Transformation pipeline: applies transformations
- Transformation pipeline → Obfuscation steps: applies steps
- Prometheus CLI → Code generation: generates code
- Prometheus CLI → Lua output: writes Lua output
- Message processing → GitHub publisher: load mode invokes
- GitHub publisher → GitHub repository: uploads output
- Message processing → Obfuscated Lua: returns file or loadstring
- Obfuscated Lua → Discord: replies with result
- Health monitor → Health endpoint: requests status
- Health endpoint → Health monitor: returns readiness
