// code from goatstore // api: https://store.agi.bd const fs = require("fs-extra"); const path = require("path"); const os = require("os"); const { createCanvas } = require("canvas"); const GIFEncoder = require("gif-encoder-2"); module.exports = { config: { name: "cpanel", version: "1.0.0", author: "modyfy bot", role: 0, category: "info", guide: { en: "{pn}" } }, onStart: async function ({ message }) { let outputPath = null; try { const width = 900; const height = 600; const cacheDir = path.join(__dirname, "cache"); await fs.ensureDir(cacheDir); outputPath = path.join( cacheDir, `cpanel_${Date.now()}.gif` ); /* ---------------- SYSTEM INFO ---------------- */ const uptime = process.uptime(); const days = Math.floor(uptime / 86400); const hours = Math.floor((uptime % 86400) / 3600); const minutes = Math.floor((uptime % 3600) / 60); const seconds = Math.floor(uptime % 60); const uptimeText = `${days}d ${hours}h ${minutes}m ${seconds}s`; const totalRAM = os.totalmem(); const freeRAM = os.freemem(); const usedRAM = totalRAM - freeRAM; const ramText = `${(usedRAM / 1024 / 1024 / 1024).toFixed(1)}GB`; const totalRamText = `${(totalRAM / 1024 / 1024 / 1024).toFixed(1)}GB`; const cpus = os.cpus() || []; const cpuCount = cpus.length || 1; const load = os.loadavg && os.loadavg().length ? os.loadavg()[0] : 0; const cpuLoad = Math.min( 100, Math.max(0, (load / cpuCount) * 100) ); const platform = os.platform(); const arch = os.arch(); const nodeVersion = process.version.replace("v", ""); const host = getHostingName(); /* ---------------- CANVAS ---------------- */ const canvas = createCanvas(width, height); const ctx = canvas.getContext("2d"); const encoder = new GIFEncoder(width, height); const stream = fs.createWriteStream(outputPath); encoder.createReadStream().pipe(stream); encoder.start(); encoder.setRepeat(0); encoder.setDelay(180); encoder.setQuality(10); /* ---------------- ANIMATION ---------------- */ const frames = 12; for (let frame = 0; frame < frames; frame++) { const pulse = Math.sin(frame * 0.7) * 8; const hue = (frame * 30) % 360; const glow = `hsl(${hue}, 100%, 65%)`; /* Background */ const bg = ctx.createLinearGradient( 0, 0, width, height ); bg.addColorStop(0, "#050912"); bg.addColorStop(0.5, "#0a1220"); bg.addColorStop(1, "#02050a"); ctx.fillStyle = bg; ctx.fillRect(0, 0, width, height); /* Header */ ctx.textAlign = "left"; ctx.textBaseline = "middle"; ctx.font = "bold 28px Arial"; ctx.fillStyle = "#ffffff"; ctx.fillText( "🤖 CPANEL • power by mili", 30, 38 ); ctx.font = "16px Arial"; ctx.fillStyle = "#8f9aaa"; ctx.fillText( "REAL BOT SYSTEM MONITOR", 32, 65 ); /* Online badge */ ctx.beginPath(); ctx.roundRect( width - 145, 23, 110, 34, 17 ); ctx.fillStyle = "rgba(0,255,150,0.12)"; ctx.fill(); ctx.strokeStyle = "#00ff9d"; ctx.lineWidth = 1.5; ctx.stroke(); ctx.fillStyle = "#00ff9d"; ctx.font = "bold 15px Arial"; ctx.textAlign = "center"; ctx.fillText( "● ONLINE", width - 90, 40 ); /* Main center circle */ const centerX = width / 2; const centerY = 315; drawCircle( ctx, centerX, centerY, 105 + pulse / 2, glow ); ctx.textAlign = "center"; ctx.font = "bold 24px Arial"; ctx.fillStyle = "#ffffff"; ctx.fillText( "CPANEL", centerX, centerY - 30 ); ctx.font = "bold 30px Arial"; ctx.fillStyle = glow; ctx.fillText( "SYSTEM", centerX, centerY + 10 ); ctx.font = "14px Arial"; ctx.fillStyle = "#9ca8b8"; ctx.fillText( "MONITORING", centerX, centerY + 40 ); /* ---------------- STAT CARDS ---------------- */ const stats = [ ["CPU", `${cpuLoad.toFixed(1)}%`], ["CORES", `${cpuCount}`], ["RAM", ramText], ["TOTAL", totalRamText], ["NODE", nodeVersion], ["ARCH", arch], ["HOST", host], ["UPTIME", uptimeText] ]; const positions = [ [145, 155], [325, 155], [575, 155], [755, 155], [145, 470], [325, 470], [575, 470], [755, 470] ]; for (let i = 0; i < stats.length; i++) { const x = positions[i][0]; const y = positions[i][1]; drawCard( ctx, x, y, 155, 82, stats[i][0], stats[i][1], glow ); } /* Footer */ ctx.textAlign = "center"; ctx.font = "13px Arial"; ctx.fillStyle = "#667085"; ctx.fillText( `Node.js ${nodeVersion} • ${platform} • ${arch}`, width / 2, height - 25 ); encoder.addFrame(ctx); } encoder.finish(); /* Wait until GIF is completely written */ await new Promise((resolve, reject) => { stream.on("finish", resolve); stream.on("error", reject); }); /* Send GIF */ await message.reply({ attachment: fs.createReadStream(outputPath) }); /* Delete temporary file */ setTimeout(() => { fs.remove(outputPath) .catch(() => {}); }, 10000); } catch (error) { console.error( "[CPANEL ERROR]", error ); if (outputPath) { await fs.remove(outputPath) .catch(() => {}); } return message.reply( "❌ CPANEL তৈরি করা যায়নি।\n\n" + "⚠️ Canvas/GIF dependency অথবা server environment সমস্যা হতে পারে।" ); } } }; /* ================================================= */ /* FUNCTIONS */ /* ================================================= */ function drawCircle( ctx, x, y, radius, color ) { ctx.save(); ctx.shadowColor = color; ctx.shadowBlur = 25; ctx.beginPath(); ctx.arc( x, y, radius, 0, Math.PI * 2 ); ctx.fillStyle = "#0b1420"; ctx.fill(); ctx.shadowBlur = 0; ctx.lineWidth = 3; ctx.strokeStyle = color; ctx.stroke(); /* Inner ring */ ctx.beginPath(); ctx.arc( x, y, radius - 10, 0, Math.PI * 2 ); ctx.lineWidth = 1; ctx.strokeStyle = "rgba(255,255,255,0.08)"; ctx.stroke(); ctx.restore(); } function drawCard( ctx, x, y, width, height, label, value, color ) { const left = x - width / 2; const top = y - height / 2; ctx.save(); /* Shadow */ ctx.shadowColor = "rgba(0,0,0,0.5)"; ctx.shadowBlur = 15; /* Card */ ctx.beginPath(); ctx.roundRect( left, top, width, height, 16 ); ctx.fillStyle = "#0d1724"; ctx.fill(); ctx.shadowBlur = 0; /* Border */ ctx.strokeStyle = "rgba(255,255,255,0.10)"; ctx.lineWidth = 1; ctx.stroke(); /* Label */ ctx.textAlign = "center"; ctx.textBaseline = "middle"; ctx.font = "bold 12px Arial"; ctx.fillStyle = "#7f8b9c"; ctx.fillText( label, x, y - 19 ); /* Value */ ctx.font = "bold 17px Arial"; ctx.fillStyle = color; ctx.fillText( value, x, y + 12 ); ctx.restore(); } function getHostingName() { const env = process.env; if (env.RENDER) return "Render"; if (env.RAILWAY_ENVIRONMENT) return "Railway"; if (env.VERCEL) return "Vercel"; if (env.REPL_ID) return "Replit"; if (env.FLY_APP_NAME) return "Fly.io"; if (env.DYNO) return "Heroku"; if (env.AWS_EXECUTION_ENV) return "AWS"; if (env.GITHUB_ACTIONS) return "GitHub"; return "VPS"; }