Getting started

Introduction

What bonktools is, when to use it and how it is organized.

bonktools is a TypeScript library that connects to bonk.io directly over the game protocol (Socket.IO), without opening a browser. With it you create rooms, control teams and players, react to events and keep a room running 24 hours a day.

Why it exists

Automating bonk.io with Puppeteer needs a full browser per room, a virtual display on Linux and fragile UI automation. bonktools replaces that with a lightweight connection: each room is just a socket, and all behavior (events, teams, reconnection) is typed TypeScript code.

What you can do

  • Create and join rooms as host, player or spectator.
  • React to player, chat, team and match events.
  • Move players between teams, lock the teams and moderate (kick/ban).
  • Detect AFK players by movement and by chat.
  • Start and stop matches, with the correct initial state for each map.
  • Keep several rooms alive with a single account, with automatic reconnection.

How the project is organized

PieceWhat it is
bonktools (npm)The library. Three layers: BonkTransport, BonkRoom and BonkSession.
24/7 room (apps/bonk-room)A reference football bot built only with the library. See Reference 24/7 room.
ProtocolAll the reverse engineering is documented in The bonk.io protocol.
text
BonkSession       room pool, shared authentication, throttle
  └── BonkRoom    state, typed events, reconnection, teams, lock, anti-AFK
        └── BonkTransport   Socket.IO v2 (EIO=3) + TLS
              └── bonk.io

Next steps