// code from goatstore // api: https://store.agi.bd module.exports.config = { name: "up2", version: "6.0.0", author: "Zihad", aliases: ["uptime", "status"], role: 0, category: "system", guide: "{pn}" }; const fs = require("fs"); const path = require("path"); const os = require("os"); const { createCanvas } = require("canvas"); const GIFEncoder = require("gif-encoder-2"); function uptime() { let s = Math.floor(process.uptime()); const d = Math.floor(s / 86400); s %= 86400; const h = Math.floor(s / 3600); s %= 3600; const m = Math.floor(s / 60); return `${d} DAYS ${h} HOURS ${m} MIN`; } function cpuLoad() { const cpus = os.cpus(); let idle = 0; let total = 0; for (const c of cpus) { idle += c.times.idle; total += c.times.user + c.times.nice + c.times.sys + c.times.idle + c.times.irq; } if (!total) return 0; return Math.round( 100 - (idle / total) * 100 ); } function ramUsage() { const total = os.totalmem(); const free = os.freemem(); return Math.round( ((total - free) / total) * 100 ); } function draw(ctx, w, h, frame) { /* ========================= DEEP CINEMATIC BACKGROUND ========================== */ const bg = ctx.createLinearGradient( 0, 0, w, h ); bg.addColorStop(0, "#02030a"); bg.addColorStop(0.5, "#05020d"); bg.addColorStop(1, "#010207"); ctx.fillStyle = bg; ctx.fillRect(0, 0, w, h); /* ========================= MOVING BLUE LIGHT ========================== */ const bx = w * 0.18 + Math.sin(frame * 0.055) * 190; const by = h * 0.35 + Math.cos(frame * 0.04) * 80; const blue = ctx.createRadialGradient( bx, by, 0, bx, by, 300 ); blue.addColorStop( 0, "rgba(0,150,255,0.24)" ); blue.addColorStop( 0.35, "rgba(0,100,255,0.10)" ); blue.addColorStop( 1, "rgba(0,0,0,0)" ); ctx.fillStyle = blue; ctx.fillRect(0, 0, w, h); /* ========================= MOVING PURPLE LIGHT ========================== */ const px = w * 0.82 + Math.cos(frame * 0.045) * 180; const py = h * 0.63 + Math.sin(frame * 0.05) * 90; const purple = ctx.createRadialGradient( px, py, 0, px, py, 290 ); purple.addColorStop( 0, "rgba(150,50,255,0.22)" ); purple.addColorStop( 0.4, "rgba(100,30,220,0.09)" ); purple.addColorStop( 1, "rgba(0,0,0,0)" ); ctx.fillStyle = purple; ctx.fillRect(0, 0, w, h); /* ========================= CINEMATIC LIGHT RIBBONS ========================== */ for (let n = 0; n < 4; n++) { ctx.beginPath(); for ( let x = -30; x <= w + 30; x += 7 ) { const y = h * (0.16 + n * 0.24) + Math.sin( x * 0.010 + frame * 0.065 + n ) * (18 + n * 6) + Math.sin( x * 0.003 + frame * 0.035 ) * 25; if (x === -30) { ctx.moveTo(x, y); } else { ctx.lineTo(x, y); } } const ribbon = ctx.createLinearGradient( 0, 0, w, 0 ); ribbon.addColorStop( 0, "rgba(0,130,255,0)" ); ribbon.addColorStop( 0.22, "rgba(0,180,255,0.09)" ); ribbon.addColorStop( 0.48, "rgba(120,80,255,0.20)" ); ribbon.addColorStop( 0.72, "rgba(0,170,255,0.10)" ); ribbon.addColorStop( 1, "rgba(0,80,255,0)" ); ctx.strokeStyle = ribbon; ctx.lineWidth = 1.5 + n * 0.4; ctx.stroke(); } /* ========================= FLOATING PARTICLES ========================== */ for (let i = 0; i < 75; i++) { const speed = 0.25 + (i % 5) * 0.08; const x = (i * 127 + frame * speed) % w; const y = (i * 67 + Math.sin( frame * 0.025 + i ) * 30) % h; const size = 0.5 + (i % 3) * 0.45; ctx.beginPath(); ctx.arc( x, y, size, 0, Math.PI * 2 ); ctx.fillStyle = i % 2 === 0 ? "rgba(60,190,255,0.50)" : "rgba(170,90,255,0.42)"; ctx.fill(); } /* ========================= TOP MINI BRAND ========================== */ ctx.textAlign = "center"; ctx.font = "bold 11px Sans"; ctx.fillStyle = "#7180a0"; ctx.fillText( "GOAT BOT / SYSTEM MONITOR", w / 2, 48 ); /* ========================= ONLINE INDICATOR ========================== */ const pulse = 0.45 + Math.sin(frame * 0.16) * 0.25; ctx.beginPath(); ctx.arc( w / 2 - 62, 82, 4, 0, Math.PI * 2 ); ctx.fillStyle = `rgba(0,255,180,${pulse})`; ctx.shadowColor = "#00ffb0"; ctx.shadowBlur = 13; ctx.fill(); ctx.shadowBlur = 0; ctx.font = "bold 13px Sans"; ctx.fillStyle = "#c7d0df"; ctx.fillText( "SERVER ONLINE", w / 2 + 15, 87 ); /* ========================= MAIN UPTIME ========================== */ ctx.font = "bold 10px Sans"; ctx.fillStyle = "#646d87"; ctx.fillText( "UPTIME", w / 2, 140 ); const ug = ctx.createLinearGradient( 150, 0, 550, 0 ); ug.addColorStop( 0, "#42c9ff" ); ug.addColorStop( 0.5, "#ffffff" ); ug.addColorStop( 1, "#a875ff" ); ctx.font = "bold 39px Sans"; ctx.fillStyle = ug; ctx.shadowColor = "rgba(50,150,255,0.40)"; ctx.shadowBlur = 20; ctx.fillText( uptime(), w / 2, 185 ); ctx.shadowBlur = 0; /* ========================= MOVING ENERGY LINE ========================== */ const lineX = 110 + ((frame * 10) % (w - 220)); const line = ctx.createLinearGradient( 80, 0, w - 80, 0 ); line.addColorStop( 0, "rgba(0,140,255,0)" ); line.addColorStop( 0.45, "rgba(70,180,255,0.12)" ); line.addColorStop( 0.5, "rgba(170,100,255,0.45)" ); line.addColorStop( 1, "rgba(0,100,255,0)" ); ctx.strokeStyle = line; ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(100, 218); ctx.lineTo(w - 100, 218); ctx.stroke(); ctx.beginPath(); ctx.arc( lineX, 218, 2.5, 0, Math.PI * 2 ); ctx.fillStyle = "#73d8ff"; ctx.shadowColor = "#42bfff"; ctx.shadowBlur = 12; ctx.fill(); ctx.shadowBlur = 0; /* ========================= MINIMAL SERVER INFO ========================== */ const stats = [ ["CPU", cpuLoad() + "%"], ["RAM", ramUsage() + "%"], ["CORE", os.cpus().length], ["NODE", process.version.replace("v", "")] ]; const xs = [ 135, 300, 465, 590 ]; for (let i = 0; i < stats.length; i++) { ctx.textAlign = "center"; ctx.font = "bold 9px Sans"; ctx.fillStyle = "#59627b"; ctx.fillText( stats[i][0], xs[i], 295 ); ctx.font = "bold 15px Sans"; const sg = ctx.createLinearGradient( xs[i] - 25, 0, xs[i] + 25, 0 ); sg.addColorStop( 0, "#5bd3ff" ); sg.addColorStop( 1, "#a06cff" ); ctx.fillStyle = sg; ctx.fillText( String(stats[i][1]), xs[i], 318 ); } /* ========================= BOTTOM CINEMATIC LINE ========================== */ const bottom = ctx.createLinearGradient( 80, 0, w - 80, 0 ); bottom.addColorStop( 0, "rgba(0,100,255,0)" ); bottom.addColorStop( 0.5, "rgba(100,130,255,0.28)" ); bottom.addColorStop( 1, "rgba(140,50,255,0)" ); ctx.strokeStyle = bottom; ctx.beginPath(); ctx.moveTo(90, 350); ctx.lineTo(w - 90, 350); ctx.stroke(); ctx.font = "9px Sans"; ctx.fillStyle = "#444b61"; ctx.fillText( "REAL PROCESS UPTIME • ZIHAD", w / 2, 375 ); } module.exports.onStart = async function ({ api, event }) { const width = 700; const height = 400; const canvas = createCanvas( width, height ); const ctx = canvas.getContext("2d"); const encoder = new GIFEncoder( width, height ); encoder.start(); encoder.setRepeat(0); encoder.setDelay(85); encoder.setQuality(7); // 32 smooth frames for (let frame = 0; frame < 32; frame++) { draw( ctx, width, height, frame ); encoder.addFrame(ctx); } encoder.finish(); const cache = path.join( __dirname, "cache" ); if (!fs.existsSync(cache)) { fs.mkdirSync(cache, { recursive: true }); } const file = path.join( cache, "up2_" + Date.now() + ".gif" ); fs.writeFileSync( file, encoder.out.getData() ); try { await api.sendMessage( { body: "⚡ SERVER ONLINE\n" + "━━━━━━━━━━━━━━━━━━\n" + "Premium Animated Uptime", attachment: fs.createReadStream(file) }, event.threadID ); } catch (err) { console.error( "UP2 ERROR:", err ); } setTimeout(() => { try { if (fs.existsSync(file)) { fs.unlinkSync(file); } } catch (e) {} }, 20000); };