How fauzi-1110/bot-trading works
This is a Telegram-based trading-game bot, described by its author as a coding exercise. Users send commands through private chat; message handling presents game actions and callback handling completes trades and other selections. The wider game includes item/coin markets, automated bots and parties, jobs/businesses, season and leaderboard functions, plus scheduled market and game-state updates. The README is brief, and excerpts are partial, so the graph includes only supported wiring; several documented command capabilities are grouped at their known handler paths.
Main entry points: func_db.js Database access · message.js Message commands · query.js Callback actions · index.js Scheduled updates
Components 17
Telegram interface
- Telegram API
- Bot entry
index.js - Message commands
System/message.js - Callback actions
System/query.js - Update parser
Trading gameplay
- Trade actions
System/query.js - Market prices
lib/func_cointem.js - Game utilities
lib/func_other.js - Jobs and shops
lib/func_other.js - Season and rankings
lib/func_other.js
Game simulation
- Bot traders
lib/func_bot.js - Party system
lib/func_bot.js - Scheduled updates
index.js
Persistent state
- Database access
lib/func_db.js - User records
database/user.json - Game records
database/global.json
Other components
- Player
Connections 31
- Player → Telegram API: sends updates
- Telegram API → Bot entry: delivers updates
- Bot entry → Telegram API: registers handlers
- Bot entry → Message commands: dispatches messages
- Bot entry → Callback actions: dispatches callbacks
- Message commands → Update parser: parses messages
- Callback actions → Update parser: parses callbacks
- Message commands → Telegram API: sends replies
- Callback actions → Telegram API: edits replies
- Message commands → Database access: reads and writes
- Callback actions → Database access: reads and writes
- Message commands → Trade actions: offers trades
- Callback actions → Trade actions: executes trades
- Trade actions → Market prices: updates volumes
- Trade actions → Game utilities: uses calculations
- Message commands → Bot traders: manages bot roles
- Message commands → Jobs and shops: handles game commands
- Callback actions → Season and rankings: handles ranking actions
- Bot entry → Scheduled updates: starts timer
- Scheduled updates → Market prices: updates prices
- Scheduled updates → Bot traders: updates bots
- Scheduled updates → Party system: checks parties
- Scheduled updates → Jobs and shops: restocks shops
- Scheduled updates → Database access: applies daily updates
- Market prices → Database access: reads and writes
- Bot traders → Database access: reads and writes
- Party system → Database access: reads and writes
- Jobs and shops → Database access: reads and writes
- Season and rankings → Database access: reads and writes
- Database access → User records: loads and saves
- Database access → Game records: loads and saves