$ show real-web-world/hh-lol-prophet
This is a Go application that integrates with the League of Legends Client (LCU) to provide real-time player analysis and automation during champion select. It monitors the game flow via WebSocket, fetches recent match history for all team members, calculates a composite score based on KDA, first blood, multi-kills, team participation, gold, damage, vision, and CS metrics, then sends 'horse' ratings (e.g., ้ๅคฉไปฃ, ๅฐไปฃ) to the in-game chat. It also supports auto-accepting games, auto-picking/banning champions, and exposes an HTTP API for querying scores and configuration. The architecture is a monolithic Go service with a Gin web server, background goroutines for LCU monitoring, and a reverse proxy for the LCU API. It uses SQLite for local config storage and OpenTelemetry for logging. The code is well-structured, with clean separation of concerns, modern Go practices, and a complex scoring algorithm that is configurable via remote or local configuration.
The LLM identified 5 files worth highlighting for reuse:
Implements a ScoreWithReason struct that accumulates score increments with named reasons. This pattern is reusable for any scoring or rating system where you need to track contributions to a final score. It is self-contained and can be extracted with minimal changes.
Provides a reverse proxy for the LCU API, handling TLS, authentication, and header forwarding. This is a reusable pattern for proxying authenticated internal APIs to external clients, especially when the target uses self-signed certificates and basic auth.
A generic HTTP client for the LCU API with methods for GET, POST, PATCH, DELETE. It handles TLS, authentication, and JSON serialization. This pattern can be reused for any REST API client that requires custom transport and auth.
Enumerates Windows processes using the CreateToolhelp32Snapshot API and retrieves full command lines via NtQueryInformationProcess and ReadProcessMemory. This is a non-trivial, self-contained module that can be reused in any Go tool needing to inspect Windows processes.
Defines WebSocket message types and constants for subscribing to LCU events. The pattern of subscribing to a JSON-based event stream and parsing typed messages is reusable for any WebSocket-based event-driven integration.