diff --git a/docs/.vuepress/components/Plugin.vue b/docs/.vuepress/components/Plugin.vue index 7e52e108..5e013158 100644 --- a/docs/.vuepress/components/Plugin.vue +++ b/docs/.vuepress/components/Plugin.vue @@ -49,14 +49,14 @@ diff --git a/docs/.vuepress/public/adapters.json b/docs/.vuepress/public/adapters.json index 24c729ca..e05870ce 100644 --- a/docs/.vuepress/public/adapters.json +++ b/docs/.vuepress/public/adapters.json @@ -9,7 +9,7 @@ }, { "id": "nonebot.adapters.ding", - "link": "nonebot-adapter-cqhttp", + "link": "nonebot-adapter-ding", "name": "ding", "desc": "钉钉协议", "author": "Artin", diff --git a/docs/.vuepress/public/plugins.json b/docs/.vuepress/public/plugins.json index e3d799de..84afb436 100644 --- a/docs/.vuepress/public/plugins.json +++ b/docs/.vuepress/public/plugins.json @@ -208,8 +208,8 @@ "repo": "knva/nonebot_plugin_biliav" }, { - "id": "nonebot-plugin-manager", - "link": "nonebot_plugin_manager", + "id": "nonebot_plugin_manager", + "link": "nonebot-plugin-manager", "name": "插件管理器", "desc": "基于 import hook 的插件管理", "author": "Jigsaw111", diff --git a/docs/api/drivers/fastapi.md b/docs/api/drivers/fastapi.md index fba15c68..3b2f4f23 100644 --- a/docs/api/drivers/fastapi.md +++ b/docs/api/drivers/fastapi.md @@ -28,7 +28,7 @@ FastAPI 驱动框架设置,详情参考 FastAPI 文档 * **说明** - openapi.json 地址,默认为 None 即关闭 + `openapi.json` 地址,默认为 `None` 即关闭 @@ -43,7 +43,7 @@ FastAPI 驱动框架设置,详情参考 FastAPI 文档 * **说明** - swagger 地址,默认为 None 即关闭 + `swagger` 地址,默认为 `None` 即关闭 @@ -58,7 +58,22 @@ FastAPI 驱动框架设置,详情参考 FastAPI 文档 * **说明** - redoc 地址,默认为 None 即关闭 + `redoc` 地址,默认为 `None` 即关闭 + + + +### `fastapi_reload_dirs` + + +* **类型** + + `List[str]` + + + +* **说明** + + `debug` 模式下重载监控文件夹列表,默认为 uvicorn 默认值 diff --git a/docs/guide/cqhttp-guide.md b/docs/guide/cqhttp-guide.md index 356fa6c3..867eb56f 100644 --- a/docs/guide/cqhttp-guide.md +++ b/docs/guide/cqhttp-guide.md @@ -1,5 +1,11 @@ # CQHTTP 协议使用指南 +## 安装 NoneBot CQHTTP 适配器 + +```bash +pip install nonebot-adapter-cqhttp +``` + ## 配置 CQHTTP 协议端(以 QQ 为例) 单纯运行 NoneBot 实例并不会产生任何效果,因为此刻 QQ 这边还不知道 NoneBot 的存在,也就无法把消息发送给它,因此现在需要使用一个无头 QQ 来把消息等事件上报给 NoneBot。 diff --git a/docs/guide/ding-guide.md b/docs/guide/ding-guide.md index ee9449ba..7e1d8d01 100644 --- a/docs/guide/ding-guide.md +++ b/docs/guide/ding-guide.md @@ -11,6 +11,12 @@ - [群机器人概述](https://developers.dingtalk.com/document/app/overview-of-group-robots) - [开发企业内部机器人](https://developers.dingtalk.com/document/app/develop-enterprise-internal-robots) +## 安装 NoneBot 钉钉 适配器 + +```bash +pip install nonebot-adapter-ding +``` + ## 关于 DingAdapter 的说明 你需要显式的注册 ding 这个适配器: diff --git a/docs/guide/installation.md b/docs/guide/installation.md index aaf916ec..1c6b5d38 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -1,6 +1,6 @@ # 安装 -## NoneBot +## 安装 NoneBot :::warning 注意 请确保你的 Python 版本 >= 3.7。 @@ -67,6 +67,18 @@ poetry install --no-dev # 推荐 pip install . # 不推荐 ``` +## 安装适配器 +适配器可以通过 `nb-cli` 在创建项目时根据你的选择自动安装,也可以自行使用 `pip` 安装 + +```bash +pip install nonebot-adapter- +``` + +```bash +# 列出所有的适配器 +nb adapter list +``` + ## 安装插件 插件可以通过 `nb-cli` 进行安装,也可以自行安装并加载插件。 diff --git a/docs/guide/mirai-guide.md b/docs/guide/mirai-guide.md index c22631e0..71003e64 100644 --- a/docs/guide/mirai-guide.md +++ b/docs/guide/mirai-guide.md @@ -28,6 +28,12 @@ Mirai-API-HTTP 的适配器以 [AGPLv3 许可](https://opensource.org/licenses/A **为了便捷起见, 以下内容均以缩写 `MAH` 代替 `mirai-api-http`** +## 安装 NoneBot Mirai 适配器 + +```bash +pip install nonebot-adapter-mirai +``` + ## 配置 MAH 客户端 正如你可能刚刚在[CQHTTP 协议使用指南](./cqhttp-guide.md)中所读到的: diff --git a/nonebot/drivers/fastapi.py b/nonebot/drivers/fastapi.py index f78681c7..a2c315f5 100644 --- a/nonebot/drivers/fastapi.py +++ b/nonebot/drivers/fastapi.py @@ -11,7 +11,7 @@ FastAPI 驱动适配 import json import asyncio import logging -from typing import Optional, Callable +from typing import List, Optional, Callable import uvicorn from pydantic import BaseSettings @@ -39,7 +39,7 @@ class Config(BaseSettings): :说明: - `openapi.json` 地址,默认为 `None` 即关闭 + ``openapi.json`` 地址,默认为 ``None`` 即关闭 """ fastapi_docs_url: Optional[str] = None """ @@ -49,7 +49,7 @@ class Config(BaseSettings): :说明: - `swagger` 地址,默认为 `None` 即关闭 + ``swagger`` 地址,默认为 ``None`` 即关闭 """ fastapi_redoc_url: Optional[str] = None """ @@ -59,7 +59,17 @@ class Config(BaseSettings): :说明: - `redoc` 地址,默认为 `None` 即关闭 + ``redoc`` 地址,默认为 ``None`` 即关闭 + """ + fastapi_reload_dirs: List[str] = [] + """ + :类型: + + ``List[str]`` + + :说明: + + ``debug`` 模式下重载监控文件夹列表,默认为 uvicorn 默认值 """ class Config: @@ -161,6 +171,7 @@ class Driver(BaseDriver): host=host or str(self.config.host), port=port or self.config.port, reload=bool(app) and self.config.debug, + reload_dirs=self.fastapi_config.fastapi_reload_dirs or None, debug=self.config.debug, log_config=LOGGING_CONFIG, **kwargs) diff --git a/nonebot/plugin/manager.py b/nonebot/plugin/manager.py index a184d956..5965d02b 100644 --- a/nonebot/plugin/manager.py +++ b/nonebot/plugin/manager.py @@ -88,7 +88,7 @@ class PluginManager: if hasattr(_internal_space, internal_id): raise RuntimeError("Plugin manager already exists!") - prefix = sys._getframe(2).f_globals.get( + prefix = sys._getframe(3).f_globals.get( "__name__") or _internal_space.__name__ if not prefix.startswith(_internal_space.__name__): prefix = _internal_space.__name__