// code from goatstore // api: https://store.agi.bd const { createCanvas, loadImage } = require('canvas'); const fs = require('fs-extra'); const path = require('path'); const os = require('os'); module.exports = { config: { name: "owner", version: "2.0.2", author: "SHANTO", countDown: 5, role: 0, description: "Display developer profile and system metrics on a dark dev-themed Canvas card", category: "info", guide: { en: "{p}owner" } }, onStart: async function ({ api, event }) { const { threadID, messageID } = event; const botName = global.GoatBot?.config?.nickNameBot || "POCKE-BOT"; const prefix = global.GoatBot?.config?.prefix || "-"; const uptimeSec = process.uptime(); const hours = Math.floor(uptimeSec / 3600); const minutes = Math.floor((uptimeSec % 3600) / 60); const seconds = Math.floor(uptimeSec % 60); const uptimeStr = `${hours}h ${minutes}m ${seconds}s`; const totalMemGB = (os.totalmem() / (1024 ** 3)).toFixed(2); const freeMemGB = (os.freemem() / (1024 ** 3)).toFixed(2); const usedMemGB = (totalMemGB - freeMemGB).toFixed(2); const ramUsagePercent = Math.round((usedMemGB / totalMemGB) * 100); const nodeVersion = process.version; const platform = `${os.type()} ${os.arch()}`; let profileImg = null; try { profileImg = await loadImage('https://i.imgur.com/WZVQpBD.jpeg'); } catch (e) {} const width = 900; const height = 580; const canvas = createCanvas(width, height); const ctx = canvas.getContext('2d'); ctx.fillStyle = '#0a0d14'; ctx.fillRect(0, 0, width, height); ctx.strokeStyle = 'rgba(255, 255, 255, 0.03)'; ctx.lineWidth = 1; for (let x = 0; x < width; x += 30) { ctx.beginPath(); ctx.moveTo(x, 0); ctx.lineTo(x, height); ctx.stroke(); } for (let y = 0; y < height; y += 30) { ctx.beginPath(); ctx.moveTo(0, y); ctx.lineTo(width, y); ctx.stroke(); } ctx.strokeStyle = '#00f2fe'; ctx.lineWidth = 2; ctx.strokeRect(12, 12, width - 24, height - 24); ctx.fillStyle = '#111625'; ctx.fillRect(14, 14, width - 28, 45); const drawDot = (x, color) => { ctx.beginPath(); ctx.arc(x, 36, 6, 0, Math.PI * 2); ctx.fillStyle = color; ctx.fill(); }; drawDot(35, '#ff5f56'); drawDot(53, '#ffbd2e'); drawDot(71, '#27c93f'); if (profileImg) { const imgX = 785; const imgY = 22; const imgSize = 75; const radius = 10; const drawRoundedBox = (x, y, w, h, r) => { ctx.beginPath(); ctx.moveTo(x + r, y); ctx.lineTo(x + w - r, y); ctx.quadraticCurveTo(x + w, y, x + w, y + r); ctx.lineTo(x + w, y + h - r); ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h); ctx.lineTo(x + r, y + h); ctx.quadraticCurveTo(x, y + h, x, y + h - r); ctx.lineTo(x, y + r); ctx.quadraticCurveTo(x, y, x + r, y); ctx.closePath(); }; ctx.save(); drawRoundedBox(imgX, imgY, imgSize, imgSize, radius); ctx.clip(); ctx.drawImage(profileImg, imgX, imgY, imgSize, imgSize); ctx.restore(); const strokeGrad = ctx.createLinearGradient(imgX, imgY, imgX + imgSize, imgY + imgSize); strokeGrad.addColorStop(0, '#00f2fe'); strokeGrad.addColorStop(0.5, '#9b51e0'); strokeGrad.addColorStop(1, '#ff007f'); ctx.strokeStyle = strokeGrad; ctx.lineWidth = 3; drawRoundedBox(imgX, imgY, imgSize, imgSize, radius); ctx.stroke(); } ctx.fillStyle = '#00f2fe'; ctx.font = 'bold 26px sans-serif'; ctx.textAlign = 'left'; ctx.fillText('⚡ DEVELOPER & SYSTEM ARCHITECTURE ⚡', 40, 95); ctx.strokeStyle = '#00f2fe'; ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(40, 110); ctx.lineTo(width - 40, 110); ctx.stroke(); const devProfile = [ { key: "AUTHOR", val: "Shanto ahmed" }, { key: "DEV ALIAS", val: "Shanto-00 [ Noob Dev's ]" }, { key: "AGE", val: "21+" }, { key: "NATIONALITY", val: "Bangladeshi (BD)" }, { key: "RELIGION", val: "Islam" }, { key: "EDUCATION", val: "Computer Engineering" }, { key: "SPECIALITY", val: "UI/UX, API Architect, Node.js" }, { key: "CORE PROJECT", val: "POCKE-BOT (Automated FCA AI)" } ]; const systemMetrics = [ { key: "BOT NAME", val: botName }, { key: "SYS PREFIX", val: prefix }, { key: "BOT UPTIME", val: uptimeStr }, { key: "RAM ALLOCATED", val: `${usedMemGB} GB / ${totalMemGB} GB (${ramUsagePercent}%)` }, { key: "OS PLATFORM", val: platform }, { key: "RUNTIME ENV", val: `Node.js ${nodeVersion}` }, { key: "DB INSTANCE", val: "Connected (JSON/SQLite)" }, { key: "STATUS", val: "ONLINE [OPTIMIZED]" } ]; ctx.fillStyle = '#131927'; ctx.fillRect(40, 130, 400, 410); ctx.strokeStyle = '#1e293b'; ctx.strokeRect(40, 130, 400, 410); ctx.fillStyle = '#98c379'; ctx.font = 'bold 18px monospace'; ctx.fillText('// DEVELOPER PROFILE', 55, 160); let profileY = 195; devProfile.forEach((item) => { ctx.fillStyle = '#abb2bf'; ctx.font = 'bold 13px monospace'; ctx.fillText(`${item.key.padEnd(13, ' ')} :`, 55, profileY); ctx.fillStyle = '#e5c07b'; ctx.font = '13px monospace'; ctx.fillText(item.val, 185, profileY); profileY += 38; }); ctx.fillStyle = '#131927'; ctx.fillRect(460, 130, 400, 410); ctx.strokeStyle = '#1e293b'; ctx.strokeRect(460, 130, 400, 410); ctx.fillStyle = '#61afef'; ctx.font = 'bold 18px monospace'; ctx.fillText('// SYSTEM METRICS', 475, 160); let sysY = 195; systemMetrics.forEach((item) => { ctx.fillStyle = '#abb2bf'; ctx.font = 'bold 13px monospace'; ctx.fillText(`${item.key.padEnd(13, ' ')} :`, 475, sysY); ctx.fillStyle = item.key === "STATUS" ? '#27c93f' : '#e06c75'; ctx.font = '13px monospace'; ctx.fillText(item.val, 605, sysY); sysY += 38; }); const cacheDir = path.join(__dirname, 'cache'); if (!fs.existsSync(cacheDir)) fs.mkdirSync(cacheDir); const imagePath = path.join(cacheDir, `owner_${event.senderID}.png`); const buffer = canvas.toBuffer('image/png'); fs.writeFileSync(imagePath, buffer); return api.sendMessage( { attachment: fs.createReadStream(imagePath) }, threadID, () => fs.unlinkSync(imagePath), messageID ); } };