koishi-plugin-ggcevo 1.0.2 → 1.0.3

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 (3) hide show
  1. package/lib/index.js +53 -0
  2. package/package.json +1 -1
  3. package/readme.md +10 -0
package/lib/index.js CHANGED
@@ -435,6 +435,59 @@ ${message}
435
435
  return "⚠️ 服务器繁忙, 请稍后尝试。";
436
436
  }
437
437
  });
438
+ ctx.command("sc2arcade/地图检测", "查询已配置的地图详细信息").action(async (argv) => {
439
+ if (!config.mapMonitorEnabled || config.mapMonitorMapIds.length === 0) {
440
+ return `<quote id="${argv.session.messageId}"/>⚠️ 地图检测功能未开启或未配置地图ID。`;
441
+ }
442
+ try {
443
+ const response = await ctx.http.get("https://server.dreamprotocol.info:13085/mapmonitor/maps");
444
+ const maps = response.maps || [];
445
+ const targetMaps = maps.filter((m) => config.mapMonitorMapIds.includes(m.mapId));
446
+ if (targetMaps.length === 0) {
447
+ return `<quote id="${argv.session.messageId}"/>📭 未找到已配置的地图信息。`;
448
+ }
449
+ const fieldLabels = {
450
+ mapName: "地图名称",
451
+ isOnline: "在线状态",
452
+ lastStatusChangeTime: "最后状态变更时间",
453
+ offlineCountLast24h: "24h内离线次数",
454
+ offlineCountLast30d: "30d内离线次数",
455
+ recentEvents: "近期事件"
456
+ };
457
+ const timeFields = ["lastStatusChangeTime"];
458
+ const messages = targetMaps.map((mapData) => {
459
+ const lines = [];
460
+ lines.push("━━━━━━━━━━━━━━━━");
461
+ lines.push(`📋 ${mapData.mapName || "未知地图"} (ID: ${mapData.mapId})`);
462
+ for (const key of Object.keys(mapData)) {
463
+ if (key === "mapId" || key === "mapName") continue;
464
+ if (key === "lastCheckTime" || key === "firstSeenTime" || key === "popularityRank") continue;
465
+ const value = mapData[key];
466
+ if (value !== null && value !== void 0 && value !== "") {
467
+ const label = fieldLabels[key] || key;
468
+ let displayValue;
469
+ if (key === "isOnline") {
470
+ displayValue = value ? "🟢 在线" : "🔴 离线";
471
+ } else if (key === "recentEvents") {
472
+ displayValue = formatRecentEvents(value);
473
+ } else if (timeFields.includes(key)) {
474
+ displayValue = toBeijingTime(value);
475
+ } else if (typeof value === "object") {
476
+ displayValue = JSON.stringify(value);
477
+ } else {
478
+ displayValue = String(value);
479
+ }
480
+ lines.push(` ${label}: ${displayValue}`);
481
+ }
482
+ }
483
+ return lines.join("\n");
484
+ });
485
+ return `<quote id="${argv.session.messageId}"/>${messages.join("\n")}`;
486
+ } catch (error) {
487
+ console.error("查询地图检测信息失败:", error);
488
+ return "⚠️ 服务器繁忙, 请稍后尝试。";
489
+ }
490
+ });
438
491
  ctx.command("ggcevo/签到").action(async (argv) => {
439
492
  const session = argv.session;
440
493
  const handle = await getHandle(session);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo",
3
3
  "description": "GGCEVO 综合插件:星际争霸2游戏句柄绑定 + 签到/抽奖/兑换/背包/活动系统等虚拟物品玩法",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md CHANGED
@@ -36,6 +36,7 @@ npm install koishi-plugin-ggcevo
36
36
  | `切换 [index]` | — | 切换正在使用的游戏句柄 |
37
37
  | `查询 [handle]` | — | 查询某游戏句柄是否已被绑定 |
38
38
  | `解绑 [index]` | 解绑句柄 | 解除绑定某个游戏句柄 |
39
+ | `地图检测` | — | 查询已配置地图(`mapMonitorMapIds`)的检测状态:在线状态、最后状态变更时间、24h/30d离线次数、近期事件。需开启 `mapMonitorEnabled` 且配置地图ID |
39
40
 
40
41
  ### 签到与虚拟物品(ggcevo)
41
42
 
@@ -94,6 +95,15 @@ npm install koishi-plugin-ggcevo
94
95
 
95
96
  ## 更新日志
96
97
 
98
+ ### v1.0.3
99
+
100
+ - 复原「地图检测」指令(命名空间 `sc2arcade/地图检测`),查询已配置地图的检测状态(在线状态、最后状态变更时间、24h/30d 离线次数、近期事件)。原被删除的是「地图检测调试」指令,本次仅复原正常地图检测指令。
101
+ - 清理未使用的工具函数:`profilesMatches`、`profilesMostPlayed`、`mapsplayerbase`、`lobbiesActive`、`lobbiesHistory`、`convertDateTimeFormat`、`makeHttpRequest`。
102
+
103
+ ### v1.0.2
104
+
105
+ - 移除未使用的 `sc2arcade_map` 数据库模型及相关代码(该表无任何调用)。
106
+
97
107
  ### v1.0.1
98
108
 
99
109
  - 移除绑定句柄时的在线检测判定(不再调用 `api.sc2arcade.com` 校验句柄是否存在),仅保留本地重复绑定校验。