koishi-plugin-ggcevo-game 0.3.22 → 0.3.23
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 +0 -1
- package/lib/index.js +42 -13
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -149,16 +149,15 @@ function apply(ctx, config) {
|
|
|
149
149
|
lastSign: "timestamp"
|
|
150
150
|
}, {
|
|
151
151
|
// 额外配置
|
|
152
|
-
primary: "
|
|
152
|
+
primary: "handle"
|
|
153
153
|
});
|
|
154
154
|
ctx.model.extend("ggcevo_blacklist", {
|
|
155
155
|
// 各字段定义
|
|
156
|
-
userId: "string",
|
|
157
156
|
handle: "string",
|
|
158
157
|
createdAt: "timestamp"
|
|
159
158
|
}, {
|
|
160
159
|
// 额外配置
|
|
161
|
-
primary: "
|
|
160
|
+
primary: "handle"
|
|
162
161
|
});
|
|
163
162
|
const initDefaultItems = {
|
|
164
163
|
"咕咕币": { id: 1, type: "抽奖道具", description: "用于进行抽奖" },
|
|
@@ -240,6 +239,10 @@ function apply(ctx, config) {
|
|
|
240
239
|
}
|
|
241
240
|
const { regionId, realmId, profileId } = profile;
|
|
242
241
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
242
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
243
|
+
if (existingEntries.length > 0) {
|
|
244
|
+
return `${handle} 已被加入黑名单。`;
|
|
245
|
+
}
|
|
243
246
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
244
247
|
if (!backpack) {
|
|
245
248
|
return "您还没有进行过签到。";
|
|
@@ -275,6 +278,10 @@ function apply(ctx, config) {
|
|
|
275
278
|
}
|
|
276
279
|
const { regionId, realmId, profileId } = profile;
|
|
277
280
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
281
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
282
|
+
if (existingEntries.length > 0) {
|
|
283
|
+
return `${handle} 已被加入黑名单。`;
|
|
284
|
+
}
|
|
278
285
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
279
286
|
if (!backpack) {
|
|
280
287
|
return "您还没有进行过签到。";
|
|
@@ -304,6 +311,10 @@ function apply(ctx, config) {
|
|
|
304
311
|
}
|
|
305
312
|
const { regionId, realmId, profileId } = profile;
|
|
306
313
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
314
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
315
|
+
if (existingEntries.length > 0) {
|
|
316
|
+
return `${handle} 已被加入黑名单。`;
|
|
317
|
+
}
|
|
307
318
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
308
319
|
if (!backpack) {
|
|
309
320
|
return "您还没有进行过签到。";
|
|
@@ -374,6 +385,10 @@ ${itemDetails.join("\n")}`;
|
|
|
374
385
|
}
|
|
375
386
|
const { regionId, realmId, profileId } = profile;
|
|
376
387
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
388
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
389
|
+
if (existingEntries.length > 0) {
|
|
390
|
+
return `${handle} 已被加入黑名单。`;
|
|
391
|
+
}
|
|
377
392
|
if (config.signrequire) {
|
|
378
393
|
const getconfig = {
|
|
379
394
|
url: `https://api.sc2arcade.com/profiles/${regionId}/${realmId}/${profileId}/matches?orderDirection=desc`,
|
|
@@ -446,6 +461,10 @@ ${itemDetails.join("\n")}`;
|
|
|
446
461
|
if (!profile) return "您的 QQ 未绑定句柄。";
|
|
447
462
|
const { regionId, realmId, profileId } = profile;
|
|
448
463
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
464
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
465
|
+
if (existingEntries.length > 0) {
|
|
466
|
+
return `${handle} 已被加入黑名单。`;
|
|
467
|
+
}
|
|
449
468
|
const [record] = await ctx.database.get("ggcevo_sign", { handle });
|
|
450
469
|
if (!record) return "请先完成一次正常签到后再进行补签。";
|
|
451
470
|
const lastSignChina = convertUTCtoChinaTime(new Date(record.lastSign));
|
|
@@ -521,6 +540,10 @@ ${itemDetails.join("\n")}`;
|
|
|
521
540
|
if (!profile) return "您的 QQ 未绑定句柄。";
|
|
522
541
|
const { regionId, realmId, profileId } = profile;
|
|
523
542
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
543
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
544
|
+
if (existingEntries.length > 0) {
|
|
545
|
+
return `${handle} 已被加入黑名单。`;
|
|
546
|
+
}
|
|
524
547
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
525
548
|
if (!backpack) return "您还没有签到过哦";
|
|
526
549
|
const memberInfo = await session.event?.member?.roles;
|
|
@@ -564,6 +587,10 @@ ${itemDetails.join("\n")}`;
|
|
|
564
587
|
if (!profile) return "您的 QQ 未绑定句柄。";
|
|
565
588
|
const { regionId, realmId, profileId } = profile;
|
|
566
589
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
590
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
591
|
+
if (existingEntries.length > 0) {
|
|
592
|
+
return `${handle} 已被加入黑名单。`;
|
|
593
|
+
}
|
|
567
594
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
568
595
|
if (!backpack) return "您还没有签到过哦";
|
|
569
596
|
const [activity] = await ctx.database.get("ggcevo_activity", {
|
|
@@ -998,6 +1025,10 @@ ${items.join("、")}
|
|
|
998
1025
|
const name2 = await session.prompt(3e4);
|
|
999
1026
|
if (!name2) return "输入超时,请重新输入指令。";
|
|
1000
1027
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
1028
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
1029
|
+
if (existingEntries.length > 0) {
|
|
1030
|
+
return `${handle} 已被加入黑名单。`;
|
|
1031
|
+
}
|
|
1001
1032
|
const configname = itemConfig[name2];
|
|
1002
1033
|
if (!configname) return "无效的物品名称,请重新输入";
|
|
1003
1034
|
const userRecords = await ctx.database.get("ggcevo_exchange", { handle, item: name2 });
|
|
@@ -1079,6 +1110,10 @@ ${output}`;
|
|
|
1079
1110
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
1080
1111
|
if (!profile) return "您的 QQ 未绑定句柄";
|
|
1081
1112
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
1113
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
1114
|
+
if (existingEntries.length > 0) {
|
|
1115
|
+
return `${handle} 已被加入黑名单。`;
|
|
1116
|
+
}
|
|
1082
1117
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
|
|
1083
1118
|
const [coupon] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 2 });
|
|
1084
1119
|
if (!coupon || coupon.quantity < 3) {
|
|
@@ -1104,6 +1139,10 @@ ${output}`;
|
|
|
1104
1139
|
}
|
|
1105
1140
|
const { regionId, realmId, profileId } = profile;
|
|
1106
1141
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
1142
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
1143
|
+
if (existingEntries.length > 0) {
|
|
1144
|
+
return `${handle} 已被加入黑名单。`;
|
|
1145
|
+
}
|
|
1107
1146
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
|
|
1108
1147
|
if (!backpack || backpack.quantity < 1) {
|
|
1109
1148
|
return `当前扭蛋币不足,剩余:${backpack?.quantity || 0}枚`;
|
|
@@ -1137,21 +1176,11 @@ ${output}`;
|
|
|
1137
1176
|
if (!handleRegex.test(handle)) {
|
|
1138
1177
|
return "句柄格式错误,请重新输入";
|
|
1139
1178
|
}
|
|
1140
|
-
const [, regionId, realmId, profileId] = handle.match(handleRegex).map(Number);
|
|
1141
1179
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
1142
1180
|
if (existingEntries.length > 0) {
|
|
1143
1181
|
return `${handle} 已在黑名单中`;
|
|
1144
1182
|
}
|
|
1145
|
-
const [profile] = await ctx.database.get("sc2arcade_player", {
|
|
1146
|
-
regionId,
|
|
1147
|
-
realmId,
|
|
1148
|
-
profileId
|
|
1149
|
-
}, ["userId"]);
|
|
1150
|
-
if (!profile) {
|
|
1151
|
-
return `未找到与 ${handle} 绑定的QQ号`;
|
|
1152
|
-
}
|
|
1153
1183
|
await ctx.database.create("ggcevo_blacklist", {
|
|
1154
|
-
userId: profile.userId,
|
|
1155
1184
|
handle,
|
|
1156
1185
|
createdAt: /* @__PURE__ */ new Date()
|
|
1157
1186
|
});
|