@sjtdev/koishi-plugin-dota2tracker 1.2.15 → 1.2.16-pre.1
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.js +31 -26
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -73,9 +73,9 @@ __export(queries_exports, {
|
|
|
73
73
|
MATCHES_FOR_DAILY: () => MATCHES_FOR_DAILY,
|
|
74
74
|
MATCH_INFO: () => MATCH_INFO,
|
|
75
75
|
PLAYERS_INFO_WITH_10_MATCHES_FOR_GUILD: () => PLAYERS_INFO_WITH_10_MATCHES_FOR_GUILD,
|
|
76
|
-
PLAYERS_LASTMATCH: () => PLAYERS_LASTMATCH,
|
|
77
76
|
PLAYER_EXTRA_INFO: () => PLAYER_EXTRA_INFO,
|
|
78
77
|
PLAYER_INFO_WITH_25_MATCHES: () => PLAYER_INFO_WITH_25_MATCHES,
|
|
78
|
+
PLAYER_LASTMATCH: () => PLAYER_LASTMATCH,
|
|
79
79
|
VERIFYING_PLAYER: () => VERIFYING_PLAYER
|
|
80
80
|
});
|
|
81
81
|
var dotaconstants = __toESM(require("dotaconstants"));
|
|
@@ -150,12 +150,6 @@ function MATCH_INFO(matchId) {
|
|
|
150
150
|
stackCount
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
playbackData {
|
|
154
|
-
purchaseEvents {
|
|
155
|
-
itemId
|
|
156
|
-
time
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
153
|
heroDamage
|
|
160
154
|
towerDamage
|
|
161
155
|
stats {
|
|
@@ -173,6 +167,10 @@ function MATCH_INFO(matchId) {
|
|
|
173
167
|
experiencePerMinute
|
|
174
168
|
heroHealing
|
|
175
169
|
stats {
|
|
170
|
+
itemPurchases{
|
|
171
|
+
itemId
|
|
172
|
+
time
|
|
173
|
+
}
|
|
176
174
|
campStack
|
|
177
175
|
heroDamageReport {
|
|
178
176
|
dealtTotal {
|
|
@@ -259,27 +257,29 @@ function VERIFYING_PLAYER(steamAccountId) {
|
|
|
259
257
|
`;
|
|
260
258
|
}
|
|
261
259
|
__name(VERIFYING_PLAYER, "VERIFYING_PLAYER");
|
|
262
|
-
function
|
|
260
|
+
function PLAYER_LASTMATCH(steamAccountId) {
|
|
263
261
|
return `
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
262
|
+
{
|
|
263
|
+
player(steamAccountId: ${steamAccountId}) {
|
|
264
|
+
steamAccount {
|
|
265
|
+
id
|
|
266
|
+
}
|
|
267
|
+
matches(request: {take: 1}) {
|
|
268
|
+
id
|
|
269
|
+
parsedDateTime
|
|
270
|
+
startDateTime
|
|
271
|
+
players {
|
|
272
|
+
steamAccount {
|
|
268
273
|
id
|
|
269
|
-
parsedDateTime
|
|
270
|
-
startDateTime
|
|
271
|
-
players{
|
|
272
|
-
steamAccount{
|
|
273
|
-
id
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
274
|
}
|
|
277
275
|
}
|
|
278
276
|
}
|
|
279
|
-
|
|
280
|
-
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
`;
|
|
281
281
|
}
|
|
282
|
-
__name(
|
|
282
|
+
__name(PLAYER_LASTMATCH, "PLAYER_LASTMATCH");
|
|
283
283
|
function PLAYER_INFO_WITH_25_MATCHES(steamAccountId, heroId) {
|
|
284
284
|
return `
|
|
285
285
|
{
|
|
@@ -529,6 +529,7 @@ async function query(query_str) {
|
|
|
529
529
|
return await http.post(CONFIGS.STRATZ_API.URL, query_str, {
|
|
530
530
|
responseType: "json",
|
|
531
531
|
headers: {
|
|
532
|
+
"User-Agent": "STRATZ_API",
|
|
532
533
|
"Content-Type": "application/graphql",
|
|
533
534
|
Authorization: `Bearer ${CONFIGS.STRATZ_API.TOKEN}`
|
|
534
535
|
}
|
|
@@ -667,7 +668,7 @@ function getFormattedMatchData(data) {
|
|
|
667
668
|
obj[key] = 0;
|
|
668
669
|
return obj;
|
|
669
670
|
}, {});
|
|
670
|
-
if (player.
|
|
671
|
+
if (player.stats?.itemPurchases) {
|
|
671
672
|
const getNextElement = /* @__PURE__ */ __name(function() {
|
|
672
673
|
let currentIndex = 0;
|
|
673
674
|
return function() {
|
|
@@ -679,7 +680,7 @@ function getFormattedMatchData(data) {
|
|
|
679
680
|
return element;
|
|
680
681
|
};
|
|
681
682
|
}, "getNextElement");
|
|
682
|
-
for (let item of player.
|
|
683
|
+
for (let item of player.stats.itemPurchases) {
|
|
683
684
|
if (!supportItemIds.includes(item.itemId)) {
|
|
684
685
|
if (!items_timelist[item.itemId]) {
|
|
685
686
|
items_timelist[item.itemId] = [];
|
|
@@ -1443,7 +1444,7 @@ async function apply(ctx, config) {
|
|
|
1443
1444
|
let lastMatchId = 0;
|
|
1444
1445
|
try {
|
|
1445
1446
|
session.send("正在搜索对局详情,请稍后...");
|
|
1446
|
-
lastMatchId = (await query(
|
|
1447
|
+
lastMatchId = (await query(PLAYER_LASTMATCH(parseInt(flagBindedPlayer?.steamId ?? input_data)))).data.player.matches[0].id;
|
|
1447
1448
|
} catch {
|
|
1448
1449
|
session.send("获取玩家最近比赛失败。");
|
|
1449
1450
|
return;
|
|
@@ -1705,7 +1706,11 @@ async function apply(ctx, config) {
|
|
|
1705
1706
|
const subscribedPlayersSteamIds = subscribedPlayersInGuild.map((player) => player.steamId).filter(function(value, index, self) {
|
|
1706
1707
|
return self.indexOf(value) === index;
|
|
1707
1708
|
});
|
|
1708
|
-
const
|
|
1709
|
+
const players = [];
|
|
1710
|
+
for (let id of subscribedPlayersSteamIds) {
|
|
1711
|
+
players.push((await query(PLAYER_LASTMATCH(id))).data.player);
|
|
1712
|
+
}
|
|
1713
|
+
const lastMatches = players.map((player) => player.matches[0]).filter((item, index, self) => index === self.findIndex((t) => t.id === item.id)).filter((match) => import_moment.default.unix(match.startDateTime).isAfter((0, import_moment.default)().subtract(1, "days"))).filter((match) => !pendingMatches.some((pendingMatch) => pendingMatch.matchId == match.id));
|
|
1709
1714
|
const sendedMatchesIds = (await ctx.database.get("dt_sended_match_id", { matchId: lastMatches.map((match) => match.id) }, ["matchId"])).map((match) => match.matchId);
|
|
1710
1715
|
lastMatches.filter((match) => !sendedMatchesIds.includes(match.id)).forEach((match) => {
|
|
1711
1716
|
const tempGuilds = [];
|