koishi-plugin-checkgal 1.4.2 → 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 +1 -0
- package/lib/commands.js +6 -8
- package/package.json +1 -1
package/lib/commands.d.ts
CHANGED
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
|
-
|
|
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
|
-
|
|
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) => {
|