koishi-plugin-checkgal 1.4.1 → 1.4.3

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.d.ts CHANGED
@@ -8,5 +8,6 @@ declare module 'koishi' {
8
8
  gameCache: GameCache;
9
9
  }
10
10
  }
11
+ export declare const name: string[];
11
12
  export declare const inject: string[];
12
13
  export declare function apply(ctx: Context, config: Config): void;
package/lib/commands.js CHANGED
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inject = void 0;
3
+ exports.inject = exports.name = void 0;
4
4
  exports.apply = apply;
5
5
  const koishi_1 = require("koishi");
6
+ exports.name = ['touchgal', 'gameCache'];
6
7
  exports.inject = ['touchgal', 'gameCache'];
7
8
  function apply(ctx, config) {
8
9
  ctx.command('查询gal <keyword:text>', '查询Galgame信息')
@@ -18,10 +19,8 @@ function apply(ctx, config) {
18
19
  }
19
20
  // 缓存结果
20
21
  results.forEach(game => ctx.gameCache.set(game.id, game));
21
- // 并发下载并转换所有图片
22
- const imageBuffers = await Promise.all(results.map(game => ctx.touchgal.downloadAndConvertImage(game.banner)));
23
- const forwardMessages = results.map((game, index) => {
24
- const imageBuffer = imageBuffers[index];
22
+ for (const game of results) {
23
+ const imageBuffer = await ctx.touchgal.downloadAndConvertImage(game.banner);
25
24
  const imageElement = imageBuffer
26
25
  ? koishi_1.h.image(imageBuffer, 'image/jpeg')
27
26
  : (0, koishi_1.h)('text', { content: '封面图加载失败' });
@@ -32,9 +31,8 @@ function apply(ctx, config) {
32
31
  `平台: ${game.platform.join(', ')}`,
33
32
  `语言: ${game.language.join(', ')}`,
34
33
  ].join('\n');
35
- return (0, koishi_1.h)('message', { userId: session.bot.selfId, nickname: 'CheckGal Bot' }, content);
36
- });
37
- await session.send((0, koishi_1.h)('message', { forward: true }, forwardMessages));
34
+ await session.send(content);
35
+ }
38
36
  });
39
37
  ctx.command('下载gal <id:number>', '获取Galgame下载地址')
40
38
  .action(async ({ session }, id) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-checkgal",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "个人测试请勿使用",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",