@sjtdev/koishi-plugin-dota2tracker 1.2.18 → 1.2.19

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.js +7 -4
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -530,9 +530,10 @@ __name(REQUEST_MATCH_DATA_ANALYSIS, "REQUEST_MATCH_DATA_ANALYSIS");
530
530
  // src/utils.ts
531
531
  var CONFIGS = { STRATZ_API: { URL: "https://api.stratz.com/graphql", TOKEN: "" } };
532
532
  var http = null;
533
- function init(newHttp, setTimeout2) {
533
+ var setTimeout;
534
+ function init(newHttp, newSetTimeout) {
534
535
  http = newHttp;
535
- setTimeout2 = setTimeout2;
536
+ setTimeout = newSetTimeout;
536
537
  }
537
538
  __name(init, "init");
538
539
  async function fetchData(query_str) {
@@ -554,7 +555,8 @@ async function query(query_func, ...args) {
554
555
  for (let i = 0; i < playerIds.length; i += chunkSize) {
555
556
  const chunk = playerIds.slice(i, i + chunkSize);
556
557
  const query_str = query_func(chunk, ...args.slice(1));
557
- const result = await new Promise((resolve) => setTimeout(() => resolve(fetchData(query_str)), 100));
558
+ const result = await new Promise((resolve) => setTimeout(async () => resolve(await fetchData(query_str)), 100));
559
+ if (result.errors) throw { errors: result.errors };
558
560
  if (result.data && result.data.players) {
559
561
  allPlayers = allPlayers.concat(result.data.players);
560
562
  }
@@ -563,6 +565,7 @@ async function query(query_func, ...args) {
563
565
  } else {
564
566
  const query_str = query_func(...args);
565
567
  const result = await fetchData(query_str);
568
+ if (result.errors) throw { errors: result.errors };
566
569
  return result || {};
567
570
  }
568
571
  }
@@ -923,7 +926,7 @@ function winRateColor(value) {
923
926
  __name(winRateColor, "winRateColor");
924
927
  async function playerisValid(steamAccountId) {
925
928
  try {
926
- let queryRes = await query(VERIFYING_PLAYER(steamAccountId));
929
+ let queryRes = await query(VERIFYING_PLAYER, steamAccountId);
927
930
  if (queryRes.data.player.matchCount != null) return { isValid: true };
928
931
  else return { isValid: false, reason: "SteamID无效或无任何场次。" };
929
932
  } catch (error) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sjtdev/koishi-plugin-dota2tracker",
3
3
  "description": "koishi插件-追踪群友的DOTA2对局",
4
- "version": "1.2.18",
4
+ "version": "1.2.19",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [