1.0.4 • Published 1 year ago

mcsrvstat-wrapper v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

MCSRVSTAT Simple Javascript Wrapper

How do I use this?

You can utilize the following methods below.
If something is missing from these responses that are returned from MCSRVSTAT's API and you'd like to see them supported, create an issue!

fetchJavaServer

Fetch the status of a Minecraft Java server

const serverInfo = await fetchJavaServer('hostname.example.com');
console.log(serverInfo);
// { online: true, version: 'Requires MC 1.8 / 1.19', players: { online: 5, max: 20 }, connection: { ip: 'xxx.xxx.xxx.xxx', hostname: 'hostname.example.com' } }

fetchBedrockServer

Fetch the status of a Minecraft Bedrock server

const serverInfo = await fetchBedrockServer('hostname.example.com');
console.log(serverInfo);
// { online: true, version: 'x.xx.xx', players: { online: 5, max: 20 }, connection: { ip: 'xxx.xxx.xxx.xxx', hostname: 'hostname.example.com' } }

fetchIcon

Generates a link to the servers icon

let url = await mcsrvstat.fetchIcon('hostname.example.com');
console.log(url)
// 'https://api.mcsrvstat.us/icon/hostname.example.com'

getJavaHttp

Returns the status of a Minecraft Java server using HTTP status code conventions.
200 is expected for Online and 404 is expected for Offline.

const httpCode = await mcsrvstat.javaHttpCode('hostname.example.com');
console.log(httpCode);
// 200/404

getBedrockHttp

Returns the status of a Minecraft Bedrock server using HTTP status code conventions.
200 is expected for Online and 404 is expected for Offline.

const httpCode = await mcsrvstat.javaHttpCode('hostname.example.com');
console.log(httpCode);
// 200/404
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago