mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-06-08 08:59:55 +08:00
docs: update contributing guides
This commit is contained in:
98
README.md
98
README.md
@@ -10,103 +10,9 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## 部署
|
## [部署](https://sabot.unv.app/deploy/)
|
||||||
|
|
||||||
### 从二进制文件部署
|
## [参与开发](https://sabot.unv.app/contribute/)
|
||||||
|
|
||||||
在 [Release](https://github.com/krau/SaveAny-Bot/releases) 页面下载对应平台的二进制文件.
|
|
||||||
|
|
||||||
在解压后目录新建 `config.toml` 文件, 参考 [config.example.toml](./config.example.toml) 编辑配置文件.
|
|
||||||
|
|
||||||
运行:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
chmod +x saveany-bot
|
|
||||||
./saveany-bot
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 添加为 systemd 服务
|
|
||||||
|
|
||||||
创建文件 `/etc/systemd/system/saveany-bot.service` 并写入以下内容:
|
|
||||||
|
|
||||||
```
|
|
||||||
[Unit]
|
|
||||||
Description=SaveAnyBot
|
|
||||||
After=systemd-user-sessions.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=/yourpath/
|
|
||||||
ExecStart=/yourpath/saveany-bot
|
|
||||||
Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
```
|
|
||||||
|
|
||||||
设为开机启动并启动服务:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
systemctl enable --now saveany-bot
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 为 OpenWrt 及衍生系统添加开机自启动服务
|
|
||||||
|
|
||||||
创建文件 ` /etc/init.d/saveanybot` ,参考[saveanybot](./docs/saveanybot)自行修改.
|
|
||||||
|
|
||||||
`chmod +x /etc/init.d/saveanybot`
|
|
||||||
|
|
||||||
完成后,将文件复制到 `/etc/rc.d`并重命名为`S99saveanybot`.
|
|
||||||
|
|
||||||
`chmod +x /etc/rc.d/S99saveanybot`
|
|
||||||
|
|
||||||
#### 为 OpenWrt 及衍生系统添加快捷指令
|
|
||||||
|
|
||||||
创建文件` /usr/bin/sabot` ,参考[sabot](./docs/sabot)自行配置修改,注意此处文件编码仅支持 ANSI 936 .
|
|
||||||
|
|
||||||
`chmod +x /usr/bin/sabot`
|
|
||||||
|
|
||||||
之后,终端输入`sabot start|stop|restart|status|enable|disable`即可.
|
|
||||||
|
|
||||||
### 使用 Docker 部署
|
|
||||||
|
|
||||||
#### Docker Compose
|
|
||||||
|
|
||||||
下载 [docker-compose.yml](./docker-compose.yml) 文件, 在同目录下新建 `config.toml` 文件, 参考 [config.example.toml](./config.example.toml) 编辑配置文件.
|
|
||||||
|
|
||||||
启动:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Docker
|
|
||||||
|
|
||||||
```shell
|
|
||||||
docker run -d --name saveany-bot \
|
|
||||||
-v /path/to/config.toml:/app/config.toml \
|
|
||||||
-v /path/to/downloads:/app/downloads \
|
|
||||||
ghcr.io/krau/saveany-bot:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
## 更新
|
|
||||||
|
|
||||||
使用 `upgrade` 或 `up` 升级到最新版
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./saveany-bot upgrade
|
|
||||||
```
|
|
||||||
|
|
||||||
如果是 Docker 部署, 使用以下命令更新:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker pull ghcr.io/krau/saveany-bot:latest
|
|
||||||
docker restart saveany-bot
|
|
||||||
```
|
|
||||||
|
|
||||||
## 使用
|
|
||||||
|
|
||||||
向 Bot 发送(转发)文件, 或发送公开频道的消息链接, 按照提示操作.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
11
docs/docs/contribute.md
Normal file
11
docs/docs/contribute.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# 参与开发
|
||||||
|
|
||||||
|
## 贡献新存储端
|
||||||
|
|
||||||
|
1. Fork 本项目, 克隆到本地
|
||||||
|
2. 在 `config/storage` 目录下定义存储端配置, 并添加到 `config/storage/factory.go` 中
|
||||||
|
3. 在 `types/types.go` 中添加新的存储端类型
|
||||||
|
4. 在 `storage` 目录下新建一个包, 编写存储端实现, 然后在 `storage/storage.go` 中导入并添加它
|
||||||
|
5. 更新 `config.example.toml` 文件, 添加新的示例配置
|
||||||
|
|
||||||
|
*可能确实有点麻烦了 = =*
|
||||||
@@ -31,3 +31,4 @@ nav:
|
|||||||
- deploy.md
|
- deploy.md
|
||||||
- help.md
|
- help.md
|
||||||
- faq.md
|
- faq.md
|
||||||
|
- contribute.md
|
||||||
|
|||||||
Reference in New Issue
Block a user