Closed dedarh closed 7 years ago
for (i = 0; i < games.matchHistory.length; i++) { if (games.matchHistory[i].matchDisplay == 'Solo') { game[i] = games.matchHistory[i]; } }
You can do:
const api = new PubgAPI({apikey: process.env.PUBG_APIKEY});
api.getProfileByNickname('fak3zito')
.then((profile) => {
const matchH = profile.getMatchHistory();
const filteredMatches = matchH.matchHistory.filter((match) => {
return season === 3;
// return region === 2;
// return match === 3;
});
});
You can filter each match by every variable, I don't now how that int values are mapped. Anyway, you can submit a pull request and I will review :)
Unhandled rejection ReferenceError: season is not defined at matchH.matchHistory.filter (D:\1\pubg\pubg\pubg.js:14:14) at Array.filter (native) at api.getProfileByNickname.then (D:\1\pubg\pubg\pubg.js:13:51) at tryCatcher (D:\1\pubg\pubg\node_modules\bluebird\js\release\util.js:16:23 )
Fixed...
const api = new PubgAPI({apikey: process.env.PUBG_APIKEY});
api.getProfileByNickname('fak3zito')
.then((profile) => {
const matchH = profile.getMatchHistory();
const filteredMatches = matchH.matchHistory.filter((match) => {
return match.season === 3;
// return match.region === 2;
// return match.match === 3;
});
});
Thank you, add in constants.js const SEASON = { .......... EA2017pre4: '2017-pre4', };
Already added in 3.4.1 https://github.com/javilobo8/pubg-api-redis/commit/47c2bb6ee207ea1ee00e16a9a78234095f203e77
const games = profile.getMatchHistory({ region: REGION.ALL, // defaults to profile.content.selectedRegion season: SEASON.EA2017pre3, // defaults to profile.content.defaultSeason match: MATCH.SOLO // defaults to SOLO });
Add a library so that you can give information by type (as in the profile SOLO DUO SQUAD)