Skip to content

Commit 93c3b61

Browse files
committed
docs: add optional fields for supported platforms and AstrBot version range in plugin metadata
1 parent e8cab77 commit 93c3b61

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

zh/dev/star/plugin-new.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,54 @@ git clone 插件仓库地址
5353

5454
可以修改(或添加) `metadata.yaml` 文件中的 `display_name` 字段,作为插件在插件市场等场景中的展示名,以方便用户阅读。
5555

56+
### 声明支持平台(Optional)
57+
58+
你可以在 `metadata.yaml` 中新增 `support_platforms` 字段(`list[str]`),声明插件支持的平台适配器。WebUI 插件页会展示该字段。
59+
60+
```yaml
61+
support_platforms:
62+
- telegram
63+
- discord
64+
```
65+
66+
`support_platforms` 中的值需要使用 `ADAPTER_NAME_2_TYPE` 的 key,目前支持:
67+
68+
- `aiocqhttp`
69+
- `qq_official`
70+
- `telegram`
71+
- `wecom`
72+
- `lark`
73+
- `dingtalk`
74+
- `discord`
75+
- `slack`
76+
- `kook`
77+
- `vocechat`
78+
- `weixin_official_account`
79+
- `satori`
80+
- `misskey`
81+
- `line`
82+
83+
### 声明 AstrBot 版本范围(Optional)
84+
85+
你可以在 `metadata.yaml` 中新增 `astrbot_version` 字段,声明插件要求的 AstrBot 版本范围。格式与 `pyproject.toml` 依赖版本约束一致(PEP 440),且不要加 `v` 前缀。
86+
87+
```yaml
88+
astrbot_version: ">=4.16,<5"
89+
```
90+
91+
可选示例:
92+
93+
- `>=4.17.0`
94+
- `>=4.16,<5`
95+
- `~=4.17`
96+
97+
如果你只想声明最低版本,可以直接写:
98+
99+
- `>=4.17.0`
100+
101+
当当前 AstrBot 版本不满足该范围时,插件会被阻止加载并提示版本不兼容。
102+
在 WebUI 安装插件时,你可以选择“无视警告,继续安装”来跳过这个检查。
103+
56104
### 调试插件
57105

58106
AstrBot 采用在运行时注入插件的机制。因此,在调试插件时,需要启动 AstrBot 本体。

0 commit comments

Comments
 (0)