$ show NapNeko/NapCatQQ
NapCatQQ is a headless QQ bot framework that integrates with the NTQQ (New Technology QQ) desktop client via native injection and reverse-engineered protocol internals. It implements the OneBot v11 standard protocol, providing HTTP, WebSocket, and SSE network adapters for external bot control, along with a comprehensive web-based management interface (WebUI) for configuration, monitoring, file management, terminal access, and plugin management. The system is organized as a monorepo with over 30 packages, including core QQ protocol interaction (napcat-core), OneBot adapter (napcat-onebot), WebUI backend (Express) and frontend (React), a plugin system, RPC library, protobuf runtime, image size detection, PTY terminal support, and database decryption tools. The architecture is modular but tightly coupled to the NTQQ native wrapper, which is loaded via platform-specific binaries. Key entry points include the shell loader (napcat-shell/napcat.ts) for process management, the framework bootstrap (napcat-framework/napcat.ts), the OneBot adapter initialization (napcat-onebot/index.ts), and the WebUI Express server (napcat-webui-backend/index.ts). Data flows involve receiving QQ events through native listeners, converting them to OneBot events, and dispatching to configured network adapters. Outgoing actions are translated to QQ internal API calls via packet transformers and highway file uploaders. External dependencies include the NTQQ desktop client (required runtime), FFmpeg for media processing, platform-specific native binaries for packet handling and PTY, and various Node.js packages (Express, React, TypeBox, etc.). The project is actively maintained but carries inherent fragility due to its reliance on reverse-engineered QQ internals that may change with QQ updates.
The LLM identified 6 files worth highlighting for reuse:
Generic RPC server implementation with serialization/deserialization, object reference management, and callback proxying. Supports local and message-based transports. Self-contained and reusable for any inter-process or network communication requiring remote object access.
Type-safe LRU cache with configurable TTL and capacity. Implements a doubly-linked list with hash map for O(1) operations. Can be extracted and used in any TypeScript project needing a bounded, time-aware cache.
Pluggable image dimension detection supporting BMP, PNG, GIF, JPEG, TIFF, and WebP formats. Each format has a dedicated parser class implementing a common interface. Self-contained and easily reusable for any project needing to extract image dimensions from binary data without external libraries.
Factory that selects between a native FFmpeg addon and a CLI-based exec adapter based on availability. Demonstrates clean interface segregation and fallback strategy. The adapter interface (ffmpeg-adapter-interface.ts) defines a contract that can be implemented by different backends, making it reusable for any project needing abstracted media processing.
Type definitions for the plugin system, including PluginModule, PluginConfigItem, PluginRouterRegistry, and lifecycle hooks. These types define a clean, self-contained plugin contract that can be extracted and reused in any Node.js application wanting a dynamic plugin architecture with configuration schemas and route registration.
Mirror management utility that lazily tests mirror latency, caches results with 30-minute TTL, and provides parallel fallback for downloading GitHub releases and artifacts. Handles rate limiting and HTML parsing for artifact URLs. Reusable for any project needing resilient file downloads from multiple sources.