Skip to content
This repository was archived by the owner on Nov 28, 2026. It is now read-only.
dorpewsPublic archive

About

Unofficial KaizenMC Statistics API powered by automated Minecraft bots for real-time player data collection.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

kaizen-api

HTTP API for Bed Wars stats from kaizenmc.gg. AzuraJS serves the endpoints. Mineflayer bots connect to the Minecraft 1.8.9 server, open the /stats GUI and read the item lore with prismarine-nbt.

Endpoints

GET /api/status

{ "online": true, "botsOnline": 3 }

GET /api/stats/:username returns this shape (numbers are examples):

{
  "username": "example",
  "bedwars": {
    "level": 120,
    "exp": 45000,
    "partidas": 400,
    "vitorias": 200,
    "derrotas": 200,
    "winStreak": 3,
    "melhorWinStreak": 12,
    "camasPerdidas": 150,
    "camasQuebradas": 210,
    "kills": 1200,
    "mortes": 900,
    "assistencias": 100,
    "killsFinais": 300,
    "mortesFinais": 250,
    "assistenciasFinais": 40
  }
}

Usernames must match ^[a-zA-Z0-9_]{2,16}$. The endpoint returns 400 for an invalid username, 404 when the player does not exist or has hidden stats, and 503 when no bot is available.

How a stats request works

src/bots/pool.ts hands one bot to each request. Reading stats opens windows and clicks items, so two requests on the same bot would mix up those windows. acquireBot waits up to 15 seconds for a free bot; releaseBot runs in a finally block after the response is built.

The bot sends /stats <username> in chat, finds the Bed Wars item in the first window, clicks it and reads the lore of the item in the second window. parseStats strips Minecraft color codes and pulls numbers from labels such as Vitórias, Kills Finais and Camas Quebradas. Chat messages saying the player was not found or that stats are hidden stop the request before any window is read.

Bots

startBots() creates the accounts configured in src/config/config.default.ts, 30 seconds apart. Each account uses the server address and version from the same file. The credentials there are plain text in the repository.

After spawning, a bot solves the chest captcha by reading the window title (Encontre o(a) ...) and clicking the item whose name matches the request. The name-to-ID dictionary lives in src/bots/auth/captcha/item-names.ts. Server chat messages decide whether the bot sends /register or /login.

A disconnect removes the bot from the active list, waits 60 seconds and starts it again. Connection and error events go to the webhook.

Logs

src/structures/utils/webhook.ts posts embeds to the Discord webhook in WEBHOOK_LOGS. Info and success use purple, errors use red, and each title ends with by dorpew & NczinX. A failed webhook call prints the error to stderr.

Run

Bun is required. The code uses Bun types and the #api/* path alias from tsconfig.json.

bun install
WEBHOOK_LOGS=https://discord.com/api/webhooks/... bun run src/index.ts

WEBHOOK_LOGS is validated by src/env.ts at startup. PORT sets the listening port and defaults to 3000.

The built-in CORS and rate-limit plugins are disabled in azura.config.json. src/api/middleware/cors.ts sets the CORS headers itself, answers OPTIONS with 204 and sends Connection: close to avoid keeping curl clients waiting after res.end().

Structure

src/
  index.ts                     Azura app, middleware and bot startup
  env.ts                       WEBHOOK_LOGS validation
  config/config.default.ts     server, accounts and webhook identity
  api/controllers/             status and stats endpoints
  api/middleware/cors.ts       manual CORS headers
  bots/index.ts                bot lifecycle
  bots/pool.ts                 one request per bot
  bots/auth/                   login, register and chest captcha
  bots/stats/index.ts          /stats window parsing
  structures/utils/webhook.ts  Discord embeds
azura.config.json              Azura server settings

Development

bunx tsc --noEmit

tsconfig.json uses strict mode and maps #api/* to src/*.

License

Apache License 2.0. See LICENSE.

About

Unofficial KaizenMC Statistics API powered by automated Minecraft bots for real-time player data collection.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages