mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 16:21:28 +00:00
📝 add plugin docs
This commit is contained in:
33
website/docs/start/editor-support.md
Normal file
33
website/docs/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/start/install-adapter.md
Normal file
40
website/docs/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>
|
||||
```
|
||||
|
||||
<!-- TODO: asciinema for install adapter -->
|
42
website/docs/start/install-driver.md
Normal file
42
website/docs/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>
|
||||
```
|
||||
|
||||
<!-- TODO: asciinema for install driver -->
|
40
website/docs/start/install-plugin.md
Normal file
40
website/docs/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>
|
||||
```
|
||||
|
||||
<!-- TODO: asciinema for install plugin -->
|
75
website/docs/start/installation.md
Normal file
75
website/docs/start/installation.md
Normal file
@ -0,0 +1,75 @@
|
||||
---
|
||||
sidebar_position: 0
|
||||
description: 通过脚手架, PyPI, GitHub 安装 NoneBot
|
||||
|
||||
options:
|
||||
menu:
|
||||
weight: 10
|
||||
category: guide
|
||||
---
|
||||
|
||||
# 安装 NoneBot
|
||||
|
||||
:::warning 注意
|
||||
请确保你的 Python 版本 >= 3.7.3。
|
||||
:::
|
||||
|
||||
:::warning 注意
|
||||
请在安装 NoneBot v2 之前卸载 NoneBot v1
|
||||
|
||||
```bash
|
||||
pip uninstall nonebot
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## 通过脚手架安装 (推荐)
|
||||
|
||||
1. (可选) 使用你喜欢的 Python 环境管理工具 (如 `poetry`, `venv`, `conda` 等) 创建新的虚拟环境
|
||||
2. 使用 `pip` 或 其他包管理工具 安装 `nb-cli`,`nonebot2` 会作为其依赖被一起安装
|
||||
|
||||
```bash
|
||||
pip install nb-cli
|
||||
```
|
||||
|
||||
<!-- TODO: asciinema for installation -->
|
||||
|
||||
:::important 提示
|
||||
`nb-cli` 的使用方法详见 [使用脚手架](./nb-cli.md)
|
||||
:::
|
||||
|
||||
## 不使用脚手架 (纯净安装)
|
||||
|
||||
如果你不想使用脚手架,可以直接安装 `nonebot2`,并自行完成开发配置。
|
||||
|
||||
```bash
|
||||
pip install nonebot2
|
||||
# 也可以通过 poetry 安装
|
||||
poetry add nonebot2
|
||||
```
|
||||
|
||||
## 从 GitHub 安装
|
||||
|
||||
如果你需要使用最新的(可能**尚未发布**的)特性,可以直接从 GitHub 仓库安装:
|
||||
|
||||
:::warning 注意
|
||||
直接从 Github 仓库中安装意味着你将使用最新提交的代码,它们并没有进行充分的稳定性测试
|
||||
|
||||
在任何情况下请不要将其应用于生产环境!
|
||||
:::
|
||||
|
||||
```bash title="Install From Github"
|
||||
# master分支
|
||||
poetry add git+https://github.com/nonebot/nonebot2.git#master
|
||||
# dev分支
|
||||
poetry add git+https://github.com/nonebot/nonebot2.git#dev
|
||||
```
|
||||
|
||||
或者在克隆 Git 仓库后手动安装:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/nonebot/nonebot2.git
|
||||
cd nonebot2
|
||||
poetry install --no-dev # 推荐
|
||||
pip install . # 不推荐
|
||||
```
|
13
website/docs/start/nb-cli.md
Normal file
13
website/docs/start/nb-cli.md
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_position: 90
|
||||
description: 使用 nb-cli 帮助开发
|
||||
|
||||
options:
|
||||
menu:
|
||||
weight: 11
|
||||
category: guide
|
||||
---
|
||||
|
||||
# 使用脚手架
|
||||
|
||||
<!-- TODO: nb-cli docs -->
|
28
website/docs/start/question.md
Normal file
28
website/docs/start/question.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
sidebar-position: 100
|
||||
description: 如何获取帮助
|
||||
---
|
||||
|
||||
# 遇到问题
|
||||
|
||||
如果在安装或者开发过程中遇到了任何问题,可以通过以下方式解决:
|
||||
|
||||
1. 点击下方链接前往 GitHub ~~点击 star~~ ,前往 Issues 页面,在 `New Issue` Template 中选择 `Question`
|
||||
|
||||
NoneBot2: [](https://github.com/nonebot/nonebot2)
|
||||
|
||||
2. 通过 QQ 群 (点击下方链接直达)
|
||||
|
||||
[](https://jq.qq.com/?_wv=1027&k=5OFifDh)
|
||||
|
||||
3. 通过 QQ 频道
|
||||
|
||||
前往 QQ 频道搜索 `NoneBot` 点击加入
|
||||
|
||||
4. 通过 Telegram 群 (点击下方链接直达)
|
||||
|
||||
[](https://t.me/cqhttp)
|
||||
|
||||
5. 通过 Discord 服务器 (点击下方链接直达)
|
||||
|
||||
[](https://discord.gg/VKtE6Gdc4h)
|
Reference in New Issue
Block a user