Skip to content

Commit e8cab77

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

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

en/dev/star/plugin-new.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,54 @@ You can add a `logo.png` file in the plugin directory as the plugin's logo. Plea
5353

5454
You can modify (or add) the `display_name` field in the `metadata.yaml` file to serve as the plugin's display name in scenarios like the plugin marketplace, making it easier for users to read.
5555

56+
### Declare Supported Platforms (Optional)
57+
58+
You can add a `support_platforms` field (`list[str]`) to `metadata.yaml` to declare which platform adapters your plugin supports. The WebUI plugin page will display this field.
59+
60+
```yaml
61+
support_platforms:
62+
- telegram
63+
- discord
64+
```
65+
66+
The values in `support_platforms` must be keys from `ADAPTER_NAME_2_TYPE`. Currently supported:
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+
### Declare AstrBot Version Range (Optional)
84+
85+
You can add an `astrbot_version` field in `metadata.yaml` to declare the required AstrBot version range for your plugin. The format follows dependency specifiers in `pyproject.toml` (PEP 440), and must not include a `v` prefix.
86+
87+
```yaml
88+
astrbot_version: ">=4.16,<5"
89+
```
90+
91+
Examples:
92+
93+
- `>=4.17.0`
94+
- `>=4.16,<5`
95+
- `~=4.17`
96+
97+
If you only want to declare a minimum version, use:
98+
99+
- `>=4.17.0`
100+
101+
If the current AstrBot version does not satisfy this range, the plugin will be blocked from loading with a compatibility error.
102+
In the WebUI installation flow, you can choose to "Ignore Warning and Install" to bypass this check.
103+
56104
### Debugging Plugins
57105

58106
AstrBot uses a runtime plugin injection mechanism. Therefore, when debugging plugins, you need to start the AstrBot main application.

zh/dev/star/plugin.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,54 @@ async def on_message(self, event: AstrMessageEvent):
228228
229229
你可以修改(或添加) `metadata.yaml` 文件中的 `display_name` 字段,作为插件在插件市场等场景中的展示名,以方便用户阅读。
230230

231+
### 声明支持平台(Optional)
232+
233+
你可以在 `metadata.yaml` 中新增 `support_platforms` 字段(`list[str]`),声明插件支持的平台适配器。WebUI 插件页会展示该字段。
234+
235+
```yaml
236+
support_platforms:
237+
- telegram
238+
- discord
239+
```
240+
241+
`support_platforms` 中的值需要使用 `ADAPTER_NAME_2_TYPE` 的 key,目前支持:
242+
243+
- `aiocqhttp`
244+
- `qq_official`
245+
- `telegram`
246+
- `wecom`
247+
- `lark`
248+
- `dingtalk`
249+
- `discord`
250+
- `slack`
251+
- `kook`
252+
- `vocechat`
253+
- `weixin_official_account`
254+
- `satori`
255+
- `misskey`
256+
- `line`
257+
258+
### 声明 AstrBot 版本范围(Optional)
259+
260+
你可以在 `metadata.yaml` 中新增 `astrbot_version` 字段,声明插件要求的 AstrBot 版本范围。格式与 `pyproject.toml` 依赖版本约束一致(PEP 440),且不要加 `v` 前缀。
261+
262+
```yaml
263+
astrbot_version: ">=4.16,<5"
264+
```
265+
266+
可选示例:
267+
268+
- `>=4.17.0`
269+
- `>=4.16,<5`
270+
- `~=4.17`
271+
272+
如果你只想声明最低版本,可以直接写:
273+
274+
- `>=4.17.0`
275+
276+
当当前 AstrBot 版本不满足该范围时,插件会被阻止加载并提示版本不兼容。
277+
在 WebUI 安装插件时,你可以选择“无视警告,继续安装”来跳过这个检查。
278+
231279
### 消息事件的监听
232280

233281
事件监听器可以收到平台下发的消息内容,可以实现指令、指令组、事件监听等功能。

0 commit comments

Comments
 (0)