koishi-plugin-node-async-bot-all 2.18.0 → 2.19.0
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/fun.d.ts +0 -6
- package/lib/index.js +67 -140
- package/package.json +1 -1
package/lib/fun.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Context } from "koishi";
|
|
|
3
3
|
import { APIUserInfo } from "./commands";
|
|
4
4
|
export declare function getSystemUsage(): Promise<Object>;
|
|
5
5
|
export declare function getHongKongTime(): string;
|
|
6
|
-
export declare function fetchWithTimeout(url: string, options: {} | undefined, timeout: number | undefined, log: any): Promise<Response>;
|
|
7
6
|
export declare function readInfoFile(ctx: Context): Promise<string>;
|
|
8
7
|
export declare function formatTimestampDiff(start: number, end: number): string;
|
|
9
8
|
export declare function getMsgCount(ctx: Context): Promise<Object>;
|
|
@@ -15,10 +14,5 @@ export declare function hostPing(host: string): Promise<{
|
|
|
15
14
|
packetLoss?: string;
|
|
16
15
|
}>;
|
|
17
16
|
export declare function random(type: number | undefined, data: any, data2?: any): number;
|
|
18
|
-
export declare function getHttp(log: any, url: string, timeout: number): Promise<{
|
|
19
|
-
success: boolean;
|
|
20
|
-
data: object;
|
|
21
|
-
error?: boolean;
|
|
22
|
-
}>;
|
|
23
17
|
export declare function request<T = any>(url: string, options?: RequestInit, timeout?: number, log?: any): Promise<HttpResponse<T>>;
|
|
24
18
|
export declare function readUserCardFile(userInfo: APIUserInfo): Promise<string>;
|
package/lib/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
34
34
|
// src/locales/zh-CN.yml
|
|
35
35
|
var require_zh_CN = __commonJS({
|
|
36
36
|
"src/locales/zh-CN.yml"(exports2, module2) {
|
|
37
|
-
module2.exports = { commands: { cxgame: { description: "查询服务器当前人数。", messages: { msg: "{time}{list}\n进服指南请在群公告中查看。", list: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 玩家列表:{list}\n➣ 备注:{note}", listNoPlayer: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 备注:{note}", listFailed: "【MC 服务器 {count}】\n➣ 查询失败:{data}\n➣ 请稍后重试。", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\n查询失败:{data}", timeout: "请求超时。", timeout2: "响应超时。", fewData: "服务端返回的数据过少。", close: "服务器已关闭。", error: "执行错误。", host: "没有到主机的路由。" } }, status: { description: "查询机器人状态。", messages: { msg: "{time}\n--- 系统状态 ---\n系统名称:{name}\nCPU使用率:{cpu}\n内存使用率:{memory}\n--- 机器人状态 ---\n昨日收/发消息数量:{msgCount}\n机器人版本:{version}\n运行时间:{online}", failed: "{time}\n状态获取失败。" } }, random: { description: "随机数生成器。", usage: "缺少参数时默认生成 0-10000 的随机数。\n使用示例:", examples: "random 1 128 生成1到128范围的随机数", messages: { msg: "{time}\n生成的随机数:{data}" } }, info: { description: "查询机器人信息。", messages: { msg: "{data}", failed: "{time}\n读取信息失败。" } }, rw: { description: "随机名言名句。", messages: { msg: "{time}\n{data}", error: "执行错误。",
|
|
37
|
+
module2.exports = { commands: { cxgame: { description: "查询服务器当前人数。", messages: { msg: "{time}{list}\n进服指南请在群公告中查看。", list: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 玩家列表:{list}\n➣ 备注:{note}", listNoPlayer: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 备注:{note}", listFailed: "【MC 服务器 {count}】\n➣ 查询失败:{data}\n➣ 请稍后重试。", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\n查询失败:{data}", timeout: "请求超时。", timeout2: "响应超时。", fewData: "服务端返回的数据过少。", close: "服务器已关闭。", error: "执行错误。", host: "没有到主机的路由。" } }, status: { description: "查询机器人状态。", messages: { msg: "{time}\n--- 系统状态 ---\n系统名称:{name}\nCPU使用率:{cpu}\n内存使用率:{memory}\n--- 机器人状态 ---\n昨日收/发消息数量:{msgCount}\n机器人版本:{version}\n运行时间:{online}", failed: "{time}\n状态获取失败。" } }, random: { description: "随机数生成器。", usage: "缺少参数时默认生成 0-10000 的随机数。\n使用示例:", examples: "random 1 128 生成1到128范围的随机数", messages: { msg: "{time}\n生成的随机数:{data}" } }, info: { description: "查询机器人信息。", messages: { msg: "{data}", failed: "{time}\n读取信息失败。" } }, rw: { description: "随机名言名句。", messages: { msg: "{time}\n{data}", error: "执行错误。", failed: "{time}\n获取失败({data})。" } }, randomba: { description: "随机BA图。", messages: { msg: "{quote}{image}", wait: "{quote}{time}\n请等待图片上传(可能较慢)。" } }, servertest: { description: "Ping服务器。", messages: { msg: "{time}\n== Ping {host} ==\n状态:{alive}\n丢包率:{packetLoss}\n返回IP:{ip}", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\nPing 失败:{data}" } }, meme: { description: "群友的怪话!", messages: { msg: "{quote}{time}\n{image}\n{title}", failed: "{quote}{time}\n获取失败:{data}", forbidden: "{quote}{time}\n此指令不允许在本群使用。", error: "执行错误。" } }, randomcat: { description: "随机猫猫图。", messages: { msg: "{quote}{image}", wait: "{quote}{time}\n请等待图片上传(可能较慢)。", failed: "{quote}{time}\n获取失败:{data}" } }, getqqinfo: { description: "获取 QQ 号的信息。", messages: { msg: "{quote}{image}", failed: "{quote}{time}\n获取失败:{data}", command: "QQ 号不正确。" } } } };
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -132,33 +132,6 @@ function getHongKongTime() {
|
|
|
132
132
|
return `${dateObj.year}-${dateObj.month}-${dateObj.day} ${dateObj.hour}:${dateObj.minute}:${dateObj.second}`;
|
|
133
133
|
}
|
|
134
134
|
__name(getHongKongTime, "getHongKongTime");
|
|
135
|
-
async function fetchWithTimeout(url, options = {}, timeout = 5e3, log) {
|
|
136
|
-
const controller = new AbortController();
|
|
137
|
-
const { signal } = controller;
|
|
138
|
-
const fetchOptions = {
|
|
139
|
-
...options,
|
|
140
|
-
signal
|
|
141
|
-
};
|
|
142
|
-
const timeoutId = setTimeout(() => {
|
|
143
|
-
controller.abort();
|
|
144
|
-
}, timeout);
|
|
145
|
-
try {
|
|
146
|
-
const response = await fetch(url, fetchOptions);
|
|
147
|
-
clearTimeout(timeoutId);
|
|
148
|
-
log.info(`Fetch code: ${response.status}`);
|
|
149
|
-
return response;
|
|
150
|
-
} catch (error) {
|
|
151
|
-
clearTimeout(timeoutId);
|
|
152
|
-
log.error(error);
|
|
153
|
-
log.error(`${error.name}: ${error.message}`);
|
|
154
|
-
if (error.name === "AbortError") {
|
|
155
|
-
throw new Error(`请求超时。(${timeout}ms)`);
|
|
156
|
-
} else {
|
|
157
|
-
throw error;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
__name(fetchWithTimeout, "fetchWithTimeout");
|
|
162
135
|
async function readInfoFile(ctx) {
|
|
163
136
|
let info;
|
|
164
137
|
try {
|
|
@@ -231,36 +204,6 @@ function random(type = 0, data, data2) {
|
|
|
231
204
|
}
|
|
232
205
|
}
|
|
233
206
|
__name(random, "random");
|
|
234
|
-
async function getHttp(log, url, timeout) {
|
|
235
|
-
let data;
|
|
236
|
-
try {
|
|
237
|
-
const response = await fetchWithTimeout(url, {}, timeout, log);
|
|
238
|
-
if (response.ok) {
|
|
239
|
-
data = await response.text();
|
|
240
|
-
log.info("Server data: " + data);
|
|
241
|
-
return {
|
|
242
|
-
"data": JSON.parse(data),
|
|
243
|
-
"success": true
|
|
244
|
-
};
|
|
245
|
-
} else {
|
|
246
|
-
data = await response.text();
|
|
247
|
-
log.error(`Error fetching data: ${data}`);
|
|
248
|
-
return {
|
|
249
|
-
"data": JSON.parse(data),
|
|
250
|
-
"error": false,
|
|
251
|
-
"success": false
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
} catch (err) {
|
|
255
|
-
log.error(`Request error: ${err.message}`);
|
|
256
|
-
return {
|
|
257
|
-
"data": { "name": err.name, "message": err.message },
|
|
258
|
-
"error": true,
|
|
259
|
-
"success": false
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
__name(getHttp, "getHttp");
|
|
264
207
|
async function request(url, options = {}, timeout = 8e3, log) {
|
|
265
208
|
const signal = AbortSignal.timeout(timeout);
|
|
266
209
|
try {
|
|
@@ -292,6 +235,7 @@ async function request(url, options = {}, timeout = 8e3, log) {
|
|
|
292
235
|
} catch (error) {
|
|
293
236
|
const isTimeout = error.name === "TimeoutError" || error.name === "AbortError";
|
|
294
237
|
const errorMessage = isTimeout ? `请求超时。(${timeout}ms)` : error.message;
|
|
238
|
+
log?.error(url);
|
|
295
239
|
log?.error(`Request Failed: ${errorMessage}`);
|
|
296
240
|
return {
|
|
297
241
|
success: false,
|
|
@@ -331,8 +275,6 @@ async function getServer(ctx, session) {
|
|
|
331
275
|
const log = ctx.logger("cx");
|
|
332
276
|
log.debug(`Got: {"form":"${session.event.guild?.id}","user":"${session.event.user?.id}","timestamp":${session.event.timestamp},"messageId":"${session.event.message?.id}"}`);
|
|
333
277
|
let msg;
|
|
334
|
-
let data;
|
|
335
|
-
let error;
|
|
336
278
|
const time = getHongKongTime();
|
|
337
279
|
const index = ctx.config.cxV2.findIndex((item) => item.id === session.event.guild?.id);
|
|
338
280
|
if (index !== -1) {
|
|
@@ -343,8 +285,8 @@ async function getServer(ctx, session) {
|
|
|
343
285
|
"data": "未指定查询 API",
|
|
344
286
|
"success": 2
|
|
345
287
|
};
|
|
346
|
-
log.
|
|
347
|
-
log.
|
|
288
|
+
log.warn("Sent:");
|
|
289
|
+
log.warn(msg);
|
|
348
290
|
return msg;
|
|
349
291
|
}
|
|
350
292
|
let count = 0;
|
|
@@ -352,14 +294,13 @@ async function getServer(ctx, session) {
|
|
|
352
294
|
for (const item of api) {
|
|
353
295
|
const note = ctx.config.cxV2[index]["note"][count];
|
|
354
296
|
count++;
|
|
355
|
-
const response = await
|
|
297
|
+
const response = await request(item, {}, ctx.config.timeout, log);
|
|
356
298
|
if (response.success) {
|
|
357
|
-
|
|
358
|
-
if (data["list"] == null) {
|
|
299
|
+
if (response.data.list == null) {
|
|
359
300
|
const temp = {
|
|
360
301
|
"count": count,
|
|
361
|
-
"players": data
|
|
362
|
-
"version": data
|
|
302
|
+
"players": response.data.players,
|
|
303
|
+
"version": response.data.version,
|
|
363
304
|
"note": note ?? "无"
|
|
364
305
|
};
|
|
365
306
|
log.info(`Server ${count}:`);
|
|
@@ -368,9 +309,9 @@ async function getServer(ctx, session) {
|
|
|
368
309
|
} else {
|
|
369
310
|
const temp = {
|
|
370
311
|
"count": count,
|
|
371
|
-
"players": data
|
|
372
|
-
"version": data
|
|
373
|
-
"list": data
|
|
312
|
+
"players": response.data.players,
|
|
313
|
+
"version": response.data.version,
|
|
314
|
+
"list": response.data.list.join(", "),
|
|
374
315
|
"note": note ?? "无"
|
|
375
316
|
};
|
|
376
317
|
log.info(`Server ${count}:`);
|
|
@@ -378,37 +319,30 @@ async function getServer(ctx, session) {
|
|
|
378
319
|
list = list + "\n" + session.text(".list", temp);
|
|
379
320
|
}
|
|
380
321
|
} else {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
error = session.text(".close");
|
|
395
|
-
} else if (error.includes("No route to host")) {
|
|
396
|
-
error = session.text(".host");
|
|
397
|
-
} else if (error.includes("Connection timed out")) {
|
|
398
|
-
error = session.text(".timeout");
|
|
399
|
-
} else if (error.includes("Server returned too few data")) {
|
|
400
|
-
error = session.text(".fewData");
|
|
401
|
-
} else if (error.includes("Server read timed out")) {
|
|
402
|
-
error = session.text(".timeout2");
|
|
322
|
+
let err;
|
|
323
|
+
if (response.code) {
|
|
324
|
+
err = response.isJson ? response.error["data"] : response.error;
|
|
325
|
+
if (err.includes("Connection refused")) {
|
|
326
|
+
err = session.text(".close");
|
|
327
|
+
} else if (err.includes("No route to host")) {
|
|
328
|
+
err = session.text(".host");
|
|
329
|
+
} else if (err.includes("Connection timed out")) {
|
|
330
|
+
err = session.text(".timeout");
|
|
331
|
+
} else if (err.includes("Server returned too few data")) {
|
|
332
|
+
err = session.text(".fewData");
|
|
333
|
+
} else if (err.includes("Server read timed out")) {
|
|
334
|
+
err = session.text(".timeout2");
|
|
403
335
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
"data": error
|
|
407
|
-
};
|
|
408
|
-
log.info(`Server ${count}:`);
|
|
409
|
-
log.info(temp);
|
|
410
|
-
list = list + "\n" + session.text(".listFailed", temp);
|
|
336
|
+
} else {
|
|
337
|
+
err = response.error.message;
|
|
411
338
|
}
|
|
339
|
+
const temp = {
|
|
340
|
+
"count": count,
|
|
341
|
+
"data": err
|
|
342
|
+
};
|
|
343
|
+
log.error(`Server ${count}:`);
|
|
344
|
+
log.error(temp);
|
|
345
|
+
list = list + "\n" + session.text(".listFailed", temp);
|
|
412
346
|
}
|
|
413
347
|
}
|
|
414
348
|
msg = {
|
|
@@ -456,8 +390,8 @@ async function getStatus(ctx, session) {
|
|
|
456
390
|
"success": 0
|
|
457
391
|
};
|
|
458
392
|
}
|
|
459
|
-
log.
|
|
460
|
-
log.
|
|
393
|
+
log.debug("Sent:");
|
|
394
|
+
log.debug(msg);
|
|
461
395
|
return msg;
|
|
462
396
|
}
|
|
463
397
|
__name(getStatus, "getStatus");
|
|
@@ -479,8 +413,8 @@ async function getRandom(ctx, session, min, max) {
|
|
|
479
413
|
"data": data,
|
|
480
414
|
"success": 0
|
|
481
415
|
};
|
|
482
|
-
log.
|
|
483
|
-
log.
|
|
416
|
+
log.debug("Sent:");
|
|
417
|
+
log.debug(msg);
|
|
484
418
|
return msg;
|
|
485
419
|
}
|
|
486
420
|
__name(getRandom, "getRandom");
|
|
@@ -505,8 +439,8 @@ async function getInfo(ctx, session) {
|
|
|
505
439
|
"success": 0
|
|
506
440
|
};
|
|
507
441
|
}
|
|
508
|
-
log.
|
|
509
|
-
log.
|
|
442
|
+
log.debug("Sent:");
|
|
443
|
+
log.debug(msg);
|
|
510
444
|
return msg;
|
|
511
445
|
}
|
|
512
446
|
__name(getInfo, "getInfo");
|
|
@@ -514,7 +448,6 @@ async function getRandomWord(ctx, session) {
|
|
|
514
448
|
const log = ctx.logger("rw");
|
|
515
449
|
log.debug(`Got: {"form":"${session.event.guild?.id}","user":"${session.event.user?.id}","timestamp":${session.event.timestamp},"messageId":"${session.event.message?.id}"}`);
|
|
516
450
|
let msg;
|
|
517
|
-
let data;
|
|
518
451
|
const time = getHongKongTime();
|
|
519
452
|
if (ctx.config.rwAPI == void 0) {
|
|
520
453
|
msg = {
|
|
@@ -522,40 +455,33 @@ async function getRandomWord(ctx, session) {
|
|
|
522
455
|
"data": "未指定 API",
|
|
523
456
|
"success": 2
|
|
524
457
|
};
|
|
525
|
-
log.
|
|
526
|
-
log.
|
|
458
|
+
log.warn("Sent:");
|
|
459
|
+
log.warn(msg);
|
|
527
460
|
return msg;
|
|
528
461
|
}
|
|
529
|
-
const response = await
|
|
462
|
+
const response = await request(ctx.config.rwAPI + "?format=json", {}, ctx.config.timeout, log);
|
|
530
463
|
if (response.success) {
|
|
531
|
-
data = response.data;
|
|
532
464
|
msg = {
|
|
533
465
|
"time": time,
|
|
534
|
-
"data": data
|
|
466
|
+
"data": response.data,
|
|
535
467
|
"success": 0
|
|
536
468
|
};
|
|
537
|
-
log.
|
|
538
|
-
log.
|
|
469
|
+
log.debug("Sent:");
|
|
470
|
+
log.debug(msg);
|
|
539
471
|
} else {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
"time": time,
|
|
544
|
-
"data": data["name"] === "AbortError" ? session.text(".error") : data["message"],
|
|
545
|
-
"success": 2
|
|
546
|
-
};
|
|
547
|
-
log.info("Sent:");
|
|
548
|
-
log.info(msg);
|
|
472
|
+
let err;
|
|
473
|
+
if (response.code) {
|
|
474
|
+
err = response.isJson ? response.error["data"] : response.error;
|
|
549
475
|
} else {
|
|
550
|
-
|
|
551
|
-
msg = {
|
|
552
|
-
"time": time,
|
|
553
|
-
"data": data["data"],
|
|
554
|
-
"success": 1
|
|
555
|
-
};
|
|
556
|
-
log.info("Sent:");
|
|
557
|
-
log.info(msg);
|
|
476
|
+
err = response.error.message;
|
|
558
477
|
}
|
|
478
|
+
msg = {
|
|
479
|
+
"time": time,
|
|
480
|
+
"data": err,
|
|
481
|
+
"success": 1
|
|
482
|
+
};
|
|
483
|
+
log.warn("Sent:");
|
|
484
|
+
log.warn(msg);
|
|
559
485
|
}
|
|
560
486
|
return msg;
|
|
561
487
|
}
|
|
@@ -573,7 +499,8 @@ async function getBlueArchive(ctx, session) {
|
|
|
573
499
|
const link = random(2, ctx.config.baAPI) + `?cacheBuster=${random(1, 1, 2147483647)}`;
|
|
574
500
|
log.info(`Link: ${link}`);
|
|
575
501
|
await (0, import_koishi2.sleep)(ms);
|
|
576
|
-
await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(link) }));
|
|
502
|
+
const status = await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(link) }));
|
|
503
|
+
if (!status) await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(link) }));
|
|
577
504
|
await session.bot.deleteMessage(session.event.guild?.id, vid[0]);
|
|
578
505
|
return 0;
|
|
579
506
|
}
|
|
@@ -659,7 +586,8 @@ async function getMeme(ctx, session, count) {
|
|
|
659
586
|
log.warn("Sent:");
|
|
660
587
|
log.warn(msg);
|
|
661
588
|
}
|
|
662
|
-
await session.send(session.text(msg["success"], msg));
|
|
589
|
+
const status = await session.send(session.text(msg["success"], msg));
|
|
590
|
+
if (!status) await session.send(session.text(msg["success"], msg));
|
|
663
591
|
return 0;
|
|
664
592
|
}
|
|
665
593
|
__name(getMeme, "getMeme");
|
|
@@ -675,7 +603,8 @@ async function getCat(ctx, session) {
|
|
|
675
603
|
const response = await request(ctx.config.catAPI, {}, ctx.config.timeout, log);
|
|
676
604
|
if (response.success) {
|
|
677
605
|
log.debug(response.data);
|
|
678
|
-
await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(response.data[0].url) }));
|
|
606
|
+
const status = await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(response.data[0].url) }));
|
|
607
|
+
if (!status) await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(response.data[0].url) }));
|
|
679
608
|
log.debug("Sent:");
|
|
680
609
|
log.debug(response.data[0].url);
|
|
681
610
|
} else {
|
|
@@ -703,7 +632,6 @@ async function getQQInfo(ctx, session, qq) {
|
|
|
703
632
|
}
|
|
704
633
|
const response = await request(ctx.config.qqAPI + `?qq=${qq}`, {}, ctx.config.timeout, log);
|
|
705
634
|
if (response.success) {
|
|
706
|
-
log.info(response.data);
|
|
707
635
|
const fullHtml = await readUserCardFile(response.data);
|
|
708
636
|
const page = await ctx.puppeteer.page();
|
|
709
637
|
await page.setViewport({
|
|
@@ -713,7 +641,8 @@ async function getQQInfo(ctx, session, qq) {
|
|
|
713
641
|
});
|
|
714
642
|
await page.setContent(fullHtml, { waitUntil: "networkidle0" });
|
|
715
643
|
const image = await page.screenshot({ type: "png", omitBackground: true });
|
|
716
|
-
await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(image, "image/png") }));
|
|
644
|
+
const status = await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(image, "image/png") }));
|
|
645
|
+
if (!status) await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(image, "image/png") }));
|
|
717
646
|
log.debug("Sent: Image");
|
|
718
647
|
} else {
|
|
719
648
|
if (response.code) {
|
|
@@ -731,7 +660,7 @@ async function getQQInfo(ctx, session, qq) {
|
|
|
731
660
|
__name(getQQInfo, "getQQInfo");
|
|
732
661
|
|
|
733
662
|
// package.json
|
|
734
|
-
var version = "2.
|
|
663
|
+
var version = "2.19.0";
|
|
735
664
|
|
|
736
665
|
// src/index.ts
|
|
737
666
|
var inject = ["database", "installer", "puppeteer"];
|
|
@@ -820,10 +749,8 @@ function apply(ctx) {
|
|
|
820
749
|
const rw = await getRandomWord(ctx, session);
|
|
821
750
|
if (rw["success"] == 0) {
|
|
822
751
|
return session?.text(".msg", rw);
|
|
823
|
-
} else if (rw["success"] == 1) {
|
|
824
|
-
return session?.text(".failed1", rw);
|
|
825
752
|
} else {
|
|
826
|
-
return session?.text(".
|
|
753
|
+
return session?.text(".failed", rw);
|
|
827
754
|
}
|
|
828
755
|
});
|
|
829
756
|
ctx.command("randomBA").alias("随机ba图").action(async ({ session }) => {
|
|
@@ -846,7 +773,7 @@ function apply(ctx) {
|
|
|
846
773
|
await getCat(ctx, session);
|
|
847
774
|
});
|
|
848
775
|
ctx.command("getQQInfo <QQ号:string>").alias("获取QQ信息").action(async ({ session }, qq) => {
|
|
849
|
-
if (qq == void 0) return session?.text(".command");
|
|
776
|
+
if (qq == void 0 || isNaN(Number(qq))) return session?.text(".command");
|
|
850
777
|
await getQQInfo(ctx, session, qq);
|
|
851
778
|
});
|
|
852
779
|
}
|