koishi-plugin-ggcevo-game 0.4.8 → 0.4.9

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/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface Config {
7
7
  signrequire: boolean;
8
8
  autorank: boolean;
9
9
  ignoreGlobalLimit: boolean;
10
+ admins: string[];
10
11
  }
11
12
  export declare const Config: Schema<Config>;
12
13
  export declare const inject: {
package/lib/index.js CHANGED
@@ -34,7 +34,8 @@ var Config = import_koishi.Schema.object({
34
34
  ggcqun: import_koishi.Schema.string().description("开启咕咕虫排行榜的群组").required(),
35
35
  signrequire: import_koishi.Schema.boolean().description("是否开启签到要求进行一场游戏").default(true),
36
36
  autorank: import_koishi.Schema.boolean().description("是否开启每小时自动同步rank数据").default(true),
37
- ignoreGlobalLimit: import_koishi.Schema.boolean().description("是否开启无限制兑换").default(false)
37
+ ignoreGlobalLimit: import_koishi.Schema.boolean().description("是否开启无限制兑换").default(false),
38
+ admins: import_koishi.Schema.array(import_koishi.Schema.string()).description("管理员QQ号列表,支持配置多个").default([]).role("table")
38
39
  });
39
40
  var inject = {
40
41
  required: ["database"]
@@ -239,7 +240,7 @@ function apply(ctx, config) {
239
240
  const handle = `${regionId}-S2-${realmId}-${profileId}`;
240
241
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
241
242
  if (existingEntries.length > 0) {
242
- return `${handle} 已被加入黑名单。`;
243
+ return `❌拒绝访问,您已被列入活动黑名单。`;
243
244
  }
244
245
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
245
246
  if (!backpack) {
@@ -278,7 +279,7 @@ function apply(ctx, config) {
278
279
  const handle = `${regionId}-S2-${realmId}-${profileId}`;
279
280
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
280
281
  if (existingEntries.length > 0) {
281
- return `${handle} 已被加入黑名单。`;
282
+ return `❌拒绝访问,您已被列入活动黑名单。`;
282
283
  }
283
284
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
284
285
  if (!backpack) {
@@ -311,7 +312,7 @@ function apply(ctx, config) {
311
312
  const handle = `${regionId}-S2-${realmId}-${profileId}`;
312
313
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
313
314
  if (existingEntries.length > 0) {
314
- return `${handle} 已被加入黑名单。`;
315
+ return `❌拒绝访问,您已被列入活动黑名单。`;
315
316
  }
316
317
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
317
318
  if (!backpack) {
@@ -385,7 +386,7 @@ ${itemDetails.join("\n")}`;
385
386
  const handle = `${regionId}-S2-${realmId}-${profileId}`;
386
387
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
387
388
  if (existingEntries.length > 0) {
388
- return `${handle} 已被加入黑名单。`;
389
+ return `❌拒绝访问,您已被列入活动黑名单。`;
389
390
  }
390
391
  if (config.signrequire) {
391
392
  const getconfig = {
@@ -461,7 +462,7 @@ ${itemDetails.join("\n")}`;
461
462
  const handle = `${regionId}-S2-${realmId}-${profileId}`;
462
463
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
463
464
  if (existingEntries.length > 0) {
464
- return `${handle} 已被加入黑名单。`;
465
+ return `❌拒绝访问,您已被列入活动黑名单。`;
465
466
  }
466
467
  const [record] = await ctx.database.get("ggcevo_sign", { handle });
467
468
  if (!record) return "请先完成一次正常签到后再进行补签。";
@@ -540,7 +541,7 @@ ${itemDetails.join("\n")}`;
540
541
  const handle = `${regionId}-S2-${realmId}-${profileId}`;
541
542
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
542
543
  if (existingEntries.length > 0) {
543
- return `${handle} 已被加入黑名单。`;
544
+ return `❌拒绝访问,您已被列入活动黑名单。`;
544
545
  }
545
546
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
546
547
  if (!backpack) return "您还没有签到过哦";
@@ -587,7 +588,7 @@ ${itemDetails.join("\n")}`;
587
588
  const handle = `${regionId}-S2-${realmId}-${profileId}`;
588
589
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
589
590
  if (existingEntries.length > 0) {
590
- return `${handle} 已被加入黑名单。`;
591
+ return `❌拒绝访问,您已被列入活动黑名单。`;
591
592
  }
592
593
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
593
594
  if (!backpack) return "您还没有签到过哦";
@@ -844,7 +845,7 @@ ID:${activity.id}
844
845
  (item, index) => `${offset + index + 1}. ${item.displayName} | 积分: ${item.rank} | 参赛: ${item.matches} 次`
845
846
  ).join("\n");
846
847
  return [
847
- `🏆 GGCEvo 胜点榜 🏆`,
848
+ `🏆 GGCEvo 胜点榜 (S1赛季至3月31日结算) 🏆`,
848
849
  `第 ${pageNum} 页 共 ${totalPages} 页`,
849
850
  "------------------------------",
850
851
  rankingText,
@@ -866,7 +867,7 @@ ID:${activity.id}
866
867
  profileId
867
868
  });
868
869
  if (!user) return "未找到您的排名信息。";
869
- if (user.Blacklist) return "您已经被禁止参加胜点榜。";
870
+ if (user.Blacklist) return "❌您已经被禁止参加本赛季胜点榜。";
870
871
  const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").execute();
871
872
  const userRank = allRanks.findIndex(
872
873
  (u) => u.regionId === regionId && u.realmId === realmId && u.profileId === profileId
@@ -899,7 +900,7 @@ ID:${activity.id}
899
900
  profileId
900
901
  });
901
902
  if (!user) return "未找到他/她的排名信息。";
902
- if (user.Blacklist) return "他/她已经被禁止参加胜点榜。";
903
+ if (user.Blacklist) return "❌他/她已经被禁止参加本赛季胜点榜。";
903
904
  const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").execute();
904
905
  const userRank = allRanks.findIndex(
905
906
  (u) => u.regionId === regionId && u.realmId === realmId && u.profileId === profileId
@@ -1039,7 +1040,7 @@ ${items.join("、")}
1039
1040
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
1040
1041
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
1041
1042
  if (existingEntries.length > 0) {
1042
- return `${handle} 已被加入黑名单。`;
1043
+ return `❌拒绝访问,您已被列入活动黑名单。`;
1043
1044
  }
1044
1045
  const configname = itemConfig[name2];
1045
1046
  if (!configname) return "无效的物品名称,请重新输入";
@@ -1127,7 +1128,7 @@ ${output}`;
1127
1128
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
1128
1129
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
1129
1130
  if (existingEntries.length > 0) {
1130
- return `${handle} 已被加入黑名单。`;
1131
+ return `❌拒绝访问,您已被列入活动黑名单。`;
1131
1132
  }
1132
1133
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
1133
1134
  const [coupon] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 2 });
@@ -1156,7 +1157,7 @@ ${output}`;
1156
1157
  const handle = `${regionId}-S2-${realmId}-${profileId}`;
1157
1158
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
1158
1159
  if (existingEntries.length > 0) {
1159
- return `${handle} 已被加入黑名单。`;
1160
+ return `❌拒绝访问,您已被列入活动黑名单。`;
1160
1161
  }
1161
1162
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
1162
1163
  if (!backpack || backpack.quantity < 1) {
@@ -1184,8 +1185,14 @@ ${output}`;
1184
1185
  }]);
1185
1186
  return `🎉 恭喜获得:${itemName}`;
1186
1187
  });
1187
- ctx.command("ggcevo/拉黑 <handle>", "添加用户到黑名单", { authority: 3 }).action(async (_, handle) => {
1188
- if (!handle) return "请指定需要拉黑的用户";
1188
+ ctx.command("ggcevo/活动拉黑", "添加用户到活动黑名单").action(async (argv) => {
1189
+ const session = argv.session;
1190
+ if (!ctx.config.admins.includes(session.userId)) {
1191
+ return "⚠️ 没有操作权限,请联系机器人管理员";
1192
+ }
1193
+ await session.send("请在30秒内输入需要拉黑的句柄:\n(句柄格式为: [区域ID]-S2-[服务器ID]-[档案ID])");
1194
+ const handle = await session.prompt(3e4);
1195
+ if (!handle) return "输入超时,请重新输入指令。";
1189
1196
  try {
1190
1197
  const handleRegex = /^([1235])-S2-([12])-(\d+)$/;
1191
1198
  if (!handleRegex.test(handle)) {
@@ -1193,13 +1200,43 @@ ${output}`;
1193
1200
  }
1194
1201
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
1195
1202
  if (existingEntries.length > 0) {
1196
- return `${handle} 已在黑名单中`;
1203
+ return `${handle} 已在活动黑名单中`;
1197
1204
  }
1198
1205
  await ctx.database.create("ggcevo_blacklist", {
1199
1206
  handle,
1200
1207
  createdAt: /* @__PURE__ */ new Date()
1201
1208
  });
1202
- return `✅ 用户 ${handle} 已被列入黑名单`;
1209
+ return `✅ 用户 ${handle} 已被列入活动黑名单(永久)`;
1210
+ } catch (error) {
1211
+ console.error("黑名单操作失败:", error);
1212
+ return "操作失败,请稍后重试。错误详情已记录";
1213
+ }
1214
+ });
1215
+ ctx.command("ggcevo/胜点榜拉黑", "添加用户到胜点榜黑名单").action(async (argv) => {
1216
+ const session = argv.session;
1217
+ if (!ctx.config.admins.includes(session.userId)) {
1218
+ return "⚠️ 没有操作权限,请联系机器人管理员";
1219
+ }
1220
+ await session.send("请在30秒内输入需要拉黑的句柄:\n(句柄格式为: [区域ID]-S2-[服务器ID]-[档案ID])");
1221
+ const handle = await session.prompt(3e4);
1222
+ if (!handle) return "输入超时,请重新输入指令。";
1223
+ try {
1224
+ const handleRegex = /^([1235])-S2-([12])-(\d+)$/;
1225
+ if (!handleRegex.test(handle)) {
1226
+ return "句柄格式错误,请重新输入";
1227
+ }
1228
+ const [, regionId, realmId, profileId] = handle.match(handleRegex).map(Number);
1229
+ const existingEntries = await ctx.database.get("ggcevo_rank", { regionId, realmId, profileId, Blacklist: true });
1230
+ if (existingEntries.length > 0) {
1231
+ return `${handle} 已在胜点榜黑名单中`;
1232
+ }
1233
+ await ctx.database.upsert("ggcevo_rank", [{
1234
+ regionId,
1235
+ realmId,
1236
+ profileId,
1237
+ Blacklist: true
1238
+ }]);
1239
+ return `✅ 用户 ${handle} 已被列入胜点榜黑名单(仅限当前赛季)`;
1203
1240
  } catch (error) {
1204
1241
  console.error("黑名单操作失败:", error);
1205
1242
  return "操作失败,请稍后重试。错误详情已记录";
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.8",
4
+ "version": "0.4.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [