koishi-plugin-ggcevo-game 0.4.6 → 0.4.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 +10 -6
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -839,11 +839,12 @@ ID:${activity.id}
839
839
  (item, index) => `${offset + index + 1}. ${item.displayName} | 积分: ${item.rank} | 参赛: ${item.matches} 次`
840
840
  ).join("\n");
841
841
  return [
842
- `🏆 GGCEvo 胜点榜 第 ${pageNum} 页 / 共 ${totalPages} 页 🏆`,
842
+ `🏆 GGCEvo 胜点榜 🏆`,
843
+ `第 ${pageNum} 页 共 ${totalPages} 页`,
843
844
  "------------------------------",
844
845
  rankingText,
845
846
  "------------------------------",
846
- pageNum < totalPages ? `输入“胜点榜 ${pageNum + 1}”查看下一页` : "已是最后一页"
847
+ pageNum < totalPages ? `输入 胜点榜 ${pageNum + 1} 查看下一页` : "已是最后一页"
847
848
  ].join("\n");
848
849
  });
849
850
  ctx.command("ggcevo/排名 [player]", "查询个人排名").alias("rank").usage("输入“排名”查看自己的排名信息").action(async (argv, player) => {
@@ -929,8 +930,10 @@ ID:${activity.id}
929
930
  return "操作失败,请稍后再试";
930
931
  }
931
932
  });
932
- ctx.command("ggcevo/违规记录 [page] [user]", "违规记录查询").usage("输入 违规记录 [页码] 查看你的处罚记录,每页1条").action(async (argv, page, user) => {
933
+ ctx.command("ggcevo/违规记录 [user]", "违规记录查询").usage("输入 违规记录 [@用户] -p 页码 查看处罚记录,每页1条").option("p", "-p <page:number> 指定页码").action(async (argv) => {
933
934
  const session = argv.session;
935
+ const pageNum = argv.options.p ? argv.options.p : 1;
936
+ const user = argv.args[0];
934
937
  let handle;
935
938
  if (!user) {
936
939
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
@@ -950,8 +953,8 @@ ID:${activity.id}
950
953
  const { regionId, realmId, profileId } = profile;
951
954
  handle = `${regionId}-S2-${realmId}-${profileId}`;
952
955
  }
953
- const pageNum = parseInt(page) || 1;
954
956
  if (pageNum < 1) return "请输入有效的页码。";
957
+ const totalPages = await ctx.database.select("ggcevo_Punishment").where({ handle }).execute((row) => import_koishi.$.count(row.id));
955
958
  const records = await ctx.database.select("ggcevo_Punishment").where({ handle }).orderBy("id", "desc").limit(1).offset(pageNum - 1).execute();
956
959
  if (!records.length) {
957
960
  return pageNum === 1 ? `【${handle}】暂无违规记录` : `【${handle}】第 ${pageNum} 条记录不存在`;
@@ -972,11 +975,12 @@ ID:${activity.id}
972
975
  return finalText;
973
976
  }).join("\n------------------------------\n");
974
977
  return [
975
- `🚨 违规记录 第 ${pageNum} 条 🚨`,
978
+ `🚨 违规记录 🚨`,
979
+ `第 ${pageNum} 条 共 ${totalPages} 条`,
976
980
  "------------------------------",
977
981
  recordText,
978
982
  "------------------------------",
979
- `输入 违规记录 ${pageNum + 1} 查看下一条`
983
+ pageNum < totalPages ? `输入 违规记录 -p ${pageNum + 1} 查看下一条` : "已是最后一页"
980
984
  ].join("\n");
981
985
  });
982
986
  const itemConfig = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "星际争霸2游戏大厅咕咕虫-Evo地图专属插件",
4
- "version": "0.4.6",
4
+ "version": "0.4.7",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -17,7 +17,7 @@
17
17
  "peerDependencies": {
18
18
  "koishi": "^4.18.7",
19
19
  "@koishijs/plugin-proxy-agent": "^0.3.3",
20
- "koishi-plugin-sc2arcade-search": "^0.3.4"
20
+ "koishi-plugin-sc2arcade-search": "^1.0.3"
21
21
  },
22
22
  "koishi": {
23
23
  "service": {