插件生态公开 API
无需登录即可读取已上架商店插件和平台内置插件;不会返回插件源码和审核数据。
获取全部插件
http
GET /api/v1/plugins
GET /api/v1/plugins?bot_id=2携带登录态时返回当前账号的真实安装/启用状态。
获取单个插件
http
GET /api/v1/plugins/{slug}版本历史
http
GET /api/v1/plugins/{slug}/versions返回字段
| 字段 | 说明 |
|---|---|
| id / slug / name | ID、唯一标识、名称 |
| source | market / builtin |
| builtin | 是否内置 |
| description / category | 简介、分类 |
| version | 当前版本 |
| author.id / author.name | 归属作者 |
| rating_avg / rating_count | 评分 |
| downloads / install_count | 安装量 |
| installed / enabled | 当前账号状态 |
| official | 是否官方 |
| versions | 历史版本 |
安装状态
匿名请求:
json
{ "installed": null, "enabled": null }因为服务端不知道请求者是谁。
携带登录态:
http
GET /api/v1/plugins?bot_id=2
Authorization: Bearer <token>会返回:
json
{ "installed": true, "enabled": true }bot_id 用于判断内置插件在该机器人上的开关。
示例
js
const res = await fetch('https://track.zxiaolin.com/api/v1/plugins');
const data = await res.json();
for (const p of data.plugins) {
console.log(p.name, p.version, p.author.name, p.downloads);
}注意
- 只包含已审核上架插件
- 审核中/已下架不会出现
- 不返回代码
- 请自行缓存,合理控制频率
