-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
32 lines (24 loc) · 834 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(async()=>{
"use strict";
// Dependencies
const request = require("request-async")
// Variables
const args = process.argv.slice(2)
// Main
if(!args.length) return console.log("usage: node index.js <serverIP>")
var response = await request(`https://api.mcsrvstat.us/2/${args[0]}`)
response = JSON.parse(response.body)
if(!response.online) return console.log("Unable to get the server information.")
console.log(`
Server IP: ${args[0]}
Server Name: ${response.hostname}
Server Port: ${response.port}
Server Protocol: ${response.protocol}
Server Icon: ${response.icon}
Server Version: ${response.version}
Server Software: ${response.software}
Players Online: ${response.players.online}
Players Max: ${response.players.max}
Is Server Online: ${response.online}`)
process.exit()
})()