From 4db58ce7471de6fe0750e2b6d6dbb1b61dd3f27a Mon Sep 17 00:00:00 2001 From: Braydon Date: Mon, 15 Apr 2024 12:50:12 -0700 Subject: [PATCH] Update sdk/js/server/query --- sdk%2Fjs%2Fserver%2Fquery.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sdk%2Fjs%2Fserver%2Fquery.md b/sdk%2Fjs%2Fserver%2Fquery.md index ad34602..36484b1 100644 --- a/sdk%2Fjs%2Fserver%2Fquery.md +++ b/sdk%2Fjs%2Fserver%2Fquery.md @@ -2,14 +2,22 @@ ## Example ```ts -import { CachedJavaMinecraftServer, CachedBedrockMinecraftServer } from "restfulmc-lib"; -import { getMinecraftServer } from "restfulmc-lib"; +import { + ServerPlatform, + getMinecraftServer, + type CachedBedrockMinecraftServer, + type CachedJavaMinecraftServer, + type RestfulMCAPIError, +} from "restfulmc-lib"; try { - const server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer = await getMinecraftServer(Platform.JAVA / Platform.BEDROCK, "hypixel.net"); - console.log(`Pinged ${server.ip}:${server.port}, there are ${server.players.online}/${server.players.max} players online`); + const server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer = + await getMinecraftServer(ServerPlatform.JAVA, "hypixel.net"); + console.log( + `Pinged ${server.ip}:${server.port}, there are ${server.players.online}/${server.players.max} players online` + ); } catch (err) { - if ((err as ErrorResponse).code == 404) { + if ((err as RestfulMCAPIError).code == 404) { console.error("Server couldn't be found, is it offline?"); } }