Skip to content

Instantly share code, notes, and snippets.

@ONLym22
Created December 27, 2025 22:57
Show Gist options
  • Select an option

  • Save ONLym22/f22ae26b83ff0c830cc65b6e4e5803cf to your computer and use it in GitHub Desktop.

Select an option

Save ONLym22/f22ae26b83ff0c830cc65b6e4e5803cf to your computer and use it in GitHub Desktop.
ONLym BOT Gist Uploaded
case "ping":
case "srvinfo": {
const os = require("os");
const nou = require("node-os-utils");
xreact();
async function getServerInfo() {
try {
const cpus = os.cpus();
const totalMem = (os.totalmem() / (1024 ** 3)).toFixed(2);
const usedMem = ((os.totalmem() - os.freemem()) / (1024 ** 3)).toFixed(2);
const storageInfo = await nou.drive.info();
const start = Date.now();
const latensi = Date.now() - start;
const dataForCanvas = {
osType: os.type().toUpperCase(),
coreCount: cpus.length,
cpuSpeed: (cpus[0].speed / 1000).toFixed(2) + " GHz",
cpuModel: cpus[0].model.split(" ")[0] + " " + cpus[0].model.split(" ")[1],
totalMem: totalMem,
usedMem: usedMem,
cpuUsage: ((1 - (os.freemem() / os.totalmem())) * 100).toFixed(1),
storageTotal: storageInfo.totalGb,
storageUsed: storageInfo.usedGb,
uptime: runtime(os.uptime()),
latensi: latensi,
botName: botname.toUpperCase()
};
const imageBuffer = await createServerStatusImage(dataForCanvas);
const buttons = [
{
name: "cta_url",
buttonParamsJson: JSON.stringify({
display_text: "CONTACT OWNER",
url: "https://wa.me/${global.owner}",
merchant_url: "https://wa.me/${global.owner}"
})
}
];
await vellia.sendButtonImage(
m.chat,
null,
"",
imageBuffer,
buttons,
null,
qkontak
);
} catch (err) {
console.error(err);
xreply("Terjadi kesalahan sistem saat merender status.");
}
}
getServerInfo();
}
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment