Skip to content

Commit

Permalink
📝 完成DicerGirl部署文档
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 committed Dec 14, 2023
1 parent 007c882 commit 1b14297
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 30 deletions.
64 changes: 49 additions & 15 deletions docs/src/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ export default {
['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }]
],

/**
* Theme configuration, here is the default theme configuration for VuePress.
*
* ref:https://v1.vuepress.vuejs.org/theme/default-theme-config.html
*/
theme: defaultTheme({
repo: 'https://github.com/noctisynth/dicer',
docsDir: 'docs',
Expand All @@ -26,17 +21,56 @@ export default {
text: '概览',
link: '/overview/',
},
{
text: '开始',
children: [
{
text: '快速开始',
link: '/getting-started/README.md',
},
{
text: '安装',
link: '/getting-started/installation.html',
},
{
text: '部署',
link: '/getting-started/deployment.html',
},
{
text: '使用',
link: '/getting-started/using-dicergirl.html',
},
]
},
],
sidebar: [
{
text: '概览',
link: '/overview/',
},
{
text: '开始',
children: [
{
text: '快速开始',
link: '/getting-started/README.md',
},
{
text: '安装',
link: '/getting-started/installation.html',
},
{
text: '部署',
link: '/getting-started/deployment.html',
},
{
text: '使用',
link: '/getting-started/using-dicergirl.html',
},
]
},
],
sidebar: [{
text: '概览',
link: '/overview/',
children: []
}],
}),

/**
* Apply plugins,ref:https://v1.vuepress.vuejs.org/zh/plugin/
*/
plugins: [
]
plugins: []
}
7 changes: 6 additions & 1 deletion docs/src/getting-started/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---
prev: ../overview/README.md
next: ./installation.md
---

# 快速开始

Noctisynth 注重于自由与开放,任何人都可以快速的部署 DicerGirl,即便你可能车卡的时候没有点计算机使用。

[安装](./installation.md)中,我们详细的阐述了如何从零开始搭建一个属于你的骰娘。

如果你已经有了一个 DicerGirl 安装,或者你非常熟悉 DicerGirl 的上层框架 Nonebot2,那么你可以直接移步[使用](./usage.md)
如果你已经有了一个 DicerGirl 安装,或者你非常熟悉 DicerGirl 的上层框架 Nonebot2,那么你可以直接移步[使用](./usage.md)
25 changes: 25 additions & 0 deletions docs/src/getting-started/deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
prev: ./deployment.md
next: ./using-dicergirl.md
---
# 部署

在进行部署之前,请确保你已经正确安装`DicerGirl`,否则请先移步[安装](./installation.md)

## 使用`nb-cli`启动

请在正确安装了`DicerGirl``Nonebot2`项目文件夹处执行指令:

```bash
nb run --reload --reload-delay 2
```

我们使用`nb-cli`启动,其中`--reload``--reload-delay`允许在`DicerGirl`插件增删或版本更新后自动重启服务并重新挂载规则包。然而,在生产环境下,热重载功能可能同样会为你的服务器增加一些未知的问题。如果你希望规避它,请使用以下指令替代:

```bash
nb run
```

在不使用`--reload`参数的情况下,`DicerGirl`的热更新无法正常使用,这意味着在插件增删后你仍然需要启动`DicerGirl`来使你的更改生效,所以我们依然建议你采用热重载。

