koishi-plugin-noah 2.0.4 → 2.0.6

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.
Files changed (2) hide show
  1. package/lib/index.cjs +19 -6
  2. package/package.json +77 -77
package/lib/index.cjs CHANGED
@@ -5439,7 +5439,8 @@ var MusicService = class _MusicService {
5439
5439
  async getMusic(ctx, musicIds) {
5440
5440
  const numericIds = musicIds.filter((id) => typeof id === "number");
5441
5441
  const stringTitles = musicIds.filter((id) => typeof id === "string");
5442
- const results = [];
5442
+ const numericMap = /* @__PURE__ */ new Map();
5443
+ const stringMap = /* @__PURE__ */ new Map();
5443
5444
  if (numericIds.length > 0) {
5444
5445
  try {
5445
5446
  const response = await ctx.http.post(
@@ -5448,9 +5449,10 @@ var MusicService = class _MusicService {
5448
5449
  { baseURL: this.sdvx_data_url }
5449
5450
  );
5450
5451
  if (Array.isArray(response)) {
5451
- results.push(
5452
- ...response.map((m) => this.normalizeMusicDifnum(m))
5453
- );
5452
+ for (const m of response) {
5453
+ const normalized = this.normalizeMusicDifnum(m);
5454
+ numericMap.set(Number(normalized.id), normalized);
5455
+ }
5454
5456
  }
5455
5457
  } catch (error) {
5456
5458
  console.warn("Failed to fetch music data for numeric IDs:", error);
@@ -5464,11 +5466,21 @@ var MusicService = class _MusicService {
5464
5466
  { baseURL: this.sdvx_data_url }
5465
5467
  );
5466
5468
  const converted = this.convertExternalToStandard(response);
5467
- results.push(...converted.map((m) => this.normalizeMusicDifnum(m)));
5469
+ for (const m of converted) {
5470
+ const normalized = this.normalizeMusicDifnum(m);
5471
+ stringMap.set(String(normalized.id), normalized);
5472
+ stringMap.set(normalized.title_name, normalized);
5473
+ }
5468
5474
  } catch (error) {
5469
5475
  console.warn("Failed to fetch music data for string IDs:", error);
5470
5476
  }
5471
5477
  }
5478
+ const results = [];
5479
+ for (const id of musicIds) {
5480
+ const music = typeof id === "number" ? numericMap.get(id) : stringMap.get(id);
5481
+ if (music) results.push(music);
5482
+ }
5483
+ console.log("results", results.slice(0, 3));
5472
5484
  return results;
5473
5485
  }
5474
5486
  /**
@@ -5516,6 +5528,7 @@ var MusicService = class _MusicService {
5516
5528
  if (musicIds.length === 0) {
5517
5529
  return null;
5518
5530
  }
5531
+ console.log("musicIds", musicIds);
5519
5532
  return await this.getMusic(ctx, musicIds);
5520
5533
  } catch {
5521
5534
  return null;
@@ -6073,7 +6086,7 @@ var SDVXService2 = class _SDVXService {
6073
6086
  responseType: "json"
6074
6087
  });
6075
6088
  const filteredData = data.filter(
6076
- (score) => score.music_id !== 244 && score.music_id !== 1759 && score.music_id !== 1761
6089
+ (score) => score.music_id !== 244 && score.music_id !== 1759 && score.music_id !== 1761 && score.is_plus === 0
6077
6090
  );
6078
6091
  const musicIds = filteredData.map((score) => score.music_id);
6079
6092
  const diffTypes = filteredData.map((score) => parseInt(score.music_diff));
package/package.json CHANGED
@@ -1,82 +1,82 @@
1
1
  {
2
- "name": "koishi-plugin-noah",
3
- "version": "2.0.4",
4
- "contributors": [
5
- "Logthm <logthm@outlook.com>"
6
- ],
7
- "homepage": "https://docs.logthm.cn/noah",
8
- "type": "module",
9
- "main": "lib/index.cjs",
10
- "typings": "lib/index.d.ts",
11
- "files": [
12
- "lib",
13
- "dist"
14
- ],
15
- "license": "MIT",
16
- "keywords": [
17
- "chatbot",
18
- "koishi",
19
- "plugin"
20
- ],
21
- "peerDependencies": {
22
- "koishi": "^4.18.10"
23
- },
24
- "dependencies": {
25
- "adm-zip": "^0.5.16",
26
- "bwip-js": "^4.8.0",
27
- "javascript-barcode-reader": "^0.6.9",
28
- "koishi-plugin-adapter-onebot": "^6.8.0",
29
- "sharp": "^0.33.5",
30
- "xml2js": "^0.6.2"
31
- },
32
- "koishi": {
33
- "description": {
34
- "en": "A tool bot for arcade music games",
35
- "zh": "街机音游工具机器人"
2
+ "name": "koishi-plugin-noah",
3
+ "version": "2.0.6",
4
+ "contributors": [
5
+ "Logthm <logthm@outlook.com>"
6
+ ],
7
+ "homepage": "https://docs.logthm.cn/noah",
8
+ "type": "module",
9
+ "main": "lib/index.cjs",
10
+ "typings": "lib/index.d.ts",
11
+ "files": [
12
+ "lib",
13
+ "dist"
14
+ ],
15
+ "license": "MIT",
16
+ "keywords": [
17
+ "chatbot",
18
+ "koishi",
19
+ "plugin"
20
+ ],
21
+ "peerDependencies": {
22
+ "koishi": "^4.18.10"
23
+ },
24
+ "dependencies": {
25
+ "adm-zip": "^0.5.16",
26
+ "bwip-js": "^4.8.0",
27
+ "javascript-barcode-reader": "^0.6.9",
28
+ "koishi-plugin-adapter-onebot": "^6.8.0",
29
+ "sharp": "^0.33.5",
30
+ "xml2js": "^0.6.2"
36
31
  },
37
- "service": {
38
- "required": [
39
- "database",
40
- "skia"
41
- ]
32
+ "koishi": {
33
+ "description": {
34
+ "en": "A tool bot for arcade music games",
35
+ "zh": "街机音游工具机器人"
36
+ },
37
+ "service": {
38
+ "required": [
39
+ "database",
40
+ "skia"
41
+ ]
42
+ },
43
+ "locales": [
44
+ "en",
45
+ "zh"
46
+ ]
42
47
  },
43
- "locales": [
44
- "en",
45
- "zh"
46
- ]
47
- },
48
- "devDependencies": {
49
- "@haixee/eslint-config": "^2.3.1",
50
- "@koishijs/plugin-adapter-discord": "^4.5.11",
51
- "@ltxhhz/koishi-plugin-skia-canvas": "^0.0.8",
52
- "@types/adm-zip": "^0",
53
- "@types/xml2js": "^0",
54
- "eslint": "^9.39.2",
55
- "eslint-config-prettier": "^10.1.8",
56
- "eslint-import-resolver-typescript": "^3.10.1",
57
- "eslint-plugin-prettier": "^5.5.5",
58
- "husky": "^9.1.7",
59
- "koishi": "^4.18.10",
60
- "lint-staged": "^16.2.7",
61
- "prettier": "^3.8.1",
62
- "yml-register": "^1.2.5"
63
- },
64
- "scripts": {
65
- "lint": "eslint --ext .js,.ts,.tsx src/",
66
- "format": "prettier --write \"src/**/*.{js,ts,tsx,json,css,md}\""
67
- },
68
- "husky": {
69
- "hooks": {
70
- "pre-commit": "lint-staged"
48
+ "devDependencies": {
49
+ "@haixee/eslint-config": "^2.3.1",
50
+ "@koishijs/plugin-adapter-discord": "^4.5.11",
51
+ "@ltxhhz/koishi-plugin-skia-canvas": "^0.0.8",
52
+ "@types/adm-zip": "^0",
53
+ "@types/xml2js": "^0",
54
+ "eslint": "^9.39.2",
55
+ "eslint-config-prettier": "^10.1.8",
56
+ "eslint-import-resolver-typescript": "^3.10.1",
57
+ "eslint-plugin-prettier": "^5.5.5",
58
+ "husky": "^9.1.7",
59
+ "koishi": "^4.18.10",
60
+ "lint-staged": "^16.2.7",
61
+ "prettier": "^3.8.1",
62
+ "yml-register": "^1.2.5"
63
+ },
64
+ "scripts": {
65
+ "lint": "eslint --ext .js,.ts,.tsx src/",
66
+ "format": "prettier --write \"src/**/*.{js,ts,tsx,json,css,md}\""
67
+ },
68
+ "husky": {
69
+ "hooks": {
70
+ "pre-commit": "lint-staged"
71
+ }
72
+ },
73
+ "lint-staged": {
74
+ "*.{js,ts,tsx}": [
75
+ "eslint --fix",
76
+ "prettier --write"
77
+ ],
78
+ "*.{css,md,json}": [
79
+ "prettier --write"
80
+ ]
71
81
  }
72
- },
73
- "lint-staged": {
74
- "*.{js,ts,tsx}": [
75
- "eslint --fix",
76
- "prettier --write"
77
- ],
78
- "*.{css,md,json}": [
79
- "prettier --write"
80
- ]
81
- }
82
82
  }