一个完整的 OneBot-11 协议插件化机器人框架 - EchoFrame
Project description
EchoFrame
╔═══════════════════════════════╗
║ ║
║ EchoFrame 2.0 ║
║ ║
║ OneBot-11 机器人框架 ║
║ ║
╚═══════════════════════════════╝
轻量级、高性能的 OneBot-11 机器人框架
✨ 特性
- 🔥 插件热加载 - 修改代码立即生效,无需重启
- 🎨 中间件系统 - 灵活的事件处理流程
- 🌐 Web API 友好 - 完善的管理接口,适合 Web 面板
- ⚡ 高性能 - 基于 aiocqhttp,异步架构
- 📦 可作为库 -
pip install echoframe即可使用 - 💬 完整实现 - 支持所有 OneBot-11 标准
- 🛠️ 简单易用 - 装饰器风格,优雅简洁
🚀 快速开始
安装
# 作为库安装(推荐)
pip install echoframe
# 或从源码运行
git clone https://github.com/your-repo/echoframe
cd echoframe
pip install -r requirements.txt
配置
-
复制配置文件:
cp config.example.yaml config.yaml
-
修改配置:
adapters: aiocqhttp: enabled: true port: 6789 access_token: "" bot: superusers: - 123456789 # 你的 QQ 号
-
配置 OneBot 实现(如 Lagrange):
{ "Type": "ReverseWebSocket", "Host": "127.0.0.1", "Port": 6789, "Suffix": "/ws/" }
运行
python bot.py
查看日志确认连接成功!
💡 创建第一个插件
plugins/hello/main.py:
from echoframe import Plugin, on_command, MS
class HelloPlugin(Plugin):
pass
@on_command("/hello")
async def hello(bot, event):
msg = MS.text("Hello from EchoFrame!") + MS.face(14)
await bot.send(event, msg.to_array())
plugins/hello/metadata.yaml:
name: "Hello 插件"
commands:
- "/hello"
重启或热加载,然后在 QQ 中发送 /hello 测试!
📚 文档
🎯 核心功能
插件系统
- 热加载/热重载 - 修改代码立即生效
- 启用/禁用控制
- 实时导入新插件
- Web API 管理接口
中间件系统
- 灵活的事件处理流程
- 内置常用中间件
- 自定义中间件支持
消息系统
- 26 种消息段类型
- MS 工厂类(简洁 API)
- 完整的 CQ 码支持
通信层
- 基于 aiocqhttp
- WebSocket 双向通信
- 自动重连
📊 性能
- 代码量:~2700 行(精简 82%)
- 启动速度:< 1 秒
- 消息延迟:~10-30ms
- 内存占用:< 100MB
🛠️ 技术栈
- Python 3.8+
- aiocqhttp 1.4.4+
- Pydantic 2.0+
- Loguru 0.7+
📄 许可证
🙏 鸣谢
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
echoframe-2.0.0.tar.gz
(39.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file echoframe-2.0.0.tar.gz.
File metadata
- Download URL: echoframe-2.0.0.tar.gz
- Upload date:
- Size: 39.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5e440821b90964f32d9341a47be8124e1dc95bc008d0efc128d34428ebd137d
|
|
| MD5 |
ea2ce27bf1f827d2b9e239cb18c6a06f
|
|
| BLAKE2b-256 |
79beb355932c420d21106385c78015cd649160fe8956179d40e59774989488ec
|
File details
Details for the file echoframe-2.0.0-py3-none-any.whl.
File metadata
- Download URL: echoframe-2.0.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e53753adb59487920073fea4f8c16ea76a2b6c9ddd33f6fcba08d76163b8221
|
|
| MD5 |
2bc5ee1ae1b04aeffc303c117e8205b5
|
|
| BLAKE2b-256 |
055623394ff023b0623500814375a3bc84ef6eb3c0711c6cb56dce2ae7523ec9
|