如果你需要更多对`nb-cli`的支持,请移步[Nonebot CLI](https://cli.nonebot.dev/)
39 changes: 30 additions & 9 deletions docs/src/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
prev: ./README.md
next: ./deployment.md
---
# 安装

## `Nonebot2`原生安装
Expand All @@ -8,7 +12,7 @@ DicerGirl 依照最新的 PEP 要求进行编写,它遵照了最新的注释

所有支持 Python3 的操作系统(包括 Windows)均可以安装 DicerGirl。

在使用原始方法安装`DicerGirl, 请先确保你已经安装了`Python3`并正确配置环境变量.
在使用原始方法安装`DicerGirl`, 请先确保你已经安装了`Python3`并正确配置环境变量.

如果你已有`Nonebot2`项目,请在`Nonebot2`项目中使用指令:

Expand All @@ -22,19 +26,36 @@ nb plugin install dicergirl
pip install nb-cli
```

并随后使用`nb-cli`创建项目
`Nonebot2`官方推荐使用`pipx`替代`pip`来安装`nb-cli`

```bash
nb create -t bootstrap
pip install pipx
pipx install nb-cli
pipx ensurepath
```

适配器与驱动器的选择参考你希望使用的适配器,例如`OneBot V11`的驱动器请选择`FastAPI``HTTPX`>与`websockets`, `QQ`适配器请选择`HTTPX``websockets``AIOHTTP`

创建完成后,在生成的项目目录中执行:
在确保`nb-cli`被安装后,你可以执行以下指令来创建`Nonebot2`项目:

```bash
nb plugin install dicergirl
nb run --reload --reload-delay 2
nb create -t bootstrap
```

Nonebot2 的项目创建与插件增删详见[Nonebot CLI](https://cli.nonebot.dev/)
适配器与驱动器的选择参考你希望使用的适配器,例如`OneBot V11`的驱动器请选择`FastAPI``HTTPX``websockets`, `QQ`适配器请选择`HTTPX``websockets``AIOHTTP`

::: tip
Nonebot2 的项目创建与插件增删详见[Nonebot CLI](https://cli.nonebot.dev/),我们建议使用`nb-cli`来安装`DicerGirl`
:::

::: warning
DicerGirl 目前仅确保在`Onebot v11``QQ`适配器下正常工作,尽管它允许在任何适配器上运行并被尽可能适配,但是我们没有进行测试。在其它适配器中使用可能出现意外的异常(当然它也大概率正常工作),如果你在使用其它适配器并发现问题,请移步[BUG提交](https://github.com/noctisynth/dicer/issues)
:::

### Windows 快速部署

下载最新版的[`Dicergirl Installer`安装包](https://gitee.com/unvisitor/dginstaller/releases), 安装完成后 DGI 会自动部署 DicerGirl, 你可以在终端中提示的`https://127.0.0.1:{port}/go-cqhttp/`中配置 QQ 账号,其中, `{port}`为随机的端口号。

网页版`go-cqhttp`基于`nonebot-plugin-gocqhttp`

::: warning
DicerGirl Installer 目前仅适用于 Windows 平台进行 `go-cqhttp` 部署,对其它平台的支持正在开发中。
:::
23 changes: 23 additions & 0 deletions docs/src/getting-started/using-dicergirl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 使用 DicerGirl

如果你已经配置好`DicerGirl`,那么你可以开始使用了。

你可以尝试发送指令:

::: tip
如果你使用 QQ 适配器(QQ官方协议)那么你需要在发送消息前`@机器人`并发送`/bot`作为替代,并且注意该`@机器人`字样不能是复制粘贴的。
:::

```bash
.bot
```

如果你收到了机器人的回复:

```plain-text
Noctisynth DicerGirl 版本 3.5.2 [Python 3.12.0 For Nonebot2 2.1.2]
此项目以 Apache-2.0 协议开源.
欢迎使用 Noctisynth DicerGirl, 使用`.help 指令`查看指令帮助.
```

那么这意味着你的骰娘已经被正确部署。
9 changes: 4 additions & 5 deletions docs/src/overview/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
next: ../getting-started/README.md
---
# 概览

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dicergirl) 
Expand Down Expand Up @@ -48,8 +51,4 @@ DicerGirl 不需要复杂的配置,如果你熟悉 Nonebot2,你可以快速
nb plugin install dicergirl
```

如果你对没点计算机使用的属性,我们还对计算机使用检定失败的玩家提供了在 Windows 平台快速部署的方案。它使用 DicerGirl Installer 安装并按照指引进行配置即可使用。

::: warning
DicerGirl Installer 目前仅适用于 Windows 平台进行 `go-cqhttp` 部署,对其它平台的支持正在开发中。
:::
如果你对没点计算机使用的属性,我们还对计算机使用检定失败的玩家提供了在 Windows 平台快速部署的方案。它使用 DicerGirl Installer 安装并按照指引进行配置即可使用。如果你已经决定开始使用`DicerGirl`,请移步[快速开始](../getting-started/README.md)

0 comments on commit 1b14297

Please sign in to comment.