mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 17:25:19 +01:00
fix: readme example and add more options to the simple example
This commit is contained in:
parent
e89cb125b2
commit
16e9454beb
2 changed files with 6 additions and 4 deletions
|
@ -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!
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue