🔖 Release 2.0.0rc3

This commit is contained in:
github-actions[bot]
2023-01-22 08:17:26 +00:00
parent 50aa8c53e0
commit eceef1ebec
77 changed files with 11207 additions and 1 deletions

View 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` 前往编辑。

View File

@ -0,0 +1,45 @@
---
sidebar_position: 2
description: 通过脚手架或 pip 安装适配器
---
import Asciinema from "@site/src/components/Asciinema";
# 安装协议适配器
## 查看
前往[商店](/store)即可查看所有协议适配器。
或者使用 nb-cli 命令行查看:
```bash
nb adapter list
```
## 安装
前往[商店](/store)点击复制 nb-cli 安装命令至命令行执行即可安装。
或者自行输入命令安装:
```bash
nb adapter install <adapter-package>
```
或者使用交互模式安装:
```bash
nb adapter install
```
也可以使用 pip 安装
```bash
pip install <adapter-package>
```
<Asciinema
url="https://asciinema.org/a/464727.cast"
options={{ theme: "monokai", poster: "npt:2.0" }}
/>

View File

@ -0,0 +1,47 @@
---
sidebar_position: 1
description: 通过脚手架或 pip 安装驱动器
---
import Asciinema from "@site/src/components/Asciinema";
# 安装驱动器
NoneBot 在默认安装情况下内置了 `none` 驱动器,其他驱动器如 `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-package>
```
<Asciinema
url="https://asciinema.org/a/464686.cast"
options={{ theme: "monokai", poster: "npt:2.8" }}
/>

View File

@ -0,0 +1,45 @@
---
sidebar_position: 3
description: 通过脚手架或 pip 安装插件
---
import Asciinema from "@site/src/components/Asciinema";
# 安装第三方插件
## 查看
前往[商店](/store)即可查看所有发布的插件。
或者使用 nb-cli 命令行查看:
```bash
nb plugin list
```
## 安装
前往[商店](/store)点击复制 nb-cli 安装命令至命令行执行即可安装。
或者自行输入命令安装:
```bash
nb plugin install <plugin-package>
```
或者使用交互模式安装:
```bash
nb plugin install
```
也可以使用 pip 安装
```bash
pip install <plugin-package>
```
<Asciinema
url="https://asciinema.org/a/464735.cast"
options={{ theme: "monokai", poster: "npt:4.3" }}
/>

View File

@ -0,0 +1,88 @@
---
sidebar_position: 0
description: 通过脚手架、PyPI 或 GitHub 安装 NoneBot2
options:
menu:
weight: 10
category: guide
---
import Asciinema from "@site/src/components/Asciinema";
# 安装 NoneBot2
:::warning 注意
请确保你的 Python 版本 >= 3.8。
:::
:::warning 注意
请在安装 NoneBot v2 之前卸载 NoneBot v1
```bash
pip uninstall nonebot
```
:::
## 通过脚手架安装(推荐)
1. 安装 [pipx](https://pypa.github.io/pipx/)
```bash
python -m pip install --user pipx
python -m pipx ensurepath
```
2. 安装脚手架
```bash
pipx install nb-cli
```
安装完成后,你可以在命令行使用 `nb` 命令来使用脚手架。如果出现无法找到命令的情况(例如:`Command not found`),请参考 [pipx 文档](https://pypa.github.io/pipx/) 检查你的环境变量。
<Asciinema
url="https://asciinema.org/a/464654.cast"
options={{ theme: "monokai", poster: "npt:2.8" }}
/>
:::important 提示
nb-cli 的使用方法详见[使用脚手架](./nb-cli.md)
:::
## 不使用脚手架(纯净安装)
如果你不想使用脚手架,可以直接安装 NoneBot2并自行完成开发配置。
```bash
pip install nonebot2[fastapi]
# 也可以通过 Poetry 安装
poetry add nonebot2[fastapi]
```
## 从 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 . # 不推荐
```

View File

@ -0,0 +1,83 @@
---
sidebar_position: 90
description: 使用 nb-cli 帮助开发
options:
menu:
weight: 11
category: guide
---
# 使用脚手架
`nb-cli` 详细参考文档已移至 <https://cli.nonebot.dev>
## 安装
```bash
pipx install nb-cli
```
## 初次使用
在安装完成之后,即可在命令行使用 nb-cli 的命令 `nb` 进行开发:
```bash
nb
```
:::warning 注意
通常情况下,你可以直接在命令行使用 `nb` 命令。如果出现无法找到命令的情况(例如:`Command not found`),请参考 [pipx 文档](https://pypa.github.io/pipx/) 检查你的环境变量。
:::
## 使用方式
nb-cli 具有两种使用方式:
1. 命令行指令
查看帮助信息:
```bash
$ nb --help
Usage: nb [OPTIONS] COMMAND [ARGS]...
Options:
-V, --version Show the version and exit.
--help Show this message and exit.
...
```
查看子命令帮助:
```bash
$ nb plugin --help
Usage: nb plugin [OPTIONS] COMMAND [ARGS]...
Manage Bot Plugin.
Options:
--help Show this message and exit.
...
```
2. 交互式选择(支持鼠标)
交互式选择菜单:
```bash
$ nb
Welcome to NoneBot CLI!
[?] What do you want to do? (Use ↑ and ↓ to choose, Enter to submit)
...
```
交互式子命令菜单:
```bash
$ nb plugin
[?] What do you want to do? (Use ↑ and ↓ to choose, Enter to submit)
...
```

View File

@ -0,0 +1,28 @@
---
sidebar-position: 100
description: 如何获取帮助
---
# 遇到问题
如果在安装或者开发过程中遇到了任何问题,可以通过以下方式解决:
1. 点击下方链接前往 GitHub前往 Issues 页面,在 `New Issue` Template 中选择 `Question`
NoneBot2[![NoneBot2](https://img.shields.io/github/stars/nonebot/nonebot2?style=social)](https://github.com/nonebot/nonebot2)
2. 通过 QQ 群(点击下方链接直达)
[![QQ Chat Group](https://img.shields.io/badge/QQ%E7%BE%A4-768887710-orange?style=social)](https://jq.qq.com/?_wv=1027&k=5OFifDh)
3. 通过 QQ 频道
[![QQ Channel](https://img.shields.io/badge/QQ%E9%A2%91%E9%81%93-NoneBot-orange?style=social)](https://qun.qq.com/qqweb/qunpro/share?_wv=3&_wwv=128&appChannel=share&inviteCode=7b4a3&appChannel=share&businessType=9&from=246610&biz=ka)
4. 通过 Telegram 群(点击下方链接直达)
[![Telegram Chat](https://img.shields.io/badge/telegram-cqhttp-blue?style=social)](https://t.me/cqhttp)
5. 通过 Discord 服务器(点击下方链接直达)
[![Discord Server](https://discordapp.com/api/guilds/847819937858584596/widget.png?style=shield)](https://discord.gg/VKtE6Gdc4h)