koishi-plugin-ggcevo-game 0.3.21 → 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 -15
- 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));
|
|
@@ -453,8 +472,6 @@ ${itemDetails.join("\n")}`;
|
|
|
453
472
|
targetDateChina.setDate(targetDateChina.getDate() + 1);
|
|
454
473
|
const targetDateUTC = new Date(targetDateChina.getTime() - 8 * 60 * 60 * 1e3);
|
|
455
474
|
const nowChina = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
|
|
456
|
-
console.log(targetDateChina);
|
|
457
|
-
console.log(nowChina);
|
|
458
475
|
if (isSameDate(targetDateChina, nowChina)) {
|
|
459
476
|
return "您需要补签的日期是今天,请进行正常签到。";
|
|
460
477
|
}
|
|
@@ -523,6 +540,10 @@ ${itemDetails.join("\n")}`;
|
|
|
523
540
|
if (!profile) return "您的 QQ 未绑定句柄。";
|
|
524
541
|
const { regionId, realmId, profileId } = profile;
|
|
525
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
|
+
}
|
|
526
547
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
527
548
|
if (!backpack) return "您还没有签到过哦";
|
|
528
549
|
const memberInfo = await session.event?.member?.roles;
|
|
@@ -566,6 +587,10 @@ ${itemDetails.join("\n")}`;
|
|
|
566
587
|
if (!profile) return "您的 QQ 未绑定句柄。";
|
|
567
588
|
const { regionId, realmId, profileId } = profile;
|
|
568
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
|
+
}
|
|
569
594
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
570
595
|
if (!backpack) return "您还没有签到过哦";
|
|
571
596
|
const [activity] = await ctx.database.get("ggcevo_activity", {
|
|
@@ -1000,6 +1025,10 @@ ${items.join("、")}
|
|
|
1000
1025
|
const name2 = await session.prompt(3e4);
|
|
1001
1026
|
if (!name2) return "输入超时,请重新输入指令。";
|
|
1002
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
|
+
}
|
|
1003
1032
|
const configname = itemConfig[name2];
|
|
1004
1033
|
if (!configname) return "无效的物品名称,请重新输入";
|
|
1005
1034
|
const userRecords = await ctx.database.get("ggcevo_exchange", { handle, item: name2 });
|
|
@@ -1081,6 +1110,10 @@ ${output}`;
|
|
|
1081
1110
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
1082
1111
|
if (!profile) return "您的 QQ 未绑定句柄";
|
|
1083
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
|
+
}
|
|
1084
1117
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
|
|
1085
1118
|
const [coupon] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 2 });
|
|
1086
1119
|
if (!coupon || coupon.quantity < 3) {
|
|
@@ -1106,6 +1139,10 @@ ${output}`;
|
|
|
1106
1139
|
}
|
|
1107
1140
|
const { regionId, realmId, profileId } = profile;
|
|
1108
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
|
+
}
|
|
1109
1146
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
|
|
1110
1147
|
if (!backpack || backpack.quantity < 1) {
|
|
1111
1148
|
return `当前扭蛋币不足,剩余:${backpack?.quantity || 0}枚`;
|
|
@@ -1139,21 +1176,11 @@ ${output}`;
|
|
|
1139
1176
|
if (!handleRegex.test(handle)) {
|
|
1140
1177
|
return "句柄格式错误,请重新输入";
|
|
1141
1178
|
}
|
|
1142
|
-
const [, regionId, realmId, profileId] = handle.match(handleRegex).map(Number);
|
|
1143
1179
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
1144
1180
|
if (existingEntries.length > 0) {
|
|
1145
1181
|
return `${handle} 已在黑名单中`;
|
|
1146
1182
|
}
|
|
1147
|
-
const [profile] = await ctx.database.get("sc2arcade_player", {
|
|
1148
|
-
regionId,
|
|
1149
|
-
realmId,
|
|
1150
|
-
profileId
|
|
1151
|
-
}, ["userId"]);
|
|
1152
|
-
if (!profile) {
|
|
1153
|
-
return `未找到与 ${handle} 绑定的QQ号`;
|
|
1154
|
-
}
|
|
1155
1183
|
await ctx.database.create("ggcevo_blacklist", {
|
|
1156
|
-
userId: profile.userId,
|
|
1157
1184
|
handle,
|
|
1158
1185
|
createdAt: /* @__PURE__ */ new Date()
|
|
1159
1186
|
});
|