(sock, message)
| 20 | usage: '.uptime', |
| 21 | isPrefixless: true, |
| 22 | async handler(sock, message) { |
| 23 | const chatId = message.key.remoteJid; |
| 24 | const commandHandler = (await import('../lib/commandHandler.js')).default; |
| 25 | const uptimeMs = process.uptime() * 1000; |
| 26 | const formatUptime = (ms) => { |
| 27 | const sec = Math.floor(ms / 1000) % 60; |
| 28 | const min = Math.floor(ms / (1000 * 60)) % 60; |
| 29 | const hr = Math.floor(ms / (1000 * 60 * 60)) % 24; |
| 30 | const day = Math.floor(ms / (1000 * 60 * 60 * 24)); |
| 31 | const parts = []; |
| 32 | if (day) |
| 33 | parts.push(`${day}d`); |
| 34 | if (hr) |
| 35 | parts.push(`${hr}h`); |
| 36 | if (min) |
| 37 | parts.push(`${min}m`); |
| 38 | parts.push(`${sec}s`); |
| 39 | return parts.join(' '); |
| 40 | }; |
| 41 | const startedAt = new Date(Date.now() - uptimeMs).toLocaleString(); |
| 42 | const ramMb = (process.memoryUsage().rss / 1024 / 1024).toFixed(1); |
| 43 | const commandCount = commandHandler.commands.size; |
| 44 | const text = `🤖 *MEGA-MD STATUS*\n\n` + |
| 45 | `⏱ Uptime: ${formatUptime(uptimeMs)}\n` + |
| 46 | `🚀 Started: ${startedAt}\n` + |
| 47 | `📦 Plugins: ${commandCount}\n` + |
| 48 | `💾 RAM: ${ramMb} MB`; |
| 49 | await sock.sendMessage(chatId, { text }); |
| 50 | } |
| 51 | }; |
| 52 | /***************************************************************************** |
| 53 | * * |
nothing calls this directly
no test coverage detected