// code from goatstore // api: https://store.agi.bd const fs = require("fs-extra"); const path = require("path"); const axios = require("axios"); const { createCanvas, loadImage } = require("canvas"); const CACHE_DIR = path.join(__dirname, "cache", "eidmubarak"); module.exports = { config: { name: "eidmubarak", version: "10.0.0", author: "Shaon Ahmed โ€ข GoatBot V2", role: 0, description: "Beautiful Eid Mubarak pair card", category: "image", guide: { en: "{pn} @mention" } }, onStart: async ({ event, message, usersData }) => { const { threadID, messageID, senderID } = event; try { const mentions = Object.keys(event.mentions || {}); if (!mentions.length) { return message.send( "๐Ÿ•Œโœจ ๐—˜๐—œ๐—— ๐— ๐—จ๐—•๐—”๐—ฅ๐—”๐—ž โœจ๐Ÿ•Œ\n\n" + "๐Ÿค เฆเฆ•เฆœเฆจเฆ•เง‡ mention เฆ•เฆฐเงเฆจเฅค\n\n" + "๐Ÿ“Œ Example:\n" + ".eidmubarak @Friend" ); } const targetID = mentions[0]; await fs.ensureDir(CACHE_DIR); try { await message.reaction("โณ", messageID); } catch (e) {} await message.send( "๐Ÿ•Œโœจ ๐—˜๐—œ๐—— ๐— ๐—จ๐—•๐—”๐—ฅ๐—”๐—ž โœจ๐Ÿ•Œ\n\n" + "๐ŸŽจ เฆ†เฆชเฆจเฆพเฆฐ Eid Card เฆคเงˆเฆฐเฆฟ เฆนเฆšเงเฆ›เง‡...\n" + "โณ เฆเฆ•เฆŸเง เฆ…เฆชเง‡เฆ•เงเฆทเฆพ เฆ•เฆฐเงเฆจ..." ); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Get names // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ let senderName = "You"; let targetName = "Friend"; try { senderName = await usersData.getName(senderID); } catch (e) {} try { targetName = await usersData.getName(targetID); } catch (e) {} // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Get profile pictures // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ let avatarOneURL; let avatarTwoURL; try { avatarOneURL = await usersData.getAvatarUrl(senderID); } catch (e) { throw new Error("เฆ†เฆชเฆจเฆพเฆฐ profile picture เฆชเฆพเฆ“เงŸเฆพ เฆฏเฆพเงŸเฆจเฆฟเฅค"); } try { avatarTwoURL = await usersData.getAvatarUrl(targetID); } catch (e) { throw new Error("Mention เฆ•เฆฐเฆพ เฆฌเงเฆฏเฆ•เงเฆคเฆฟเฆฐ profile picture เฆชเฆพเฆ“เงŸเฆพ เฆฏเฆพเงŸเฆจเฆฟเฅค"); } // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Download profile pictures // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ const [avatarOneRes, avatarTwoRes] = await Promise.all([ axios.get(avatarOneURL, { responseType: "arraybuffer", timeout: 30000 }), axios.get(avatarTwoURL, { responseType: "arraybuffer", timeout: 30000 }) ]); const avatarOne = await loadImage( Buffer.from(avatarOneRes.data) ); const avatarTwo = await loadImage( Buffer.from(avatarTwoRes.data) ); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Canvas // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ const width = 1080; const height = 1350; const canvas = createCanvas(width, height); const ctx = canvas.getContext("2d"); // Background const gradient = ctx.createLinearGradient( 0, 0, width, height ); gradient.addColorStop(0, "#071A2B"); gradient.addColorStop(0.5, "#123C4A"); gradient.addColorStop(1, "#06121F"); ctx.fillStyle = gradient; ctx.fillRect(0, 0, width, height); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Decorative moon // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ctx.beginPath(); ctx.arc(540, 245, 115, 0, Math.PI * 2); ctx.fillStyle = "#F8E7A5"; ctx.fill(); ctx.beginPath(); ctx.arc(590, 205, 105, 0, Math.PI * 2); ctx.fillStyle = "#071A2B"; ctx.fill(); // Stars const stars = [ [120, 160], [230, 270], [870, 150], [950, 300], [150, 430], [900, 450], [780, 90], [300, 100] ]; stars.forEach(([x, y]) => { ctx.beginPath(); ctx.arc(x, y, 5, 0, Math.PI * 2); ctx.fillStyle = "#F8E7A5"; ctx.fill(); }); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Header // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ctx.textAlign = "center"; ctx.font = "bold 72px Sans"; ctx.fillStyle = "#F8E7A5"; ctx.fillText("EID MUBARAK", 540, 520); ctx.font = "34px Sans"; ctx.fillStyle = "#FFFFFF"; ctx.fillText("May Allah bless you with happiness", 540, 575); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Card // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ const cardX = 80; const cardY = 625; const cardW = 920; const cardH = 500; ctx.beginPath(); ctx.roundRect(cardX, cardY, cardW, cardH, 45); ctx.fillStyle = "rgba(255,255,255,0.10)"; ctx.fill(); ctx.lineWidth = 3; ctx.strokeStyle = "#F8E7A5"; ctx.stroke(); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Avatar function // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ function drawAvatar(img, x, y, size) { ctx.save(); ctx.beginPath(); ctx.arc( x + size / 2, y + size / 2, size / 2 + 10, 0, Math.PI * 2 ); ctx.fillStyle = "#F8E7A5"; ctx.fill(); ctx.beginPath(); ctx.arc( x + size / 2, y + size / 2, size / 2, 0, Math.PI * 2 ); ctx.clip(); ctx.drawImage(img, x, y, size, size); ctx.restore(); } // Avatars drawAvatar(avatarOne, 210, 685, 250); drawAvatar(avatarTwo, 620, 685, 250); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Names // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ctx.textAlign = "center"; ctx.font = "bold 30px Sans"; ctx.fillStyle = "#FFFFFF"; ctx.fillText( senderName.length > 18 ? senderName.substring(0, 18) + "..." : senderName, 335, 1000 ); ctx.fillText( targetName.length > 18 ? targetName.substring(0, 18) + "..." : targetName, 745, 1000 ); // Heart ctx.font = "50px Sans"; ctx.fillStyle = "#F8E7A5"; ctx.fillText("โ™ก", 540, 820); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Bottom text // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ctx.font = "bold 32px Sans"; ctx.fillStyle = "#F8E7A5"; ctx.fillText("๐ŸŒ™ เฆˆเฆฆ เฆฎเง‹เฆฌเฆพเฆฐเฆ• ๐ŸŒ™", 540, 1075); ctx.font = "24px Sans"; ctx.fillStyle = "#FFFFFF"; ctx.fillText( "May your Eid be filled with peace & blessings", 540, 1115 ); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Footer decoration // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ctx.font = "28px Sans"; ctx.fillStyle = "#F8E7A5"; ctx.fillText( "โœฆ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” โœฆ", 540, 1200 ); ctx.font = "22px Sans"; ctx.fillStyle = "#FFFFFF"; ctx.fillText( "With love & duas ๐Ÿค", 540, 1245 ); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Save // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ const outputPath = path.join( CACHE_DIR, `eid_${senderID}_${targetID}_${Date.now()}.png` ); await fs.writeFile( outputPath, canvas.toBuffer("image/png") ); // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ // Send // โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ await message.send({ body: "๐Ÿ•Œโœจ ๐—˜๐—œ๐—— ๐— ๐—จ๐—•๐—”๐—ฅ๐—”๐—ž โœจ๐Ÿ•Œ\n\n" + `๐Ÿค ${senderName} ร— ${targetName}\n\n` + "๐ŸŒ™ เฆˆเฆฆ เฆฎเง‹เฆฌเฆพเฆฐเฆ•!\n" + "๐Ÿคฒ เฆ†เฆฒเงเฆฒเฆพเฆน เฆ†เฆชเฆจเฆพเฆฆเง‡เฆฐ เฆœเง€เฆฌเฆจ เฆธเงเฆ– เฆ“ เฆถเฆพเฆจเงเฆคเฆฟเฆคเง‡ เฆญเฆฐเฆฟเฆฏเฆผเง‡ เฆฆเฆฟเฆจเฅค", attachment: fs.createReadStream(outputPath) }); try { await message.reaction("โค๏ธ", messageID); } catch (e) {} // Cleanup setTimeout(async () => { try { await fs.remove(outputPath); } catch (e) {} }, 20000); } catch (error) { console.error("[EIDMUBARAK ERROR]", error); try { await message.reaction("โŒ", messageID); } catch (e) {} return message.send( "โŒ | Eid Mubarak Card เฆคเงˆเฆฐเฆฟ เฆ•เฆฐเฆพ เฆฏเฆพเฆฏเฆผเฆจเฆฟ!\n\n" + "โš ๏ธ Error: " + (error.message || "Unknown error") ); } } };