goat
command
health
Show bot & server health status
0
views
0
likes
0
installs
raw source
const os = require("os");
module.exports.config = {
name: "health",
version: "1.0.0",
role: 0, // সবাঠবΰ§ΰ¦―বহার ΰ¦ΰ¦°ΰ¦€ΰ§ ΰ¦ͺারবΰ§
author: "π©π
ππ·πΎππͺ πππΎ",
description: "Show bot & server health status",
category: "system",
usages: "/health",
countDown: 5
};
module.exports.onStart = async function ({ api, event }) {
try {
const uptime = process.uptime(); // seconds
const uptimeH = Math.floor(uptime / 3600);
const uptimeM = Math.floor((uptime % 3600) / 60);
const uptimeS = Math.floor(uptime % 60);
const memory = process.memoryUsage();
const usedMB = (memory.rss / 1024 / 1024).toFixed(2);
const heapMB = (memory.heapUsed / 1024 / 1024).toFixed(2);
const cpuLoad = os.loadavg()[0].toFixed(2);
const totalMem = (os.totalmem() / 1024 / 1024).toFixed(0);
const freeMem = (os.freemem() / 1024 / 1024).toFixed(0);
const statusMsg =
`π©Ί BOT HEALTH STATUS
π€ Bot Name: ${global.config?.BOTNAME || "Moyna"}
β‘ Status: ONLINE
π Uptime: ${uptimeH}h ${uptimeM}m ${uptimeS}s
π§ Memory:
β’ Used (RSS): ${usedMB} MB
β’ Heap Used: ${heapMB} MB
π₯ Server:
β’ CPU Load: ${cpuLoad}
β’ RAM: ${freeMem} MB free / ${totalMem} MB total
β’ Platform: ${process.platform}
π Environment:
β’ Node: ${process.version}
β’ PID: ${process.pid}
β
All systems operational`;
api.sendMessage(statusMsg, event.threadID);
} catch (err) {
api.sendMessage(
"β Health check failed. Something went wrong.",
event.threadID
);
}
};