notmebotz-tools
Version:
Sebuah Tools yang berfungsi untuk mendownload Video atau Foto dari media sosial, serta sebagai tools yang berguna untuk aplikasi kamu seperti untuk BOT
19 lines (16 loc) • 686 B
JavaScript
const fetch = require("node-fetch");
async function getStatus(server, type) {
const [ip, port] = server.split(":");
const apiUrl = type === "bedrock"
? `https://api.mcstatus.io/v2/status/bedrock/${ip}${port ? `:${port}` : ""}`
: `https://api.mcstatus.io/v2/status/java/${ip}${port ? `:${port}` : ""}`;
try {
const response = await fetch(apiUrl);
if (!response.ok) throw new Error("Failed to fetch server status");
const data = await response.json();
return { author: "Herza", status: 200, data: data };
} catch (error) {
return { author: "Herza", status: 500, error: error.message + "only java and bedrock" };
}
}
module.exports = { getStatus }