Files
NeoBot/docs/getting-started.md
K2cr2O1 292881595e refactor(compile_machine_code): 优化编译脚本并移除冗余日志
docs(getting-started): 删除中文依赖说明
refactor(image_manager): 简化base64图片生成逻辑
2026-01-23 17:15:24 +08:00

96 lines
1.9 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.
# 快速上手
runit
## 1. 你需要准备
* **Python 3.14**: 必须是这个版本别问我为什么。。。
* **Git**: 拉取代码
* **Redis**: 装一个
* **脑子和手**: 这个最重要,或者你去问问镀铬酸钾,会给你一对一教学的。。。
* **OneBot v11 客户端**: 机器人本体,推荐用 [NapCatQQ](https://github.com/NapNeko/NapCatQQ)
## 2. 搭起来
### a. 克隆代码
找个你喜欢的地方,把代码从 GitHub 上clone下来
```bash
git clone [项目仓库地址]
cd [项目目录]
```
### b. 创建虚拟环境
别把你的系统环境搞得乱七八糟
```bash
# Windows
python -m venv venv
.\venv\Scripts\activate
# Linux / macOS
python3.14 -m venv venv
source venv/bin/activate
```
看到命令行前面多了个 `(venv)`,就说明你进来了。
### c. 安装依赖
```bash
pip install -r requirements.txt
```
### d. 安装 Playwright 依赖
我们用 Playwright 来截图画画,它需要一个浏览器核心。
```bash
playwright install chromium
```
### e. 编译核心 (可选,但强烈建议)
想让你的代码更快?把它的核心代码编译成 C。
```bash
python setup_mypyc.py build_ext --inplace
```
*Windows 上可能需要装个 Visual Studio Build ToolsLinux 上需要 GCC。编译失败也别慌跳过就行JIT 也能保证不错的速度*
## 3. 第一次
### a. 修改配置
去根目录找 `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
```
`uri` 改成你自己的 OneBot 地址。
### b. 启动!
一切就绪
```bash
# 推荐开启 JIT 模式启动
python -X jit main.py
```
如果你看到日志刷出来,最后显示 “连接成功!”,恭喜,你成功了!
现在,试着给你的机器人发个 `/help`看看会返回什么东西