// code from goatstore // api: https://store.agi.bd const { createCanvas, loadImage } = require("canvas"); const fs = require("fs-extra"); const path = require("path"); module.exports = { config: { name: "intro", version: "4.0.0", author: "MJ HAMIM", countDown: 5, role: 0, shortDescription: "Premium Intro Card", longDescription: "Create a stylish intro card", category: "box chat", guide: "{pn} [name] | [class] | [age] | [relation]" }, onStart: async function ({ api, event, args }) { const input = args.join(" ").split("|").map(x => x.trim()); const name = input[0] || "Your Name"; const className = input[1] || "Class 10"; const age = input[2] || "18"; const relation = input[3] || "Single"; const width = 1000; const height = 600; const canvas = createCanvas(width, height); const ctx = canvas.getContext("2d"); // Background const bg = ctx.createLinearGradient(0, 0, width, height); bg.addColorStop(0, "#090914"); bg.addColorStop(0.5, "#19102b"); bg.addColorStop(1, "#07070d"); ctx.fillStyle = bg; ctx.fillRect(0, 0, width, height); // Decorative glow ctx.shadowBlur = 35; ctx.shadowColor = "#ff9d00"; ctx.strokeStyle = "#ffb52e"; ctx.lineWidth = 5; ctx.strokeRect(20, 20, width - 40, height - 40); ctx.shadowBlur = 0; // Inner border ctx.strokeStyle = "#8b5a16"; ctx.lineWidth = 2; ctx.strokeRect(35, 35, width - 70, height - 70); // Header ctx.fillStyle = "#ffbd45"; ctx.font = "bold 34px Sans"; ctx.textAlign = "center"; ctx.fillText("✦ INTRODUCTION ✦", 500, 95); // Profile picture let avatar; try { const userInfo = await api.getUserInfo(event.senderID); const user = userInfo[event.senderID]; const avatarUrl = user && user.thumbSrc; if (avatarUrl) { avatar = await loadImage(avatarUrl); } } catch (e) {} const cx = 190; const cy = 300; const radius = 105; ctx.save(); ctx.beginPath(); ctx.arc(cx, cy, radius + 8, 0, Math.PI * 2); ctx.strokeStyle = "#ffb52e"; ctx.lineWidth = 7; ctx.shadowColor = "#ff9d00"; ctx.shadowBlur = 22; ctx.stroke(); ctx.restore(); if (avatar) { ctx.save(); ctx.beginPath(); ctx.arc(cx, cy, radius, 0, Math.PI * 2); ctx.clip(); ctx.drawImage( avatar, cx - radius, cy - radius, radius * 2, radius * 2 ); ctx.restore(); } else { ctx.beginPath(); ctx.arc(cx, cy, radius, 0, Math.PI * 2); ctx.fillStyle = "#20162d"; ctx.fill(); ctx.fillStyle = "#ffffff"; ctx.font = "bold 70px Sans"; ctx.fillText("?", cx, cy + 24); } // Name ctx.textAlign = "left"; ctx.fillStyle = "#ffbd45"; ctx.font = "bold 48px Sans"; ctx.fillText(name.slice(0, 22), 360, 205); // Separator ctx.fillStyle = "#ffffff"; ctx.fillRect(360, 230, 500, 2); // Information rows const details = [ ["NAME", name], ["CLASS", className], ["AGE", age], ["RELATION", relation] ]; let y = 290; for (const [label, value] of details) { ctx.fillStyle = "#c2a6e8"; ctx.font = "bold 25px Sans"; ctx.fillText(label, 365, y); ctx.fillStyle = "#ffffff"; ctx.font = "28px Sans"; ctx.fillText(": " + value.slice(0, 24), 535, y); y += 65; } // Signature ctx.textAlign = "center"; ctx.fillStyle = "#ffbd45"; ctx.font = "italic 24px Sans"; ctx.fillText("Signature __________________", 690, 550); // Footer ctx.fillStyle = "#b9b2c7"; ctx.font = "18px Sans"; ctx.fillText("PREMIUM INTRO CARD", 500, 575); const outputPath = path.join( __dirname, `intro_${event.senderID}.png` ); try { await fs.writeFile(outputPath, canvas.toBuffer("image/png")); api.sendMessage( { body: "✦ 𝐘𝐎𝐔𝐑 𝐈𝐍𝐓𝐑𝐎 𝐂𝐀𝐑𝐃 ✦", attachment: fs.createReadStream(outputPath) }, event.threadID, () => { fs.remove(outputPath).catch(() => {}); }, event.messageID ); } catch (err) { api.sendMessage( "Intro card তৈরি করা যায়নি। Bot-এ canvas ও fs-extra ইনস্টল আছে কি না চেক করো।", event.threadID, event.messageID ); } } };