koishi-plugin-noah 2.3.7 → 2.4.0

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.cjs CHANGED
@@ -337,12 +337,54 @@ __export(core_exports, {
337
337
  });
338
338
  var import_koishi6 = require("koishi");
339
339
 
340
- // src/core/command.ts
341
- var command_exports = {};
342
- __export(command_exports, {
343
- apply: () => apply2,
344
- name: () => name2
345
- });
340
+ // src/core/api/auth.ts
341
+ var crypto = __toESM(require("crypto"), 1);
342
+ function resolveApiContext(config) {
343
+ return {
344
+ secret: crypto.randomBytes(32).toString("hex"),
345
+ tokenTtl: config.tokenTtl ?? 1800,
346
+ frontendUrl: config.frontendUrl ?? "",
347
+ corsOrigin: config.corsOrigin ?? "*"
348
+ };
349
+ }
350
+ __name(resolveApiContext, "resolveApiContext");
351
+ var ALG = "sha256";
352
+ function base64url(data) {
353
+ const buf = typeof data === "string" ? Buffer.from(data) : data;
354
+ return buf.toString("base64url");
355
+ }
356
+ __name(base64url, "base64url");
357
+ function sign(payload, secret) {
358
+ const header = base64url(JSON.stringify({ alg: "HS256", typ: "JWT" }));
359
+ const body = base64url(payload);
360
+ const signature = crypto.createHmac(ALG, secret).update(`${header}.${body}`).digest("base64url");
361
+ return `${header}.${body}.${signature}`;
362
+ }
363
+ __name(sign, "sign");
364
+ function createToken(uid, secret, ttlSeconds = 1800) {
365
+ const now = Math.floor(Date.now() / 1e3);
366
+ const payload = { uid, iat: now, exp: now + ttlSeconds };
367
+ return sign(JSON.stringify(payload), secret);
368
+ }
369
+ __name(createToken, "createToken");
370
+ function verifyToken(token, secret) {
371
+ const parts = token.split(".");
372
+ if (parts.length !== 3) return null;
373
+ const [header, body, signature] = parts;
374
+ const expected = crypto.createHmac(ALG, secret).update(`${header}.${body}`).digest("base64url");
375
+ if (!crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))) return null;
376
+ try {
377
+ const payload = JSON.parse(Buffer.from(body, "base64url").toString());
378
+ if (payload.exp < Math.floor(Date.now() / 1e3)) return null;
379
+ return payload;
380
+ } catch {
381
+ return null;
382
+ }
383
+ }
384
+ __name(verifyToken, "verifyToken");
385
+
386
+ // src/types/index.ts
387
+ var serverValues = ["asphyxia", "mao", "official"];
346
388
 
347
389
  // src/core/services/card-service.ts
