From 16e9454beb03d8b0023ca13b47399fc813c1e9a3 Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Mon, 22 Jan 2024 23:17:07 +0200 Subject: [PATCH] fix: readme example and add more options to the simple example --- README.md | 6 +++--- examples/simple.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 21e4fe6..b480d8e 100644 --- a/README.md +++ b/README.md @@ -18,15 +18,15 @@ See the [GAMES_LIST.md](GAMES_LIST.md) file for the currently supported titles, ## Usage from Node.js Install using your favorite package manager: `npm install gamedig`, then use! ```js -import GameDig from 'gamedig'; +import { GameDig } from 'gamedig'; GameDig.query({ type: 'minecraft', - host: 'mc.example.com' + host: 'mc.hypixel.net' }).then((state) => { console.log(state); }).catch((error) => { - console.log("Server is offline"); + console.log(`Server is offline, error: ${error}`); }); ``` Confused on how this works, or you want to see more? Checkout the [examples](/examples) folder! diff --git a/examples/simple.js b/examples/simple.js index a0c52c1..31295db 100644 --- a/examples/simple.js +++ b/examples/simple.js @@ -3,7 +3,9 @@ import { GameDig } from '../lib/index.js' GameDig.query({ type: 'minecraft', - host: 'mc.hypixel.net' + host: 'mc.hypixel.net', + port: 25565, // lets us explicitly specify the query port of this server + givenPortOnly: true // the library will attempt multiple ports in order to ensure success, to avoid this pass this option }).then((state) => { console.log(state) }).catch((error) => {