koishi-plugin-checkgal 1.0.3 → 1.1.1
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/lib/commands.js +7 -7
- package/package.json +1 -1
package/lib/commands.js
CHANGED
|
@@ -19,11 +19,11 @@ function apply(ctx, config) {
|
|
|
19
19
|
// 缓存结果
|
|
20
20
|
results.forEach(game => ctx.gameCache.set(game.id, game));
|
|
21
21
|
// 并发下载并转换所有图片
|
|
22
|
-
const
|
|
22
|
+
const imagePaths = await Promise.all(results.map(game => ctx.touchgal.downloadAndConvertImage(game.banner)));
|
|
23
23
|
const forwardMessages = results.map((game, index) => {
|
|
24
|
-
const
|
|
25
|
-
const imageElement =
|
|
26
|
-
? (0, koishi_1.h)('image', { url: `
|
|
24
|
+
const imagePath = imagePaths[index];
|
|
25
|
+
const imageElement = imagePath
|
|
26
|
+
? (0, koishi_1.h)('image', { url: `file://${imagePath}` })
|
|
27
27
|
: (0, koishi_1.h)('text', { content: '封面图加载失败' });
|
|
28
28
|
const content = [
|
|
29
29
|
imageElement,
|
|
@@ -63,9 +63,9 @@ function apply(ctx, config) {
|
|
|
63
63
|
return `未找到ID为 ${id} 的下载资源。`;
|
|
64
64
|
}
|
|
65
65
|
const gameTitle = gameInfo ? `游戏: ${gameInfo.name} (ID: ${id})` : `游戏ID: ${id}`;
|
|
66
|
-
const
|
|
67
|
-
const imageElement =
|
|
68
|
-
? (0, koishi_1.h)('image', { url: `
|
|
66
|
+
const imagePath = gameInfo ? await ctx.touchgal.downloadAndConvertImage(gameInfo.banner) : null;
|
|
67
|
+
const imageElement = imagePath
|
|
68
|
+
? (0, koishi_1.h)('image', { url: `file://${imagePath}` })
|
|
69
69
|
: (0, koishi_1.h)('text', { content: gameInfo ? '封面图加载失败' : '' });
|
|
70
70
|
const header = [
|
|
71
71
|
imageElement,
|