koishi-plugin-ggcevo-game 0.4.8 → 0.4.10
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 +1 -0
- package/lib/index.js +56 -18
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,8 @@ 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赛季胜点榜 🏆`,
|
|
849
|
+
`本赛季至3月31日23点结算`,
|
|
848
850
|
`第 ${pageNum} 页 共 ${totalPages} 页`,
|
|
849
851
|
"------------------------------",
|
|
850
852
|
rankingText,
|
|
@@ -866,7 +868,7 @@ ID:${activity.id}
|
|
|
866
868
|
profileId
|
|
867
869
|
});
|
|
868
870
|
if (!user) return "未找到您的排名信息。";
|
|
869
|
-
if (user.Blacklist) return "
|
|
871
|
+
if (user.Blacklist) return "❌您已经被禁止参加本赛季胜点榜。";
|
|
870
872
|
const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").execute();
|
|
871
873
|
const userRank = allRanks.findIndex(
|
|
872
874
|
(u) => u.regionId === regionId && u.realmId === realmId && u.profileId === profileId
|
|
@@ -899,7 +901,7 @@ ID:${activity.id}
|
|
|
899
901
|
profileId
|
|
900
902
|
});
|
|
901
903
|
if (!user) return "未找到他/她的排名信息。";
|
|
902
|
-
if (user.Blacklist) return "
|
|
904
|
+
if (user.Blacklist) return "❌他/她已经被禁止参加本赛季胜点榜。";
|
|
903
905
|
const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").execute();
|
|
904
906
|
const userRank = allRanks.findIndex(
|
|
905
907
|
(u) => u.regionId === regionId && u.realmId === realmId && u.profileId === profileId
|
|
@@ -1039,7 +1041,7 @@ ${items.join("、")}
|
|
|
1039
1041
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
1040
1042
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
1041
1043
|
if (existingEntries.length > 0) {
|
|
1042
|
-
return
|
|
1044
|
+
return `❌拒绝访问,您已被列入活动黑名单。`;
|
|
1043
1045
|
}
|
|
1044
1046
|
const configname = itemConfig[name2];
|
|
1045
1047
|
if (!configname) return "无效的物品名称,请重新输入";
|
|
@@ -1127,7 +1129,7 @@ ${output}`;
|
|
|
1127
1129
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
1128
1130
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
1129
1131
|
if (existingEntries.length > 0) {
|
|
1130
|
-
return
|
|
1132
|
+
return `❌拒绝访问,您已被列入活动黑名单。`;
|
|
1131
1133
|
}
|
|
1132
1134
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
|
|
1133
1135
|
const [coupon] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 2 });
|
|
@@ -1156,7 +1158,7 @@ ${output}`;
|
|
|
1156
1158
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
1157
1159
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
1158
1160
|
if (existingEntries.length > 0) {
|
|
1159
|
-
return
|
|
1161
|
+
return `❌拒绝访问,您已被列入活动黑名单。`;
|
|
1160
1162
|
}
|
|
1161
1163
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
|
|
1162
1164
|
if (!backpack || backpack.quantity < 1) {
|
|
@@ -1184,8 +1186,14 @@ ${output}`;
|
|
|
1184
1186
|
}]);
|
|
1185
1187
|
return `🎉 恭喜获得:${itemName}`;
|
|
1186
1188
|
});
|
|
1187
|
-
ctx.command("ggcevo
|
|
1188
|
-
|
|
1189
|
+
ctx.command("ggcevo/活动拉黑", "添加用户到活动黑名单").action(async (argv) => {
|
|
1190
|
+
const session = argv.session;
|
|
1191
|
+
if (!ctx.config.admins.includes(session.userId)) {
|
|
1192
|
+
return "⚠️ 没有操作权限,请联系机器人管理员";
|
|
1193
|
+
}
|
|
1194
|
+
await session.send("请在30秒内输入需要拉黑的句柄:\n(句柄格式为: [区域ID]-S2-[服务器ID]-[档案ID])");
|
|
1195
|
+
const handle = await session.prompt(3e4);
|
|
1196
|
+
if (!handle) return "输入超时,请重新输入指令。";
|
|
1189
1197
|
try {
|
|
1190
1198
|
const handleRegex = /^([1235])-S2-([12])-(\d+)$/;
|
|
1191
1199
|
if (!handleRegex.test(handle)) {
|
|
@@ -1193,13 +1201,43 @@ ${output}`;
|
|
|
1193
1201
|
}
|
|
1194
1202
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
1195
1203
|
if (existingEntries.length > 0) {
|
|
1196
|
-
return `${handle}
|
|
1204
|
+
return `${handle} 已在活动黑名单中`;
|
|
1197
1205
|
}
|
|
1198
1206
|
await ctx.database.create("ggcevo_blacklist", {
|
|
1199
1207
|
handle,
|
|
1200
1208
|
createdAt: /* @__PURE__ */ new Date()
|
|
1201
1209
|
});
|
|
1202
|
-
return `✅ 用户 ${handle}
|
|
1210
|
+
return `✅ 用户 ${handle} 已被列入活动黑名单(永久)`;
|
|
1211
|
+
} catch (error) {
|
|
1212
|
+
console.error("黑名单操作失败:", error);
|
|
1213
|
+
return "操作失败,请稍后重试。错误详情已记录";
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1216
|
+
ctx.command("ggcevo/胜点榜拉黑", "添加用户到胜点榜黑名单").action(async (argv) => {
|
|
1217
|
+
const session = argv.session;
|
|
1218
|
+
if (!ctx.config.admins.includes(session.userId)) {
|
|
1219
|
+
return "⚠️ 没有操作权限,请联系机器人管理员";
|
|
1220
|
+
}
|
|
1221
|
+
await session.send("请在30秒内输入需要拉黑的句柄:\n(句柄格式为: [区域ID]-S2-[服务器ID]-[档案ID])");
|
|
1222
|
+
const handle = await session.prompt(3e4);
|
|
1223
|
+
if (!handle) return "输入超时,请重新输入指令。";
|
|
1224
|
+
try {
|
|
1225
|
+
const handleRegex = /^([1235])-S2-([12])-(\d+)$/;
|
|
1226
|
+
if (!handleRegex.test(handle)) {
|
|
1227
|
+
return "句柄格式错误,请重新输入";
|
|
1228
|
+
}
|
|
1229
|
+
const [, regionId, realmId, profileId] = handle.match(handleRegex).map(Number);
|
|
1230
|
+
const existingEntries = await ctx.database.get("ggcevo_rank", { regionId, realmId, profileId, Blacklist: true });
|
|
1231
|
+
if (existingEntries.length > 0) {
|
|
1232
|
+
return `${handle} 已在胜点榜黑名单中`;
|
|
1233
|
+
}
|
|
1234
|
+
await ctx.database.upsert("ggcevo_rank", [{
|
|
1235
|
+
regionId,
|
|
1236
|
+
realmId,
|
|
1237
|
+
profileId,
|
|
1238
|
+
Blacklist: true
|
|
1239
|
+
}]);
|
|
1240
|
+
return `✅ 用户 ${handle} 已被列入胜点榜黑名单(仅限当前赛季)`;
|
|
1203
1241
|
} catch (error) {
|
|
1204
1242
|
console.error("黑名单操作失败:", error);
|
|
1205
1243
|
return "操作失败,请稍后重试。错误详情已记录";
|