// code from goatstore // api: https://store.agi.bd // code from goatstore // Fixed by Jihad const axios = require("axios"); const Canvas = require("canvas"); const fs = require("fs"); const path = require("path"); module.exports = { config: { name: "pair4", aliases: ["4", "pair 4"], version: "3.0.0", author: "Jihad", role: 0, countDown: 5, shortDescription: "Futuristic romantic pair system", category: "FUN & SOCIAL" }, onStart: async function ({ api, event, usersData }) { const { threadID, messageID, senderID } = event; try { /* * ========================================== * TARGET SYSTEM * ========================================== * Reply > Mention */ const targetID = event.messageReply?.senderID || event.messageReply?.author || Object.keys(event.mentions || {})[0]; if (!targetID) { return api.sendMessage( "⚠️ কাউকে Reply অথবা Mention করে Pair 4 দিন!", threadID, messageID ); } // নিজের সাথে pair আটকানো if (String(targetID) === String(senderID)) { return api.sendMessage( "😅 নিজেকে Reply/Mention করে Pair করা যাবে না!", threadID, messageID ); } /* * ========================================== * GET BOTH USERS * ========================================== */ const [ senderData, targetData ] = await Promise.all([ usersData.get(senderID), usersData.get(targetID) ]); const senderName = senderData?.name || "User"; const targetName = targetData?.name || "User"; const senderGender = senderData?.gender; const targetGender = targetData?.gender; /* * ========================================== * LOADING * ========================================== */ const loading = await api.sendMessage( "💫 | Creating your perfect pair...", threadID ); /* * ========================================== * COMPATIBILITY * ========================================== */ const match = Math.floor(Math.random() * 31) + 70; /* * ========================================== * CANVAS * ========================================== */ const canvas = Canvas.createCanvas( 1600, 900 ); const ctx = canvas.getContext("2d"); const width = canvas.width; const height = canvas.height; /* * ========================================== * BACKGROUND * ========================================== */ const bg = ctx.createLinearGradient( 0, 0, width, height ); bg.addColorStop( 0, "#050816" ); bg.addColorStop( 0.35, "#101b3d" ); bg.addColorStop( 0.65, "#24114d" ); bg.addColorStop( 1, "#050816" ); ctx.fillStyle = bg; ctx.fillRect( 0, 0, width, height ); /* * ========================================== * CYAN STARS * ========================================== */ for (let i = 0; i < 160; i++) { const x = Math.random() * width; const y = Math.random() * height; const size = Math.random() * 3 + 1; ctx.beginPath(); ctx.arc( x, y, size, 0, Math.PI * 2 ); ctx.fillStyle = `rgba(0, 230, 255, ${ Math.random() * 0.6 })`; ctx.fill(); } /* * ========================================== * PINK PARTICLES * ========================================== */ for (let i = 0; i < 70; i++) { const x = Math.random() * width; const y = Math.random() * height; ctx.fillStyle = `rgba(255, 0, 180, ${ Math.random() * 0.3 })`; ctx.fillRect( x, y, 2, 2 ); } /* * ========================================== * OUTER BORDER * ========================================== */ ctx.strokeStyle = "rgba(0, 240, 255, 0.7)"; ctx.lineWidth = 4; ctx.shadowBlur = 25; ctx.shadowColor = "#00eaff"; ctx.strokeRect( 20, 20, width - 40, height - 40 ); ctx.shadowBlur = 0; ctx.strokeStyle = "rgba(255, 0, 200, 0.35)"; ctx.lineWidth = 2; ctx.strokeRect( 32, 32, width - 64, height - 64 ); /* * ========================================== * HEADER * ========================================== */ ctx.textAlign = "center"; ctx.fillStyle = "#ffffff"; ctx.shadowColor = "#00eaff"; ctx.shadowBlur = 18; ctx.font = "bold 68px Arial"; ctx.fillText( "PAIR CONNECTION", width / 2, 105 ); ctx.shadowBlur = 0; ctx.fillStyle = "#00eaff"; ctx.font = "bold 28px Arial"; ctx.fillText( "✦ COMPATIBILITY ANALYSIS ✦", width / 2, 150 ); /* * ========================================== * FACEBOOK PROFILE PICTURES * ========================================== */ const token = "6628568379|c1e620fa708a1d5696fb991c1bde5662"; // নিজের ছবি const avt1 = `https://graph.facebook.com/${senderID}/picture?width=1024&height=1024&access_token=${token}`; // Reply/Mention করা ব্যক্তির ছবি const avt2 = `https://graph.facebook.com/${targetID}/picture?width=1024&height=1024&access_token=${token}`; async function loadImage(url) { const response = await axios.get( url, { responseType: "arraybuffer", headers: { "User-Agent": "Mozilla/5.0" }, timeout: 15000 } ); return Canvas.loadImage( response.data ); } const [ img1, img2 ] = await Promise.all([ loadImage(avt1), loadImage(avt2) ]); /* * ========================================== * DRAW TECH AVATAR * ========================================== */ function drawTechAvatar( img, x, y ) { const size = 330; ctx.save(); // Cyan outer glow ctx.shadowColor = "#00eaff"; ctx.shadowBlur = 35; ctx.strokeStyle = "#00eaff"; ctx.lineWidth = 8; ctx.beginPath(); ctx.arc( x + size / 2, y + size / 2, size / 2 + 20, 0, Math.PI * 2 ); ctx.stroke(); // Pink ring ctx.shadowColor = "#ff00c8"; ctx.shadowBlur = 25; ctx.strokeStyle = "#ff00c8"; ctx.lineWidth = 5; ctx.beginPath(); ctx.arc( x + size / 2, y + size / 2, size / 2 + 8, 0, Math.PI * 2 ); ctx.stroke(); ctx.shadowBlur = 0; // Clip image circle ctx.save(); ctx.beginPath(); ctx.arc( x + size / 2, y + size / 2, size / 2 - 5, 0, Math.PI * 2 ); ctx.clip(); ctx.drawImage( img, x, y, size, size ); ctx.restore(); // Inner border ctx.strokeStyle = "rgba(255,255,255,0.9)"; ctx.lineWidth = 3; ctx.beginPath(); ctx.arc( x + size / 2, y + size / 2, size / 2 - 5, 0, Math.PI * 2 ); ctx.stroke(); ctx.restore(); // Connected status ctx.fillStyle = "#00eaff"; ctx.font = "bold 25px Arial"; ctx.textAlign = "center"; ctx.fillText( "● CONNECTED", x + size / 2, y + size + 55 ); } /* * ========================================== * AVATARS * ========================================== */ drawTechAvatar( img1, 180, 250 ); drawTechAvatar( img2, 1090, 250 ); /* * ========================================== * CENTER HEART * ========================================== */ ctx.shadowColor = "#ff00c8"; ctx.shadowBlur = 30; ctx.fillStyle = "#ff00c8"; ctx.font = "bold 135px Arial"; ctx.textAlign = "center"; ctx.fillText( "♥", width / 2, 390 ); ctx.shadowBlur = 0; /* * ========================================== * PROGRESS CIRCLE * ========================================== */ ctx.strokeStyle = "rgba(0,234,255,0.25)"; ctx.lineWidth = 16; ctx.beginPath(); ctx.arc( width / 2, 465, 105, 0, Math.PI * 2 ); ctx.stroke(); const progress = (match / 100) * Math.PI * 2; ctx.strokeStyle = "#00eaff"; ctx.lineWidth = 16; ctx.beginPath(); ctx.arc( width / 2, 465, 105, -Math.PI / 2, -Math.PI / 2 + progress ); ctx.stroke(); /* * ========================================== * MATCH % * ========================================== */ ctx.fillStyle = "#ffffff"; ctx.font = "bold 60px Arial"; ctx.fillText( `${match}%`, width / 2, 505 ); ctx.fillStyle = "#00eaff"; ctx.font = "bold 25px Arial"; const compatibility = match > 85 ? "PERFECT CONNECTION" : match > 75 ? "STRONG CONNECTION" : "GOOD CONNECTION"; ctx.fillText( compatibility, width / 2, 550 ); /* * ========================================== * DISPLAY NAMES * ========================================== */ let displayName1 = String(senderName); let displayName2 = String(targetName); if ( displayName1.length > 18 ) { displayName1 = displayName1.substring( 0, 18 ) + "..."; } if ( displayName2.length > 18 ) { displayName2 = displayName2.substring( 0, 18 ) + "..."; } ctx.shadowColor = "#ff00c8"; ctx.shadowBlur = 15; ctx.fillStyle = "#ffffff"; ctx.font = "bold 42px Arial"; ctx.fillText( displayName1, 345, 680 ); ctx.fillText( displayName2, 1255, 680 ); ctx.shadowBlur = 0; /* * ========================================== * VS * ========================================== */ ctx.fillStyle = "#ff00c8"; ctx.font = "bold 32px Arial"; ctx.fillText( "VS", width / 2, 680 ); /* * ========================================== * FOOTER * ========================================== */ ctx.fillStyle = "#ffffff"; ctx.font = "bold 36px Arial"; ctx.fillText( "✦ PERFECT PAIR ✦", width / 2, 750 ); ctx.fillStyle = "#00eaff"; ctx.font = "24px Arial"; ctx.fillText( "💫 TWO PROFILES • ONE CONNECTION 💫", width / 2, 795 ); ctx.fillStyle = "rgba(255,255,255,0.45)"; ctx.font = "18px Arial"; ctx.fillText( "PAIR4 SYSTEM", width / 2, 835 ); /* * ========================================== * CACHE * ========================================== */ const cacheDir = path.join( __dirname, "cache" ); if ( !fs.existsSync(cacheDir) ) { fs.mkdirSync( cacheDir, { recursive: true } ); } const filePath = path.join( cacheDir, `pair4_${Date.now()}.png` ); fs.writeFileSync( filePath, canvas.toBuffer() ); /* * ========================================== * REMOVE LOADING * ========================================== */ if ( loading && loading.messageID ) { try { await api.unsendMessage( loading.messageID ); } catch {} } /* * ========================================== * RESULT * ========================================== */ const emoji = match > 85 ? "💞" : match > 75 ? "💗" : "💕"; const compatibilityText = match > 85 ? "Perfect" : match > 75 ? "Great" : "Good"; const genderEmoji1 = senderGender === 1 ? "👦" : senderGender === 2 ? "👧" : "👤"; const genderEmoji2 = targetGender === 1 ? "👦" : targetGender === 2 ? "👧" : "👤"; const msg = `${emoji} 𝐏𝐀𝐈𝐑 𝟒 ${genderEmoji1} ${senderName} ✦ ${genderEmoji2} ${targetName} 📊 ${match}% ${compatibilityText} Match 💘 Status: Matched!`; /* * ========================================== * SEND RESULT * ========================================== */ return api.sendMessage( { body: msg, attachment: fs.createReadStream( filePath ) }, threadID, () => { if ( fs.existsSync(filePath) ) { try { fs.unlinkSync( filePath ); } catch {} } }, messageID ); } catch (err) { console.log( "PAIR4 ERROR:", err ); return api.sendMessage( "❌ | Pair 4 failed! Please try again.", threadID, messageID ); } } };