koishi-plugin-jscn-aaaquery 1.0.15 → 1.0.16

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.
Files changed (2) hide show
  1. package/lib/index.js +45 -43
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -834,13 +834,15 @@ function apply(ctx, config) {
834
834
  return !message.includes("\n") && message.length < 30;
835
835
  }
836
836
  __name(isShortPrompt, "isShortPrompt");
837
+ function getSeparator() {
838
+ return "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄";
839
+ }
840
+ __name(getSeparator, "getSeparator");
837
841
  function formatOutputMessage(message) {
838
842
  if (isShortPrompt(message)) {
839
843
  return message;
840
844
  }
841
- if (!message.trim().endsWith("--------------------------------")) {
842
- message = message + "\n--------------------------------";
843
- }
845
+ message = message.replace(/--------------------------------/g, getSeparator());
844
846
  return "\n" + message;
845
847
  }
846
848
  __name(formatOutputMessage, "formatOutputMessage");
@@ -943,7 +945,7 @@ function apply(ctx, config) {
943
945
  const { onuDetail, ccname, order, vlanInfo } = await queryTerminalInfo(cleanInput, true);
944
946
  const messages = [
945
947
  "🖥️ 终端基本信息",
946
- "--------------------------------",
948
+ getSeparator(),
947
949
  `MAC地址: ${cleanInput}`,
948
950
  `状态:${onuDetail.status === 1 ? "在线 ✅" : "不在线 ❌"}`,
949
951
  `机房: ${onuDetail.roomName}`,
@@ -957,7 +959,7 @@ function apply(ctx, config) {
957
959
  `CCName: ${ccname}`,
958
960
  "",
959
961
  "📃 工单信息",
960
- "--------------------------------",
962
+ getSeparator(),
961
963
  order ? [
962
964
  `工单编号: ${order.orderId}`,
963
965
  `创建时间: ${order.createDate}`,
@@ -965,7 +967,7 @@ function apply(ctx, config) {
965
967
  ].join("\n") : "无工单信息",
966
968
  "",
967
969
  "⚙️ 业务配置信息",
968
- "--------------------------------"
970
+ getSeparator()
969
971
  ];
970
972
  const vlanGroups = {};
971
973
  vlanInfo.forEach((info) => {
@@ -987,7 +989,7 @@ function apply(ctx, config) {
987
989
  ` 工单VLAN: ${group.actualVlan}`
988
990
  );
989
991
  });
990
- messages.push("--------------------------------");
992
+ messages.push(getSeparator());
991
993
  return messages.join("\n");
992
994
  } catch (error) {
993
995
  console.error("查询MAC地址过程出错:", error);
@@ -1023,10 +1025,10 @@ function apply(ctx, config) {
1023
1025
  if (radiusUserInfo.code !== "000000" || !radiusUserInfo.data) {
1024
1026
  const message = [
1025
1027
  "🌐 账号查询结果",
1026
- "--------------------------------",
1028
+ getSeparator(),
1027
1029
  `账号: ${input}`,
1028
1030
  `RADIUS状态: ${radiusUserInfo.message || "账号授权验证失败"} ,请检查或者重新授权❌`,
1029
- "--------------------------------"
1031
+ getSeparator()
1030
1032
  ].join("\n");
1031
1033
  return message;
1032
1034
  }
@@ -1046,7 +1048,7 @@ function apply(ctx, config) {
1046
1048
  }
1047
1049
  const message = [
1048
1050
  "🌐 账号查询结果",
1049
- "--------------------------------",
1051
+ getSeparator(),
1050
1052
  `账号: ${accountInfo.accessUserName}`,
1051
1053
  // `RADIUS用户密码: ${user.password}`,
1052
1054
  `RADIUS状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
@@ -1093,7 +1095,7 @@ function apply(ctx, config) {
1093
1095
  message.push("");
1094
1096
  if (orders && orders.length > 0) {
1095
1097
  message.push("🛒 订购信息");
1096
- message.push("--------------------------------");
1098
+ message.push(getSeparator());
1097
1099
  orders.forEach((order, index) => {
1098
1100
  message.push(
1099
1101
  `订购 #${index + 1}:`,
@@ -1107,13 +1109,13 @@ function apply(ctx, config) {
1107
1109
  }
1108
1110
  });
1109
1111
  }
1110
- message.push("--------------------------------");
1112
+ message.push(getSeparator());
1111
1113
  return message.join("\n");
1112
1114
  } catch (accountError) {
1113
1115
  console.error("智能查询中账号详细信息出错:", accountError);
1114
1116
  const message = [
1115
1117
  "🌐 账号查询结果(部分信息)",
1116
- "--------------------------------",
1118
+ getSeparator(),
1117
1119
  `账号: ${input}`,
1118
1120
  `RADIUS状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
1119
1121
  "",
@@ -1123,7 +1125,7 @@ function apply(ctx, config) {
1123
1125
  ];
1124
1126
  if (orders && orders.length > 0) {
1125
1127
  message.push("🛒 订购信息");
1126
- message.push("--------------------------------");
1128
+ message.push(getSeparator());
1127
1129
  orders.forEach((order, index) => {
1128
1130
  message.push(
1129
1131
  `订购 #${index + 1}:`,
@@ -1137,7 +1139,7 @@ function apply(ctx, config) {
1137
1139
  }
1138
1140
  });
1139
1141
  }
