koishi-plugin-oni-wiki-qq 0.0.2 → 0.0.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/index.d.ts +1 -1
- package/lib/index.js +229 -28
- package/lib/lib.d.ts +12 -1
- package/lib/lib.js +58 -9
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Schema } from "koishi";
|
|
2
2
|
export declare const name = "oni-wiki-qq";
|
|
3
3
|
export declare const inject: string[];
|
|
4
|
-
export declare const usage = "\n - 0.0.2 \u57FA\u672C\u529F\u80FD\u5B8C\u6210\n - 0.0.1 \u521D\u59CB\u5316\uFF0C\u660E\u5929\u518D\u6162\u6162\u5199\u4E86\uFF08\n";
|
|
4
|
+
export declare const usage = "\n - 0.0.3 \u5C06\u94FE\u63A5\u6539\u4E3Amd\u53D1\u9001\u4EE5\u7ED5\u8FC7\u6C9F\u817E\u8BAF\u7684\u94FE\u63A5\u62E6\u622A\n - 0.0.2 \u57FA\u672C\u529F\u80FD\u5B8C\u6210\n - 0.0.1 \u521D\u59CB\u5316\uFF0C\u660E\u5929\u518D\u6162\u6162\u5199\u4E86\uFF08\n";
|
|
5
5
|
export interface Config {
|
|
6
6
|
mdId: string;
|
|
7
7
|
api: string;
|
package/lib/index.js
CHANGED
|
@@ -26,7 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.Config = exports.usage = exports.inject = exports.name = void 0;
|
|
30
|
+
exports.apply = apply;
|
|
30
31
|
const koishi_1 = require("koishi");
|
|
31
32
|
const fs_1 = __importDefault(require("fs"));
|
|
32
33
|
const os_1 = __importDefault(require("os"));
|
|
@@ -34,11 +35,12 @@ const lib = __importStar(require("./lib"));
|
|
|
34
35
|
exports.name = "oni-wiki-qq";
|
|
35
36
|
exports.inject = ["puppeteer"];
|
|
36
37
|
exports.usage = `
|
|
38
|
+
- 0.0.3 将链接改为md发送以绕过沟腾讯的链接拦截
|
|
37
39
|
- 0.0.2 基本功能完成
|
|
38
40
|
- 0.0.1 初始化,明天再慢慢写了(
|
|
39
41
|
`;
|
|
40
42
|
exports.Config = koishi_1.Schema.object({
|
|
41
|
-
mdId: koishi_1.Schema.string().description("模板ID"),
|
|
43
|
+
mdId: koishi_1.Schema.string().description("模板ID").default("102019091_1708758661"),
|
|
42
44
|
api: koishi_1.Schema.string()
|
|
43
45
|
.description("api地址")
|
|
44
46
|
.default("https://oxygennotincluded.fandom.com/zh/api.php"),
|
|
@@ -56,7 +58,7 @@ function apply(ctx, config) {
|
|
|
56
58
|
.option("update", "-u 更新本地缓存", { authority: 2 })
|
|
57
59
|
.option("delete", "-d 删除本地缓存", { authority: 2 })
|
|
58
60
|
.option("rename", "-r <newName> 重命名本地缓存", { authority: 2 })
|
|
59
|
-
.action(async ({ session, options }, itemName) => {
|
|
61
|
+
.action(async ({ session, options }, itemName = "电解器") => {
|
|
60
62
|
let filePath = config.imgPath +
|
|
61
63
|
itemName.replace(/\//g, "-").replace(/:/g, "-").replace(/'/g, "-") +
|
|
62
64
|
".jpeg";
|
|
@@ -89,8 +91,61 @@ function apply(ctx, config) {
|
|
|
89
91
|
await lib.delay(1000);
|
|
90
92
|
// 判断文件是否在本地
|
|
91
93
|
if (lib.checkFileExists(filePath)) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
await session.bot.internal.sendMessage(session.guildId, {
|
|
95
|
+
content: "111",
|
|
96
|
+
msg_type: 2,
|
|
97
|
+
markdown: {
|
|
98
|
+
custom_template_id: config.mdId,
|
|
99
|
+
params: [
|
|
100
|
+
{
|
|
101
|
+
key: "text1",
|
|
102
|
+
values: [
|
|
103
|
+
`文件缓存已命中,缓存时间为:${lib.getFileModifyTime(filePath)} 请前往以下网址查看:[🔗${itemName}`,
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: "text2",
|
|
108
|
+
values: [
|
|
109
|
+
`](${config.publicUrl +
|
|
110
|
+
itemName
|
|
111
|
+
.replace(/\//g, "-")
|
|
112
|
+
.replace(/:/g, "-")
|
|
113
|
+
.replace(/'/g, "-")}.jpeg)`,
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
keyboard: {
|
|
119
|
+
content: {
|
|
120
|
+
rows: [
|
|
121
|
+
{
|
|
122
|
+
buttons: [
|
|
123
|
+
{
|
|
124
|
+
id: "1",
|
|
125
|
+
render_data: {
|
|
126
|
+
label: "我也要查wiki",
|
|
127
|
+
visited_label: "我也要查wiki",
|
|
128
|
+
},
|
|
129
|
+
action: {
|
|
130
|
+
type: 2,
|
|
131
|
+
permission: {
|
|
132
|
+
type: 2,
|
|
133
|
+
},
|
|
134
|
+
unsupport_tips: "兼容文本",
|
|
135
|
+
data: "/查wiki ",
|
|
136
|
+
enter: false,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
msg_id: session.messageId,
|
|
145
|
+
timestamp: session.timestamp,
|
|
146
|
+
msg_seq: Math.floor(Math.random() * 500),
|
|
147
|
+
});
|
|
148
|
+
return;
|
|
94
149
|
}
|
|
95
150
|
else {
|
|
96
151
|
// 没有缓存
|
|
@@ -104,11 +159,68 @@ function apply(ctx, config) {
|
|
|
104
159
|
let res_url = [...res[1]];
|
|
105
160
|
logger.info(`API返回的数据为: ${title}`);
|
|
106
161
|
if (title[0] === itemName) {
|
|
107
|
-
|
|
162
|
+
let res = await lib.screenShot(res_url[0], ctx, itemName, config);
|
|
163
|
+
if (res) {
|
|
164
|
+
await session.bot.internal.sendMessage(session.guildId, {
|
|
165
|
+
content: "111",
|
|
166
|
+
msg_type: 2,
|
|
167
|
+
markdown: {
|
|
168
|
+
custom_template_id: config.mdId,
|
|
169
|
+
params: [
|
|
170
|
+
{
|
|
171
|
+
key: "text1",
|
|
172
|
+
values: [
|
|
173
|
+
`文件缓存已命中,缓存时间为:${lib.getFileModifyTime(filePath)} 请前往以下网址查看:[🔗${itemName}`,
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
key: "text2",
|
|
178
|
+
values: [
|
|
179
|
+
`](${config.publicUrl +
|
|
180
|
+
itemName
|
|
181
|
+
.replace(/\//g, "-")
|
|
182
|
+
.replace(/:/g, "-")
|
|
183
|
+
.replace(/'/g, "-")}.jpeg)`,
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
keyboard: {
|
|
189
|
+
content: {
|
|
190
|
+
rows: [
|
|
191
|
+
{
|
|
192
|
+
buttons: [
|
|
193
|
+
{
|
|
194
|
+
id: "1",
|
|
195
|
+
render_data: {
|
|
196
|
+
label: "我也要查wiki",
|
|
197
|
+
visited_label: "我也要查wiki",
|
|
198
|
+
},
|
|
199
|
+
action: {
|
|
200
|
+
type: 2,
|
|
201
|
+
permission: {
|
|
202
|
+
type: 2,
|
|
203
|
+
},
|
|
204
|
+
unsupport_tips: "兼容文本",
|
|
205
|
+
data: "/查wiki ",
|
|
206
|
+
enter: false,
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
msg_id: session.messageId,
|
|
215
|
+
timestamp: session.timestamp,
|
|
216
|
+
msg_seq: Math.floor(Math.random() * 500),
|
|
217
|
+
});
|
|
218
|
+
}
|
|
108
219
|
}
|
|
109
220
|
else {
|
|
110
221
|
let [one = "曼德拉草汤", two = "火龙果派", three = "大肉汤", four = "饺子", five = "萌新骨头汤",] = title;
|
|
111
222
|
// 发送md消息
|
|
223
|
+
let btn_list = [["①", "1", "②", "2", "③", "④", "4", "⑤", "5"]];
|
|
112
224
|
await session.bot.internal.sendMessage(session.guildId, {
|
|
113
225
|
content: "111",
|
|
114
226
|
msg_type: 2,
|
|
@@ -116,24 +228,38 @@ function apply(ctx, config) {
|
|
|
116
228
|
custom_template_id: config.mdId,
|
|
117
229
|
params: [
|
|
118
230
|
{
|
|
119
|
-
key:
|
|
120
|
-
values: [
|
|
231
|
+
key: "text1",
|
|
232
|
+
values: ["Oh,No,出现了一丢丢问题"],
|
|
121
233
|
},
|
|
122
234
|
{
|
|
123
|
-
key:
|
|
124
|
-
values: [
|
|
235
|
+
key: "text2",
|
|
236
|
+
values: [
|
|
237
|
+
"没有找到您查询的关键字,以下是自主搜索的结果,你康康有没有需要的,点击按钮选择,没有的话,请等待超时结束本轮查询以减轻服务器压力",
|
|
238
|
+
],
|
|
125
239
|
},
|
|
126
240
|
{
|
|
127
|
-
key:
|
|
128
|
-
values: [
|
|
241
|
+
key: "text3",
|
|
242
|
+
values: [`占位`],
|
|
129
243
|
},
|
|
130
244
|
{
|
|
131
|
-
key:
|
|
132
|
-
values: [
|
|
245
|
+
key: "text4",
|
|
246
|
+
values: [`1- ${one}`],
|
|
133
247
|
},
|
|
134
248
|
{
|
|
135
|
-
key:
|
|
136
|
-
values: [
|
|
249
|
+
key: "text5",
|
|
250
|
+
values: [`2- ${two}`],
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
key: "text6",
|
|
254
|
+
values: [`3- ${three}`],
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
key: "text7",
|
|
258
|
+
values: [`4- ${four}`],
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
key: "text8",
|
|
262
|
+
values: [`5- ${five}`],
|
|
137
263
|
},
|
|
138
264
|
],
|
|
139
265
|
},
|
|
@@ -145,8 +271,8 @@ function apply(ctx, config) {
|
|
|
145
271
|
{
|
|
146
272
|
id: "1",
|
|
147
273
|
render_data: {
|
|
148
|
-
label:
|
|
149
|
-
visited_label:
|
|
274
|
+
label: `①`,
|
|
275
|
+
visited_label: `①`,
|
|
150
276
|
},
|
|
151
277
|
action: {
|
|
152
278
|
type: 2,
|
|
@@ -161,8 +287,8 @@ function apply(ctx, config) {
|
|
|
161
287
|
{
|
|
162
288
|
id: "2",
|
|
163
289
|
render_data: {
|
|
164
|
-
label:
|
|
165
|
-
visited_label:
|
|
290
|
+
label: `②`,
|
|
291
|
+
visited_label: `②`,
|
|
166
292
|
},
|
|
167
293
|
action: {
|
|
168
294
|
type: 2,
|
|
@@ -177,8 +303,8 @@ function apply(ctx, config) {
|
|
|
177
303
|
{
|
|
178
304
|
id: "3",
|
|
179
305
|
render_data: {
|
|
180
|
-
label:
|
|
181
|
-
visited_label:
|
|
306
|
+
label: `③`,
|
|
307
|
+
visited_label: `③`,
|
|
182
308
|
},
|
|
183
309
|
action: {
|
|
184
310
|
type: 2,
|
|
@@ -193,8 +319,8 @@ function apply(ctx, config) {
|
|
|
193
319
|
{
|
|
194
320
|
id: "4",
|
|
195
321
|
render_data: {
|
|
196
|
-
label:
|
|
197
|
-
visited_label:
|
|
322
|
+
label: `④`,
|
|
323
|
+
visited_label: `④`,
|
|
198
324
|
},
|
|
199
325
|
action: {
|
|
200
326
|
type: 2,
|
|
@@ -209,8 +335,8 @@ function apply(ctx, config) {
|
|
|
209
335
|
{
|
|
210
336
|
id: "5",
|
|
211
337
|
render_data: {
|
|
212
|
-
label:
|
|
213
|
-
visited_label:
|
|
338
|
+
label: `⑤`,
|
|
339
|
+
visited_label: `⑤`,
|
|
214
340
|
},
|
|
215
341
|
action: {
|
|
216
342
|
type: 2,
|
|
@@ -224,6 +350,26 @@ function apply(ctx, config) {
|
|
|
224
350
|
},
|
|
225
351
|
],
|
|
226
352
|
},
|
|
353
|
+
{
|
|
354
|
+
buttons: [
|
|
355
|
+
{
|
|
356
|
+
id: "1",
|
|
357
|
+
render_data: {
|
|
358
|
+
label: "我也要查wiki",
|
|
359
|
+
visited_label: "我也要查wiki",
|
|
360
|
+
},
|
|
361
|
+
action: {
|
|
362
|
+
type: 2,
|
|
363
|
+
permission: {
|
|
364
|
+
type: 2,
|
|
365
|
+
},
|
|
366
|
+
unsupport_tips: "兼容文本",
|
|
367
|
+
data: "/查wiki ",
|
|
368
|
+
enter: false,
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
},
|
|
227
373
|
],
|
|
228
374
|
},
|
|
229
375
|
},
|
|
@@ -236,7 +382,63 @@ function apply(ctx, config) {
|
|
|
236
382
|
?.replace(/\s+/g, "")
|
|
237
383
|
?.slice(-1) || NaN;
|
|
238
384
|
if (awlist.includes(awser)) {
|
|
239
|
-
|
|
385
|
+
let res = await lib.screenShot(res_url[awser - 1], ctx, itemName, config);
|
|
386
|
+
if (res) {
|
|
387
|
+
await session.bot.internal.sendMessage(session.guildId, {
|
|
388
|
+
content: "111",
|
|
389
|
+
msg_type: 2,
|
|
390
|
+
markdown: {
|
|
391
|
+
custom_template_id: config.mdId,
|
|
392
|
+
params: [
|
|
393
|
+
{
|
|
394
|
+
key: "text1",
|
|
395
|
+
values: [
|
|
396
|
+
`文件缓存已命中,缓存时间为:${lib.getFileModifyTime(filePath)} 请前往以下网址查看:[🔗${itemName}`,
|
|
397
|
+
],
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
key: "text2",
|
|
401
|
+
values: [
|
|
402
|
+
`](${config.publicUrl +
|
|
403
|
+
itemName
|
|
404
|
+
.replace(/\//g, "-")
|
|
405
|
+
.replace(/:/g, "-")
|
|
406
|
+
.replace(/'/g, "-")}.jpeg)`,
|
|
407
|
+
],
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
},
|
|
411
|
+
keyboard: {
|
|
412
|
+
content: {
|
|
413
|
+
rows: [
|
|
414
|
+
{
|
|
415
|
+
buttons: [
|
|
416
|
+
{
|
|
417
|
+
id: "1",
|
|
418
|
+
render_data: {
|
|
419
|
+
label: "我也要查wiki",
|
|
420
|
+
visited_label: "我也要查wiki",
|
|
421
|
+
},
|
|
422
|
+
action: {
|
|
423
|
+
type: 2,
|
|
424
|
+
permission: {
|
|
425
|
+
type: 2,
|
|
426
|
+
},
|
|
427
|
+
unsupport_tips: "兼容文本",
|
|
428
|
+
data: "/查wiki ",
|
|
429
|
+
enter: false,
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
],
|
|
433
|
+
},
|
|
434
|
+
],
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
msg_id: session.messageId,
|
|
438
|
+
timestamp: session.timestamp,
|
|
439
|
+
msg_seq: Math.floor(Math.random() * 500),
|
|
440
|
+
});
|
|
441
|
+
}
|
|
240
442
|
}
|
|
241
443
|
else if (Number.isNaN(awser)) {
|
|
242
444
|
return `您输入的选项有误,已完结本轮查询。如需,如有需要,请重新发起查询.`;
|
|
@@ -246,4 +448,3 @@ function apply(ctx, config) {
|
|
|
246
448
|
}
|
|
247
449
|
});
|
|
248
450
|
}
|
|
249
|
-
exports.apply = apply;
|
package/lib/lib.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare function getFileModifyTime(filePath: string): string;
|
|
|
20
20
|
* @param itemName 物品名称
|
|
21
21
|
* @returns string
|
|
22
22
|
*/
|
|
23
|
-
export declare function screenShot(url: string, ctx: Context, itemName: string, config: Config): Promise<
|
|
23
|
+
export declare function screenShot(url: string, ctx: Context, itemName: string, config: Config): Promise<boolean>;
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
26
26
|
* @param ms 延迟毫秒数
|
|
@@ -32,3 +32,14 @@ export declare function delay(ms: number): Promise<unknown>;
|
|
|
32
32
|
* @returns []
|
|
33
33
|
*/
|
|
34
34
|
export declare function getFromFandom(url: string, ctx: Context, itemName: string): Promise<any[]>;
|
|
35
|
+
/**
|
|
36
|
+
* @param list 传入的列表,内部元素要求为偶数个
|
|
37
|
+
* @returns 对象列表
|
|
38
|
+
*/
|
|
39
|
+
export declare function createMd(list: string[]): object[];
|
|
40
|
+
/**
|
|
41
|
+
* @param btn_list 按钮数组 [['第一行按钮','第一行按钮DATA'],['第二行按钮','第二行按钮DATA']]
|
|
42
|
+
* @returns 按钮列表rows
|
|
43
|
+
* @description 创建多行按钮
|
|
44
|
+
*/
|
|
45
|
+
export declare function createBtn(input: string[][]): object[];
|
package/lib/lib.js
CHANGED
|
@@ -3,7 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.checkFileExists = checkFileExists;
|
|
7
|
+
exports.getFileModifyTime = getFileModifyTime;
|
|
8
|
+
exports.screenShot = screenShot;
|
|
9
|
+
exports.delay = delay;
|
|
10
|
+
exports.getFromFandom = getFromFandom;
|
|
11
|
+
exports.createMd = createMd;
|
|
12
|
+
exports.createBtn = createBtn;
|
|
7
13
|
const fs_1 = __importDefault(require("fs"));
|
|
8
14
|
/**
|
|
9
15
|
* 检查文件是否存在
|
|
@@ -19,7 +25,6 @@ function checkFileExists(filePath) {
|
|
|
19
25
|
return false;
|
|
20
26
|
}
|
|
21
27
|
}
|
|
22
|
-
exports.checkFileExists = checkFileExists;
|
|
23
28
|
/**
|
|
24
29
|
* @desc 获取文件修改时间
|
|
25
30
|
* @param filePath 文件路径
|
|
@@ -37,7 +42,6 @@ function getFileModifyTime(filePath) {
|
|
|
37
42
|
second: "numeric",
|
|
38
43
|
});
|
|
39
44
|
}
|
|
40
|
-
exports.getFileModifyTime = getFileModifyTime;
|
|
41
45
|
/**
|
|
42
46
|
* @desc 截屏
|
|
43
47
|
* @param url 截屏地址
|
|
@@ -48,7 +52,7 @@ exports.getFileModifyTime = getFileModifyTime;
|
|
|
48
52
|
*/
|
|
49
53
|
async function screenShot(url, ctx, itemName, config) {
|
|
50
54
|
if (!url) {
|
|
51
|
-
return
|
|
55
|
+
return false;
|
|
52
56
|
}
|
|
53
57
|
else {
|
|
54
58
|
const page = await ctx.puppeteer.page();
|
|
@@ -74,18 +78,17 @@ async function screenShot(url, ctx, itemName, config) {
|
|
|
74
78
|
})
|
|
75
79
|
.then(async () => {
|
|
76
80
|
// console.info(`截图成功...`);
|
|
77
|
-
return
|
|
81
|
+
return true;
|
|
78
82
|
})
|
|
79
83
|
.catch((err) => {
|
|
80
84
|
console.error(err);
|
|
81
|
-
return
|
|
85
|
+
return false;
|
|
82
86
|
})
|
|
83
87
|
.finally(async () => {
|
|
84
88
|
await page.close();
|
|
85
89
|
});
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
|
-
exports.screenShot = screenShot;
|
|
89
92
|
/**
|
|
90
93
|
*
|
|
91
94
|
* @param ms 延迟毫秒数
|
|
@@ -94,7 +97,6 @@ exports.screenShot = screenShot;
|
|
|
94
97
|
async function delay(ms) {
|
|
95
98
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
96
99
|
}
|
|
97
|
-
exports.delay = delay;
|
|
98
100
|
/**
|
|
99
101
|
* @desc 从fandom获取数据
|
|
100
102
|
* @returns []
|
|
@@ -123,4 +125,51 @@ async function getFromFandom(url, ctx, itemName) {
|
|
|
123
125
|
return [];
|
|
124
126
|
});
|
|
125
127
|
}
|
|
126
|
-
|
|
128
|
+
/**
|
|
129
|
+
* @param list 传入的列表,内部元素要求为偶数个
|
|
130
|
+
* @returns 对象列表
|
|
131
|
+
*/
|
|
132
|
+
function createMd(list) {
|
|
133
|
+
let res = [];
|
|
134
|
+
for (let i = 0; i < list.length; i += 2) {
|
|
135
|
+
res.push({
|
|
136
|
+
key: list[i],
|
|
137
|
+
values: [list[i + 1]],
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return res;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @param btn_list 按钮数组 [['第一行按钮','第一行按钮DATA'],['第二行按钮','第二行按钮DATA']]
|
|
144
|
+
* @returns 按钮列表rows
|
|
145
|
+
* @description 创建多行按钮
|
|
146
|
+
*/
|
|
147
|
+
function createBtn(input) {
|
|
148
|
+
const rows = [];
|
|
149
|
+
input.forEach((subList) => {
|
|
150
|
+
const row = {
|
|
151
|
+
buttons: [],
|
|
152
|
+
};
|
|
153
|
+
for (let i = 0; i < subList.length; i += 2) {
|
|
154
|
+
const button = {
|
|
155
|
+
id: i / 2 + 1,
|
|
156
|
+
render_data: {
|
|
157
|
+
label: subList[i],
|
|
158
|
+
visited_label: subList[i],
|
|
159
|
+
},
|
|
160
|
+
action: {
|
|
161
|
+
type: 2,
|
|
162
|
+
permission: {
|
|
163
|
+
type: 2,
|
|
164
|
+
},
|
|
165
|
+
unsupport_tips: "兼容文本",
|
|
166
|
+
data: subList[i + 1],
|
|
167
|
+
enter: true,
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
row.buttons.push(button);
|
|
171
|
+
}
|
|
172
|
+
rows.push(row);
|
|
173
|
+
});
|
|
174
|
+
return rows;
|
|
175
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-oni-wiki-qq",
|
|
3
3
|
"description": "缺氧Wiki查询。QQ群版。需要官方群机器人md模板和群机器人权限。自用",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
"plugin"
|
|
16
16
|
],
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"koishi": "^4.17.
|
|
18
|
+
"koishi": "^4.17.2"
|
|
19
19
|
}
|
|
20
20
|
}
|