mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 08:11:38 +00:00
📝 write install guide and init tutorial
This commit is contained in:
33
website/docs/guide/start/editor-support.md
Normal file
33
website/docs/guide/start/editor-support.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
sidebar_position: 80
|
||||||
|
description: 编辑器支持
|
||||||
|
---
|
||||||
|
|
||||||
|
# 编辑器支持
|
||||||
|
|
||||||
|
框架基于 [PEP484](https://www.python.org/dev/peps/pep-0484/), [PEP 561](https://www.python.org/dev/peps/pep-0517/), [PEP8](https://www.python.org/dev/peps/pep-0008/) 等规范进行开发并且是 **Fully Typed**。框架使用 `pyright` (`pylance`) 工具进行类型检查,确保代码可以被编辑器正确解析。
|
||||||
|
|
||||||
|
## 编辑器推荐配置
|
||||||
|
|
||||||
|
### Visual Studio Code
|
||||||
|
|
||||||
|
在 Visual Studio Code 中,可以使用 `pylance` Language Server 并启用 `Type Checking` 以达到最佳开发体验。
|
||||||
|
|
||||||
|
向 `.vscode` 文件夹中对应文件添加以下配置并在 VSCode 插件面板安装推荐插件:
|
||||||
|
|
||||||
|
```json title=extensions.json
|
||||||
|
{
|
||||||
|
"recommendations": ["ms-python.python", "ms-python.vscode-pylance"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```json title=settings.json
|
||||||
|
{
|
||||||
|
"python.languageServer": "Pylance",
|
||||||
|
"python.analysis.typeCheckingMode": "basic"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 其他
|
||||||
|
|
||||||
|
欢迎提交 Pull Request 添加其他编辑器配置推荐。点击左下角 `Edit this page` 前往编辑。
|
40
website/docs/guide/start/install-adapter.md
Normal file
40
website/docs/guide/start/install-adapter.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
sidebar_position: 2
|
||||||
|
description: 通过脚手架, pip 安装适配器
|
||||||
|
---
|
||||||
|
|
||||||
|
# 安装协议适配器
|
||||||
|
|
||||||
|
## 查看
|
||||||
|
|
||||||
|
前往 [商店](/store) 即可查看所有协议适配器。
|
||||||
|
|
||||||
|
或者使用 `nb-cli` 命令行查看:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nb adapter list
|
||||||
|
```
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
前往 [商店](/store) 点击复制 `nb-cli` 安装命令至命令行执行即可安装。
|
||||||
|
|
||||||
|
或者自行输入命令安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nb adapter install <adapter-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
或者使用交互模式安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nb adapter install
|
||||||
|
```
|
||||||
|
|
||||||
|
也可以使用 `pip` 安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install <adapter-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- asciinema for install adapter -->
|
42
website/docs/guide/start/install-driver.md
Normal file
42
website/docs/guide/start/install-driver.md
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
sidebar_position: 1
|
||||||
|
description: 通过脚手架, pip 安装驱动器
|
||||||
|
---
|
||||||
|
|
||||||
|
# 安装驱动器
|
||||||
|
|
||||||
|
NoneBot 在默认安装情况下内置了 `fastapi` 服务端驱动器,其他驱动器如 `httpx`, `aiohttp` 则需要额外安装。
|
||||||
|
|
||||||
|
## 查看
|
||||||
|
|
||||||
|
前往 [商店](/store) 即可查看所有驱动器。
|
||||||
|
|
||||||
|
或者使用 `nb-cli` 命令行查看:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nb driver list
|
||||||
|
```
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
前往 [商店](/store) 点击复制 `nb-cli` 安装命令至命令行执行即可安装。
|
||||||
|
|
||||||
|
或者自行输入命令安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nb driver install <driver-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
或者使用交互模式安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nb driver install
|
||||||
|
```
|
||||||
|
|
||||||
|
也可以使用 `pip` 安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install <driver-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- asciinema for install driver -->
|
40
website/docs/guide/start/install-plugin.md
Normal file
40
website/docs/guide/start/install-plugin.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
sidebar_position: 3
|
||||||
|
description: 通过脚手架, pip 安装插件
|
||||||
|
---
|
||||||
|
|
||||||
|
# 安装第三方插件
|
||||||
|
|
||||||
|
## 查看
|
||||||
|
|
||||||
|
前往 [商店](/store) 即可查看所有发布的插件。
|
||||||
|
|
||||||
|
或者使用 `nb-cli` 命令行查看:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nb plugin list
|
||||||
|
```
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
前往 [商店](/store) 点击复制 `nb-cli` 安装命令至命令行执行即可安装。
|
||||||
|
|
||||||
|
或者自行输入命令安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nb plugin install <plugin-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
或者使用交互模式安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nb plugin install
|
||||||
|
```
|
||||||
|
|
||||||
|
也可以使用 `pip` 安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install <plugin-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- asciinema for install plugin -->
|
@ -34,6 +34,10 @@ pip uninstall nonebot
|
|||||||
|
|
||||||
<!-- asciinema for installation -->
|
<!-- asciinema for installation -->
|
||||||
|
|
||||||
|
:::important 提示
|
||||||
|
`nb-cli` 的使用方法详见 [使用脚手架](./nb-cli.md)
|
||||||
|
:::
|
||||||
|
|
||||||
## 不使用脚手架 (纯净安装)
|
## 不使用脚手架 (纯净安装)
|
||||||
|
|
||||||
如果你不想使用脚手架,可以直接安装 `nonebot2`,并自行完成开发配置。
|
如果你不想使用脚手架,可以直接安装 `nonebot2`,并自行完成开发配置。
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
sidebar_position: 1
|
sidebar_position: 90
|
||||||
description: 使用 nb-cli 帮助开发
|
description: 使用 nb-cli 帮助开发
|
||||||
|
|
||||||
options:
|
options:
|
||||||
@ -9,3 +9,5 @@ options:
|
|||||||
---
|
---
|
||||||
|
|
||||||
# 使用脚手架
|
# 使用脚手架
|
||||||
|
|
||||||
|
<!-- TODO -->
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
sidebar-position: 100
|
||||||
|
description: 如何获取帮助
|
||||||
---
|
---
|
||||||
|
|
||||||
# 遇到问题
|
# 遇到问题
|
4
website/docs/guide/tutorial/_category_.json
Normal file
4
website/docs/guide/tutorial/_category_.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"position": 2,
|
||||||
|
"label": "教程"
|
||||||
|
}
|
@ -1,17 +1,13 @@
|
|||||||
---
|
---
|
||||||
sidebar_position: 4
|
sidebar_position: 0
|
||||||
|
|
||||||
options:
|
options:
|
||||||
menu:
|
menu:
|
||||||
weight: 40
|
weight: 20
|
||||||
category: guide
|
category: guide
|
||||||
---
|
---
|
||||||
|
|
||||||
# 创建一个完整的项目
|
# 创建项目
|
||||||
|
|
||||||
上一章中我们已经运行了一个简单的 NoneBot 实例,在这一章,我们将从零开始一个完整的项目。
|
|
||||||
|
|
||||||
## 目录结构
|
|
||||||
|
|
||||||
可以使用 `nb-cli` 或者自行创建完整的项目目录:
|
可以使用 `nb-cli` 或者自行创建完整的项目目录:
|
||||||
|
|
||||||
@ -19,6 +15,8 @@ options:
|
|||||||
nb create
|
nb create
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 目录结构
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
:::vue
|
:::vue
|
||||||
AweSome-Bot
|
AweSome-Bot
|
||||||
@ -46,7 +44,7 @@ AweSome-Bot
|
|||||||
:::warning 提示
|
:::warning 提示
|
||||||
如果您使用如 `VSCode` / `PyCharm` 等 IDE 启动 nonebot,请检查 IDE 当前工作空间目录是否与当前侧边栏打开目录一致。
|
如果您使用如 `VSCode` / `PyCharm` 等 IDE 启动 nonebot,请检查 IDE 当前工作空间目录是否与当前侧边栏打开目录一致。
|
||||||
|
|
||||||
- 注意:在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
|
> 注意:在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
Reference in New Issue
Block a user