feed4rz / node-battlegrounds

PUBG Web API wrapper for nodejs
MIT License
12 stars 3 forks source link

PUBG failed look up response? #5

Closed aanders50 closed 5 years ago

aanders50 commented 5 years ago

Hello, how should I go about getting a failed player look-up? (i.e. a player does not exist or they spelled their name wrong).

I tried adding a .catch or viewing the response object from the request but I cannot seem to find the right way to get the error back so I can display it to the user.

let player = await api.getPlayers({ names: [obj.username] });

if (!player || !player[0]) {
    console.log("Could not find player: " + obj.username);
    return;
}

Thank you!

feed4rz commented 5 years ago

Hey, I am not really working on this package anymore, so the issue might be its not compatible anymore with the current version of API.

You should try just doing http requests to an API itself, documentation can be found here: https://documentation.pubg.com/en/introduction.html