koishi-plugin-meinv 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +6 -11
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -21,26 +21,21 @@ exports.apply = (ctx) => {
|
|
|
21
21
|
}
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
videoUrl = res.data.data.link
|
|
27
|
-
} else if (res.data?.url) {
|
|
28
|
-
videoUrl = res.data.url
|
|
29
|
-
}
|
|
30
|
-
|
|
24
|
+
// 第三步:解析视频链接
|
|
25
|
+
const videoUrl = res.data?.data?.link || res.data?.url
|
|
31
26
|
if (!videoUrl) {
|
|
32
27
|
return '❌ 未获取到有效视频链接。'
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
//
|
|
30
|
+
// 第四步:使用 Koishi 官方 File 类发送(关键!)
|
|
36
31
|
const file = new File(videoUrl)
|
|
37
32
|
await session.send(file)
|
|
38
33
|
|
|
39
|
-
return '✅
|
|
34
|
+
return '✅ 视频已发送!'
|
|
40
35
|
|
|
41
36
|
} catch (e) {
|
|
42
|
-
ctx.logger('meinv').error('
|
|
43
|
-
return '⚠️
|
|
37
|
+
ctx.logger('meinv').error('请求失败:', e.message)
|
|
38
|
+
return '⚠️ 视频加载失败,请稍后再试。'
|
|
44
39
|
}
|
|
45
40
|
})
|
|
46
41
|
}
|