Update sdk/js/player/query

Braydon 2024-04-14 15:08:59 -07:00
parent 190a36d9ad
commit f976a112f2

@ -5,6 +5,12 @@
import { CachedPlayer } from "restfulmc-lib";
import { getPlayer } from "restfulmc-lib";
const player: CachedPlayer = await getPlayer("Username or UUID");
console.log(`Hello ${player.username}, your UUID is ${player.uniqueId}!`);
try {
const player: CachedPlayer = await getPlayer("Rainnny");
console.log(`Hello ${player.username}, your UUID is ${player.uniqueId}!`);
} catch (err) {
if ((err as ErrorResponse).code == 404) {
console.error("Player with UUID or username not found.");
}
}
```