mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
feat: add support to CommonJS (#519)
* Add support to CommonJS * Fixes * Update CHANGELOG.md
This commit is contained in:
parent
731f553607
commit
38ddfd61f3
7 changed files with 679 additions and 4 deletions
13
examples/require.cjs
Normal file
13
examples/require.cjs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
const { GameDig } = require('../dist/index.cjs')
|
||||
// Instead of '../dist/index.cjs' 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
|
||||
}).then((state) => {
|
||||
console.log(state)
|
||||
}).catch((error) => {
|
||||
console.log(`Server is offline, error: ${error}`)
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue