node-gamedig/examples/simple.js

14 lines
487 B
JavaScript
Raw Normal View History

import { GameDig } from '../lib/index.js'
2023-10-30 22:35:39 +01:00
// Instead of '../lib/index.js' you would have here 'gamedig'.
GameDig.query({
type: 'minecraft',
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
2023-10-30 22:35:39 +01:00
}).then((state) => {
console.log(state)
}).catch((error) => {
console.log(`Server is offline, error: ${error}`)
})