add plugin metadata to builtin plugins (#2113)

This commit is contained in:
Ju4tCode
2023-06-20 13:50:05 +08:00
committed by GitHub
parent 20d3d62bd5
commit e00890033e
5 changed files with 38 additions and 5 deletions

View File

@ -22,6 +22,6 @@ _✨ NoneBot 本地文档插件 ✨_
## 使用方式
加载插件并启动 Bot ,在浏览器内打开 `http://host:port/docs/`
加载插件并启动 Bot ,在浏览器内打开 `http://host:port/website/`
具体网址会在控制台内输出。

View File

@ -2,6 +2,17 @@ import importlib
import nonebot
from nonebot.log import logger
from nonebot.plugin import PluginMetadata
__plugin_meta__ = PluginMetadata(
name="NoneBot 离线文档",
description="在本地查看 NoneBot 文档",
usage="启动机器人后访问 http://localhost:port/website/ 查看文档",
type="application",
homepage="https://github.com/nonebot/nonebot2/blob/master/packages/nonebot-plugin-docs",
config=None,
supported_adapters=None,
)
def init():
@ -17,7 +28,7 @@ def init():
register_route(driver)
host = str(driver.config.host)
port = driver.config.port
if host in ["0.0.0.0", "127.0.0.1"]:
if host in {"0.0.0.0", "127.0.0.1"}:
host = "localhost"
logger.opt(colors=True).info(
f"Nonebot docs will be running at: "

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot-plugin-docs"
version = "2.0.0-beta.1"
version = "2.0.0"
description = "View NoneBot2 Docs Locally"
authors = ["yanyongyu <yyy@nonebot.dev>"]
license = "MIT"
@ -13,7 +13,7 @@ include = ["nonebot_plugin_docs/dist/**/*"]
[tool.poetry.dependencies]
python = "^3.8"
nonebot2 = "^2.0.0-beta.1"
nonebot2 = "^2.0.0"
[tool.poetry.dev-dependencies]