https://github.com/crayonlu/wrap-bot
A QQ bot framework using golang
https://github.com/crayonlu/wrap-bot
bot chat golang qq
Last synced: 3 months ago
JSON representation
A QQ bot framework using golang
- Host: GitHub
- URL: https://github.com/crayonlu/wrap-bot
- Owner: crayonlu
- Created: 2025-10-11T16:01:00.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2026-01-28T14:47:29.000Z (5 months ago)
- Last Synced: 2026-01-29T06:01:21.125Z (5 months ago)
- Topics: bot, chat, golang, qq
- Language: Go
- Homepage:
- Size: 6.16 MB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> A bot framework using golang
* Introduction
The framework is a highly available and scalable QQ robot framework
* Dev
It is developed using golang which is known for its high concurrency
* modal
Use onion modal pattern,which is a intuitive way
---------
- **Trace:** Start from 2025.10.12...
- **Status:** 🚧 In Active Development

> Project Structure
```
bot/
├── cmd/bot/ # Main application entry point
├── internal/
│ ├── config/ # Configuration management
│ └── admin/ # Admin API and WebSocket
├── pkgs/
│ ├── bot/ # Core bot engine
│ │ ├── engine.go # Bot engine with middleware support
│ │ ├── context.go # Request context
│ │ ├── event.go # Event types and handlers
│ │ ├── middleware.go # Built-in middlewares
│ │ └── helper.go # Helper functions
│ ├── napcat/ # NapCat API client
│ │ ├── client.go # HTTP client
│ │ ├── websocket.go # WebSocket client
│ │ └── message.go # Message operations
│ └── feature/ # Utility features
│ └── scheduler.go # Task scheduler
├── plugins/ # Bot plugins
│ ├── plugin.go # Plugin registration
│ ├── ping.go # Ping command
│ ├── echo.go # Echo command
│ ├── help.go # Help command
│ ├── ai_chat.go # AI chat integration
│ └── tech_push/ # Tech news push
│ ├── tech_push.go
│ └── handlers/ # Data source handlers
├── configs/ # Configuration files
├── wrap-web/ # Admin web panel (React + shadcn/ui)
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── lib/ # Utilities (API, WebSocket)
│ │ ├── stores/ # Zustand state management
│ │ └── hooks/ # Custom React hooks
│ └── package.json
└── .github/workflows/ # CI/CD workflows
```
> Architecture Overview
**Core Components:**
- Engine: Middleware-based request handling with onion model pattern
- Context: Request context carrying event data and response methods
- Event: WebSocket event processing from NapCat
- Middleware: Recovery, Logger, Authentication, RateLimit, etc.
**Integration:**
- NapCat Client: HTTP API calls for sending messages and querying data
- WebSocket Client: Real-time event receiving from NapCat server
- Scheduler: Cron-like task scheduling for periodic operations
**Plugin System:**
- Registration-based plugin loading
- Middleware chain execution
- Support for commands, event handlers, and scheduled tasks
