koishi-plugin-node-async-bot-all 2.18.0 → 2.18.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/index.js +10 -6
- package/package.json +1 -1
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: "执行错误。", failed1: "{time}\n获取失败(1)。", failed2: "{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
|
|
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: "执行错误。", failed1: "{time}\n获取失败(1)。", failed2: "{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
|
|
|
@@ -292,6 +292,7 @@ async function request(url, options = {}, timeout = 8e3, log) {
|
|
|
292
292
|
} catch (error) {
|
|
293
293
|
const isTimeout = error.name === "TimeoutError" || error.name === "AbortError";
|
|
294
294
|
const errorMessage = isTimeout ? `请求超时。(${timeout}ms)` : error.message;
|
|
295
|
+
log?.error(url);
|
|
295
296
|
log?.error(`Request Failed: ${errorMessage}`);
|
|
296
297
|
return {
|
|
297
298
|
success: false,
|
|
@@ -573,7 +574,8 @@ async function getBlueArchive(ctx, session) {
|
|
|
573
574
|
const link = random(2, ctx.config.baAPI) + `?cacheBuster=${random(1, 1, 2147483647)}`;
|
|
574
575
|
log.info(`Link: ${link}`);
|
|
575
576
|
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) }));
|
|
577
|
+
const status = await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(link) }));
|
|
578
|
+
if (!status) await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(link) }));
|
|
577
579
|
await session.bot.deleteMessage(session.event.guild?.id, vid[0]);
|
|
578
580
|
return 0;
|
|
579
581
|
}
|
|
@@ -659,7 +661,8 @@ async function getMeme(ctx, session, count) {
|
|
|
659
661
|
log.warn("Sent:");
|
|
660
662
|
log.warn(msg);
|
|
661
663
|
}
|
|
662
|
-
await session.send(session.text(msg["success"], msg));
|
|
664
|
+
const status = await session.send(session.text(msg["success"], msg));
|
|
665
|
+
if (!status) await session.send(session.text(msg["success"], msg));
|
|
663
666
|
return 0;
|
|
664
667
|
}
|
|
665
668
|
__name(getMeme, "getMeme");
|
|
@@ -713,7 +716,8 @@ async function getQQInfo(ctx, session, qq) {
|
|
|
713
716
|
});
|
|
714
717
|
await page.setContent(fullHtml, { waitUntil: "networkidle0" });
|
|
715
718
|
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") }));
|
|
719
|
+
const status = await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(image, "image/png") }));
|
|
720
|
+
if (!status) await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(image, "image/png") }));
|
|
717
721
|
log.debug("Sent: Image");
|
|
718
722
|
} else {
|
|
719
723
|
if (response.code) {
|
|
@@ -731,7 +735,7 @@ async function getQQInfo(ctx, session, qq) {
|
|
|
731
735
|
__name(getQQInfo, "getQQInfo");
|
|
732
736
|
|
|
733
737
|
// package.json
|
|
734
|
-
var version = "2.18.
|
|
738
|
+
var version = "2.18.1";
|
|
735
739
|
|
|
736
740
|
// src/index.ts
|
|
737
741
|
var inject = ["database", "installer", "puppeteer"];
|
|
@@ -846,7 +850,7 @@ function apply(ctx) {
|
|
|
846
850
|
await getCat(ctx, session);
|
|
847
851
|
});
|
|
848
852
|
ctx.command("getQQInfo <QQ号:string>").alias("获取QQ信息").action(async ({ session }, qq) => {
|
|
849
|
-
if (qq == void 0) return session?.text(".command");
|
|
853
|
+
if (qq == void 0 || isNaN(Number(qq))) return session?.text(".command");
|
|
850
854
|
await getQQInfo(ctx, session, qq);
|
|
851
855
|
});
|
|
852
856
|
}
|