348
390
  var CardService = class {
@@ -725,7 +767,7 @@ var UserService = class {
725
767
  };
726
768
 
727
769
  // src/core/utils/card.ts
728
- var crypto = __toESM(require("crypto"), 1);
770
+ var crypto2 = __toESM(require("crypto"), 1);
729
771
  var KEY_STRING = "?I'llB2c.YouXXXeMeHaYpy!";
730
772
  var KEY_BUFFER = Buffer.from(KEY_STRING, "ascii");
731
773
  var DES3_KEY = Buffer.from(KEY_BUFFER.map((b) => b * 2 & 255));
@@ -735,7 +777,7 @@ function encDes(data) {
735
777
  if (data.length !== 8) {
736
778
  throw new Error("encDes: data must be 8 bytes");
737
779
  }
738
- const cipher = crypto.createCipheriv("des-ede3-cbc", DES3_KEY, IV);
780
+ const cipher = crypto2.createCipheriv("des-ede3-cbc", DES3_KEY, IV);
739
781
  cipher.setAutoPadding(false);
740
782
  const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
741
783
  return encrypted;
@@ -745,7 +787,7 @@ function decDes(data) {
745
787
  if (data.length !== 8) {
746
788
  throw new Error("decDes: data must be 8 bytes");
747
789
  }
748
- const decipher = crypto.createDecipheriv("des-ede3-cbc", DES3_KEY, IV);
790
+ const decipher = crypto2.createDecipheriv("des-ede3-cbc", DES3_KEY, IV);
749
791
  decipher.setAutoPadding(false);
750
792
  const decrypted = Buffer.concat([decipher.update(data), decipher.final()]);
751
793
  return decrypted;
@@ -1034,6 +1076,352 @@ async function ensureOfficialServerForUser(ctx, serverService, userService, uid,
1034
1076
  }
1035
1077
  __name(ensureOfficialServerForUser, "ensureOfficialServerForUser");
1036
1078
 
1079
+ // src/core/api/index.ts
1080
+ function registerApiRoutes(ctx, apiCtx) {
1081
+ const { secret, corsOrigin } = apiCtx;
1082
+ function setCors(kctx) {
1083
+ kctx.set("Access-Control-Allow-Origin", corsOrigin);
1084
+ kctx.set("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS");
1085
+ kctx.set("Access-Control-Allow-Headers", "Authorization, Content-Type");
1086
+ }
1087
+ __name(setCors, "setCors");
1088
+ function authenticate(kctx) {
1089
+ const auth = kctx.get("Authorization");
1090
+ if (!auth?.startsWith("Bearer ")) return null;
1091
+ return verifyToken(auth.slice(7), secret);
1092
+ }
1093
+ __name(authenticate, "authenticate");
1094
+ function unauthorized(kctx) {
1095
+ kctx.status = 401;
1096
+ kctx.body = { error: "Unauthorized" };
1097
+ }
1098
+ __name(unauthorized, "unauthorized");
1099
+ function badRequest(kctx, message) {
1100
+ kctx.status = 400;
1101
+ kctx.body = { error: message };
1102
+ }
1103
+ __name(badRequest, "badRequest");
1104
+ ctx.server.get("/noah/api/health", async (kctx) => {
1105
+ setCors(kctx);
1106
+ kctx.body = { status: "ok" };
1107
+ });
1108
+ const apiPaths = [
1109
+ "/noah/api/me",
1110
+ "/noah/api/cards",
1111
+ "/noah/api/cards/:id",
1112
+ "/noah/api/servers",
1113
+ "/noah/api/servers/:id",
1114
+ "/noah/api/defaults",
1115
+ "/noah/api/resolve",
1116
+ "/noah/api/health"
1117
+ ];
1118
+ for (const path3 of apiPaths) {
1119
+ ctx.server.all(path3, async (kctx, next) => {
1120
+ setCors(kctx);
1121
+ if (kctx.method === "OPTIONS") {
1122
+ kctx.status = 204;
1123
+ return;
1124
+ }
1125
+ await next();
1126
+ });
1127
+ }
1128
+ ctx.server.get("/noah/api/me", async (kctx) => {
1129
+ setCors(kctx);
1130
+ const payload = authenticate(kctx);
1131
+ if (!payload) return unauthorized(kctx);
1132
+ const cardService = new CardService(ctx);
1133
+ const serverService = new ServerService(ctx);
1134
+ const defaultCard = await cardService.getDefaultCardByUid(payload.uid);
1135
+ const defaultServer = await serverService.getDefaultServerByUid(payload.uid);
1136
+ kctx.body = {
1137
+ uid: payload.uid,
1138
+ defaultCardId: defaultCard?.id ?? null,
1139
+ defaultServerId: defaultServer?.id ?? null
1140
+ };
1141
+ });
1142
+ ctx.server.get("/noah/api/cards", async (kctx) => {
1143
+ setCors(kctx);
1144
+ const payload = authenticate(kctx);
1145
+ if (!payload) return unauthorized(kctx);
1146
+ const cardService = new CardService(ctx);
1147
+ const defaultCard = await cardService.getDefaultCardByUid(payload.uid);
1148
+ const cards = await cardService.getCardsByUid(payload.uid);
1149
+ kctx.body = cards.map((card2) => ({
1150
+ id: card2.id,
1151
+ code: card2.code,
1152
+ name: card2.name,
1153
+ defaultServerId: card2.defaultServerId || null,
1154
+ isDefault: defaultCard?.id === card2.id
1155
+ }));
1156
+ });
1157
+ ctx.server.post("/noah/api/cards", async (kctx) => {
1158
+ setCors(kctx);
1159
+ const payload = authenticate(kctx);
1160
+ if (!payload) return unauthorized(kctx);
1161
+ const body = kctx.request.body;
1162
+ if (!body?.code || !body?.name) return badRequest(kctx, "code and name are required");
1163
+ const cardService = new CardService(ctx);
1164
+ const serverService = new ServerService(ctx);
1165
+ const userService = new UserService(ctx);
1166
+ const processed = processInputCardCode(body.code);
1167
+ const cardType = classifyCardId(ctx, processed);
1168
+ if (cardType === "invalid") return badRequest(kctx, "Invalid card code");
1169
+ let finalCode = processed;
1170
+ if (cardType === "access") {
1171
+ try {
1172
+ finalCode = await accessToUid(ctx, processed);
1173
+ } catch (e) {
1174
+ return badRequest(kctx, `Failed to convert access code: ${e.message}`);
1175
+ }
1176
+ } else if (cardType === "konamiid") {
1177
+ try {
1178
+ finalCode = konamiIdToUid(processed);
1179
+ } catch (e) {
1180
+ return badRequest(kctx, `Failed to convert Konami ID: ${e.message}`);
1181
+ }
1182
+ }
1183
+ const existing = await cardService.getCardByCode(finalCode);
1184
+ if (existing) return badRequest(kctx, "Card already exists");
1185
+ const card2 = await cardService.createCard(payload.uid, finalCode, body.name);
1186
+ if (cardType === "official") {
1187
+ await ensureOfficialServerForUser(ctx, serverService, userService, payload.uid);
1188
+ }
1189
+ const defaultCard = await cardService.getDefaultCardByUid(payload.uid);
1190
+ if (!defaultCard) {
1191
+ await userService.updateUserDefaultCard(payload.uid, card2.id);
1192
+ }
1193
+ kctx.status = 201;
1194
+ kctx.body = { id: card2.id, code: card2.code, name: card2.name, defaultServerId: null };
1195
+ });
1196
+ ctx.server.patch("/noah/api/cards/:id", async (kctx) => {
1197
+ setCors(kctx);
1198
+ const payload = authenticate(kctx);
1199
+ if (!payload) return unauthorized(kctx);
1200
+ const cardId = Number(kctx.params.id);
1201
+ if (isNaN(cardId)) return badRequest(kctx, "Invalid card id");
1202
+ const cardService = new CardService(ctx);
1203
+ const cards = await cardService.getCardsByUid(payload.uid);
1204
+ if (!cards.find((c) => c.id === cardId)) {
1205
+ kctx.status = 404;
1206
+ kctx.body = { error: "Card not found" };
1207
+ return;
1208
+ }
1209
+ const body = kctx.request.body ?? {};
1210
+ const update = {};
1211
+ if (body.name !== void 0) update.name = body.name;
1212
+ if (body.defaultServerId !== void 0) update.defaultServerId = body.defaultServerId ?? 0;
1213
+ if (Object.keys(update).length > 0) {
1214
+ await cardService.updateCard(cardId, update);
1215
+ }
1216
+ const updated = await cardService.getCardById(cardId);
1217
+ kctx.body = updated;
1218
+ });
1219
+ ctx.server.delete("/noah/api/cards/:id", async (kctx) => {
1220
+ setCors(kctx);
1221
+ const payload = authenticate(kctx);
1222
+ if (!payload) return unauthorized(kctx);
1223
+ const cardId = Number(kctx.params.id);
1224
+ if (isNaN(cardId)) return badRequest(kctx, "Invalid card id");
1225
+ const cardService = new CardService(ctx);
1226
+ const cards = await cardService.getCardsByUid(payload.uid);
1227
+ if (!cards.find((c) => c.id === cardId)) {
1228
+ kctx.status = 404;
1229
+ kctx.body = { error: "Card not found" };
1230
+ return;
1231
+ }
1232
+ await cardService.removeCard(cardId);
1233
+ kctx.status = 204;
1234
+ });
1235
+ ctx.server.get("/noah/api/servers", async (kctx) => {
1236
+ setCors(kctx);
1237
+ const payload = authenticate(kctx);
1238
+ if (!payload) return unauthorized(kctx);
1239
+ const serverService = new ServerService(ctx);
1240
+ const defaultServer = await serverService.getDefaultServerByUid(payload.uid);
1241
+ const servers = await serverService.getServersByUid(payload.uid);
1242
+ kctx.body = servers.map((s) => ({
1243
+ id: s.id,
1244
+ type: s.type,
1245
+ name: s.name,
1246
+ baseUrl: s.baseUrl,
1247
+ pcbid: s.pcbid ?? null,
1248
+ isDefault: defaultServer?.id === s.id
1249
+ }));
1250
+ });
1251
+ ctx.server.post("/noah/api/servers", async (kctx) => {
1252
+ setCors(kctx);
1253
+ const payload = authenticate(kctx);
1254
+ if (!payload) return unauthorized(kctx);
1255
+ const body = kctx.request.body;
1256
+ if (!body?.type) return badRequest(kctx, "type is required");
1257
+ if (!serverValues.includes(body.type)) {
1258
+ return badRequest(
1259
+ kctx,
1260
+ `Invalid server type. Must be one of: ${serverValues.join(", ")}`
1261
+ );
1262
+ }
1263
+ const serverType = body.type;
1264
+ let baseUrl;
1265
+ let serverName;
1266
+ if (serverType === "mao") {
1267
+ baseUrl = ctx.globalConfig.maoServerUrl;
1268
+ serverName = body.name || "MaoMaNi";
1269
+ } else if (serverType === "official") {
1270
+ baseUrl = ctx.globalConfig.official_support_url;
1271
+ serverName = body.name || "Official";
1272
+ } else {
1273
+ if (!body.baseUrl) return badRequest(kctx, "baseUrl is required for asphyxia servers");
1274
+ if (!body.name) return badRequest(kctx, "name is required for asphyxia servers");
1275
+ baseUrl = body.baseUrl;
1276
+ serverName = body.name;
1277
+ }
1278
+ const serverService = new ServerService(ctx);
1279
+ const userService = new UserService(ctx);
1280
+ const server2 = await serverService.createServerForUser(
1281
+ {
1282
+ type: serverType,
1283
+ name: serverName,
1284
+ baseUrl,
1285
+ pcbid: body.pcbid,
1286
+ supportedGames: []
1287
+ },
1288
+ payload.uid
1289
+ );
1290
+ const defaultServer = await serverService.getDefaultServerByUid(payload.uid);
1291
+ if (!defaultServer) {
1292
+ await userService.updateUserDefaultServer(payload.uid, server2.id);
1293
+ }
1294
+ kctx.status = 201;
1295
+ kctx.body = {
1296
+ id: server2.id,
1297
+ type: server2.type,
1298
+ name: server2.name,
1299
+ baseUrl: server2.baseUrl,
1300
+ pcbid: server2.pcbid ?? null
1301
+ };
1302
+ });
1303
+ ctx.server.patch("/noah/api/servers/:id", async (kctx) => {
1304
+ setCors(kctx);
1305
+ const payload = authenticate(kctx);
1306
+ if (!payload) return unauthorized(kctx);
1307
+ const serverId = Number(kctx.params.id);
1308
+ if (isNaN(serverId)) return badRequest(kctx, "Invalid server id");
1309
+ const serverService = new ServerService(ctx);
1310
+ const servers = await serverService.getServersByUid(payload.uid);
1311
+ if (!servers.find((s) => s.id === serverId)) {
1312
+ kctx.status = 404;
1313
+ kctx.body = { error: "Server not found" };
1314
+ return;
1315
+ }
1316
+ const body = kctx.request.body ?? {};
1317
+ const update = {};
1318
+ if (body.name !== void 0) update.name = body.name;
1319
+ if (body.baseUrl !== void 0) update.baseUrl = body.baseUrl;
1320
+ if (body.pcbid !== void 0) update.pcbid = body.pcbid;
1321
+ if (Object.keys(update).length > 0) {
1322
+ await serverService.updateServer(serverId, update);
1323
+ }
1324
+ const updated = await serverService.getServerById(serverId);
1325
+ kctx.body = {
1326
+ id: updated.id,
1327
+ type: updated.type,
1328
+ name: updated.name,
1329
+ baseUrl: updated.baseUrl,
1330
+ pcbid: updated.pcbid ?? null
1331
+ };
1332
+ });
1333
+ ctx.server.delete("/noah/api/servers/:id", async (kctx) => {
1334
+ setCors(kctx);
1335
+ const payload = authenticate(kctx);
1336
+ if (!payload) return unauthorized(kctx);
1337
+ const serverId = Number(kctx.params.id);
1338
+ if (isNaN(serverId)) return badRequest(kctx, "Invalid server id");
1339
+ const serverService = new ServerService(ctx);
1340
+ const servers = await serverService.getServersByUid(payload.uid);
1341
+ if (!servers.find((s) => s.id === serverId)) {
1342
+ kctx.status = 404;
1343
+ kctx.body = { error: "Server not found" };
1344
+ return;
1345
+ }
1346
+ await serverService.removeServer(serverId);
1347
+ kctx.status = 204;
1348
+ });
1349
+ ctx.server.put("/noah/api/defaults", async (kctx) => {
1350
+ setCors(kctx);
1351
+ const payload = authenticate(kctx);
1352
+ if (!payload) return unauthorized(kctx);
1353
+ const body = kctx.request.body ?? {};
1354
+ const userService = new UserService(ctx);
1355
+ const cardService = new CardService(ctx);
1356
+ const serverService = new ServerService(ctx);
1357
+ if (body.defaultCardId !== void 0) {
1358
+ if (body.defaultCardId === null || body.defaultCardId === 0) {
1359
+ await userService.updateUserDefaultCard(payload.uid, 0);
1360
+ } else {
1361
+ const cards = await cardService.getCardsByUid(payload.uid);
1362
+ if (!cards.find((c) => c.id === body.defaultCardId)) {
1363
+ return badRequest(kctx, "Card not found");
1364
+ }
1365
+ await userService.updateUserDefaultCard(payload.uid, body.defaultCardId);
1366
+ }
1367
+ }
1368
+ if (body.defaultServerId !== void 0) {
1369
+ if (body.defaultServerId === null || body.defaultServerId === 0) {
1370
+ await userService.updateUserDefaultServer(payload.uid, 0);
1371
+ } else {
1372
+ const servers = await serverService.getServersByUid(payload.uid);
1373
+ if (!servers.find((s) => s.id === body.defaultServerId)) {
1374
+ return badRequest(kctx, "Server not found");
1375
+ }
1376
+ await userService.updateUserDefaultServer(payload.uid, body.defaultServerId);
1377
+ }
1378
+ }
1379
+ const defaultCard = await cardService.getDefaultCardByUid(payload.uid);
1380
+ const defaultServer = await serverService.getDefaultServerByUid(payload.uid);
1381
+ kctx.body = {
1382
+ defaultCardId: defaultCard?.id ?? null,
1383
+ defaultServerId: defaultServer?.id ?? null
1384
+ };
1385
+ });
1386
+ ctx.server.get("/noah/api/resolve", async (kctx) => {
1387
+ setCors(kctx);
1388
+ const payload = authenticate(kctx);
1389
+ if (!payload) return unauthorized(kctx);
1390
+ const cardService = new CardService(ctx);
1391
+ const serverService = new ServerService(ctx);
1392
+ const cards = await cardService.getCardsByUid(payload.uid);
1393
+ const defaultCard = await cardService.getDefaultCardByUid(payload.uid);
1394
+ const result = await Promise.all(
1395
+ cards.map(async (card2) => {
1396
+ let resolvedServer = null;
1397
+ if (card2.defaultServerId && card2.defaultServerId !== 0) {
1398
+ resolvedServer = await serverService.getServerById(card2.defaultServerId);
1399
+ }
1400
+ if (!resolvedServer) {
1401
+ resolvedServer = await serverService.getDefaultServerByUid(payload.uid);
1402
+ }
1403
+ return {
1404
+ cardId: card2.id,
1405
+ cardName: card2.name,
1406
+ isDefaultCard: defaultCard?.id === card2.id,
1407
+ resolvedServerId: resolvedServer?.id ?? null,
1408
+ resolvedServerName: resolvedServer?.name ?? null,
1409
+ source: card2.defaultServerId && card2.defaultServerId !== 0 ? "card" : "user-default"
1410
+ };
1411
+ })
1412
+ );
1413
+ kctx.body = result;
1414
+ });
1415
+ }
1416
+ __name(registerApiRoutes, "registerApiRoutes");
1417
+
1418
+ // src/core/command.ts
1419
+ var command_exports = {};
1420
+ __export(command_exports, {
1421
+ apply: () => apply2,
1422
+ name: () => name2
1423
+ });
1424
+
1037
1425
  // src/core/commands/bind.ts
1038
1426
  function bind(ctx, config) {
1039
1427
  ctx.command("bind [cardCode:text]", { slash: true }).alias("绑卡").userFields(["defaultCardId", "id"]).action(async ({ session }, cardCode) => {
@@ -1603,11 +1991,6 @@ __name(maintain, "maintain");
1603
1991
 
1604
1992
  // src/core/commands/server.ts
1605
1993
  var import_koishi5 = require("koishi");
1606
-
1607
- // src/types/index.ts
1608
- var serverValues = ["asphyxia", "mao", "official"];
1609
-
1610
- // src/core/commands/server.ts
1611
1994
  function normalizeUrl(url) {
1612
1995
  try {
1613
1996
  if (!url.match(/^https?:\/\//i)) {
@@ -2014,6 +2397,19 @@ async function addServer(ctx, session, serverService, userService, from, uid, us
2014
2397
  }
2015
2398
  __name(addServer, "addServer");
2016
2399
 
2400
+ // src/core/commands/settings.ts
2401
+ function settings(ctx, apiCtx) {
2402
+ ctx.command("settings", { slash: true }).alias("设置", "setting").userFields(["id"]).channelFields(["id"]).action(async ({ session }) => {
2403
+ const atGuild = session.guildId != null;
2404
+ if (atGuild) return session.text(".dm-only");
2405
+ const { secret, tokenTtl, frontendUrl } = apiCtx;
2406
+ const token = createToken(session.user.id, secret, tokenTtl);
2407
+ const url = frontendUrl ? `${frontendUrl}?token=${token}` : `Token: ${token}`;
2408
+ return session.text(".success", { url, minutes: Math.floor(tokenTtl / 60) });
2409
+ });
2410
+ }
2411
+ __name(settings, "settings");
2412
+
2017
2413
  // src/core/command.ts
2018
2414
  var name2 = "command";
2019
2415
  function apply2(ctx, config) {
@@ -2024,6 +2420,9 @@ function apply2(ctx, config) {
2024
2420
  locale(ctx, config);
2025
2421
  link(ctx, config);
2026
2422
  maintain(ctx, config);
2423
+ if (config._apiCtx) {
2424
+ settings(ctx, config._apiCtx);
2425
+ }
2027
2426
  }
2028
2427
  __name(apply2, "apply");
2029
2428
 
@@ -2268,17 +2667,17 @@ function apply4(ctx, config) {
2268
2667
  __name(apply4, "apply");
2269
2668
 
2270
2669
  // src/core/locales/en-US.yml
2271
- var en_US_default2 = { _config: { $desc: "Core Module Settings", adminUsers: "**Plugin Admin** User ID (use inspect command to get)", guildNameCards: "**Group Card** Name List", maoServerUrl: "**Mao Server** URL address", official_support_url: "**Official Support** URL address" }, commands: { maintain: { description: "Switch to maintenance mode", messages: { "no-auth": "<p>You don't have permission to use this feature~</p>", start: "<p>Entering maintenance mode</p>", "success-start": "<p>Successfully switched to maintenance mode</p>", stop: "<p>Exiting maintenance mode</p>", "success-stop": "<p>Successfully exited maintenance mode</p>" } }, timeout: "Noah didn't wait for your reply, please try again!", help: { description: "Show Noah help information", messages: { content: "<p>Guide:</p>\n<p>https://docs.logthm.cn/noah</p>", "qq-extra": "<p>Having issues? Join group 723977027 to give feedback~</p>" } }, locale: { description: "Set language", messages: { "no-auth": "<p>Only group admins can use this feature~</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Quit!</p>", "reset-channel": "<p>Reset successfully!</p>", "reset-user": "<p>Reset successfully!</p>", success: "<p>Set successfully!</p>", "set-channel": "<p>Select the default language for group chats:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. Quit</p>", "set-user": "<p>Select the language you use:</p>\n<p>1. 中文</p>\n<p>2. English</p>\n<p>q. Quit</p>" } }, link: { description: "Link account to another platform", options: { remove: "Unlink" }, messages: { "generated-1": `<p>The Link command can be used to link user data across multiple platforms. During the linking process, the original platform's user data is fully preserved, while the target platform's user data is overwritten.</p>
2670
+ var en_US_default2 = { _config: { $desc: "Core Module Settings", adminUsers: "**Plugin Admin** User ID (use inspect command to get)", guildNameCards: "**Group Card** Name List", maoServerUrl: "**Mao Server** URL address", official_support_url: "**Official Support** URL address", tokenTtl: "**Settings Panel** Link expiry time (seconds)", frontendUrl: "**Settings Panel** Frontend URL (/settings will generate a full link when set)", corsOrigin: "**Settings Panel** CORS allowed origin (set to frontend domain in production)" }, selector: { "card-not-found": "<p>You haven't bound a card yet, go bind one first~</p>", "server-not-found": "<p>No available servers, add one yourself~</p>", "menu-select": "<p>Please select the card you want to use:</p>\n{card_list}\n<p>q. Quit</p>", "server-menu-select": "<p>Please select the server you want to use:</p>\n{server_list}\n<p>q. Quit</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Quit!</p>", "default-card": "Default", "default-server": "Default" }, commands: { maintain: { description: "Switch to maintenance mode", messages: { "no-auth": "<p>You don't have permission to use this feature~</p>", start: "<p>Entering maintenance mode</p>", "success-start": "<p>Successfully switched to maintenance mode</p>", stop: "<p>Exiting maintenance mode</p>", "success-stop": "<p>Successfully exited maintenance mode</p>" } }, timeout: "Noah didn't wait for your reply, please try again!", help: { description: "Show Noah help information", messages: { content: "<p>Guide:</p>\n<p>https://docs.logthm.cn/noah</p>", "qq-extra": "<p>Having issues? Join group 723977027 to give feedback~</p>" } }, locale: { description: "Set language", messages: { "no-auth": "<p>Only group admins can use this feature~</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Quit!</p>", "reset-channel": "<p>Reset successfully!</p>", "reset-user": "<p>Reset successfully!</p>", success: "<p>Set successfully!</p>", "set-channel": "<p>Select the default language for group chats:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. Quit</p>", "set-user": "<p>Select the language you use:</p>\n<p>1. 中文</p>\n<p>2. English</p>\n<p>q. Quit</p>" } }, link: { description: "Link account to another platform", options: { remove: "Unlink" }, messages: { "generated-1": `<p>The Link command can be used to link user data across multiple platforms. During the linking process, the original platform's user data is fully preserved, while the target platform's user data is overwritten.</p>
2272
2671
  <p>Please make sure the current platform is your target platform and send the following text to the bot on the original platform within 5 minutes:</p>
2273
2672
  <p>{0}</p>
2274
- <p>Once linked, you can use "link -r" to unlink at any time.</p>`, "generated-2": "<p>Token verified! Now proceeding to the second step.</p>\n<p>Please send the following text to the bot on the target platform within 5 minutes:</p>\n<p>{0}</p>\n<p>Note: The current platform is your original platform. User data here will overwrite the target platform's data.</p>", "self-1": "<p>Please enter this on the original platform.</p>", "self-2": "<p>Please enter this on the target platform.</p>", success: "<p>Account linked successfully!</p>", "remove-success": "<p>Account unlinked successfully!</p>", "remove-original": "<p>Cannot unlink: this is your original account.</p>" } }, bind: { description: "Bind card", messages: { prompt: "<p>Please enter your card number:</p>", "convert-access-failed": "<p>Failed to convert Access Code, please use 16-digit card code instead.</p>", "invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", name: "<p>Received! Please give this card a name, no spaces allowed:</p>", "invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", success: "<p>Bound successfully, your card information is as follows:</p>\n<p>[{cardName}]</p>\n<p>{cardCode}</p>" } }, card: { description: "Manage cards", options: { detail: "Show detailed card information" }, messages: { "invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", "invalid-select": "<p>No such option!</p>", "lookup-error": "Lookup failed: {message}", "lookup-error-unknown": "Lookup failed: unknown error", "menu-select": "<p>[Card Management]</p>\n{card_list}\n<p>0. Add new card</p>\n<p>Please enter the serial number:</p>", menu: "<p>[{name}]</p>\n<p>1. Set as default card</p>\n<p>2. View or modify card number</p>\n<p>3. Delete the card</p>\n<p>4. Rename the card</p>\n<p>5. Bind the card to a specified server</p>\n<p>0. Return to card selection</p>\n<p>Please enter the serial number:</p>", "menu-has-bound-server": "<p>[{name}]</p>\n<p>Bound server: {defaultServerName}</p>\n<p>1. Set as default card</p>\n<p>2. View or modify card number</p>\n<p>3. Delete the card</p>\n<p>4. Rename the card</p>\n<p>5. Bind the card to a specified server</p>\n<p>0. Return to card selection</p>\n<p>Please enter the serial number:</p>", "menu-1-success": "<p>Set successfully!</p>", "menu-1-error-duplicate": "<p>The selected card is the same as the old default card!</p>", "menu-2-prompt": "<p>Card number: {code}</p>\n<p>Please enter the new card number:</p>\n<p>Enter 0 to return</p>", "menu-2-success": "<p>Modified successfully!</p>", "menu-2-error-invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", "menu-3-success": "<p>Deleted successfully!</p>", "menu-4-prompt": "<p>Enter a new name, no spaces allowed:</p>", "menu-4-error-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "menu-4-success": "<p>Modified successfully!</p>", "menu-5": "{server_list}\n<p>Please enter the serial number:</p>", "menu-5-success": "<p>Set successfully!</p>", "menu-5-error-duplicate": "<p>The selected server is the same as the old default server!</p>" } }, server: { description: "Manage servers", messages: { "no-channel": "<p>Please use this feature in group chats~</p>", "invalid-select": "<p>No such option!</p>", "no-auth": "<p>Only group admins can use this feature~</p>", "admin-menu-select": "<p>[Group server management]</p>\n{server_list}\n<p>0. Add new server</p>\n<p>Please enter the serial number:</p>", "menu-select": "<p>[Server management]</p>\n{server_list}\n<p>0. Add new server</p>\n<p>Please enter the serial number:</p>", menu: "<p>[{name}]</p>\n<p>Type: {type}</p>\n<p>1. Set as default server</p>\n<p>2. View or modify url</p>\n<p>3. Delete the server</p>\n<p>4. Rename the server</p>\n<p>0. Return to server selection</p>\n<p>Please enter the serial number:</p>", "menu-1-success": "<p>Set successfully!</p>", "menu-1-error-duplicate": "<p>The selected server is the same as the old default server!</p>", "menu-2-prompt": "<p>The server's url: {baseUrl}</p>\n<p>Please enter the new server url:</p>\n<p>Enter 0 to return</p>", "menu-2-success": "<p>Modified successfully!</p>", "menu-2-invalid-url": "<p>Invalid URL format! Please enter a valid url address.</p>", "menu-2-too-many-attempts": "<p>Too many attempts. Operation cancelled.</p>", "menu-3-success": "<p>Deleted successfully!</p>", "menu-4-prompt": "<p>Enter a new name, no spaces allowed:</p>", "menu-4-error-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "menu-4-success": "<p>Modified successfully!</p>", "add-type": "<p>Please select the server type:</p>\n{server_type_list}", "add-url": "<p>Please enter the server url:</p>", "add-invalid-url": "<p>Invalid URL format! Please enter a valid url address.</p>", "add-too-many-attempts": "<p>Too many attempts. Operation cancelled.</p>", "add-name": "<p>Received! Please give the server a name, no spaces allowed:</p>", "add-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "add-success": "<p>Added successfully, the server information is as follows:</p>\n<p>[{serverName}]</p>\n<p>Type: {serverType}</p>" } } } };
2673
+ <p>Once linked, you can use "link -r" to unlink at any time.</p>`, "generated-2": "<p>Token verified! Now proceeding to the second step.</p>\n<p>Please send the following text to the bot on the target platform within 5 minutes:</p>\n<p>{0}</p>\n<p>Note: The current platform is your original platform. User data here will overwrite the target platform's data.</p>", "self-1": "<p>Please enter this on the original platform.</p>", "self-2": "<p>Please enter this on the target platform.</p>", success: "<p>Account linked successfully!</p>", "remove-success": "<p>Account unlinked successfully!</p>", "remove-original": "<p>Cannot unlink: this is your original account.</p>" } }, bind: { description: "Bind card", messages: { prompt: "<p>Please enter your card number:</p>", "convert-access-failed": "<p>Failed to convert Access Code, please use 16-digit card code instead.</p>", "invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", name: "<p>Received! Please give this card a name, no spaces allowed:</p>", "invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", success: "<p>Bound successfully, your card information is as follows:</p>\n<p>[{cardName}]</p>\n<p>{cardCode}</p>" } }, card: { description: "Manage cards", options: { detail: "Show detailed card information" }, messages: { "invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", "invalid-select": "<p>No such option!</p>", "lookup-error": "Lookup failed: {message}", "lookup-error-unknown": "Lookup failed: unknown error", "menu-select": "<p>[Card Management]</p>\n{card_list}\n<p>0. Add new card</p>\n<p>Please enter the serial number:</p>", menu: "<p>[{name}]</p>\n<p>1. Set as default card</p>\n<p>2. View or modify card number</p>\n<p>3. Delete the card</p>\n<p>4. Rename the card</p>\n<p>5. Bind the card to a specified server</p>\n<p>0. Return to card selection</p>\n<p>Please enter the serial number:</p>", "menu-has-bound-server": "<p>[{name}]</p>\n<p>Bound server: {defaultServerName}</p>\n<p>1. Set as default card</p>\n<p>2. View or modify card number</p>\n<p>3. Delete the card</p>\n<p>4. Rename the card</p>\n<p>5. Bind the card to a specified server</p>\n<p>0. Return to card selection</p>\n<p>Please enter the serial number:</p>", "menu-1-success": "<p>Set successfully!</p>", "menu-1-error-duplicate": "<p>The selected card is the same as the old default card!</p>", "menu-2-prompt": "<p>Card number: {code}</p>\n<p>Please enter the new card number:</p>\n<p>Enter 0 to return</p>", "menu-2-success": "<p>Modified successfully!</p>", "menu-2-error-invalid-code": "<p>The card number is incorrect, if you don't remember it, go to the arcade to check it~</p>", "menu-3-success": "<p>Deleted successfully!</p>", "menu-4-prompt": "<p>Enter a new name, no spaces allowed:</p>", "menu-4-error-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "menu-4-success": "<p>Modified successfully!</p>", "menu-5": "{server_list}\n<p>Please enter the serial number:</p>", "menu-5-success": "<p>Set successfully!</p>", "menu-5-error-duplicate": "<p>The selected server is the same as the old default server!</p>" } }, server: { description: "Manage servers", messages: { "no-channel": "<p>Please use this feature in group chats~</p>", "invalid-select": "<p>No such option!</p>", "no-auth": "<p>Only group admins can use this feature~</p>", "admin-menu-select": "<p>[Group server management]</p>\n{server_list}\n<p>0. Add new server</p>\n<p>Please enter the serial number:</p>", "menu-select": "<p>[Server management]</p>\n{server_list}\n<p>0. Add new server</p>\n<p>Please enter the serial number:</p>", menu: "<p>[{name}]</p>\n<p>Type: {type}</p>\n<p>1. Set as default server</p>\n<p>2. View or modify url</p>\n<p>3. Delete the server</p>\n<p>4. Rename the server</p>\n<p>0. Return to server selection</p>\n<p>Please enter the serial number:</p>", "menu-1-success": "<p>Set successfully!</p>", "menu-1-error-duplicate": "<p>The selected server is the same as the old default server!</p>", "menu-2-prompt": "<p>The server's url: {baseUrl}</p>\n<p>Please enter the new server url:</p>\n<p>Enter 0 to return</p>", "menu-2-success": "<p>Modified successfully!</p>", "menu-2-invalid-url": "<p>Invalid URL format! Please enter a valid url address.</p>", "menu-2-too-many-attempts": "<p>Too many attempts. Operation cancelled.</p>", "menu-3-success": "<p>Deleted successfully!</p>", "menu-4-prompt": "<p>Enter a new name, no spaces allowed:</p>", "menu-4-error-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "menu-4-success": "<p>Modified successfully!</p>", "add-type": "<p>Please select the server type:</p>\n{server_type_list}", "add-url": "<p>Please enter the server url:</p>", "add-invalid-url": "<p>Invalid URL format! Please enter a valid url address.</p>", "add-too-many-attempts": "<p>Too many attempts. Operation cancelled.</p>", "add-name": "<p>Received! Please give the server a name, no spaces allowed:</p>", "add-invalid-name": "<p>No spaces allowed! Please try again o(一︿一+)o</p>", "add-success": "<p>Added successfully, the server information is as follows:</p>\n<p>[{serverName}]</p>\n<p>Type: {serverType}</p>" } }, settings: { description: "Get settings panel link", messages: { "dm-only": "Please use this command in a direct message.", success: "<p>Open the settings panel via the link below:</p>\n<p>{url}</p>\n<p>This link expires in {minutes} minutes. Do not share it.</p>" } } } };
2275
2674
 
2276
2675
  // src/core/locales/zh-CN.yml
2277
- var zh_CN_default2 = { _config: { $desc: "Core 模块设置", adminUsers: "**插件管理员** 的用户id (使用 inspect 指令获取)", guildNameCards: "**群聊卡片** 的名称列表", maoServerUrl: "**猫网服务器** 的 URL 地址", official_support_url: "**官方支持** 的 URL 地址" }, commands: { maintain: { description: "切换到维护模式", messages: { "no-auth": "<p>你没有权限使用本功能哦~</p>", start: "<p>正在进入维护模式</p>", "success-start": "<p>成功切换到维护模式</p>", stop: "<p>正在退出维护模式</p>", "success-stop": "<p>成功退出维护模式</p>" } }, timeout: "Noah 没等到你的回复,请重试!", help: { description: "显示 Noah 帮助信息", messages: { content: "<p>使用文档:</p>\n<p>https://docs.logthm.cn/noah</p>", "qq-extra": "<p>遇到问题了?加群 723977027 反馈~</p>" } }, locale: { description: "设置语言", messages: { "no-auth": "<p>只有群管理员能使用本功能哦~</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", "reset-channel": "<p>重置成功!</p>", "reset-user": "<p>重置成功!</p>", success: "<p>设置成功!</p>", "set-channel": "<p>选择群聊默认使用的语言:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. 退出</p>", "set-user": "<p>选择你使用的语言:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. 退出</p>" } }, link: { description: "关联账号到其他平台", options: { remove: "解除关联" }, messages: { "generated-1": "<p>Link 指令可用于在多个平台间关联用户数据。关联过程中,原始平台的用户数据将完全保留,而目标平台的用户数据将被原始平台的数据所覆盖。</p>\n<p>请确认当前平台是你的目标平台,并在 5 分钟内使用你的账号在原始平台内向机器人发送以下文本:</p>\n<p>{0}</p>\n<p>关联完成后,你可以随时使用「link -r」来解除关联。</p>", "generated-2": "<p>令牌核验成功!下面将进行第二步操作。</p>\n<p>请在 5 分钟内使用你的账号在目标平台内向机器人发送以下文本:</p>\n<p>{0}</p>\n<p>注意:当前平台是你的原始平台,这里的用户数据将覆盖目标平台的数据。</p>", "self-1": "<p>请前往原始平台输入。</p>", "self-2": "<p>请前往目标平台输入。</p>", success: "<p>账号关联成功!</p>", "remove-success": "<p>账号解除关联成功!</p>", "remove-original": "<p>无法解除关联:这是你的原始账号。</p>" } }, bind: { description: "绑定卡片", messages: { prompt: "<p>请输入你的卡号:</p>", "convert-access-failed": "<p>转换 Access Code 失败,请使用 16 位卡号进行绑定。</p>", "invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", name: "<p>收到!为这张卡取一个名字吧,不要带空格哦:</p>", "invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", success: "<p>绑好啦,你的卡片信息如下:</p>\n<p>[{cardName}]</p>\n<p>{cardCode}</p>" } }, card: { description: "管理卡片", options: { detail: "显示卡片详细信息" }, messages: { "invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", "lookup-error": "查询失败: {message}", "lookup-error-unknown": "查询失败: 未知错误", "menu-select": "<p>[卡片管理]</p>\n{card_list}\n<p>0. 添加新卡片</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", menu: "<p>[{name}]</p>\n<p>1. 设为默认卡片</p>\n<p>2. 查看或修改卡号</p>\n<p>3. 删除该卡</p>\n<p>4. 重命名该卡片</p>\n<p>5. 将卡片与指定服务器绑定</p>\n<p>0. 返回卡片选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-has-bound-server": "<p>[{name}]</p>\n<p>已绑定服务器:{defaultServerName}</p>\n<p>1. 设为默认卡片</p>\n<p>2. 查看或修改卡号</p>\n<p>3. 删除该卡</p>\n<p>4. 重命名该卡片</p>\n<p>5. 将卡片与指定服务器绑定</p>\n<p>0. 返回卡片选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-1-success": "<p>设置成功!</p>", "menu-1-error-duplicate": "<p>选择的卡片与旧的默认卡片相同!</p>", "menu-2-prompt": "<p>卡号:{code}</p>\n<p>请输入新的卡号:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-2-success": "<p>修改成功!</p>", "menu-2-error-invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", "menu-3-success": "<p>已删除!</p>", "menu-4-prompt": "<p>输入一个新名字,不要带空格哦:</p>\n<p>q. 退出</p>", "menu-4-error-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "menu-4-success": "<p>修改成功!</p>", "menu-5": "<p>请选择一个服务器:</p>\n{server_list}\n<p>q. 退出</p>", "menu-5-success": "<p>设置成功!</p>", "menu-5-error-duplicate": "<p>选择的服务器与旧的默认服务器相同!</p>" } }, server: { description: "管理服务器", messages: { "no-channel": "<p>请在群聊中使用本功能哦~</p>", "invalid-select": "<p>没有该选项!</p>", "no-auth": "<p>只有群管理员能使用本功能哦~</p>", quit: "<p>已退出~</p>", "admin-menu-select": "<p>[群聊服务器管理]</p>\n{server_list}\n<p>0. 添加新服务器</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-select": "<p>[服务器管理]</p>\n{server_list}\n<p>0. 添加新服务器</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", menu: "<p>[{name}]</p>\n<p>类型:{type}</p>\n<p>1. 设为默认服务器</p>\n<p>2. 查看或修改 url</p>\n<p>3. 删除该服务器</p>\n<p>4. 重命名该服务器</p>\n<p>0. 返回服务器选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-1-success": "<p>设置成功!</p>", "menu-1-error-duplicate": "<p>选择的服务器与旧的默认服务器相同!</p>", "menu-2-prompt": "<p>该服务器的 url:{baseUrl}</p>\n<p>请输入新的服务器 url:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-2-success": "<p>修改成功!</p>", "menu-2-invalid-url": "<p>URL 格式不正确!请输入有效的 url 地址。</p>", "menu-2-too-many-attempts": "<p>尝试次数过多,操作已取消。</p>", "menu-3-success": "<p>已删除!</p>", "menu-4-prompt": "<p>输入一个新名字,不要带空格哦:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-4-error-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "menu-4-success": "<p>修改成功!</p>", "add-type": "<p>请选择服务器的类型:</p>\n{server_type_list}\n<p>q. 退出</p>", "add-url": "<p>请输入服务器的 url:</p>\n<p>q. 退出</p>", "add-invalid-url": "<p>URL 格式不正确!请输入有效的 url 地址。</p>", "add-too-many-attempts": "<p>尝试次数过多,操作已取消。</p>", "add-name": "<p>收到!为服务器取一个名字吧,不要带空格哦:</p>\n<p>q. 退出</p>", "add-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "add-success": "<p>添加成功啦,服务器信息如下:</p>\n<p>[{serverName}]</p>\n<p>类型:{serverType}</p>" } } } };
2676
+ var zh_CN_default2 = { _config: { $desc: "Core 模块设置", adminUsers: "**插件管理员** 的用户id (使用 inspect 指令获取)", guildNameCards: "**群聊卡片** 的名称列表", tokenTtl: "**设置面板** 链接有效期(秒)", frontendUrl: "**设置面板** 前端地址(配置后 /settings 会生成完整链接)", corsOrigin: "**设置面板** CORS 允许来源(生产环境请设为前端域名)", maoServerUrl: "**猫网服务器** 的 URL 地址", official_support_url: "**官方支持** 的 URL 地址" }, selector: { "card-not-found": "<p>你还没绑卡,去绑个卡再来吧~</p>", "server-not-found": "<p>没有可用的服务器哦,自己添加一个吧~</p>", "menu-select": "<p>请选择你要使用的卡片:</p>\n{card_list}\n<p>q. 退出</p>", "server-menu-select": "<p>请选择你要使用的服务器:</p>\n{server_list}\n<p>q. 退出</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", "default-card": "默认卡片", "default-server": "默认服务器" }, commands: { maintain: { description: "切换到维护模式", messages: { "no-auth": "<p>你没有权限使用本功能哦~</p>", start: "<p>正在进入维护模式</p>", "success-start": "<p>成功切换到维护模式</p>", stop: "<p>正在退出维护模式</p>", "success-stop": "<p>成功退出维护模式</p>" } }, timeout: "Noah 没等到你的回复,请重试!", help: { description: "显示 Noah 帮助信息", messages: { content: "<p>使用文档:</p>\n<p>https://docs.logthm.cn/noah</p>", "qq-extra": "<p>遇到问题了?加群 723977027 反馈~</p>" } }, locale: { description: "设置语言", messages: { "no-auth": "<p>只有群管理员能使用本功能哦~</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", "reset-channel": "<p>重置成功!</p>", "reset-user": "<p>重置成功!</p>", success: "<p>设置成功!</p>", "set-channel": "<p>选择群聊默认使用的语言:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. 退出</p>", "set-user": "<p>选择你使用的语言:</p>\n<p>1. 简体中文</p>\n<p>2. English</p>\n<p>q. 退出</p>" } }, link: { description: "关联账号到其他平台", options: { remove: "解除关联" }, messages: { "generated-1": "<p>Link 指令可用于在多个平台间关联用户数据。关联过程中,原始平台的用户数据将完全保留,而目标平台的用户数据将被原始平台的数据所覆盖。</p>\n<p>请确认当前平台是你的目标平台,并在 5 分钟内使用你的账号在原始平台内向机器人发送以下文本:</p>\n<p>{0}</p>\n<p>关联完成后,你可以随时使用「link -r」来解除关联。</p>", "generated-2": "<p>令牌核验成功!下面将进行第二步操作。</p>\n<p>请在 5 分钟内使用你的账号在目标平台内向机器人发送以下文本:</p>\n<p>{0}</p>\n<p>注意:当前平台是你的原始平台,这里的用户数据将覆盖目标平台的数据。</p>", "self-1": "<p>请前往原始平台输入。</p>", "self-2": "<p>请前往目标平台输入。</p>", success: "<p>账号关联成功!</p>", "remove-success": "<p>账号解除关联成功!</p>", "remove-original": "<p>无法解除关联:这是你的原始账号。</p>" } }, bind: { description: "绑定卡片", messages: { prompt: "<p>请输入你的卡号:</p>", "convert-access-failed": "<p>转换 Access Code 失败,请使用 16 位卡号进行绑定。</p>", "invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", name: "<p>收到!为这张卡取一个名字吧,不要带空格哦:</p>", "invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", success: "<p>绑好啦,你的卡片信息如下:</p>\n<p>[{cardName}]</p>\n<p>{cardCode}</p>" } }, card: { description: "管理卡片", options: { detail: "显示卡片详细信息" }, messages: { "invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", "lookup-error": "查询失败: {message}", "lookup-error-unknown": "查询失败: 未知错误", "menu-select": "<p>[卡片管理]</p>\n{card_list}\n<p>0. 添加新卡片</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", menu: "<p>[{name}]</p>\n<p>1. 设为默认卡片</p>\n<p>2. 查看或修改卡号</p>\n<p>3. 删除该卡</p>\n<p>4. 重命名该卡片</p>\n<p>5. 将卡片与指定服务器绑定</p>\n<p>0. 返回卡片选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-has-bound-server": "<p>[{name}]</p>\n<p>已绑定服务器:{defaultServerName}</p>\n<p>1. 设为默认卡片</p>\n<p>2. 查看或修改卡号</p>\n<p>3. 删除该卡</p>\n<p>4. 重命名该卡片</p>\n<p>5. 将卡片与指定服务器绑定</p>\n<p>0. 返回卡片选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-1-success": "<p>设置成功!</p>", "menu-1-error-duplicate": "<p>选择的卡片与旧的默认卡片相同!</p>", "menu-2-prompt": "<p>卡号:{code}</p>\n<p>请输入新的卡号:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-2-success": "<p>修改成功!</p>", "menu-2-error-invalid-code": "<p>卡号不对哟,不记得的话去机台刷一下吧~</p>", "menu-3-success": "<p>已删除!</p>", "menu-4-prompt": "<p>输入一个新名字,不要带空格哦:</p>\n<p>q. 退出</p>", "menu-4-error-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "menu-4-success": "<p>修改成功!</p>", "menu-5": "<p>请选择一个服务器:</p>\n{server_list}\n<p>q. 退出</p>", "menu-5-success": "<p>设置成功!</p>", "menu-5-error-duplicate": "<p>选择的服务器与旧的默认服务器相同!</p>" } }, server: { description: "管理服务器", messages: { "no-channel": "<p>请在群聊中使用本功能哦~</p>", "invalid-select": "<p>没有该选项!</p>", "no-auth": "<p>只有群管理员能使用本功能哦~</p>", quit: "<p>已退出~</p>", "admin-menu-select": "<p>[群聊服务器管理]</p>\n{server_list}\n<p>0. 添加新服务器</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-select": "<p>[服务器管理]</p>\n{server_list}\n<p>0. 添加新服务器</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", menu: "<p>[{name}]</p>\n<p>类型:{type}</p>\n<p>1. 设为默认服务器</p>\n<p>2. 查看或修改 url</p>\n<p>3. 删除该服务器</p>\n<p>4. 重命名该服务器</p>\n<p>0. 返回服务器选择</p>\n<p>q. 退出菜单</p>\n<p>请输入序号:</p>", "menu-1-success": "<p>设置成功!</p>", "menu-1-error-duplicate": "<p>选择的服务器与旧的默认服务器相同!</p>", "menu-2-prompt": "<p>该服务器的 url:{baseUrl}</p>\n<p>请输入新的服务器 url:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-2-success": "<p>修改成功!</p>", "menu-2-invalid-url": "<p>URL 格式不正确!请输入有效的 url 地址。</p>", "menu-2-too-many-attempts": "<p>尝试次数过多,操作已取消。</p>", "menu-3-success": "<p>已删除!</p>", "menu-4-prompt": "<p>输入一个新名字,不要带空格哦:</p>\n<p>0. 返回</p>\n<p>q. 退出</p>", "menu-4-error-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "menu-4-success": "<p>修改成功!</p>", "add-type": "<p>请选择服务器的类型:</p>\n{server_type_list}\n<p>q. 退出</p>", "add-url": "<p>请输入服务器的 url:</p>\n<p>q. 退出</p>", "add-invalid-url": "<p>URL 格式不正确!请输入有效的 url 地址。</p>", "add-too-many-attempts": "<p>尝试次数过多,操作已取消。</p>", "add-name": "<p>收到!为服务器取一个名字吧,不要带空格哦:</p>\n<p>q. 退出</p>", "add-invalid-name": "<p>名字不要带空格!重来重来 o(一︿一+)o</p>", "add-success": "<p>添加成功啦,服务器信息如下:</p>\n<p>[{serverName}]</p>\n<p>类型:{serverType}</p>" } }, settings: { description: "获取设置面板链接", messages: { "dm-only": "请在私聊中使用此命令。", success: "<p>点击下方链接打开设置面板:</p>\n<p>{url}</p>\n<p>链接有效期 {minutes} 分钟,请勿分享给他人。</p>" } } } };
2278
2677
 
2279
2678
  // src/core/index.ts
2280
2679
  var name5 = "Noah-Core";
2281
- var inject = ["database", "globalConfig"];
2680
+ var inject = ["database", "globalConfig", "server"];
2282
2681
  var logger2 = new import_koishi6.Logger("Noah-Core");
2283
2682
  function apply5(ctx, config) {
2284
2683
  ;
@@ -2286,9 +2685,11 @@ function apply5(ctx, config) {
2286
2685
  ["en-US", en_US_default2],
2287
2686
  ["zh-CN", zh_CN_default2]
2288
2687
  ].forEach(([lang, file]) => ctx.i18n.define(lang, file));
2688
+ const apiCtx = resolveApiContext(config.core);
2289
2689
  ctx.plugin(database_exports, config.core);
2290
- ctx.plugin(command_exports, config.core);
2690
+ ctx.plugin(command_exports, { ...config.core, _apiCtx: apiCtx });
2291
2691
  ctx.plugin(event_exports, config.core);
2692
+ registerApiRoutes(ctx, apiCtx);
2292
2693
  }
2293
2694
  __name(apply5, "apply");
2294
2695
 
@@ -3037,20 +3438,20 @@ var SDVXDrawer = class extends BaseDrawer {
3037
3438
  ctx.save();
3038
3439
  ctx.translate(556, 17);
3039
3440
  ctx.beginPath();
3040
- const r = 16, w = 100, h10 = 200, x0 = 0, y0 = 0;
3441
+ const r = 16, w = 100, h11 = 200, x0 = 0, y0 = 0;
3041
3442
  ctx.moveTo(x0 + r, y0);
3042
3443
  ctx.lineTo(x0 + w - r, y0);
3043
3444
  ctx.arcTo(x0 + w, y0, x0 + w, y0 + r, r);
3044
- ctx.lineTo(x0 + w, y0 + h10 - r);
3045
- ctx.arcTo(x0 + w, y0 + h10, x0 + w - r, y0 + h10, r);
3046
- ctx.lineTo(x0 + r, y0 + h10);
3047
- ctx.arcTo(x0, y0 + h10, x0, y0 + h10 - r, r);
3445
+ ctx.lineTo(x0 + w, y0 + h11 - r);
3446
+ ctx.arcTo(x0 + w, y0 + h11, x0 + w - r, y0 + h11, r);
3447
+ ctx.lineTo(x0 + r, y0 + h11);
3448
+ ctx.arcTo(x0, y0 + h11, x0, y0 + h11 - r, r);
3048
3449
  ctx.lineTo(x0, y0 + r);
3049
3450
  ctx.arcTo(x0, y0, x0 + r, y0, r);
3050
3451
  ctx.closePath();
3051
3452
  const circleRadius = 14;
3052
3453
  const circleX = x0 + w;
3053
- const circleY = y0 + h10 / 2;
3454
+ const circleY = y0 + h11 / 2;
3054
3455
  ctx.moveTo(circleX + circleRadius, circleY);
3055
3456
  ctx.arc(circleX, circleY, circleRadius, 0, Math.PI * 2, true);
3056
3457
  ctx.clip();
@@ -4168,7 +4569,7 @@ __export(sdvx_exports, {
4168
4569
  logger: () => logger4,
4169
4570
  name: () => name13
4170
4571
  });
4171
- var import_koishi18 = require("koishi");
4572
+ var import_koishi19 = require("koishi");
4172
4573
 
4173
4574
  // src/servers/index.ts
4174
4575
  var servers_exports = {};
@@ -5982,6 +6383,66 @@ function chart(ctx, config, logger5) {
5982
6383
  }
5983
6384
  __name(chart, "chart");
5984
6385
 
6386
+ // src/core/utils/selector.ts
6387
+ var import_koishi16 = require("koishi");
6388
+ async function selectCard(session, cardService, uid) {
6389
+ const userCards = await cardService.getCardsByUid(uid);
6390
+ if (userCards.length === 0) {
6391
+ return { ok: false, message: session.text("selector.card-not-found") };
6392
+ }
6393
+ const defaultCard = await cardService.getDefaultCardByUid(uid);
6394
+ const defaultLabel = session.text("selector.default-card");
6395
+ let cardListMsg = "";
6396
+ for (let i = 0; i < userCards.length; i++) {
6397
+ if (defaultCard && userCards[i].id === defaultCard.id) {
6398
+ cardListMsg += `<p>${i + 1}. ${userCards[i].name} &lt; ${defaultLabel}</p>`;
6399
+ } else {
6400
+ cardListMsg += `<p>${i + 1}. ${userCards[i].name}</p>`;
6401
+ }
6402
+ }
6403
+ const msg = import_koishi16.h.unescape(session.text("selector.menu-select", { card_list: cardListMsg }));
6404
+ await session.send(msg);
6405
+ const select = await session.prompt();
6406
+ if (!select) return { ok: false, message: session.text("commands.timeout") };
6407
+ if (select === "q") return { ok: false, message: session.text("selector.quit") };
6408
+ const selectNum = parseInt(select, 10);
6409
+ if (isNaN(selectNum) || selectNum < 1 || selectNum > userCards.length) {
6410
+ return { ok: false, message: session.text("selector.invalid-select") };
6411
+ }
6412
+ const card2 = await cardService.getCardByCode(userCards[selectNum - 1].code);
6413
+ return { ok: true, value: card2 };
6414
+ }
6415
+ __name(selectCard, "selectCard");
6416
+ async function selectServer(session, serverService, uid, channelId) {
6417
+ const servers = await serverService.getSelectableServers(uid, channelId);
6418
+ if (servers.length === 0) {
6419
+ return { ok: false, message: session.text("selector.server-not-found") };
6420
+ }
6421
+ const defaultServer = await serverService.getDefaultServerByUid(uid);
6422
+ const defaultLabel = session.text("selector.default-server");
6423
+ let serverListMsg = "";
6424
+ for (let i = 0; i < servers.length; i++) {
6425
+ if (defaultServer && servers[i].id === defaultServer.id) {
6426
+ serverListMsg += `<p>${i + 1}. ${servers[i].name} (${servers[i].type}) &lt; ${defaultLabel}</p>`;
6427
+ } else {
6428
+ serverListMsg += `<p>${i + 1}. ${servers[i].name} (${servers[i].type})</p>`;
6429
+ }
6430
+ }
6431
+ const msg = import_koishi16.h.unescape(
6432
+ session.text("selector.server-menu-select", { server_list: serverListMsg })
6433
+ );
6434
+ await session.send(msg);
6435
+ const select = await session.prompt();
6436
+ if (!select) return { ok: false, message: session.text("commands.timeout") };
6437
+ if (select === "q") return { ok: false, message: session.text("selector.quit") };
6438
+ const selectNum = parseInt(select, 10);
6439
+ if (isNaN(selectNum) || selectNum < 1 || selectNum > servers.length) {
6440
+ return { ok: false, message: session.text("selector.invalid-select") };
6441
+ }
6442
+ return { ok: true, value: servers[selectNum - 1] };
6443
+ }
6444
+ __name(selectServer, "selectServer");
6445
+
5985
6446
  // src/games/sdvx/services/score-service.ts
5986
6447
  var ScoreService = class _ScoreService {
5987
6448
  static {
@@ -6105,29 +6566,46 @@ var ScoreService = class _ScoreService {
6105
6566
 
6106
6567
  // src/games/sdvx/commands/radar.ts
6107
6568
  function radar(ctx, config, logger5) {
6108
- ctx.command("sdvx.radar").userFields(["defaultCardId", "defaultServerId", "id"]).channelFields(["defaultServerId", "id"]).action(async ({ session }) => {
6569
+ ctx.command("sdvx.radar").userFields(["defaultCardId", "defaultServerId", "id"]).channelFields(["defaultServerId", "id"]).option("card", "-c").option("server", "-s").action(async ({ session, options }) => {
6109
6570
  const atGuild = session.guildId != null;
6110
6571
  const cardService = new CardService(ctx);
6111
6572
  const serverService = new ServerService(ctx);
6573
+ const channelId = atGuild ? session.channel.id : null;
6112
6574
  const userCards = await cardService.getCardsByUid(session.user.id);
6113
6575
  if (userCards.length === 0) return session.text(".card-not-found");
6114
- const serverRes = await serverService.getSelectableServers(
6115
- session.user.id,
6116
- atGuild ? session.channel.id : null
6117
- );
6576
+ const serverRes = await serverService.getSelectableServers(session.user.id, channelId);
6118
6577
  if (serverRes.length === 0) return session.text(".server-not-found");
6119
- const defaultCard = await cardService.getDefaultCardByUid(session.user.id);
6120
- if (!defaultCard) return session.text(".card-not-found");
6121
- const card2 = await cardService.getCardByCode(defaultCard.code);
6122
- const server2 = await resolveServerForCard(
6123
- card2,
6124
- cardService,
6125
- serverService,
6126
- session.user.id,
6127
- session.platform,
6128
- atGuild ? session.channel.id : null
6129
- );
6130
- if (!server2) return session.text(".server-not-found");
6578
+ let card2;
6579
+ if (options.card) {
6580
+ const result = await selectCard(session, cardService, session.user.id);
6581
+ if (result.ok === false) return result.message;
6582
+ card2 = result.value;
6583
+ } else {
6584
+ const defaultCard = await cardService.getDefaultCardByUid(session.user.id);
6585
+ if (!defaultCard) return session.text(".card-not-found");
6586
+ card2 = await cardService.getCardByCode(defaultCard.code);
6587
+ }
6588
+ let server2;
6589
+ if (options.server) {
6590
+ const result = await selectServer(
6591
+ session,
6592
+ serverService,
6593
+ session.user.id,
6594
+ channelId
6595
+ );
6596
+ if (result.ok === false) return result.message;
6597
+ server2 = result.value;
6598
+ } else {
6599
+ server2 = await resolveServerForCard(
6600
+ card2,
6601
+ cardService,
6602
+ serverService,
6603
+ session.user.id,
6604
+ session.platform,
6605
+ channelId
6606
+ );
6607
+ if (!server2) return session.text(".server-not-found");
6608
+ }
6131
6609
  const serverManager = ServerManager.getInstance();
6132
6610
  const sdvxService = serverManager.getGameService(server2.type, "sdvx");
6133
6611
  const scoreService = ScoreService.getInstance();
@@ -6161,56 +6639,49 @@ function radar(ctx, config, logger5) {
6161
6639
  __name(radar, "radar");
6162
6640
 
6163
6641
  // src/games/sdvx/commands/recent.ts
6164
- var import_koishi16 = require("koishi");
6642
+ var import_koishi17 = require("koishi");
6165
6643
  function recent(ctx, config, logger5) {
6166
- ctx.command("sdvx.recent [count:number]").alias("sdvx.r").userFields(["defaultCardId", "defaultServerId", "id"]).channelFields(["defaultServerId", "id"]).option("lossless", "-l").option("card", "-c").action(async ({ session, options }, count) => {
6644
+ ctx.command("sdvx.recent [count:number]").alias("sdvx.r").userFields(["defaultCardId", "defaultServerId", "id"]).channelFields(["defaultServerId", "id"]).option("lossless", "-l").option("card", "-c").option("server", "-s").action(async ({ session, options }, count) => {
6167
6645
  const atGuild = session.guildId != null;
6168
6646
  if (!count) count = 1;
6169
6647
  const cardService = new CardService(ctx);
6170
6648
  const serverService = new ServerService(ctx);
6649
+ const channelId = atGuild ? session.channel.id : null;
6171
6650
  const userCards = await cardService.getCardsByUid(session.user.id);
6172
6651
  if (userCards.length === 0) return session.text(".card-not-found");
6173
- const serverRes = await serverService.getSelectableServers(
6174
- session.user.id,
6175
- atGuild ? session.channel.id : null
6176
- );
6652
+ const serverRes = await serverService.getSelectableServers(session.user.id, channelId);
6177
6653
  if (serverRes.length === 0) return session.text(".server-not-found");
6178
- let cardCode = "";
6179
- if (!options.card) {
6654
+ let card2;
6655
+ if (options.card) {
6656
+ const result = await selectCard(session, cardService, session.user.id);
6657
+ if (result.ok === false) return result.message;
6658
+ card2 = result.value;
6659
+ } else {
6180
6660
  const defaultCard = await cardService.getDefaultCardByUid(session.user.id);
6181
6661
  if (!defaultCard) return session.text(".card-not-found");
6182
- cardCode = defaultCard.code;
6662
+ card2 = await cardService.getCardByCode(defaultCard.code);
6663
+ }
6664
+ let server2;
6665
+ if (options.server) {
6666
+ const result = await selectServer(
6667
+ session,
6668
+ serverService,
6669
+ session.user.id,
6670
+ channelId
6671
+ );
6672
+ if (result.ok === false) return result.message;
6673
+ server2 = result.value;
6183
6674
  } else {
6184
- let cardListMsg = "";
6185
- for (let i = 0; i < userCards.length; i++) {
6186
- const defaultCard = await cardService.getDefaultCardByUid(session.user.id);
6187
- if (defaultCard && userCards[i].id === defaultCard.id) {
6188
- cardListMsg += `<p>${i + 1}. ${userCards[i].name} < 默认卡片</p>`;
6189
- } else {
6190
- cardListMsg += `<p>${i + 1}. ${userCards[i].name}</p>`;
6191
- }
6192
- }
6193
- const msg = import_koishi16.h.unescape(session.text(".menu-select", { card_list: cardListMsg })).replace("< 默认卡片", "&lt; 默认卡片");
6194
- await session.send(msg);
6195
- const select = await session.prompt();
6196
- if (!select) return session.text("commands.timeout");
6197
- if (select === "q") return session.text(".quit");
6198
- const selectNum = parseInt(select, 10);
6199
- if (isNaN(selectNum) || selectNum < 1 || selectNum > userCards.length) {
6200
- return session.text(".invalid-select");
6201
- }
6202
- cardCode = userCards[selectNum - 1].code;
6675
+ server2 = await resolveServerForCard(
6676
+ card2,
6677
+ cardService,
6678
+ serverService,
6679
+ session.user.id,
6680
+ session.platform,
6681
+ channelId
6682
+ );
6683
+ if (!server2) return session.text(".server-not-found");
6203
6684
  }
6204
- const card2 = await cardService.getCardByCode(cardCode);
6205
- const server2 = await resolveServerForCard(
6206
- card2,
6207
- cardService,
6208
- serverService,
6209
- session.user.id,
6210
- session.platform,
6211
- atGuild ? session.channel.id : null
6212
- );
6213
- if (!server2) return session.text(".server-not-found");
6214
6685
  const serverManager = ServerManager.getInstance();
6215
6686
  const sdvxService = serverManager.getGameService(server2.type, "sdvx");
6216
6687
  try {
@@ -6239,9 +6710,9 @@ function recent(ctx, config, logger5) {
6239
6710
  }
6240
6711
  );
6241
6712
  if (options.lossless) {
6242
- return import_koishi16.h.image(imageBuffer, "image/png");
6713
+ return import_koishi17.h.image(imageBuffer, "image/png");
6243
6714
  }
6244
- return import_koishi16.h.image(imageBuffer, "image/jpg");
6715
+ return import_koishi17.h.image(imageBuffer, "image/jpg");
6245
6716
  } catch (error) {
6246
6717
  logger5.warn(error);
6247
6718
  return session.text(".error");
@@ -6447,7 +6918,7 @@ __name(sync, "sync");
6447
6918
 
6448
6919
  // src/games/sdvx/commands/vf.ts
6449
6920
  var fs4 = __toESM(require("fs"), 1);
6450
- var import_koishi17 = require("koishi");
6921
+ var import_koishi18 = require("koishi");
6451
6922
 
6452
6923
  // src/games/sdvx/utils/filter.ts
6453
6924
  function parseFilterQuery(query) {
@@ -6501,53 +6972,46 @@ __name(parseFilterQuery, "parseFilterQuery");
6501
6972
 
6502
6973
  // src/games/sdvx/commands/vf.ts
6503
6974
  function vf(ctx, config, logger5) {
6504
- ctx.command("vf").userFields(["defaultCardId", "defaultServerId", "id"]).channelFields(["defaultServerId", "id"]).option("lossless", "-l").option("card", "-c").option("filter", "-f <query:text>").action(async ({ session, options }) => {
6975
+ ctx.command("vf").userFields(["defaultCardId", "defaultServerId", "id"]).channelFields(["defaultServerId", "id"]).option("lossless", "-l").option("card", "-c").option("server", "-s").option("filter", "-f <query:text>").action(async ({ session, options }) => {
6505
6976
  const atGuild = session.guildId != null;
6506
6977
  const cardService = new CardService(ctx);
6507
6978
  const serverService = new ServerService(ctx);
6979
+ const channelId = atGuild ? session.channel.id : null;
6508
6980
  const userCards = await cardService.getCardsByUid(session.user.id);
6509
6981
  if (userCards.length === 0) return session.text(".card-not-found");
6510
- const serverRes = await serverService.getSelectableServers(
6511
- session.user.id,
6512
- atGuild ? session.channel.id : null
6513
- );
6982
+ const serverRes = await serverService.getSelectableServers(session.user.id, channelId);
6514
6983
  if (serverRes.length === 0) return session.text(".server-not-found");
6515
- let cardCode = "";
6516
- if (!options.card) {
6984
+ let card2;
6985
+ if (options.card) {
6986
+ const result = await selectCard(session, cardService, session.user.id);
6987
+ if (result.ok === false) return result.message;
6988
+ card2 = result.value;
6989
+ } else {
6517
6990
  const defaultCard = await cardService.getDefaultCardByUid(session.user.id);
6518
6991
  if (!defaultCard) return session.text(".card-not-found");
6519
- cardCode = defaultCard.code;
6992
+ card2 = await cardService.getCardByCode(defaultCard.code);
6993
+ }
6994
+ let server2;
6995
+ if (options.server) {
6996
+ const result = await selectServer(
6997
+ session,
6998
+ serverService,
6999
+ session.user.id,
7000
+ channelId
7001
+ );
7002
+ if (result.ok === false) return result.message;
7003
+ server2 = result.value;
6520
7004
  } else {
6521
- let cardListMsg = "";
6522
- for (let i = 0; i < userCards.length; i++) {
6523
- const defaultCard = await cardService.getDefaultCardByUid(session.user.id);
6524
- if (defaultCard && userCards[i].id === defaultCard.id) {
6525
- cardListMsg += `<p>${i + 1}. ${userCards[i].name} < 默认卡片</p>`;
6526
- } else {
6527
- cardListMsg += `<p>${i + 1}. ${userCards[i].name}</p>`;
6528
- }
6529
- }
6530
- const msg = import_koishi17.h.unescape(session.text(".menu-select", { card_list: cardListMsg })).replace("< 默认卡片", "&lt; 默认卡片");
6531
- await session.send(msg);
6532
- const select = await session.prompt();
6533
- if (!select) return session.text("commands.timeout");
6534
- if (select === "q") return session.text(".quit");
6535
- const selectNum = parseInt(select, 10);
6536
- if (isNaN(selectNum) || selectNum < 1 || selectNum > userCards.length) {
6537
- return session.text(".invalid-select");
6538
- }
6539
- cardCode = userCards[selectNum - 1].code;
7005
+ server2 = await resolveServerForCard(
7006
+ card2,
7007
+ cardService,
7008
+ serverService,
7009
+ session.user.id,
7010
+ session.platform,
7011
+ channelId
7012
+ );
7013
+ if (!server2) return session.text(".server-not-found");
6540
7014
  }
6541
- const card2 = await cardService.getCardByCode(cardCode);
6542
- const server2 = await resolveServerForCard(
6543
- card2,
6544
- cardService,
6545
- serverService,
6546
- session.user.id,
6547
- session.platform,
6548
- atGuild ? session.channel.id : null
6549
- );
6550
- if (!server2) return session.text(".server-not-found");
6551
7015
  const serverManager = ServerManager.getInstance();
6552
7016
  const sdvxService = serverManager.getGameService(server2.type, "sdvx");
6553
7017
  const scoreService = ScoreService.getInstance();
@@ -6582,9 +7046,9 @@ function vf(ctx, config, logger5) {
6582
7046
  }
6583
7047
  );
6584
7048
  if (options.lossless) {
6585
- session.send(import_koishi17.h.file(imageBuffer, "image/png"));
7049
+ session.send(import_koishi18.h.file(imageBuffer, "image/png"));
6586
7050
  } else {
6587
- session.send(import_koishi17.h.image(imageBuffer, "image/jpg"));
7051
+ session.send(import_koishi18.h.image(imageBuffer, "image/jpg"));
6588
7052
  }
6589
7053
  const sortedScores = [...best50ScoreList].sort((a, b) => b.extra.volforce - a.extra.volforce).slice(0, 50);
6590
7054
  const total = sortedScores.reduce((sum, score) => sum + score.extra.volforce, 0);
@@ -6613,11 +7077,11 @@ function vf(ctx, config, logger5) {
6613
7077
  );
6614
7078
  if (fs4.existsSync(audioPath)) {
6615
7079
  const audioBuffer = fs4.readFileSync(audioPath);
6616
- session.send(import_koishi17.h.audio(audioBuffer, "audio/mpeg"));
7080
+ session.send(import_koishi18.h.audio(audioBuffer, "audio/mpeg"));
6617
7081
  }
6618
7082
  if (fs4.existsSync(imagePath)) {
6619
7083
  const imageBuffer2 = fs4.readFileSync(imagePath);
6620
- session.send(import_koishi17.h.image(imageBuffer2, "image/png"));
7084
+ session.send(import_koishi18.h.image(imageBuffer2, "image/png"));
6621
7085
  }
6622
7086
  } catch (error) {
6623
7087
  logger5.warn(`Failed to send celebration files: ${error.message}`);
@@ -6681,15 +7145,15 @@ function apply12(ctx) {
6681
7145
  __name(apply12, "apply");
6682
7146
 
6683
7147
  // src/games/sdvx/locales/en-US.yml
6684
- var en_US_default4 = { _config: { $desc: "SDVX Module Settings", sdvx_data_url: "<p>The URL of the SDVX data service</p>", sdvx_search_url: "<p>The URL of the SDVX search service</p>", official_support_url: "<p>The URL of the SDVX official support service</p>" }, commands: { vf: { description: "Show Noah help information", messages: { "card-not-found": "<p>You haven't bound a card yet, go bind a card first~</p>", "server-not-found": "<p>No available servers, add one yourself~</p>", "no-scores-found": "<p>No scores found, please check your data.</p>", error: "<p>An error occurred(っ °Д °;)っ</p>", drawing: "<p>Noah is drawing {name} [{difstr}], please wait patiently~</p>", "menu-select": "<p>Please select the card you want to use:</p>\n{card_list}\n<p>q. Exit</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Exited~</p>" } }, sdvx: { recent: { description: "Show recent scores", messages: { "menu-select": "<p>Please select the card you want to use:</p>\n{card_list}\n<p>q. Exit</p>", "invalid-select": "<p>No such option!</p>", "card-not-found": "<p>You haven't bound a card yet, go bind a card first~</p>", "server-not-found": "<p>No available servers, add one yourself~</p>", "no-scores-found": "<p>No scores found, please check your data.</p>", error: "<p>An error occurred(っ °Д °;)っ</p>", drawing: "<p>Noah is drawing, please wait patiently~</p>" } }, chart: { description: "Show SDVX chart", messages: { prompt: "<p>Which song's chart would you like to view?</p>", error: "<p>An error occurred(っ °Д °;)っ</p>", drawing: "<p>Noah is drawing, please wait patiently~</p>", "no-result": "<p>Aww, Noah couldn’t find that song~ try another keyword, okay?</p>" } }, calculate: { description: "Calculate volforce value or score", messages: { "invalid-query": "<p>Invalid query parameters, please check your input~</p>", "no-results": "<p>No results found~</p>", "too-many-results": "<p>Too many results! Found {0} results, please narrow down your query (current limit: 500 results)</p>", drawing: "<p>Noah is drawing, please wait patiently~</p>", error: "<p>An error occurred(っ °Д °;)っ</p>" } }, radar: { description: "Show player radar stats", messages: { "card-not-found": "<p>You haven't bound a card yet, go bind a card first~</p>", "server-not-found": "<p>No available servers, add one yourself~</p>", "no-scores-found": "<p>No scores found, please check your data.</p>", error: "<p>An error occurred(っ °Д °;)っ</p>", result: "<p>{name}'s Radar</p>\n<p>NOTES: {notes}</p>\n<p>PEAK: {peak}</p>\n<p>TSUMAMI: {tsumami}</p>\n<p>TRICKY: {tricky}</p>\n<p>HAND-TRIP: {hand_trip}</p>\n<p>ONE-HAND: {one_hand}</p>" } }, sync: { description: "Sync scores to Mao", messages: { "mao-not-found": "<p>Mao server not found. Please add a Mao server first, then try syncing again.</p>", "source-server-not-found": "<p>No available source servers. Please add a server first.</p>", "source-server-select": "<p>Please choose the source server:</p>\n{server_list}\n<p>q. Exit</p>", "card-not-found": "<p>You haven't bound any card yet. Please bind a card first.</p>", "source-card-select": "<p>Please choose the source card:</p>\n{card_list}\n<p>q. Exit</p>", "target-card-select": "<p>Please choose the target card (sync to Mao):</p>\n{card_list}\n<p>q. Exit</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Sync cancelled.</p>", "same-card-error": "<p>When the source server is Mao, the source card and target card cannot be the same. Please choose again.</p>", "dm-only": "<p>For security, please use this command in a private chat.</p>", "pin-prompt": "<p>Please enter the Mao PIN (4 digits):</p>\n<p>q. Exit</p>", "pin-invalid": "<p>Invalid PIN format. Please enter 4 digits.</p>", "pin-verify-failed": "<p>PIN verification failed: {message}</p>", "pin-verify-error": "<p>PIN verification error. Please try again later.</p>", "pin-too-many": "<p>Too many PIN attempts. Please try again later.</p>", "fetch-error": "<p>Failed to fetch scores from the source server. Please try again later.</p>", "no-scores": "<p>No scores available for sync.</p>", "confirm-sync": "<p>Found {score_count} scores. Start sync?</p>\n<p>Type y to confirm, any other key to cancel.</p>", "sync-error": "<p>Error occurred during sync(っ °Д °;)っ</p>", "sync-failed": "<p>Sync failed(っ °Д °;)っ</p>", "selected-summary": "<p>Sync completedヾ(≧▽≦*)o</p>\n<p>Source server: {source_server_name} ({source_server_type})</p>\n<p>Source card: {source_card_name}</p>\n<p>Target card: {target_card_name}</p>\n<p>Tracks synced: {score_count}</p>" } } } } };
7148
+ var en_US_default4 = { _config: { $desc: "SDVX Module Settings", sdvx_data_url: "<p>The URL of the SDVX data service</p>", sdvx_search_url: "<p>The URL of the SDVX search service</p>", official_support_url: "<p>The URL of the SDVX official support service</p>" }, commands: { vf: { description: "Show Noah help information", messages: { "card-not-found": "<p>You haven't bound a card yet, go bind a card first~</p>", "server-not-found": "<p>No available servers, add one yourself~</p>", "no-scores-found": "<p>No scores found, please check your data.</p>", error: "<p>An error occurred(っ °Д °;)っ</p>", drawing: "<p>Noah is drawing {name} [{difstr}], please wait patiently~</p>", "menu-select": "<p>Please select the card you want to use:</p>\n{card_list}\n<p>q. Exit</p>", "server-menu-select": "<p>Please select the server you want to use:</p>\n{server_list}\n<p>q. Exit</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Exited~</p>" } }, sdvx: { recent: { description: "Show recent scores", messages: { "menu-select": "<p>Please select the card you want to use:</p>\n{card_list}\n<p>q. Exit</p>", "server-menu-select": "<p>Please select the server you want to use:</p>\n{server_list}\n<p>q. Exit</p>", "invalid-select": "<p>No such option!</p>", "card-not-found": "<p>You haven't bound a card yet, go bind a card first~</p>", "server-not-found": "<p>No available servers, add one yourself~</p>", "no-scores-found": "<p>No scores found, please check your data.</p>", error: "<p>An error occurred(っ °Д °;)っ</p>", drawing: "<p>Noah is drawing, please wait patiently~</p>", quit: "<p>Exited~</p>" } }, chart: { description: "Show SDVX chart", messages: { prompt: "<p>Which song's chart would you like to view?</p>", error: "<p>An error occurred(っ °Д °;)っ</p>", drawing: "<p>Noah is drawing, please wait patiently~</p>", "no-result": "<p>Aww, Noah couldn’t find that song~ try another keyword, okay?</p>" } }, calculate: { description: "Calculate volforce value or score", messages: { "invalid-query": "<p>Invalid query parameters, please check your input~</p>", "no-results": "<p>No results found~</p>", "too-many-results": "<p>Too many results! Found {0} results, please narrow down your query (current limit: 500 results)</p>", drawing: "<p>Noah is drawing, please wait patiently~</p>", error: "<p>An error occurred(っ °Д °;)っ</p>" } }, radar: { description: "Show player radar stats", messages: { "card-not-found": "<p>You haven't bound a card yet, go bind a card first~</p>", "server-not-found": "<p>No available servers, add one yourself~</p>", "no-scores-found": "<p>No scores found, please check your data.</p>", error: "<p>An error occurred(っ °Д °;)っ</p>", "menu-select": "<p>Please select the card you want to use:</p>\n{card_list}\n<p>q. Exit</p>", "server-menu-select": "<p>Please select the server you want to use:</p>\n{server_list}\n<p>q. Exit</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Exited~</p>", result: "<p>{name}'s Radar</p>\n<p>NOTES: {notes}</p>\n<p>PEAK: {peak}</p>\n<p>TSUMAMI: {tsumami}</p>\n<p>TRICKY: {tricky}</p>\n<p>HAND-TRIP: {hand_trip}</p>\n<p>ONE-HAND: {one_hand}</p>" } }, sync: { description: "Sync scores to Mao", messages: { "mao-not-found": "<p>Mao server not found. Please add a Mao server first, then try syncing again.</p>", "source-server-not-found": "<p>No available source servers. Please add a server first.</p>", "source-server-select": "<p>Please choose the source server:</p>\n{server_list}\n<p>q. Exit</p>", "card-not-found": "<p>You haven't bound any card yet. Please bind a card first.</p>", "source-card-select": "<p>Please choose the source card:</p>\n{card_list}\n<p>q. Exit</p>", "target-card-select": "<p>Please choose the target card (sync to Mao):</p>\n{card_list}\n<p>q. Exit</p>", "invalid-select": "<p>No such option!</p>", quit: "<p>Sync cancelled.</p>", "same-card-error": "<p>When the source server is Mao, the source card and target card cannot be the same. Please choose again.</p>", "dm-only": "<p>For security, please use this command in a private chat.</p>", "pin-prompt": "<p>Please enter the Mao PIN (4 digits):</p>\n<p>q. Exit</p>", "pin-invalid": "<p>Invalid PIN format. Please enter 4 digits.</p>", "pin-verify-failed": "<p>PIN verification failed: {message}</p>", "pin-verify-error": "<p>PIN verification error. Please try again later.</p>", "pin-too-many": "<p>Too many PIN attempts. Please try again later.</p>", "fetch-error": "<p>Failed to fetch scores from the source server. Please try again later.</p>", "no-scores": "<p>No scores available for sync.</p>", "confirm-sync": "<p>Found {score_count} scores. Start sync?</p>\n<p>Type y to confirm, any other key to cancel.</p>", "sync-error": "<p>Error occurred during sync(っ °Д °;)っ</p>", "sync-failed": "<p>Sync failed(っ °Д °;)っ</p>", "selected-summary": "<p>Sync completedヾ(≧▽≦*)o</p>\n<p>Source server: {source_server_name} ({source_server_type})</p>\n<p>Source card: {source_card_name}</p>\n<p>Target card: {target_card_name}</p>\n<p>Tracks synced: {score_count}</p>" } } } } };
6685
7149
 
6686
7150
  // src/games/sdvx/locales/zh-CN.yml
6687
- var zh_CN_default4 = { _config: { $desc: "SDVX 模块设置", sdvx_data_url: "<p>SDVX 数据服务的 URL</p>", sdvx_search_url: "<p>SDVX 搜索服务的 URL</p>", official_support_url: "<p>SDVX 官方支持服务的 URL</p>" }, commands: { vf: { description: "查询 SDVX VOLFORCE", messages: { "card-not-found": "<p>你还没绑卡,去绑个卡再来吧~</p>", "server-not-found": "<p>没有可用的服务器哦,自己添加一个吧~</p>", "no-scores-found": "<p>没有找到你的分数数据哦~</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>", drawing: "<p>Noah 正在画啦,请耐心等待~</p>", "menu-select": "<p>请选择你要使用的卡片:</p>\n{card_list}\n<p>q. 退出</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>" } }, sdvx: { recent: { description: "查询最近分数", messages: { "menu-select": "<p>请选择你要使用的卡片:</p>\n{card_list}\n<p>q. 退出</p>", "invalid-select": "<p>没有该选项!</p>", "card-not-found": "<p>你还没绑卡,去绑个卡再来吧~</p>", "server-not-found": "<p>没有可用的服务器哦,自己添加一个吧~</p>", "no-scores-found": "<p>没有找到你的分数数据哦~</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>", drawing: "<p>Noah 正在画啦,请耐心等待~</p>" } }, chart: { description: "查询 SDVX 谱面", messages: { prompt: "<p>要查哪首歌的铺面呢?</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>", drawing: "<p>Noah 正在绘制 {name} [{difstr}],请耐心等待~</p>", "no-result": "<p>Noah 没有找到这首歌,换个关键词试试吧~</p>" } }, calculate: { description: "计算 volforce 值或分数", messages: { "invalid-query": "<p>查询参数无效,请检查你的输入~</p>", "no-results": "<p>没有找到符合条件的结果~</p>", "too-many-results": "<p>结果太多啦!共找到 {0} 条结果,请缩小查询范围(当前限制:500 条)</p>", drawing: "<p>Noah 正在画啦,请耐心等待~</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>" } }, radar: { description: "查询玩家六维雷达", messages: { "card-not-found": "<p>你还没绑卡,去绑个卡再来吧~</p>", "server-not-found": "<p>没有可用的服务器哦,自己添加一个吧~</p>", "no-scores-found": "<p>没有找到你的分数数据哦~</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>", result: "<p>{name} 的雷达</p>\n<p>NOTES: {notes}</p>\n<p>PEAK: {peak}</p>\n<p>TSUMAMI: {tsumami}</p>\n<p>TRICKY: {tricky}</p>\n<p>HAND-TRIP: {hand_trip}</p>\n<p>ONE-HAND: {one_hand}</p>" } }, sync: { description: "同步成绩到猫网", messages: { "mao-not-found": "<p>没有找到猫网服务器,请先添加猫网服务器后再尝试同步。</p>", "source-server-not-found": "<p>没有可作为来源的服务器,请先添加服务器。</p>", "source-server-select": "<p>请选择来源服务器:</p>\n{server_list}\n<p>q. 退出</p>", "card-not-found": "<p>你还没有绑定任何卡片哦~</p>", "source-card-select": "<p>请选择来源卡片:</p>\n{card_list}\n<p>q. 退出</p>", "target-card-select": "<p>请选择目标卡片(同步到猫网):</p>\n{card_list}\n<p>q. 退出</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出同步。</p>", "same-card-error": "<p>来源服务器为猫网时,来源卡片和目标卡片不能相同,请重新选择。</p>", "dm-only": "<p>出于安全考虑,请在私聊中使用该指令。</p>", "pin-prompt": "<p>请输入猫网 PIN 码(4 位数字):</p>\n<p>q. 退出</p>", "pin-invalid": "<p>PIN 码格式不正确,请输入 4 位数字。</p>", "pin-verify-failed": "<p>PIN 验证失败:{message}</p>", "pin-verify-error": "<p>PIN 验证时出现错误,请稍后重试。</p>", "pin-too-many": "<p>PIN 验证次数过多,请稍后再试。</p>", "fetch-error": "<p>获取来源服务器成绩失败,请稍后再试。</p>", "no-scores": "<p>没有可同步的成绩。</p>", "confirm-sync": "<p>共找到 {score_count} 条成绩,是否开始同步?</p>\n<p>输入 y 确认,其他任意键取消。</p>", "sync-error": "<p>同步过程中出现了错误(っ °Д °;)っ</p>", "sync-failed": "<p>同步失败(っ °Д °;)っ</p>", "selected-summary": "<p>同步完成ヾ(≧▽≦*)o</p>\n<p>来源服务器:{source_server_name} ({source_server_type})</p>\n<p>来源卡片:{source_card_name}</p>\n<p>目标卡片:{target_card_name}</p>\n<p>同步曲目数量:{score_count}</p>" } } } } };
7151
+ var zh_CN_default4 = { _config: { $desc: "SDVX 模块设置", sdvx_data_url: "<p>SDVX 数据服务的 URL</p>", sdvx_search_url: "<p>SDVX 搜索服务的 URL</p>", official_support_url: "<p>SDVX 官方支持服务的 URL</p>" }, commands: { vf: { description: "查询 SDVX VOLFORCE", messages: { "card-not-found": "<p>你还没绑卡,去绑个卡再来吧~</p>", "server-not-found": "<p>没有可用的服务器哦,自己添加一个吧~</p>", "no-scores-found": "<p>没有找到你的分数数据哦~</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>", drawing: "<p>Noah 正在画啦,请耐心等待~</p>", "menu-select": "<p>请选择你要使用的卡片:</p>\n{card_list}\n<p>q. 退出</p>", "server-menu-select": "<p>请选择你要使用的服务器:</p>\n{server_list}\n<p>q. 退出</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>" } }, sdvx: { recent: { description: "查询最近分数", messages: { "menu-select": "<p>请选择你要使用的卡片:</p>\n{card_list}\n<p>q. 退出</p>", "server-menu-select": "<p>请选择你要使用的服务器:</p>\n{server_list}\n<p>q. 退出</p>", "invalid-select": "<p>没有该选项!</p>", "card-not-found": "<p>你还没绑卡,去绑个卡再来吧~</p>", "server-not-found": "<p>没有可用的服务器哦,自己添加一个吧~</p>", "no-scores-found": "<p>没有找到你的分数数据哦~</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>", drawing: "<p>Noah 正在画啦,请耐心等待~</p>", quit: "<p>已退出~</p>" } }, chart: { description: "查询 SDVX 谱面", messages: { prompt: "<p>要查哪首歌的铺面呢?</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>", drawing: "<p>Noah 正在绘制 {name} [{difstr}],请耐心等待~</p>", "no-result": "<p>Noah 没有找到这首歌,换个关键词试试吧~</p>" } }, calculate: { description: "计算 volforce 值或分数", messages: { "invalid-query": "<p>查询参数无效,请检查你的输入~</p>", "no-results": "<p>没有找到符合条件的结果~</p>", "too-many-results": "<p>结果太多啦!共找到 {0} 条结果,请缩小查询范围(当前限制:500 条)</p>", drawing: "<p>Noah 正在画啦,请耐心等待~</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>" } }, radar: { description: "查询玩家六维雷达", messages: { "card-not-found": "<p>你还没绑卡,去绑个卡再来吧~</p>", "server-not-found": "<p>没有可用的服务器哦,自己添加一个吧~</p>", "no-scores-found": "<p>没有找到你的分数数据哦~</p>", error: "<p>Noah 遇到了错误(っ °Д °;)っ</p>", "menu-select": "<p>请选择你要使用的卡片:</p>\n{card_list}\n<p>q. 退出</p>", "server-menu-select": "<p>请选择你要使用的服务器:</p>\n{server_list}\n<p>q. 退出</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出~</p>", result: "<p>{name} 的雷达</p>\n<p>NOTES: {notes}</p>\n<p>PEAK: {peak}</p>\n<p>TSUMAMI: {tsumami}</p>\n<p>TRICKY: {tricky}</p>\n<p>HAND-TRIP: {hand_trip}</p>\n<p>ONE-HAND: {one_hand}</p>" } }, sync: { description: "同步成绩到猫网", messages: { "mao-not-found": "<p>没有找到猫网服务器,请先添加猫网服务器后再尝试同步。</p>", "source-server-not-found": "<p>没有可作为来源的服务器,请先添加服务器。</p>", "source-server-select": "<p>请选择来源服务器:</p>\n{server_list}\n<p>q. 退出</p>", "card-not-found": "<p>你还没有绑定任何卡片哦~</p>", "source-card-select": "<p>请选择来源卡片:</p>\n{card_list}\n<p>q. 退出</p>", "target-card-select": "<p>请选择目标卡片(同步到猫网):</p>\n{card_list}\n<p>q. 退出</p>", "invalid-select": "<p>没有该选项!</p>", quit: "<p>已退出同步。</p>", "same-card-error": "<p>来源服务器为猫网时,来源卡片和目标卡片不能相同,请重新选择。</p>", "dm-only": "<p>出于安全考虑,请在私聊中使用该指令。</p>", "pin-prompt": "<p>请输入猫网 PIN 码(4 位数字):</p>\n<p>q. 退出</p>", "pin-invalid": "<p>PIN 码格式不正确,请输入 4 位数字。</p>", "pin-verify-failed": "<p>PIN 验证失败:{message}</p>", "pin-verify-error": "<p>PIN 验证时出现错误,请稍后重试。</p>", "pin-too-many": "<p>PIN 验证次数过多,请稍后再试。</p>", "fetch-error": "<p>获取来源服务器成绩失败,请稍后再试。</p>", "no-scores": "<p>没有可同步的成绩。</p>", "confirm-sync": "<p>共找到 {score_count} 条成绩,是否开始同步?</p>\n<p>输入 y 确认,其他任意键取消。</p>", "sync-error": "<p>同步过程中出现了错误(っ °Д °;)っ</p>", "sync-failed": "<p>同步失败(っ °Д °;)っ</p>", "selected-summary": "<p>同步完成ヾ(≧▽≦*)o</p>\n<p>来源服务器:{source_server_name} ({source_server_type})</p>\n<p>来源卡片:{source_card_name}</p>\n<p>目标卡片:{target_card_name}</p>\n<p>同步曲目数量:{score_count}</p>" } } } } };
6688
7152
 
6689
7153
  // src/games/sdvx/index.ts
6690
7154
  var name13 = "Noah-SDVX";
6691
7155
  var inject3 = ["database", "globalConfig"];
6692
- var logger4 = new import_koishi18.Logger("Noah-SDVX");
7156
+ var logger4 = new import_koishi19.Logger("Noah-SDVX");
6693
7157
  async function apply13(ctx, config) {
6694
7158
  ;
6695
7159
  [
@@ -6704,47 +7168,50 @@ async function apply13(ctx, config) {
6704
7168
  __name(apply13, "apply");
6705
7169
 
6706
7170
  // src/config.ts
6707
- var import_koishi26 = require("koishi");
7171
+ var import_koishi27 = require("koishi");
6708
7172
 
6709
7173
  // src/asset/config.ts
6710
- var import_koishi19 = require("koishi");
6711
- var assetConfig = import_koishi19.Schema.object({
6712
- data_path: import_koishi19.Schema.string().default("noah_assets"),
6713
- auto_update: import_koishi19.Schema.boolean().default(true),
6714
- update_url: import_koishi19.Schema.string().default("https://github.com/logthm/noah/releases/latest/download/"),
6715
- update_interval: import_koishi19.Schema.number().default(24 * 60 * 60 * 1e3),
7174
+ var import_koishi20 = require("koishi");
7175
+ var assetConfig = import_koishi20.Schema.object({
7176
+ data_path: import_koishi20.Schema.string().default("noah_assets"),
7177
+ auto_update: import_koishi20.Schema.boolean().default(true),
7178
+ update_url: import_koishi20.Schema.string().default("https://github.com/logthm/noah/releases/latest/download/"),
7179
+ update_interval: import_koishi20.Schema.number().default(24 * 60 * 60 * 1e3),
6716
7180
  // 24 hours in milliseconds
6717
- github_token: import_koishi19.Schema.string().description("GitHub token for accessing private repositories").role("secret")
7181
+ github_token: import_koishi20.Schema.string().description("GitHub token for accessing private repositories").role("secret")
6718
7182
  }).i18n({
6719
7183
  "en-US": en_US_default._config,
6720
7184
  "zh-CN": zh_CN_default._config
6721
7185
  });
6722
7186
 
6723
7187
  // src/core/config.ts
6724
- var import_koishi20 = require("koishi");
6725
- var coreConfig = import_koishi20.Schema.object({
6726
- adminUsers: import_koishi20.Schema.array(String).role("table"),
6727
- guildNameCards: import_koishi20.Schema.array(String).role("table").default(["Noah | /help 获取食用指南"])
7188
+ var import_koishi21 = require("koishi");
7189
+ var coreConfig = import_koishi21.Schema.object({
7190
+ adminUsers: import_koishi21.Schema.array(String).role("table"),
7191
+ guildNameCards: import_koishi21.Schema.array(String).role("table").default(["Noah | /help 获取食用指南"]),
7192
+ tokenTtl: import_koishi21.Schema.number().default(1800),
7193
+ frontendUrl: import_koishi21.Schema.string().default(""),
7194
+ corsOrigin: import_koishi21.Schema.string().default("*")
6728
7195
  }).i18n({
6729
7196
  "en-US": en_US_default2._config,
6730
7197
  "zh-CN": zh_CN_default2._config
6731
7198
  });
6732
7199
 
6733
7200
  // src/fun/poke/config.ts
6734
- var import_koishi21 = require("koishi");
6735
- var pokeConfig = import_koishi21.Schema.object({
6736
- interval: import_koishi21.Schema.number().default(1e3).step(100),
6737
- warning: import_koishi21.Schema.boolean().default(false),
6738
- prompt: import_koishi21.Schema.array(
6739
- import_koishi21.Schema.object({
6740
- content: import_koishi21.Schema.string().required(),
6741
- weight: import_koishi21.Schema.number().min(0).max(100).default(50)
7201
+ var import_koishi22 = require("koishi");
7202
+ var pokeConfig = import_koishi22.Schema.object({
7203
+ interval: import_koishi22.Schema.number().default(1e3).step(100),
7204
+ warning: import_koishi22.Schema.boolean().default(false),
7205
+ prompt: import_koishi22.Schema.array(
7206
+ import_koishi22.Schema.object({
7207
+ content: import_koishi22.Schema.string().required(),
7208
+ weight: import_koishi22.Schema.number().min(0).max(100).default(50)
6742
7209
  })
6743
7210
  ).role("table"),
6744
- messages: import_koishi21.Schema.array(
6745
- import_koishi21.Schema.object({
6746
- content: import_koishi21.Schema.string().required(),
6747
- weight: import_koishi21.Schema.number().min(0).max(100).default(50)
7211
+ messages: import_koishi22.Schema.array(
7212
+ import_koishi22.Schema.object({
7213
+ content: import_koishi22.Schema.string().required(),
7214
+ weight: import_koishi22.Schema.number().min(0).max(100).default(50)
6748
7215
  })
6749
7216
  ).role("table")
6750
7217
  }).i18n({
@@ -6753,7 +7220,7 @@ var pokeConfig = import_koishi21.Schema.object({
6753
7220
  });
6754
7221
 
6755
7222
  // src/games/general/config.ts
6756
- var import_koishi22 = require("koishi");
7223
+ var import_koishi23 = require("koishi");
6757
7224
 
6758
7225
  // src/games/general/locales/en-US.yml
6759
7226
  var en_US_default5 = { _config: { $desc: "General Module Settings", barcode_api_url: "<p>The URL of the barcode API</p>" } };
@@ -6762,33 +7229,33 @@ var en_US_default5 = { _config: { $desc: "General Module Settings", barcode_api_
6762
7229
  var zh_CN_default5 = { _config: { $desc: "通用工具模块设置", barcode_api_url: "<p>条形码 API 地址</p>" } };
6763
7230
 
6764
7231
  // src/games/general/config.ts
6765
- var generalConfig = import_koishi22.Schema.object({
6766
- barcode_api_url: import_koishi22.Schema.string().required()
7232
+ var generalConfig = import_koishi23.Schema.object({
7233
+ barcode_api_url: import_koishi23.Schema.string().required()
6767
7234
  }).i18n({
6768
7235
  "en-US": en_US_default5._config,
6769
7236
  "zh-CN": zh_CN_default5._config
6770
7237
  });
6771
7238
 
6772
7239
  // src/games/sdvx/config.ts
6773
- var import_koishi23 = require("koishi");
6774
- var sdvxConfig = import_koishi23.Schema.object({
6775
- sdvx_data_url: import_koishi23.Schema.string().required(),
6776
- sdvx_search_url: import_koishi23.Schema.string().required()
7240
+ var import_koishi24 = require("koishi");
7241
+ var sdvxConfig = import_koishi24.Schema.object({
7242
+ sdvx_data_url: import_koishi24.Schema.string().required(),
7243
+ sdvx_search_url: import_koishi24.Schema.string().required()
6777
7244
  }).i18n({
6778
7245
  "en-US": en_US_default4._config,
6779
7246
  "zh-CN": zh_CN_default4._config
6780
7247
  });
6781
7248
 
6782
7249
  // src/global/config.ts
6783
- var import_koishi24 = require("koishi");
6784
- var globalConfig = import_koishi24.Schema.object({
6785
- official_support_url: import_koishi24.Schema.string().default("https://noah.logthm.com"),
6786
- maoServerUrl: import_koishi24.Schema.string().default("http://maomani.cn:577"),
6787
- maoApiKey: import_koishi24.Schema.string().role("secret").default("")
7250
+ var import_koishi25 = require("koishi");
7251
+ var globalConfig = import_koishi25.Schema.object({
7252
+ official_support_url: import_koishi25.Schema.string().default("https://noah.logthm.com"),
7253
+ maoServerUrl: import_koishi25.Schema.string().default("http://maomani.cn:577"),
7254
+ maoApiKey: import_koishi25.Schema.string().role("secret").default("")
6788
7255
  });
6789
7256
 
6790
7257
  // src/slash/config.ts
6791
- var import_koishi25 = require("koishi");
7258
+ var import_koishi26 = require("koishi");
6792
7259
 
6793
7260
  // src/slash/locales/en-US.yml
6794
7261
  var en_US_default6 = { _config: { $desc: "Slash Module Settings", test_guilds: "**Guilds To Sync**", auto_sync_on_start: "**Auto Sync on Connect**" } };
@@ -6797,16 +7264,16 @@ var en_US_default6 = { _config: { $desc: "Slash Module Settings", test_guilds: "
6797
7264
  var zh_CN_default6 = { _config: { $desc: "Slash 模块设置", test_guilds: "**默认同步 Guild 列表**", auto_sync_on_start: "**连接后自动同步**" } };
6798
7265
 
6799
7266
  // src/slash/config.ts
6800
- var slashConfig = import_koishi25.Schema.object({
6801
- test_guilds: import_koishi25.Schema.array(String).default([]),
6802
- auto_sync_on_start: import_koishi25.Schema.boolean().default(true)
7267
+ var slashConfig = import_koishi26.Schema.object({
7268
+ test_guilds: import_koishi26.Schema.array(String).default([]),
7269
+ auto_sync_on_start: import_koishi26.Schema.boolean().default(true)
6803
7270
  }).i18n({
6804
7271
  "en-US": en_US_default6._config,
6805
7272
  "zh-CN": zh_CN_default6._config
6806
7273
  });
6807
7274
 
6808
7275
  // src/config.ts
6809
- var Config = import_koishi26.Schema.object({
7276
+ var Config = import_koishi27.Schema.object({
6810
7277
  global: globalConfig,
6811
7278
  core: coreConfig,
6812
7279
  sdvx: sdvxConfig,
@@ -6818,7 +7285,7 @@ var Config = import_koishi26.Schema.object({
6818
7285
 
6819
7286
  // src/index.ts
6820
7287
  var name14 = "noah";
6821
- var inject4 = ["database", "skia"];
7288
+ var inject4 = ["database", "skia", "server"];
6822
7289
  async function apply14(ctx, config) {
6823
7290
  initConstants(ctx);
6824
7291
  ctx.set("globalConfig", config.global);