Getting players data
Unlike other API wrappers, we not only let you get info of a player but also about multiple players at once.
Getting Info of a Single Player
- JavaScript
- ESM
client.players
.fetch('player-tag')
.then((player) => {
console.log(player);
})
.catch((error) => {
console.error(error);
});
await client.players.fetch('player-tag');
note
Instead of using player-tag
as your tag, you can also use #player-tag
or %23player-tag
to get the same result. For
example, 22QJ0JPVJ
, #22QJ0JPVJ
and %2322QJ0JPVJ
all return same player.
Getting info of multiple players
- JavaScript
- ESM
client.players
.fetchMany('player-tag-1', 'player-tag-2', 'player-tag-3')
.then((player) => {
console.log(player);
})
.catch((error) => {
console.error(error);
});
await client.players.fetchMany('player-tag-1', 'player-tag-2', 'player-tag-3');
note
Instead of using player-tag
as your tag, you can also use #player-tag
or %23player-tag
to get the same result. For
example, 22QJ0JPVJ
, #22QJ0JPVJ
and %2322QJ0JPVJ
all return same player.