Files
NeoBot/docs/getting-started.md
K2cr2O1 24af862924 feat: 添加性能优化和架构文档,更新依赖和核心模块
refactor(browser_manager): 实现页面池机制以提升性能
refactor(image_manager): 添加模板缓存并集成页面池
refactor(bili_parser): 迁移到异步HTTP请求并实现会话复用
docs: 新增性能优化、架构设计和最佳实践文档
chore: 更新requirements.txt添加新依赖
2026-01-13 03:56:31 +08:00

98 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 快速上手
这篇文档教你怎么把 NEO Bot 跑起来。如果你连这都搞不定,建议先去补补 Python 基础。
## 1. 环境准备
别拿老古董环境来跑新代码,我们用的是最新的技术栈。
* **Python**: 必须 `3.14` 或更高。
* 推荐开启 JIT (`-X jit`)。
* 别问为什么不用 3.8,问就是慢。
* **Git**: 拉代码用的,这都要教?
* **Redis**: 必须装。
* Windows 用户自己想办法 (WSL2 或者 Memurai)。
* Linux/macOS 用户直接包管理器装。
* 没 Redis 跑不起来,别试了。
* **OneBot v11 客户端**: 机器人本体。
* **强烈推荐**: [NapCatQQ](https://github.com/NapNeko/NapCatQQ)
* 别用那些几百年不更新的协议端,出了问题别找我。
## 2. 安装步骤
### 拉代码
```bash
git clone [项目仓库地址]
cd [项目目录]
```
### 搞个虚拟环境
别把系统环境搞脏了,这是基本礼貌。
```bash
# 创建
python -m venv venv
# 激活 (Windows)
.\venv\Scripts\activate
# 激活 (Linux/macOS)
source venv/bin/activate
```
### 装依赖
```bash
pip install -r requirements.txt
```
### 装浏览器内核
我们用了 Playwright 做渲染,所以得装个 Chromium。
```bash
playwright install chromium
```
### 编译核心 (可选,但推荐)
想体验极致速度?把核心模块编译成 C 扩展。
```bash
python setup_mypyc.py build_ext --inplace
```
*Windows 上需要 Visual Studio Build ToolsLinux 上需要 GCC。编译失败就跳过反正 JIT 也够快了。*
## 3. 配置
去根目录找 `config.toml`
```toml
[napcat_ws]
# 你的 OneBot 地址
# 我们用的是正向连接,也就是 Bot 主动去连 OneBot
uri = "ws://127.0.0.1:3001"
token = ""
[redis]
host = "127.0.0.1"
port = 6379
db = 0
```
## 4. 启动
一切就绪,起飞。
```bash
# 开启 JIT 模式启动
python -X jit main.py
```
看到 `连接成功!` 就说明跑通了。如果报错,先看日志,别上来就问。