2.1 KiB
2.1 KiB
mcbot
Mineflayer bot for handling a spawner workflow, placing bone orders, and protecting the area with automatic emergency shutdown logic.
Features
- Repeating spawner cycle (
/api/spawner) with a 60-second delay between cycles. - GUI automation for:
- opening spawner GUI
- moving bones to inventory
- running
/order ZareMate - delivering and confirming order
- Security monitor:
- detects unauthorized nearby players (from
allowed_players.txt) - detects nearby block breaks
- triggers emergency routine
- detects unauthorized nearby players (from
- Emergency routine:
- attempts to break/remove the spawner
- attempts to stash spawner drops into a nearby ender chest
- sends Discord webhook alert
- quits bot
- Simple web UI + API on
http://localhost:3008.
Requirements
- Node.js 18+
- A valid Microsoft-authenticated Minecraft account for the configured bot username
- Access to target server (
java.donutsmp.netby default in code)
Install
npm install
Configure
Create .env in project root.
DISCORD_WEBHOOK_URL=
ALLOWED_PLAYERS_FILE=allowed_players.txt
DEBUG_LOGS=0
Notes:
ALLOWED_PLAYERS_FILEcan be relative to project root or absolute path.DEBUG_LOGS=1enables extra slot/window debug logging.
Run
node index.js
Web Endpoints
GET /: basic web UIGET /api/logs: bot logs as JSONPOST /api/spawner: start spawner loopPOST /api/stop: stop spawner loop
Allow List
Edit allowed_players.txt:
- one player name per line
- case-insensitive matching
- lines starting with
#are ignored
Important Runtime Behavior
- On first spawn, bot stores join position and auto-arms security after 5 seconds.
- Movement guard pauses loop if bot is moved too far from loop start.
- If security is triggered, bot now tries to stash spawner items in ender chest before quitting.
Files
index.js: all bot logic and HTTP serverweb/index.html: web UIallowed_players.txt: allow-list for security monitorAGENTS.md: guidance for future automation agentsdocs/BOT_OPERATIONS.md: deeper operational notes