mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-05-22 18:21:18 +00:00
📝 重置了deploy
下的文档
Some checks failed
Docker Image Build / build (push) Failing after 2m10s
Deploy VitePress site to Liteyuki PaaS / build (push) Failing after 2m30s
Pre-commit checks / pre-commit (3.10) (push) Failing after 3m7s
Pre-commit checks / pre-commit (3.11) (push) Failing after 2m37s
Pre-commit checks / pre-commit (3.12) (push) Failing after 2m42s
Pre-commit checks / pre-commit (3.13) (push) Failing after 3m18s
Some checks failed
Docker Image Build / build (push) Failing after 2m10s
Deploy VitePress site to Liteyuki PaaS / build (push) Failing after 2m30s
Pre-commit checks / pre-commit (3.10) (push) Failing after 3m7s
Pre-commit checks / pre-commit (3.11) (push) Failing after 2m37s
Pre-commit checks / pre-commit (3.12) (push) Failing after 2m42s
Pre-commit checks / pre-commit (3.13) (push) Failing after 3m18s
新添加了adapter.md用来转移配置器相关内容; 修改了部分文件的版权归属日期;
This commit is contained in:
parent
6c7d073cb1
commit
908812a3d9
27
docs/zh/deploy/adapter.md
Normal file
27
docs/zh/deploy/adapter.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
title: 适配器
|
||||||
|
order: 3
|
||||||
|
---
|
||||||
|
|
||||||
|
## **示例:与NoneBot对接的OneBot实现端配置**
|
||||||
|
|
||||||
|
生产环境中推荐反向WebSocket
|
||||||
|
不同的实现端给出的字段可能不同,但是基本上都是一样的,这里给出一个参考值
|
||||||
|
|
||||||
|
| 字段 | 参考值 | 说明 |
|
||||||
|
|----------------|--------------------------------|----------------------------------------------------------------------|
|
||||||
|
| 协议 | 反向 WebSocket | 推荐使用反向 WebSocket 协议进行通信,即轻雪作为服务端运行。 |
|
||||||
|
| 地址 | `ws://127.0.0.1:20216/onebot/v11/ws` | 地址取决于配置文件,本机默认为 `127.0.0.1:20216`。 |
|
||||||
|
| AccessToken | `""` | 如果你给轻雪配置了 `AccessToken`,请在此填写相同的值。 |
|
||||||
|
|
||||||
|
> **注意**:要使用其他通信方式,请访问 [OneBot Adapter](https://onebot.adapters.nonebot.dev/) 获取详细信息。
|
||||||
|
|
||||||
|
|
||||||
|
## **其他**
|
||||||
|
|
||||||
|
轻雪不局限于OneBot适配器,你可以使用[NoneBot2支持的任何适配器](https://github.com/nonebot/)(链接指向nonebot的github主页)或使用轻雪讯息传递插件
|
||||||
|
|
||||||
|
例如:
|
||||||
|
- [Console Adapter](https://github.com/nonebot/adapter-console)
|
||||||
|
- [Mirai Adapter](https://github.com/nonebot/adapter-mirai)
|
||||||
|
等
|
@ -4,14 +4,55 @@ order: 2
|
|||||||
---
|
---
|
||||||
# 配置
|
# 配置
|
||||||
|
|
||||||
轻雪支持`yaml`、`json`和`toml`作为配置文件,取决于你个人的喜好
|
## 轻雪配置文件说明
|
||||||
|
|
||||||
首次运行后生成`config.yml`和`config`目录,你可修改配置项后重启轻雪,绝大多数情况下,你只需要修改`superusers`及`nickname`字段即可
|
轻雪支持 `.yaml`、`.json` 和 `.toml` 三种文件类型作为配置文件, 您可以根据个人喜好选择使用
|
||||||
|
|
||||||
启动时会加载项目目录下`config.yml/yaml/json/toml`和`config`目录下的所有配置文件,你可在`config`目录下创建多个配置文件,轻雪会自动合并这些配置文件
|
### 配置文件生成
|
||||||
|
|
||||||
## **基础配置项**
|
首次运行轻雪后,会生成以下文件和目录结构:
|
||||||
|
|
||||||
|
```
|
||||||
|
./
|
||||||
|
├── config.yml # 默认生成的配置文件
|
||||||
|
└── config/ # 配置目录,可包含多个配置文件
|
||||||
|
└── file1.yaml # 示例配置文件1
|
||||||
|
└── file2.json # 示例配置文件2
|
||||||
|
└── file3.toml # 示例配置文件3
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 配置文件修改
|
||||||
|
|
||||||
|
您可以修改生成的 `config.yml` 文件或在 `config` 目录下添加新的配置文件
|
||||||
|
|
||||||
|
绝大多数情况下,您只需要修改以下字段:
|
||||||
|
|
||||||
|
- `superusers`:超级用户列表
|
||||||
|
- `nickname`:昵称配置
|
||||||
|
|
||||||
|
修改完成后,重启轻雪以应用新的配置
|
||||||
|
|
||||||
|
### 配置文件加载
|
||||||
|
|
||||||
|
启动轻雪时,会加载项目目录下以下文件和 `config` 目录下的所有配置文件:
|
||||||
|
|
||||||
|
- `config.yml`
|
||||||
|
- `config.yaml`
|
||||||
|
- `config.json`
|
||||||
|
- `config.toml`
|
||||||
|
|
||||||
|
轻雪会自动合并 `config` 目录下的所有配置文件
|
||||||
|
|
||||||
|
这意味着您可以在 `config` 目录下创建多个配置文件, 轻雪会将它们的内容合并为一个完整的配置
|
||||||
|
|
||||||
|
## 示例配置文件
|
||||||
|
|
||||||
|
### **基础配置项**
|
||||||
|
|
||||||
|
> 请注意, 文档中的配置代码是被拆分的, 实际上为一个配置文件(`config.yml`),此处仅为方便阅读拆分
|
||||||
|
|
||||||
|
**Nonebot配置**
|
||||||
```yaml
|
```yaml
|
||||||
nonebot:
|
nonebot:
|
||||||
# Nonebot机器人的配置,6.3.10版本后,NoneBot下配置已迁移至nonebot键下,不再使用外层配置,但是部分内容会被覆盖,请尽快迁移
|
# Nonebot机器人的配置,6.3.10版本后,NoneBot下配置已迁移至nonebot键下,不再使用外层配置,但是部分内容会被覆盖,请尽快迁移
|
||||||
@ -20,6 +61,10 @@ nonebot:
|
|||||||
port: 20216 # 绑定端口
|
port: 20216 # 绑定端口
|
||||||
nickname: [ "liteyuki" ] # 机器人昵称列表
|
nickname: [ "liteyuki" ] # 机器人昵称列表
|
||||||
superusers: [ "1919810" ] # 超级用户列表
|
superusers: [ "1919810" ] # 超级用户列表
|
||||||
|
```
|
||||||
|
|
||||||
|
**Liteyuki配置**
|
||||||
|
```yaml
|
||||||
liteyuki:
|
liteyuki:
|
||||||
# 写在外层的配置项将会被覆盖,建议迁移到liteyuki下
|
# 写在外层的配置项将会被覆盖,建议迁移到liteyuki下
|
||||||
log_level: "INFO" # 日志等级
|
log_level: "INFO" # 日志等级
|
||||||
@ -41,31 +86,17 @@ nonebot:
|
|||||||
default_language: "zh-CN" # 默认语言
|
default_language: "zh-CN" # 默认语言
|
||||||
alconna_auto_completion: false # alconna是否自动补全指令,默认false,建议开启
|
alconna_auto_completion: false # alconna是否自动补全指令,默认false,建议开启
|
||||||
safe_mode: false # 安全模式,开启后将不会加载任何第三方NoneBot插件
|
safe_mode: false # 安全模式,开启后将不会加载任何第三方NoneBot插件
|
||||||
|
|
||||||
# 其他Nonebot插件的配置项
|
# 其他Nonebot插件的配置项
|
||||||
custom_config_1: "custom_value1"
|
custom_config_1: "custom_value1"
|
||||||
custom_config_2: "custom_value2"
|
custom_config_2: "custom_value2"
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
# 开发者选项
|
# 开发者选项
|
||||||
liteyuki:
|
liteyuki:
|
||||||
allow_update: true # 是否允许更新
|
allow_update: true # 是否允许更新
|
||||||
debug: false # 轻雪调试,开启会自动重载Bot或者资源,其他插件自带的调试功能也将开启
|
debug: false # 轻雪调试,开启会自动重载Bot或者资源,其他插件自带的调试功能也将开启
|
||||||
dev_mode: false # 开发者模式,开启后将会启动监视者,监视文件变化并自动重载
|
dev_mode: false # 开发者模式,开启后将会启动监视者,监视文件变化并自动重载
|
||||||
|
# ...其他配置项...
|
||||||
...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## **示例:与NoneBot对接的OneBot实现端配置**
|
|
||||||
|
|
||||||
生产环境中推荐反向WebSocket
|
|
||||||
不同的实现端给出的字段可能不同,但是基本上都是一样的,这里给出一个参考值
|
|
||||||
|
|
||||||
| 字段 | 参考值 | 说明 |
|
|
||||||
|-------------|------------------------------------|----------------------------------|
|
|
||||||
| 协议 | 反向WebSocket | 推荐使用反向ws协议进行通信,即轻雪作为服务端 |
|
|
||||||
| 地址 | ws://127.0.0.1:20216/onebot/v11/ws | 地址取决于配置文件,本机默认为`127.0.0.1:20216` |
|
|
||||||
| AccessToken | `""` | 如果你给轻雪配置了`AccessToken`,请在此填写相同的值 |
|
|
||||||
- 要使用其他通信方式请访问[OneBot Adapter](https://onebot.adapters.nonebot.dev/)获取详细信息
|
|
||||||
|
|
||||||
## **其他**
|
|
||||||
|
|
||||||
- 轻雪不局限于OneBot适配器,你可以使用NoneBot2支持的任何适配器或使用轻雪讯息传递插件
|
|
||||||
|
@ -1,25 +1,58 @@
|
|||||||
---
|
---
|
||||||
title: 答疑
|
title: 答疑
|
||||||
order: 3
|
order: 4
|
||||||
---
|
---
|
||||||
# 答疑
|
# 答疑
|
||||||
## **常见问题**
|
|
||||||
|
|
||||||
- 设备上Python环境太乱了,pip和python不对应怎么办?
|
## 常见问题
|
||||||
- 请使用`/path/to/python -m pip install -r requirements.txt`来安装依赖,
|
|
||||||
然后用`/path/to/python main.py`来启动Bot,
|
|
||||||
其中`/path/to/python`是你要用来运行Bot的可执行文件
|
|
||||||
|
|
||||||
- 更新轻雪失败,报错`InvalidGitRepositoryError`
|
以下是一些常见问题的解答和解决方案:
|
||||||
- 请正确安装`Git`,并使用克隆而非直接下载的方式部署轻雪
|
|
||||||
|
|
||||||
- 怎么对接聊天平台?
|
### **设备上 Python 环境太乱了,pip 和 python 不对应怎么办?**
|
||||||
- Bot部分插件提供了对接特定平台的能力,例如使用NoneBot插件可对接支持的适配器平台
|
|
||||||
- `Playwright`安装失败
|
请使用以下命令来安装依赖, 并启动 Bot:
|
||||||
- 输入`playwright install`安装浏览器
|
|
||||||
- 有的插件安装后报错无法启动
|
```bash
|
||||||
- 请先查阅插件文档,确认插件必要配置项完好后,仍然出现问题,请联系插件作者或在安全模式`safe_mode: true`下启动轻雪,在安全模式下你可以使用`npm uninstall`卸载问题插件
|
/path/to/python -m pip install -r requirements.txt
|
||||||
|
/path/to/python main.py
|
||||||
|
```
|
||||||
|
|
||||||
|
其中 `/path/to/python` 是你要用来运行 Bot 的 Python 可执行文件的路径
|
||||||
|
|
||||||
|
### **更新轻雪失败,报错 `InvalidGitRepositoryError`**
|
||||||
|
|
||||||
|
请确保正确安装了 `Git` , 并使用克隆而非直接下载的方式部署轻雪
|
||||||
|
|
||||||
|
如果你已经正确安装了 `Git` 但仍然遇到问题,请尝试使用手动下载的方式来更新轻雪(这对于一些特殊的网络环境有效)
|
||||||
|
|
||||||
|
### **怎么对接聊天平台?**
|
||||||
|
|
||||||
|
Bot 部分插件提供了对接特定平台的能力, 例如, 使用 NoneBot 插件可以对接支持的[适配器平台](https://bot.liteyuki.icu/deploy/adapter.html)
|
||||||
|
|
||||||
|
### **`Playwright` 安装失败**
|
||||||
|
|
||||||
|
运行以下命令来安装浏览器:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
playwright install
|
||||||
|
```
|
||||||
|
|
||||||
|
### **有的插件安装后报错无法启动**
|
||||||
|
|
||||||
|
请先查阅插件文档,确认插件必要配置项完好, 如果问题仍然存在,请联系插件作者或在安全模式下启动轻雪:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
safe_mode: true
|
||||||
|
```
|
||||||
|
|
||||||
|
在安全模式下,你可以使用以下命令卸载问题插件:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm uninstall <plugin-name>
|
||||||
|
```
|
||||||
|
|
||||||
## 其他问题
|
## 其他问题
|
||||||
-
|
|
||||||
加入QQ群[775840726](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=SzmDYbfR6jY94o9KFNon7AwelRyI6M_u&authKey=ygeBdEmdFNyCWuNR4w0M1M8%2B5oDg7k%2FDfN0tzBkYcnbB%2FGHNnlVEnCIGbdftsnn7&noverify=0&group_code=775840726)
|
如果以上解答无法解决您的问题,欢迎加入我们的 QQ 群 [775840726](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=SzmDYbfR6jY94o9KFNon7AwelRyI6M_u&authKey=ygeBdEmdFNyCWuNR4w0M1M8%2B5oDg7k%2FDfN0tzBkYcnbB%2FGHNnlVEnCIGbdftsnn7&noverify=0&group_code=775840726) 进行进一步的交流和讨论
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,29 +7,61 @@ order: 1
|
|||||||
|
|
||||||
## **常规部署**
|
## **常规部署**
|
||||||
|
|
||||||
1. 安装 [`Git`](https://git-scm.com/download/) 和 [
|
### 安装基本环境
|
||||||
`Python3.10+`](https://www.python.org/downloads/release/python-31010/) 环境
|
|
||||||
|
|
||||||
```bash
|
**Git 版本管理工具**
|
||||||
# 克隆项目到本地,轻雪使用Git进行版本管理,该步骤为必要项
|
[Git](https://git-scm.com/download/)
|
||||||
git clone https://github.com/LiteyukiStudio/LiteyukiBot --depth=1 # 若你不能访问Github,可以使用Liteyuki镜像:https://git.liteyuki.icu/bot/app
|
|
||||||
|
|
||||||
# 切换到Bot目录下
|
**Python3.10+**
|
||||||
cd LiteyukiBot
|
[Python3.10+](https://www.python.org/downloads/release/python-31010/)
|
||||||
|
|
||||||
# 创建虚拟环境
|
|
||||||
python -m venv venv
|
|
||||||
|
|
||||||
# 激活虚拟环境
|
### 克隆项目到本地,轻雪使用Git进行版本管理,该步骤为必要项
|
||||||
.\venv\Scripts\activate # Windows
|
|
||||||
source venv/bin/activate # Linux
|
|
||||||
|
|
||||||
# 安装依赖
|
`git clone https://github.com/LiteyukiStudio/LiteyukiBot --depth=1`
|
||||||
pip install -r requirements.txt
|
|
||||||
|
> 若你不能访问Github,可以使用Liteyuki镜像:`https://git.liteyuki.icu/bot/app`
|
||||||
|
|
||||||
|
### 切换到Bot目录下
|
||||||
|
|
||||||
|
`cd LiteyukiBot`
|
||||||
|
|
||||||
|
> 如果存在文件夹缺失报错, 尝试使用绝对路径进行路径跳转
|
||||||
|
|
||||||
|
### 创建虚拟环境
|
||||||
|
|
||||||
|
`python -m venv venv`
|
||||||
|
|
||||||
|
> 如果出现相关虚拟环境错误, 建议查询 [Python Venv](https://docs.python.org/3/library/venv.html)
|
||||||
|
|
||||||
|
|
||||||
|
### 激活虚拟环境
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
`.\venv\Scripts\activate`
|
||||||
|
|
||||||
|
> 出现`'activate' 不是内部或外部命令,也不是可运行的程序或批处理文件。`错误, 请使用完整路径激活虚拟环境
|
||||||
|
|
||||||
|
Linux:
|
||||||
|
`source venv/bin/activate`
|
||||||
|
|
||||||
|
> 如果出现`source: command not found`, 请使用完整路径激活虚拟环境
|
||||||
|
|
||||||
|
|
||||||
|
### 安装依赖
|
||||||
|
|
||||||
|
`pip install -r requirements.txt`
|
||||||
|
|
||||||
|
> 若出现`ERROR: Could not open requirements file: [Errno 2] No such file or directory`错误, 请检查是否在Bot目录下执行命令
|
||||||
|
|
||||||
|
> 若出现`ERROR: Could not build wheels for xx, which is required to install pyproject.toml-based projects`错误,请尝试使用手动命令安装相关依赖(虚拟环境下执行`pip install xx`,例如`pip install Pillow`)
|
||||||
|
|
||||||
|
### 启动Bot
|
||||||
|
|
||||||
|
`python main.py`
|
||||||
|
|
||||||
|
> 若出现`ModuleNotFoundError: No module named 'xx'`错误, 请尝试重新执行安装依赖步骤
|
||||||
|
|
||||||
# 启动Bot
|
|
||||||
python main.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## **使用Docker构建**
|
## **使用Docker构建**
|
||||||
|
|
||||||
@ -43,10 +75,15 @@ docker pull ghcr.io/liteyukistudio/liteyukibot:latest # 每夜版镜像
|
|||||||
|
|
||||||
## **装置要求**
|
## **装置要求**
|
||||||
|
|
||||||
- Windows系统版本最低`Windows10+`/`Windows Server 2019+`
|
- Windows系统版本推荐最低版本: `Windows 10 21H2` / `Windows Server 2019+`
|
||||||
|
>版本低于`Windows 10 21H2` 可能无法正常使用Bot, 建议升级系统版本或使用Docker部署
|
||||||
|
|
||||||
- Linux系统要支持Python3.10+,推荐`Ubuntu 20.04+`(~~别用你那b CentOS~~)
|
- Linux系统要支持Python3.10+,推荐`Ubuntu 20.04+`(~~别用你那b CentOS~~)
|
||||||
|
|
||||||
- CPU: 至少`1vCPU`
|
- CPU: 至少`1vCPU`
|
||||||
|
|
||||||
- 内存: Bot无其他插件会占用`300~500MB`,包括`chromium` 及 `node`等进程,其他插件占用视具体插件而定,建议`1GB`以上
|
- 内存: Bot无其他插件会占用`300~500MB`,包括`chromium` 及 `node`等进程,其他插件占用视具体插件而定,建议`1GB`以上
|
||||||
|
|
||||||
- 硬盘: 至少`1GB`空间
|
- 硬盘: 至少`1GB`空间
|
||||||
|
|
||||||
> [!warning]
|
> [!warning]
|
||||||
@ -54,6 +91,6 @@ docker pull ghcr.io/liteyukistudio/liteyukibot:latest # 每夜版镜像
|
|||||||
> 为你的Python可执行文件路径
|
> 为你的Python可执行文件路径
|
||||||
|
|
||||||
> [!warning]
|
> [!warning]
|
||||||
> 轻雪的更新功能依赖Git,如果你没有安装Git直接下载源代码运行,你将无法使用更新功能
|
> 轻雪的更新功能依赖Git,如果你没有安装Git直接下载源代码运行,你将无法使用更新功能(除非你闲的手动下载源代码更新轻雪~~)
|
||||||
|
|
||||||
#### 其他问题请移步至[答疑](./fandq)
|
#### 其他问题请移步至[答疑](./fandq)
|
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
Copyright (C) 2020-2025 LiteyukiStudio. All Rights Reserved
|
||||||
|
|
||||||
@Time : 2024/7/27 上午11:12
|
@Time : 2024/7/27 上午11:12
|
||||||
@Author : snowykami
|
@Author : snowykami
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
Copyright (C) 2020-2025 LiteyukiStudio. All Rights Reserved
|
||||||
|
|
||||||
@Time : 2024/8/18 上午5:04
|
@Time : 2024/8/18 上午5:04
|
||||||
@Author : snowykami
|
@Author : snowykami
|
||||||
|
Loading…
x
Reference in New Issue
Block a user