// bestie.js const fs = require("fs-extra"); const Canvas = require("canvas"); module.exports = { config: { name: "bestie", aliases: ["friend", "buddy"], version: "7.3.8", author: "Rahad", countDown: 5, role: 0, shortDescription: "Bestie edit with template", longDescription: "Put user profile pictures exactly on placeholders in background", category: "funny", guide: "{pn} @tag" }, onStart: async function ({ event, api }) { try { const id1 = event.senderID; const mentions = Object.keys(event.mentions || {}); const id2 = mentions[0]; if (!id2) { return api.sendMessage("โŒ | Please mention someone!", event.threadID, event.messageID); } // Load avatars const avatar1 = await Canvas.loadImage( `https://graph.facebook.com/${id1}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662` ); const avatar2 = await Canvas.loadImage( `https://graph.facebook.com/${id2}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662` ); // Load background const background = await Canvas.loadImage("https://i.imgur.com/RloX16v.jpg"); // Create canvas const canvas = Canvas.createCanvas(background.width, background.height); const ctx = canvas.getContext("2d"); // Draw background ctx.drawImage(background, 0, 0, canvas.width, canvas.height); // === Coordinates (same as jimp version) === const left = { x: 93, y: 111, size: 191 }; const right = { x: 434, y: 107, size: 190 }; // Draw left avatar ctx.save(); ctx.beginPath(); ctx.arc(left.x + left.size / 2, left.y + left.size / 2, left.size / 2, 0, Math.PI * 2, true); ctx.closePath(); ctx.clip(); ctx.drawImage(avatar1, left.x, left.y, left.size, left.size); ctx.restore(); // Draw right avatar ctx.save(); ctx.beginPath(); ctx.arc(right.x + right.size / 2, right.y + right.size / 2, right.size / 2, 0, Math.PI * 2, true); ctx.closePath(); ctx.clip(); ctx.drawImage(avatar2, right.x, right.y, right.size, right.size); ctx.restore(); // Save & send const path = __dirname + "/cache/bestie.png"; const out = fs.createWriteStream(path); const stream = canvas.createPNGStream(); stream.pipe(out); out.on("finish", () => { api.sendMessage( { body: "โœงโ€ขโ๐…๐ซ๐ข๐ž๐ง๐๐ฌ๐ก๐ข๐ฉโโ€ขโœง\n\nโ•”โ•โ•โ•โ–โ€ขโ€ขยฐ ยฐโ€ขโ€ขโ–โ•โ•โ•โ•—\n\n ๐’๐ฎ๐œ๐œ๐ž๐ฌ๐ฌ๐Ÿ๐ฎ๐ฅ ๐๐ž๐ฌ๐ญ๐ข๐ž ๐„๐๐ข๐ญ\n\nโ•šโ•โ•โ•โ–โ€ขโ€ขยฐ ยฐโ€ขโ€ขโ–โ•โ•โ•โ•\n\n โœถโŠถโŠทโŠทโโŠถโŠทโŠทโœถ\n\n ๐Ÿค๐Ÿ’จ ๐๐ž ๐ƒ๐ก๐จ๐ซ ๐“๐จ๐ซ ๐๐ž๐ฌ๐ญ๐ข๐ž ๐Ÿ’ž\n\n โœถโŠถโŠทโŠทโโŠถโŠทโŠทโœถ", attachment: fs.createReadStream(path) }, event.threadID, () => fs.unlinkSync(path), event.messageID ); }); } catch (err) { console.error(err); api.sendMessage("โŒ | Something went wrong!", event.threadID, event.messageID); } } };