koishi-plugin-ggcevo-game 1.0.6 → 1.0.7

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 +55 -12
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -881,16 +881,27 @@ ID:${activity.id}
881
881
  displayName: await checkSensitiveWord(item.name) ? item.name : (item.name[0] || "") + "***"
882
882
  }))
883
883
  );
884
+ const ggcmap = await ctx.database.get("sc2arcade_map", { guildId: config.ggcqun });
885
+ const lastdate = ggcmap[0].lastdate;
884
886
  const rankingText = processedRecords.map(
885
887
  (item, index) => `${offset + index + 1}. ${item.displayName} | 积分: ${item.rank} | 胜率: ${item.matches === 0 ? "0.00%" : (item.wins / item.matches * 100).toFixed(2) + "%"}`
886
888
  ).join("\n");
887
889
  return [
888
890
  `🏆 GGCEvo S1赛季胜点榜 🏆`,
889
- `本赛季从4月1日至5月15日23点结算`,
890
- `第 ${pageNum} 页 共 ${totalPages} 页`,
891
+ `本赛季从4月1日至5月15日23点`,
892
+ `数据同步时间: ${lastdate.toLocaleString("zh-CN", {
893
+ timeZone: "Asia/Shanghai",
894
+ year: "numeric",
895
+ month: "2-digit",
896
+ day: "2-digit",
897
+ hour: "2-digit",
898
+ minute: "2-digit",
899
+ hour12: false
900
+ })}`,
891
901
  "------------------------------",
892
902
  rankingText,
893
903
  "------------------------------",
904
+ `第 ${pageNum} 页 / 共 ${totalPages} 页`,
894
905
  pageNum < totalPages ? `输入 胜点榜 ${pageNum + 1} 查看下一页` : "已是最后一页"
895
906
  ].join("\n");
896
907
  });
@@ -1311,7 +1322,7 @@ ${achievementList.join("\n")}`;
1311
1322
  ──────────────`);
1312
1323
  const [sign] = await ctx.database.get("ggcevo_sign", { handle });
1313
1324
  if (sign) {
1314
- const chinaTime = sign.lastSign.toLocaleString("zh-CN", {
1325
+ const chinaTime = new Date(sign.lastSign).toLocaleString("zh-CN", {
1315
1326
  timeZone: "Asia/Shanghai",
1316
1327
  year: "numeric",
1317
1328
  month: "2-digit",
@@ -1339,22 +1350,54 @@ ${achievementList.join("\n")}`;
1339
1350
  "──────────────"
1340
1351
  );
1341
1352
  }
1342
- const [achievements] = await ctx.database.get("ggcevo_achievements", { handle });
1343
- if (achievements) {
1344
- output.push(
1345
- "🏆 已获成就:",
1346
- `${achievements.achievementname} (${achievements.gaintime.toLocaleDateString("zh-CN", {
1353
+ const achievements = await ctx.database.get("ggcevo_achievements", { handle });
1354
+ if (achievements.length) {
1355
+ output.push("🏆 最近成就:");
1356
+ achievements.sort((a, b) => {
1357
+ const aTime = new Date(a.gaintime).getTime();
1358
+ const bTime = new Date(b.gaintime).getTime();
1359
+ return bTime - aTime;
1360
+ }).slice(0, 3).forEach((ach) => {
1361
+ const time = new Date(ach.gaintime).toLocaleDateString("zh-CN", {
1347
1362
  timeZone: "Asia/Shanghai",
1348
1363
  year: "numeric",
1349
1364
  month: "2-digit",
1350
1365
  day: "2-digit"
1351
- })})`,
1366
+ });
1367
+ output.push(`├ ${ach.achievementname} (${time})`);
1368
+ });
1369
+ output.push(
1370
+ `└ 共获得 ${achievements.length} 个成就`,
1352
1371
  "──────────────"
1353
1372
  );
1354
1373
  }
1355
- const sections = [sign, lottery, achievements].filter(Boolean).length;
1356
- output.push(`共查询到 ${sections} 项个人信息`);
1357
- return output.flat().join("\n");
1374
+ const exchanges = await ctx.database.get("ggcevo_exchange", { handle });
1375
+ if (exchanges.length) {
1376
+ output.push("📜 兑换记录:");
1377
+ exchanges.sort((a, b) => {
1378
+ const aTime = new Date(a.date).getTime();
1379
+ const bTime = new Date(b.date).getTime();
1380
+ return bTime - aTime;
1381
+ }).forEach((e, index) => {
1382
+ const date = new Date(e.date).toLocaleString("zh-CN", {
1383
+ timeZone: "Asia/Shanghai",
1384
+ year: "numeric",
1385
+ month: "2-digit",
1386
+ day: "2-digit"
1387
+ });
1388
+ const symbol = index === exchanges.length - 1 ? "└" : "├";
1389
+ output.push(`${symbol} [${e.type}] ${e.item} (${date})`);
1390
+ });
1391
+ output.push("──────────────");
1392
+ }
1393
+ const existModules = [
1394
+ sign && "签到",
1395
+ lottery && "抽奖",
1396
+ achievements.length && "成就",
1397
+ exchanges.length && "兑换"
1398
+ ].filter(Boolean);
1399
+ output.push(`📊 共查询到 ${existModules.length} 类信息`);
1400
+ return output.join("\n");
1358
1401
  });
1359
1402
  }
1360
1403
  __name(apply, "apply");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "星际争霸2游戏大厅咕咕虫-Evo地图专属插件",
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [