// code from goatstore // api: https://store.agi.bd const os = require("os"); const fs = require("fs-extra"); const axios = require("axios"); const startTime = new Date(); module.exports = { config: { name: "uptime", aliases: ["upt"], author: "NIROB", countDown: 0, role: 0, category: "system", longDescription: { en: "Get System Information", }, }, onStart: async function ({ api, event, args, threadsData, usersData }) { try { const uptimeInSeconds = (new Date() - startTime) / 1000; const days = Math.floor(uptimeInSeconds / (3600 * 24)); const hours = Math.floor((uptimeInSeconds % (3600 * 24)) / 3600); const minutes = Math.floor((uptimeInSeconds % 3600) / 60); const secondsLeft = Math.floor(uptimeInSeconds % 60); const uptimeFormatted = `${days}d ${hours}h ${minutes}m ${secondsLeft}s`; const cpuUsage = os.cpus().reduce((acc, curr) => acc + curr.times.user, 0) / os.cpus().length; const totalMemoryGB = os.totalmem() / 1024 ** 3; const freeMemoryGB = os.freemem() / 1024 ** 3; const usedMemoryGB = totalMemoryGB - freeMemoryGB; const allUsers = await usersData.getAll(); const allThreads = await threadsData.getAll(); const currentDate = new Date(); const date = currentDate.toLocaleDateString("en-US"); const time = currentDate.toLocaleTimeString("en-US", { timeZone: "Asia/Kolkata", hour12: true, }); const timeStart = Date.now(); await api.sendMessage("๐Ÿ”Ž Checking system info...", event.threadID); const ping = Date.now() - timeStart; let pingStatus = "โ›” Bad System"; if (ping < 1000) pingStatus = "โœ… Smooth System"; const systemInfo = `โ™ก โˆฉ_โˆฉ ๏ผˆโ€žโ€ข ึŠ โ€ขโ€ž)โ™ก โ•ญโ”€โˆชโˆชโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โŸก โ”‚ ๐—จ๐—ฃ๐—ง๐—œ๐— ๐—˜ ๐—œ๐—ก๐—™๐—ข โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โŸก โ”‚ โฐ Runtime: ${uptimeFormatted} โ”‚ OS: ${os.type()} ${os.arch()} โ”‚ CPU: ${os.cpus()[0].model} โ”‚ Storage: ${usedMemoryGB.toFixed(2)} GB / ${totalMemoryGB.toFixed(2)} GB โ”‚ CPU Usage: ${cpuUsage.toFixed(1)}% โ”‚ RAM: ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(1)} MB โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โŸก โ”‚ ๐Ÿ“† Date: ${date} โ”‚ โฑ๏ธ Time: ${time} โ”‚ ๐Ÿ‘ฅ Users: ${allUsers.length} โ”‚ ๐Ÿงต Threads: ${allThreads.length} โ”‚ ๐Ÿ“ก Ping: ${ping}ms โ”‚ Status: ${pingStatus} โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โŸก`; // Media from catbox (video) let attachment = null; const mediaUrl = "https://files.catbox.moe/9nx2wx.mp4"; if (mediaUrl.endsWith(".jpg") || mediaUrl.endsWith(".png") || mediaUrl.endsWith(".mp4")) { const response = await axios.get(mediaUrl, { responseType: "stream" }); attachment = response.data; } api.sendMessage( { body: systemInfo, attachment, }, event.threadID, ); } catch (error) { console.error("System info error:", error); api.sendMessage("โš ๏ธ Could not retrieve system information.", event.threadID); } }, };