1140
- message.push("--------------------------------");
1142
+ message.push(getSeparator());
1141
1143
  return message.join("\n");
1142
1144
  }
1143
1145
  } catch (error) {
@@ -1162,10 +1164,10 @@ function apply(ctx, config) {
1162
1164
  if (radiusUserInfo.code !== "000000" || !radiusUserInfo.data) {
1163
1165
  const message = [
1164
1166
  "🌐 账号查询结果",
1165
- "--------------------------------",
1167
+ getSeparator(),
1166
1168
  `账号: ${account}`,
1167
1169
  `RADIUS状态: ${radiusUserInfo.message || "账号授权验证失败"},请检查或者重新授权 ❌`,
1168
- "--------------------------------"
1170
+ getSeparator()
1169
1171
  ].join("\n");
1170
1172
  return message;
1171
1173
  }
@@ -1185,7 +1187,7 @@ function apply(ctx, config) {
1185
1187
  }
1186
1188
  const message = [
1187
1189
  "🌐 账号查询结果",
1188
- "--------------------------------",
1190
+ getSeparator(),
1189
1191
  `账号: ${accountInfo.accessUserName}`,
1190
1192
  // `RADIUS用户密码: ${user.password}`,
1191
1193
  `RADIUS状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
@@ -1232,7 +1234,7 @@ function apply(ctx, config) {
1232
1234
  message.push("");
1233
1235
  if (orders && orders.length > 0) {
1234
1236
  message.push("🛒 订购信息");
1235
- message.push("--------------------------------");
1237
+ message.push(getSeparator());
1236
1238
  orders.forEach((order, index) => {
1237
1239
  message.push(
1238
1240
  `订购 #${index + 1}:`,
@@ -1246,13 +1248,13 @@ function apply(ctx, config) {
1246
1248
  }
1247
1249
  });
1248
1250
  }
1249
- message.push("--------------------------------");
1251
+ message.push(getSeparator());
1250
1252
  return message.join("\n");
1251
1253
  } catch (accountError) {
1252
1254
  console.error("查询账号详细信息出错:", accountError);
1253
1255
  const message = [
1254
1256
  "🌐 账号查询结果(部分信息)",
1255
- "--------------------------------",
1257
+ getSeparator(),
1256
1258
  `账号: ${account}`,
1257
1259
  `RADIUS状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
1258
1260
  "",
@@ -1262,7 +1264,7 @@ function apply(ctx, config) {
1262
1264
  ];
1263
1265
  if (orders && orders.length > 0) {
1264
1266
  message.push("🛒 订购信息");
1265
- message.push("--------------------------------");
1267
+ message.push(getSeparator());
1266
1268
  orders.forEach((order, index) => {
1267
1269
  message.push(
1268
1270
  `订购 #${index + 1}:`,
@@ -1276,7 +1278,7 @@ function apply(ctx, config) {
1276
1278
  }
1277
1279
  });
1278
1280
  }
1279
- message.push("--------------------------------");
1281
+ message.push(getSeparator());
1280
1282
  return message.join("\n");
1281
1283
  }
1282
1284
  } catch (error) {
@@ -1298,7 +1300,7 @@ function apply(ctx, config) {
1298
1300
  }
1299
1301
  const messages = records.map((record, index) => [
1300
1302
  `📋 记录 #${index + 1}`,
1301
- "--------------------------------",
1303
+ getSeparator(),
1302
1304
  `账号: ${record.accessUserName}`,
1303
1305
  `记录类型: ${record.recordType}`,
1304
1306
  `设备名称: ${record.nickName}`,
@@ -1309,7 +1311,7 @@ function apply(ctx, config) {
1309
1311
  `原因: ${record.reason || "无"}`
1310
1312
  ].join("\n"));
1311
1313
  let result = messages.join("\n\n");
1312
- result += "\n--------------------------------";
1314
+ result += getSeparator();
1313
1315
  return result;
1314
1316
  } catch (error) {
1315
1317
  console.error("查询过程出错:", error);
@@ -1328,7 +1330,7 @@ function apply(ctx, config) {
1328
1330
  const { onuDetail, vlanInfo } = await queryTerminalInfo(formattedMac, false);
1329
1331
  const messages = [
1330
1332
  "🖥️ 终端基本信息",
1331
- "--------------------------------",
1333
+ getSeparator(),
1332
1334
  `MAC地址: ${formattedMac}`,
1333
1335
  `状态:${onuDetail.status === 1 ? "在线 ✅" : "不在线 ❌"}`,
1334
1336
  `设备名称: `,
@@ -1337,7 +1339,7 @@ function apply(ctx, config) {
1337
1339
  `接收光功率: ${onuDetail.onuReceivePower === "设备不在线" ? "设备不在线" : onuDetail.onuReceivePower + "dBm"}${onuDetail.onuReceivePower !== "设备不在线" ? " " + evaluateOpticalPower(onuDetail.onuReceivePower) : ""}`,
1338
1340
  "",
1339
1341
  "⚙️ 业务配置信息",
1340
- "--------------------------------"
1342
+ getSeparator()
1341
1343
  ];
1342
1344
  const vlanGroups = {};
1343
1345
  vlanInfo.forEach((info) => {
@@ -1359,7 +1361,7 @@ function apply(ctx, config) {
1359
1361
  ` 工单VLAN: ${group.actualVlan}`
1360
1362
  );
1361
1363
  });
1362
- messages.push("--------------------------------");
1364
+ messages.push(getSeparator());
1363
1365
  return messages.join("\n");
1364
1366
  } catch (error) {
1365
1367
  console.error("查询过程出错:", error);
@@ -1378,7 +1380,7 @@ function apply(ctx, config) {
1378
1380
  const { onuDetail, ccname, order, vlanInfo } = await queryTerminalInfo(formattedMac, true);
1379
1381
  const messages = [
1380
1382
  "🖥️ 终端基本信息",
1381
- "--------------------------------",
1383
+ getSeparator(),
1382
1384
  `MAC地址: ${formattedMac}`,
1383
1385
  `状态:${onuDetail.status === 1 ? "在线 ✅" : "不在线 ❌"}`,
1384
1386
  `机房: ${onuDetail.roomName}`,
@@ -1392,7 +1394,7 @@ function apply(ctx, config) {
1392
1394
  `CCName: ${ccname}`,
1393
1395
  "",
1394
1396
  "📃 工单信息",
1395
- "--------------------------------",
1397
+ getSeparator(),
1396
1398
  order ? [
1397
1399
  `工单编号: ${order.orderId}`,
1398
1400
  `创建时间: ${order.createDate}`,
@@ -1400,7 +1402,7 @@ function apply(ctx, config) {
1400
1402
  ].join("\n") : "无工单信息",
1401
1403
  "",
1402
1404
  "⚙️ 业务配置信息",
1403
- "--------------------------------"
1405
+ getSeparator()
1404
1406
  ];
1405
1407
  const vlanGroups = {};
1406
1408
  vlanInfo.forEach((info) => {
@@ -1422,7 +1424,7 @@ function apply(ctx, config) {
1422
1424
  ` 工单VLAN: ${group.actualVlan}`
1423
1425
  );
1424
1426
  });
1425
- messages.push("--------------------------------");
1427
+ messages.push(getSeparator());
1426
1428
  return messages.join("\n");
1427
1429
  } catch (error) {
1428
1430
  console.error("查询过程出错:", error);
@@ -1463,7 +1465,7 @@ function apply(ctx, config) {
1463
1465
  const batchLogs = filteredLogs.slice(startIdx, endIdx);
1464
1466
  const messages = [
1465
1467
  `📝 上线分析日志 (第 ${i + 1}/${totalBatches} 批)`,
1466
- "--------------------------------"
1468
+ getSeparator()
1467
1469
  ];
1468
1470
  batchLogs.forEach((log, index) => {
1469
1471
  messages.push(
@@ -1472,11 +1474,11 @@ function apply(ctx, config) {
1472
1474
  `描述: ${log.description || "无描述"}`,
1473
1475
  `创建时间: ${log.createTime || "未知"}`,
1474
1476
  `更新时间: ${log.updateTime || "未知"}`,
1475
- "--------------------------------"
1477
+ getSeparator()
1476
1478
  );
1477
1479
  });
1478
1480
  if (!messages[messages.length - 1].includes("----")) {
1479
- messages.push("--------------------------------");
1481
+ messages.push(getSeparator());
1480
1482
  }
1481
1483
  await session?.send(formatOutputMessage(messages.join("\n")));
1482
1484
  if (i < totalBatches - 1) {
@@ -1501,7 +1503,7 @@ function apply(ctx, config) {
1501
1503
  const { user, orders } = radiusUserInfo.data;
1502
1504
  const messages = [
1503
1505
  "🔐 RADIUS用户信息",
1504
- "--------------------------------",
1506
+ getSeparator(),
1505
1507
  `账号: ${user.login_name}`,
1506
1508
  // `密码: ${user.password}`,
1507
1509
  `状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
@@ -1511,7 +1513,7 @@ function apply(ctx, config) {
1511
1513
  `用户VLAN: ${user.user_vlan}`,
1512
1514
  "",
1513
1515
  "🛒 订购信息",
1514
- "--------------------------------"
1516
+ getSeparator()
1515
1517
  ];
1516
1518
  if (orders && orders.length > 0) {
1517
1519
  orders.forEach((order, index) => {
@@ -1529,7 +1531,7 @@ function apply(ctx, config) {
1529
1531
  } else {
1530
1532
  messages.push("无订购信息");
1531
1533
  }
1532
- messages.push("--------------------------------");
1534
+ messages.push(getSeparator());
1533
1535
  return messages.join("\n");
1534
1536
  } catch (error) {
1535
1537
  console.error("查询过程出错:", error);
@@ -1560,7 +1562,7 @@ function apply(ctx, config) {
1560
1562
  }, "buildBar");
1561
1563
  return [
1562
1564
  "📈 系统状态监控",
1563
- "--------------------------------",
1565
+ getSeparator(),
1564
1566
  `缓存命中率: ${hitRate}% ${buildBar(hitRate)}`,
1565
1567
  `缓存项数量: ${cacheStats.totalItems}项`,
1566
1568
  `缓存占用空间: 约 ${cacheStats.totalSize} KB`,
@@ -1568,7 +1570,7 @@ function apply(ctx, config) {
1568
1570
  `等待请求: ${waitingRequests}`,
1569
1571
  `消息队列: ${messageQueue.length}/${MAX_QUEUE_LENGTH} ${buildBar(messageQueueUtilization)}`,
1570
1572
  `处理状态: ${isProcessingMessage ? "正在处理" : "空闲"}`,
1571
- "--------------------------------"
1573
+ getSeparator()
1572
1574
  ].join("\n");
1573
1575
  }
1574
1576
  __name(getSystemStatus, "getSystemStatus");
@@ -1578,7 +1580,7 @@ function apply(ctx, config) {
1578
1580
  ctx.command("使用说明", "显示插件的使用方法和命令说明").alias("/使用说明").action(async ({ session }) => {
1579
1581
  const helpText = [
1580
1582
  "📋 JSCN小帮手使用说明",
1581
- "--------------------------------",
1583
+ getSeparator(),
1582
1584
  "命令格式:",
1583
1585
  " @JSCN小助手+命令+空格+带查询参数",
1584
1586
  "示例:",
@@ -1591,7 +1593,7 @@ function apply(ctx, config) {
1591
1593
  " 3. 命令与参数之间必须需要加空格!",
1592
1594
  "",
1593
1595
  "🔍 核心功能与命令(@JSCN小帮手之后再输入命令)",
1594
- "--------------------------------",
1596
+ getSeparator(),
1595
1597
  "1. 账号查询",
1596
1598
  " 命令:账号查询 [账号]",
1597
1599
  " 示例:账号查询 GDC8510019239048(账号不区分大小写)",
@@ -1618,7 +1620,7 @@ function apply(ctx, config) {
1618
1620
  " 示例:",
1619
1621
  " 输入 GDC8510019239048 → 触发账号查询",
1620
1622
  " 输入 00:11:22:33:44:55 → 触发终端查询",
1621
- "--------------------------------"
1623
+ getSeparator()
1622
1624
  ].join("\n");
1623
1625
  return formatOutputMessage(helpText);
1624
1626
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-jscn-aaaquery",
3
3
  "description": "江苏有线无锡分公司宽带信息查询插件",
4
- "version": "1.0.15",
4
+ "version": "1.0.16",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [