How mrcatplay/autoresell works
Project Type and Purpose
• This is a Node.js automation tool (“bot”) designed to log into multiple Minecraft anarchy servers (with optional SOCKS5 proxies), automatically sell a specified in-game item at a configured price, and send sale notifications to a Telegram chat.
• Key indicators: presence of index.js as entry point, modules like Autoresel.js (automation), sendTelegram.js (notifications), processChatCommand.js (runtime commands), and a JSON config (Name.json) specifying bot accounts and Telegram settings.
File Structure Analysis
• Top-level files:
• index.js – orchestrates startup, reads config, kicks off bot workflows
• Name.json – configuration (Telegram token/chatId, sale price, user account details, proxy settings)
• Autoresel.js – core item-selling logic using the Minecraft protocol
• processChatCommand.js – handles incoming Telegram chat commands at runtime
• sendTelegram.js – wrapper around the Telegram Bot API for notifications
• startBOT/Proxy.js + startBOT/NotProxy.js – two variants of the per-account bot runner, chosen based on presence of proxy config
• No database or front-end; modular CLI service with external integrations: Minecraft servers and Telegram.
Key README Insights
• The JSON config drives everything: token, chat ID, main recipient, target item, price, and an array of user bots (with optional proxies).
• Launch is simply node index.js after config.
a. Main Components
• Config Loader (reads Name.json)
• Bot Orchestrator (index.js)
• Bot Worker Module – two variants:
– Proxy-enabled (startBOT/Proxy.js)
– Direct (startBOT/NotProxy.js)
• Auto-Seller Logic (Autoresel.js)
• Telegram Command Processor (processChatCommand.js)
• Telegram Notifier (sendTelegram.js)
• External Systems: Minecraft Anarchy Servers + Telegram Bot API
b. Relationships & Data Flows
1) On start, Config Loader → passes settings to Bot Orchestrator.
2) Bot Orchestrator spawns one Bot Worker per user: picks Proxy.js if proxy settings exist, else NotProxy.js.
3) Each Bot Worker uses Autoresel.js to:
• To Minecraft server (via proxy or direct)
• Authenticate with nickname/password
• Monitor in-game store, execute sale at configured price
• Emit sale events or errors back to Orchestrator
4) Orchestrator forwards sale events to Telegram Notifier, which calls Telegram Bot API.
5) processChatCommand.js listens for incoming Telegram commands (e.g., status requests), routes them to Orchestrator at runtime.
c. Architectural Patterns & Principles
• Modular separation of concerns: config, orchestration, worker logic, notifications, command handling
• Strategy pattern for proxy vs. non-proxy workers
• Event-driven notifications (Emit/Listen between workers and notifier)
d. Key Technologies
• Node.js runtime
• Telegram Bot API (via sendTelegram.js)
• Minecraft protocol library (inside Autoresel.js)
• SOCKS5 proxy handling (in Proxy.js)