koishi-plugin-node-async-bot-all 2.24.4 → 2.24.6
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 +12 -7
- package/package.json +3 -3
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 = { noApi: "未指定 API", noop: "无", unknownError: "未知错误。", 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➣ 请稍后重试。\n➣ 备注:{note}", listA2S: "【A2S 服务器 {count}】\n➣ {version}:{players}\n➣ 机器人:{bots}\n➣ 备注:{note}", listFailedA2S: "【A2S 服务器 {count}】\n➣ 查询失败:{data}\n➣ 请稍后重试。\n➣ 备注:{note}", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\n查询失败:{data}", timeout: "请求超时。", fewData: "服务端返回的数据过少。", close: "服务器已关闭。", 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}", failed: "{time}\n获取失败({data})。" } }, randomba: { description: "随机BA图。", messages: { msg: "{quote}{image}", wait: "{quote}{time}\n请等待图片上传(可能较慢)。" } }, centerservertest: { description: "查看中心服务器状态。", messages: { msg: "{time}{list}", list: "== {name} ==\n状态:{status}\n存活率:{uptime}\n检测时间:{time}", listFailed: "== {name} ==\n查看失败:{data}", failed: "{time}\n查看失败:{data}", statusLive: "✅ 正常", statusDie: "❌ 故障", dataFail: "未能获取到此服务器的状态信息。" } }, meme: { description: "群友的怪话!", messages: { msg: "{quote}{time}\n{image}\n{title}", failed: "{quote}{time}\n获取失败:{data}", forbidden: "{quote}{time}\n此指令不允许在本群使用。" } }, 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 号不正确。" } }, msg2img: { description: "引用一个消息并使用此指令,即可将消息转图。", messages: { msg: "{quote}{image}", failed: "{quote}{time}\n获取失败:{data}", null: "未引用任何消息。", matroska: "{quote}禁止套娃!" } }, slnews: { description: "抓取 NorthWood 的 Steam 最新新闻。" } } };
|
|
37
|
+
module2.exports = { noApi: "未指定 API", noop: "无", unknownError: "未知错误。", 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➣ 请稍后重试。\n➣ 备注:{note}", listA2S: "【A2S 服务器 {count}】\n➣ {version}:{players}\n➣ 机器人:{bots}\n➣ 备注:{note}", listFailedA2S: "【A2S 服务器 {count}】\n➣ 查询失败:{data}\n➣ 请稍后重试。\n➣ 备注:{note}", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\n查询失败:{data}", timeout: "请求超时。", fewData: "服务端返回的数据过少。", close: "服务器已关闭。", host: "没有到主机的路由。", dns: "解析失败。" } }, 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}", failed: "{time}\n获取失败({data})。" } }, randomba: { description: "随机BA图。", messages: { msg: "{quote}{image}", wait: "{quote}{time}\n请等待图片上传(可能较慢)。" } }, centerservertest: { description: "查看中心服务器状态。", messages: { msg: "{time}{list}", list: "== {name} ==\n状态:{status}\n存活率:{uptime}\n检测时间:{time}", listFailed: "== {name} ==\n查看失败:{data}", failed: "{time}\n查看失败:{data}", statusLive: "✅ 正常", statusDie: "❌ 故障", dataFail: "未能获取到此服务器的状态信息。" } }, meme: { description: "群友的怪话!", messages: { msg: "{quote}{time}\n{image}\n{title}", failed: "{quote}{time}\n获取失败:{data}", forbidden: "{quote}{time}\n此指令不允许在本群使用。" } }, 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 号不正确。" } }, msg2img: { description: "引用一个消息并使用此指令,即可将消息转图。", messages: { msg: "{quote}{image}", failed: "{quote}{time}\n获取失败:{data}", null: "未引用任何消息。", matroska: "{quote}禁止套娃!" } }, slnews: { description: "抓取 NorthWood 的 Steam 最新新闻。" } } };
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -71,12 +71,14 @@ function getMemoryUsage() {
|
|
|
71
71
|
const totalMemory = import_os.default.totalmem();
|
|
72
72
|
const freeMemory = import_os.default.freemem();
|
|
73
73
|
const usedMemory = totalMemory - freeMemory;
|
|
74
|
-
|
|
74
|
+
const percentage = Math.round(usedMemory / totalMemory * 1e4) / 100;
|
|
75
|
+
const memory = `${(usedMemory / 1024 ** 3).toFixed(2)}GB / ${(totalMemory / 1024 ** 3).toFixed(2)}GB`;
|
|
76
|
+
return `${percentage}%(${memory})`;
|
|
75
77
|
}
|
|
76
78
|
__name(getMemoryUsage, "getMemoryUsage");
|
|
77
79
|
async function getCpuUsage() {
|
|
78
80
|
const cpus1 = import_os.default.cpus();
|
|
79
|
-
await
|
|
81
|
+
await (0, import_koishi.sleep)(100);
|
|
80
82
|
const cpus2 = import_os.default.cpus();
|
|
81
83
|
let totalIdle = 0;
|
|
82
84
|
let totalTick = 0;
|
|
@@ -93,15 +95,16 @@ async function getCpuUsage() {
|
|
|
93
95
|
totalTick += totalDiff;
|
|
94
96
|
}
|
|
95
97
|
const usage2 = 100 - 100 * totalIdle / totalTick;
|
|
96
|
-
|
|
98
|
+
const cpus = import_os.default.cpus();
|
|
99
|
+
return `${Math.round(usage2 * 100) / 100}%(${(cpus[0].speed / 1024).toFixed(2)}GHz)`;
|
|
97
100
|
}
|
|
98
101
|
__name(getCpuUsage, "getCpuUsage");
|
|
99
102
|
async function getSystemUsage() {
|
|
100
103
|
try {
|
|
101
104
|
return {
|
|
102
105
|
"name": getSystemName(),
|
|
103
|
-
"cpu": await getCpuUsage()
|
|
104
|
-
"memory": getMemoryUsage()
|
|
106
|
+
"cpu": await getCpuUsage(),
|
|
107
|
+
"memory": getMemoryUsage(),
|
|
105
108
|
"success": 0
|
|
106
109
|
};
|
|
107
110
|
} catch (error) {
|
|
@@ -434,6 +437,8 @@ async function getServer(ctx, session) {
|
|
|
434
437
|
err = session.text(".fewData");
|
|
435
438
|
} else if (err.includes("Expected server to send packet type")) {
|
|
436
439
|
err = session.text(".fewData");
|
|
440
|
+
} else if (err.includes("getaddrinfo")) {
|
|
441
|
+
err = session.text(".dns");
|
|
437
442
|
}
|
|
438
443
|
const temp = {
|
|
439
444
|
"count": count,
|
|
@@ -907,7 +912,7 @@ async function getNewsMsg(ctx, type) {
|
|
|
907
912
|
__name(getNewsMsg, "getNewsMsg");
|
|
908
913
|
|
|
909
914
|
// package.json
|
|
910
|
-
var version = "2.24.
|
|
915
|
+
var version = "2.24.6";
|
|
911
916
|
|
|
912
917
|
// src/index.ts
|
|
913
918
|
var inject = ["database", "installer", "puppeteer", "cron"];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-node-async-bot-all",
|
|
3
3
|
"description": "NodeAsync Bot插件(自用)",
|
|
4
|
-
"version": "2.24.
|
|
4
|
+
"version": "2.24.6",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"contributors": [
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@koishijs/plugin-help": "^2.4.5",
|
|
36
36
|
"@koishijs/plugin-market": "^2.11.8",
|
|
37
37
|
"koishi": "^4.18.7",
|
|
38
|
-
"koishi-plugin-
|
|
39
|
-
"koishi-plugin-
|
|
38
|
+
"koishi-plugin-cron": "^3.1.0",
|
|
39
|
+
"koishi-plugin-puppeteer": "^3.9.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@bbob/html": "^4.3.1",
|