// code from goatstore // api: https://store.agi.bd const axios = require("axios"); const Canvas = require("canvas"); const fs = require("fs"); module.exports = { config: { name: "pair2", aliases: ["pair 2", "2"], version: "1.1", author: "Jihad", role: 0, countDown: 5, shortDescription: "Pair", category: "FUN" }, onStart: async ({ api, event, usersData }) => { try { const { threadID, messageID, senderID } = event; const targetID = event.messageReply?.senderID || Object.keys(event.mentions || {})[0]; if (!targetID) return api.sendMessage( "⚠️ কাউকে Reply অথবা Mention করে Pair 2 দিন!", threadID, messageID ); const [me, target] = await Promise.all([ usersData.get(senderID), usersData.get(targetID) ]); const match = Math.floor(Math.random() * 31) + 70; const canvas = Canvas.createCanvas(1200, 700); const ctx = canvas.getContext("2d"); // Background const bg = ctx.createLinearGradient(0, 0, 1200, 700); bg.addColorStop(0, "#ffe6f2"); bg.addColorStop(1, "#fff5fa"); ctx.fillStyle = bg; ctx.fillRect(0, 0, 1200, 700); // 💕 Medium Love Effects for (let i = 0; i < 45; i++) { ctx.font = `${18 + Math.random() * 28}px sans-serif`; ctx.globalAlpha = 0.25 + Math.random() * 0.35; ctx.fillText( ["💗", "💖", "💕", "💞"][Math.floor(Math.random() * 4)], Math.random() * 1200, Math.random() * 700 ); } ctx.globalAlpha = 1; // Border ctx.strokeStyle = "#ffafd2"; ctx.lineWidth = 14; ctx.strokeRect(12, 12, 1176, 676); // Top ribbons ctx.font = "48px sans-serif"; for (let i = 0; i < 6; i++) ctx.fillText("🎀", 100 + i * 200, 65); const token = "6628568379|c1e620fa708a1d5696fb991c1bde5662"; async function getAvatar(id) { const res = await axios.get( `https://graph.facebook.com/${id}/picture?width=512&height=512&access_token=${token}`, { responseType: "arraybuffer" } ); return Canvas.loadImage(res.data); } const [img1, img2] = await Promise.all([ getAvatar(senderID), getAvatar(targetID) ]); // Photo frames function drawPhoto(img, x, y) { ctx.shadowColor = "#ff69b4"; ctx.shadowBlur = 25; ctx.fillStyle = "#fff"; ctx.fillRect(x - 12, y - 12, 284, 284); ctx.shadowBlur = 0; ctx.strokeStyle = "#ff8dc7"; ctx.lineWidth = 8; ctx.strokeRect(x - 5, y - 5, 270, 270); ctx.drawImage(img, x, y, 260, 260); ctx.font = "32px sans-serif"; ctx.fillText("💗", x - 15, y - 15); ctx.fillText("💖", x + 235, y - 15); ctx.fillText("💕", x - 12, y + 290); ctx.fillText("💞", x + 235, y + 290); } drawPhoto(img1, 100, 190); drawPhoto(img2, 840, 190); // Center heart ctx.font = "115px sans-serif"; ctx.fillText("💗", 520, 350); ctx.textAlign = "center"; // Match ctx.fillStyle = "#ff1493"; ctx.font = "bold 48px Arial"; ctx.fillText(`${match}% MATCH`, 600, 540); // Names ctx.fillStyle = "#d63384"; ctx.font = "bold 30px Arial"; let n1 = me.name || "You"; let n2 = target.name || "Someone"; if (n1.length > 15) n1 = n1.slice(0, 15) + "..."; if (n2.length > 15) n2 = n2.slice(0, 15) + "..."; ctx.fillText(n1, 230, 610); ctx.fillText(n2, 970, 610); ctx.font = "26px Arial"; ctx.fillStyle = "#ff69b4"; ctx.fillText("Made with Love 💕", 600, 660); const file = `${__dirname}/pair2_${Date.now()}.png`; fs.writeFileSync(file, canvas.toBuffer()); return api.sendMessage( { body: `💗 𝗣𝗘𝗥𝗙𝗘𝗖𝗧 𝗣𝗔𝗜𝗥 👤 ${n1} ✦ 👤 ${n2} 💞 ${match}% Match 💘 Status: Matched!`, attachment: fs.createReadStream(file) }, threadID, () => { if (fs.existsSync(file)) fs.unlinkSync(file); }, messageID ); } catch (err) { console.log("PAIR2 ERROR:", err); return api.sendMessage( "❌ Pair failed!", event.threadID, event.messageID ); } } };