koishi-plugin-node-async-bot-all 2.7.0 → 2.9.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 CHANGED
@@ -11,6 +11,5 @@ export declare function hostPing(host: string): Promise<{
11
11
  data?: any;
12
12
  ip?: string;
13
13
  alive?: boolean;
14
- time?: string;
15
14
  packetLoss?: string;
16
15
  }>;
package/lib/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export declare const usage = "\u8FD9\u662F\u4E00\u4E2A\u79C1\u6709\u63D2\u4EF6\u
14
14
  export interface ConfigCxV2 {
15
15
  id: string;
16
16
  api: Array<string>;
17
+ note: Array<string>;
17
18
  }
18
19
  export interface Config {
19
20
  cxV2: Array<ConfigCxV2>;
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: { cx: { description: "查询服务器当前人数。", messages: { msg: "{time}{list}\n进服指南请在群公告中查看。", list: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 玩家列表:{list}\n➣ 协议版本:{protocol}", listNoPlayer: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 协议版本:{protocol}", listFailed: "【MC 服务器 {count}】\n➣ 查询失败:{data}\n➣ 请稍后重试。", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\n查询失败:{data}", timeout: "请求超时。", timeout2: "响应超时。", fewData: "服务端返回的数据过少。", close: "服务器已关闭。", error: "执行错误。", unknown: "未知错误。", 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}", failed1: "{time}\n获取失败(1)。", failed2: "{time}\n获取失败(2)。" } }, randomba: { description: "随机BA图。", messages: { wait: "{time}\n请等待图片上传(可能较慢)。" } }, servertest: { description: "Ping服务器。", messages: { msg: "{time}\n== Ping {host} ==\n状态:{alive}\n丢包率:{packetLoss}\n返回IP:{ip}\n{avg}", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\nPing 失败:{data}" } } } };
37
+ module2.exports = { commands: { cx: { 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: "执行错误。", unknown: "未知错误。", 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}", failed1: "{time}\n获取失败(1)。", failed2: "{time}\n获取失败(2)。" } }, randomba: { description: "随机BA图。", messages: { wait: "{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}" } } } };
38
38
  }
39
39
  });
40
40
 
@@ -185,7 +185,6 @@ async function hostPing(host) {
185
185
  "success": true,
186
186
  "ip": tmp.numeric_host,
187
187
  "alive": tmp.alive,
188
- "time": tmp.avg == "unknown" ? "请求超时。" : `平均延迟:${tmp.avg}ms`,
189
188
  "packetLoss": tmp.packetLoss.toString()
190
189
  };
191
190
  } catch (error) {
@@ -222,6 +221,7 @@ async function getServer(ctx, session) {
222
221
  let count = 0;
223
222
  let list = "";
224
223
  for (const item of api) {
224
+ const note = ctx.config.cxV2[index]["note"][count];
225
225
  count++;
226
226
  try {
227
227
  const response = await fetchWithTimeout(item, {}, ctx.config.timeout, log);
@@ -234,7 +234,7 @@ async function getServer(ctx, session) {
234
234
  "count": count,
235
235
  "players": data["players"],
236
236
  "version": data["version"],
237
- "protocol": data["protocol"]
237
+ "note": note ?? ""
238
238
  };
239
239
  log.info(`Server ${count}:`);
240
240
  log.info(temp);
@@ -245,7 +245,7 @@ async function getServer(ctx, session) {
245
245
  "players": data["players"],
246
246
  "version": data["version"],
247
247
  "list": data["list"].join(", "),
248
- "protocol": data["protocol"]
248
+ "note": note ?? ""
249
249
  };
250
250
  log.info(`Server ${count}:`);
251
251
  log.info(temp);
@@ -481,14 +481,13 @@ async function serverTest(ctx, session) {
481
481
  "host": host,
482
482
  "ip": tmp.ip,
483
483
  "alive": tmp.alive == true ? "正常" : "异常",
484
- "packetLoss": tmp.packetLoss,
485
- "avg": tmp.time
484
+ "packetLoss": tmp.packetLoss
486
485
  };
487
486
  }
488
487
  __name(serverTest, "serverTest");
489
488
 
490
489
  // package.json
491
- var version = "2.7.0";
490
+ var version = "2.9.0";
492
491
 
493
492
  // src/index.ts
494
493
  var inject = ["database"];
@@ -502,7 +501,8 @@ var Config = import_koishi2.Schema.intersect([
502
501
  cxV2: import_koishi2.Schema.array(
503
502
  import_koishi2.Schema.object({
504
503
  id: import_koishi2.Schema.string().required().description("查询 群"),
505
- api: import_koishi2.Schema.array(String).description("查询 API")
504
+ api: import_koishi2.Schema.array(String).description("查询 API"),
505
+ note: import_koishi2.Schema.array(String).description("查询 备注")
506
506
  })
507
507
  ).default([]).description("查询的 API 和 群")
508
508
  }).description("查询"),
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.7.0",
4
+ "version": "2.9.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "contributors": [