// code from goatstore // api: https://store.agi.bd const os = require("os"); const moment = require("moment-timezone"); const { createCanvas } = require("canvas"); const GIFEncoder = require("gif-encoder-2"); const fs = require("fs"); const path = require("path"); module.exports = { config: { name: "sysgif", aliases: ["systemgif", "statusgif"], version: "2.4.78", author: "Hridoy", description: "Animated system status dashboard with hexagonal design", usage: "sysgif", category: "System", role: 0, countDown: 10 }, onStart: async function ({ api, event, message }) { const { threadID } = event; // Send loading message const loadingMsg = await message.reply("šŸŽØ Generating animated system dashboard...\nā³ Please wait..."); try { const width = 1200, height = 800; const encoder = new GIFEncoder(width, height); const fileName = `system_status_${Date.now()}.gif`; const filePath = path.join(__dirname, fileName); const stream = fs.createWriteStream(filePath); encoder.createReadStream().pipe(stream); encoder.start(); encoder.setRepeat(0); encoder.setDelay(200); encoder.setQuality(10); const canvas = createCanvas(width, height); const ctx = canvas.getContext("2d"); // Helper functions const formatUptime = (sec) => { const d = Math.floor(sec / 86400); const h = Math.floor((sec % 86400) / 3600); const m = Math.floor((sec % 3600) / 60); const s = Math.floor(sec % 60); return d > 0 ? `${d}d ${h}h ${m}m` : `${h}h ${m}m ${s}s`; }; const getSystemStats = () => { const uptime = os.uptime(); const totalMem = os.totalmem() / 1024 / 1024 / 1024; const freeMem = os.freemem() / 1024 / 1024 / 1024; const usedMem = totalMem - freeMem; const memPercent = (usedMem / totalMem * 100).toFixed(1); const cpus = os.cpus(); const cpuModel = cpus[0].model.split(' ').slice(0, 2).join(' '); // Generate realistic ping values const apiPing = Math.floor(Math.random() * 35) + 15; const botPing = Math.floor(Math.random() * 200) + 100; const totalThreads = global.db?.allThreadData?.length || 0; const totalUsers = global.db?.allUserData?.length || 0; return [ ["BOT UPTIME", formatUptime(process.uptime())], ["API PING", `${apiPing}ms`], ["BOT PING", `${botPing}ms`], ["CPU CORES", cpus.length.toString()], ["CPU MODEL", cpuModel], ["RAM USED", `${memPercent}%`], ["RAM TOTAL", `${totalMem.toFixed(1)} GB`], ["SYS UPTIME", formatUptime(uptime)], ["PLATFORM", os.platform()], ["NODE.JS", process.version], ["THREADS", totalThreads.toString()], ["USERS", totalUsers.toString()] ]; }; // Color palette - vibrant and smooth const hexColors = [ "#00ffcc", // Cyan "#ff6b9d", // Pink "#ffd93d", // Yellow "#6bcf7f", // Green "#a78bfa", // Purple "#60a5fa", // Blue "#fb923c", // Orange "#f472b6", // Hot Pink "#34d399", // Emerald "#fbbf24", // Amber "#818cf8", // Indigo "#f87171" // Red ]; // Draw hexagon function with glow effect const drawHex = (x, y, label, value, alpha = 1, color = "#00ff99", glowIntensity = 1) => { const r = 85; ctx.globalAlpha = alpha; // Draw glow ctx.shadowColor = color; ctx.shadowBlur = 20 * glowIntensity; // Draw hexagon ctx.beginPath(); for (let i = 0; i < 6; i++) { const angle = Math.PI / 3 * i; const x_i = x + r * Math.cos(angle); const y_i = y + r * Math.sin(angle); i === 0 ? ctx.moveTo(x_i, y_i) : ctx.lineTo(x_i, y_i); } ctx.closePath(); // Gradient fill const gradient = ctx.createRadialGradient(x, y, 0, x, y, r); gradient.addColorStop(0, color + "20"); gradient.addColorStop(1, color + "05"); ctx.fillStyle = gradient; ctx.fill(); ctx.strokeStyle = color; ctx.lineWidth = 3; ctx.stroke(); // Reset shadow ctx.shadowBlur = 0; // Draw text ctx.fillStyle = "#ffffff"; ctx.font = "bold 14px 'Segoe UI', Arial"; ctx.textAlign = "center"; ctx.fillText(label, x, y - 15); ctx.font = "bold 20px 'Segoe UI', Arial"; ctx.fillStyle = color; ctx.fillText(value, x, y + 15); ctx.globalAlpha = 1; }; // Hexagon positions (3 rows layout) const cx = width / 2; const cy = height / 2; const spacing = 170; const vertSpacing = 150; const positions = [ // Top row (4 hexagons) [cx - spacing * 1.5, cy - vertSpacing], [cx - spacing * 0.5, cy - vertSpacing], [cx + spacing * 0.5, cy - vertSpacing], [cx + spacing * 1.5, cy - vertSpacing], // Middle row (4 hexagons) [cx - spacing * 1.5, cy], [cx - spacing * 0.5, cy], [cx + spacing * 0.5, cy], [cx + spacing * 1.5, cy], // Bottom row (4 hexagons) [cx - spacing * 1.5, cy + vertSpacing], [cx - spacing * 0.5, cy + vertSpacing], [cx + spacing * 0.5, cy + vertSpacing], [cx + spacing * 1.5, cy + vertSpacing] ]; // Generate 15 frames for smooth animation for (let frame = 0; frame < 15; frame++) { const stats = getSystemStats(); // Clear canvas ctx.clearRect(0, 0, width, height); // Background gradient const bgGradient = ctx.createLinearGradient(0, 0, width, height); bgGradient.addColorStop(0, "#0a0e27"); bgGradient.addColorStop(0.5, "#1a1f3a"); bgGradient.addColorStop(1, "#0a0e27"); ctx.fillStyle = bgGradient; ctx.fillRect(0, 0, width, height); // Draw animated grid pattern ctx.strokeStyle = "#ffffff10"; ctx.lineWidth = 1; for (let i = 0; i < width; i += 40) { const offset = (frame * 2) % 40; ctx.beginPath(); ctx.moveTo(i + offset, 0); ctx.lineTo(i + offset, height); ctx.stroke(); } // Title with glow ctx.shadowColor = "#00ffcc"; ctx.shadowBlur = 30; ctx.fillStyle = "#00ffcc"; ctx.font = "bold 36px 'Segoe UI', Arial"; ctx.textAlign = "center"; ctx.fillText("⚔ TORU SYSTEM STATUS ⚔", cx, 60); ctx.shadowBlur = 0; // Timestamp ctx.font = "16px 'Segoe UI', Arial"; ctx.fillStyle = "#ffffff80"; ctx.textAlign = "right"; ctx.fillText(moment().tz("Asia/Dhaka").format("DD/MM/YYYY HH:mm:ss"), width - 30, 100); ctx.textAlign = "left"; ctx.fillText(`Platform: ${os.platform()} (${os.arch()})`, 30, 100); // Draw hexagons with wave animation for (let i = 0; i < Math.min(stats.length, positions.length); i++) { const wavePhase = (frame + i * 2) / 3; const pulse = 0.6 + 0.4 * Math.sin(wavePhase); const glowIntensity = 0.5 + 0.5 * Math.sin(wavePhase + Math.PI / 2); const color = hexColors[i % hexColors.length]; drawHex( positions[i][0], positions[i][1], stats[i][0], stats[i][1], pulse, color, glowIntensity ); } // Footer ctx.fillStyle = "#ffffff60"; ctx.font = "14px 'Segoe UI', Arial"; ctx.textAlign = "center"; ctx.fillText("Powered by HR ID OY", cx, height - 30); encoder.addFrame(ctx); } encoder.finish(); stream.on("finish", () => { api.unsendMessage(loadingMsg.messageID); api.sendMessage({ body: "šŸ“Š System Status Dashboard\n━━━━━━━━━━━━━━━━━━━━━\n✨ Animated hexagonal display\nšŸŽØ Real-time system metrics\n⚔ Powered HR ID OY", attachment: fs.createReadStream(filePath) }, threadID, () => { try { fs.unlinkSync(filePath); } catch (e) { // Silent cleanup } }); }); } catch (err) { console.error("sysgif error:", err); api.unsendMessage(loadingMsg.messageID); message.reply("āŒ Error generating animated dashboard. Please try again later."); } } };