CatBoat-Launcher/modules/serverPing.js
2025-04-30 05:01:03 +02:00

18 lines
459 B
JavaScript

const config = require("../config.json")
async function fetchServerStatus() {
const response = await fetch(`https://api.mcsrvstat.us/3/${config.minecraft.server.host}:${config.minecraft.server.port}`)
const json = await response.json()
return {
online: json.online,
players: {
online: json.players?.online || 0,
max: json.players?.max || 0
}
}
}
module.exports = {
fetchServerStatus
}