// code from goatstore // api: https://store.agi.bd const Jimp = require("jimp"); const fs = require("fs"); const path = require("path"); const os = require("os"); const axios = require("axios"); module.exports = { config: { name: "balance2", aliases: ["bal2"], version: "4.8", author: "NIROB", role: 0, shortDescription: "Aesthetic Balance Card", category: "economy" }, onStart: async function ({ message, usersData, event, args }) { const targetID = Object.keys(event.mentions).length > 0 ? Object.keys(event.mentions)[0] : (args.length > 0 ? args[0] : event.senderID); const imgPath = path.join(os.tmpdir(), `bal_${targetID}.png`); try { const userData = await usersData.get(targetID) || {}; const name = userData.name || "User"; const balance = userData.money || 0; const validDate = "01/2029"; // ১. ব্যাকগ্রাউন্ড লোড const bgURL = "https://files.catbox.moe/wbkbzg.jpg"; const bgBuffer = await axios.get(bgURL, { responseType: "arraybuffer" }); const card = await Jimp.read(Buffer.from(bgBuffer.data)); card.resize(900, 500); // ২. প্রোফাইল পিকচার ফিক্স (Graph API & Fallback) const avatarURL = `https://graph.facebook.com/${targetID}/picture?width=512&height=512&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`; const fallbackURL = `https://graph.facebook.com/${targetID}/picture?type=large`; let avatar; try { const avtRes = await axios.get(avatarURL, { responseType: "arraybuffer" }); avatar = await Jimp.read(Buffer.from(avtRes.data)); } catch (e) { try { const fbRes = await axios.get(fallbackURL, { responseType: "arraybuffer" }); avatar = await Jimp.read(Buffer.from(fbRes.data)); } catch (err) { avatar = new Jimp(220, 220, 0x444444ff); } } avatar.resize(220, 220); const circleMask = new Jimp(220, 220, 0x00000000); const radius = 110; circleMask.scan(0, 0, 220, 220, function(x, y, idx) { const dist = Math.sqrt(Math.pow(x - radius, 2) + Math.pow(y - radius, 2)); if (dist <= radius) this.bitmap.data[idx + 3] = 255; }); avatar.mask(circleMask, 0, 0); // ৩. ফন্ট লোড const fontMedium = await Jimp.loadFont(Jimp.FONT_SANS_32_WHITE); const fontLarge = await Jimp.loadFont(Jimp.FONT_SANS_64_WHITE); // ৪. ডিজাইন (ব্যাকগ্রাউন্ড পরিষ্কার রাখার জন্য overlay অপাসিটি কমানো হয়েছে) // 0x00000066 মানে হালকা কালো শেড, যাতে পেছনের ছবি দেখা যায় const overlay = new Jimp(900, 500, 0x00000066); card.composite(overlay, 0, 0); // ৫. টেক্সট বসানো card.print(fontMedium, 60, 140, `NAME: ${name.toUpperCase()}`); card.print(fontMedium, 60, 200, `UID: ${targetID}`); card.print(fontMedium, 60, 260, `VALID: ${validDate}`); card.print(fontMedium, 60, 330, "AVAILABLE BALANCE"); card.print(fontLarge, 60, 370, `$${balance.toLocaleString()}`); // নিয়ন বর্ডার ও ছবি বসানো const glow = new Jimp(236, 236, 0x00000000); glow.scan(0, 0, 236, 236, function(x, y, idx) { const dist = Math.sqrt(Math.pow(x - 118, 2) + Math.pow(y - 118, 2)); if (dist <= 118 && dist >= 114) { this.bitmap.data[idx] = 0; this.bitmap.data[idx+1] = 255; this.bitmap.data[idx+2] = 255; this.bitmap.data[idx+3] = 255; } }); card.composite(glow, 597, 127); card.composite(avatar, 605, 135); // ৬. সেভ ও সেন্ড await card.writeAsync(imgPath); const msgText = `✨ NAME : ${name}\n🆔 UID : ${targetID}\n🛑 VALID : ${validDate}\n♎ BALANCE : $${balance.toLocaleString()}`; await message.reply({ body: msgText, attachment: fs.createReadStream(imgPath) }); setTimeout(() => { if (fs.existsSync(imgPath)) fs.unlinkSync(imgPath); }, 5000); } catch (err) { console.error(err); message.reply("❌ Error: " + err.message); if (fs.existsSync(imgPath)) fs.unlinkSync(imgPath); } } };