const fs = require("fs"); const axios = require("axios"); const path = require("path"); const baseApiUrl = async () => { const base = await axios.get( "https://raw.githubusercontent.com/mahmudx7/HINATA/main/baseApiUrl.json" ); return base.data.mahmud; }; module.exports = { config: { name: "brother", aliases: ["bro", "ভাই"], version: "1.7", author: "Efx Asif", countDown: 5, role: 0, description: { bn: "ভাই-বোনের মিষ্টি সম্পর্কের একটি ছবি তৈরি করুন", en: "Create a sweet brother-sister relationship image", vi: "Tạo hình ảnh tình cảm anh chị em ngọt ngào" }, category: "love", guide: { bn: " {pn} <@tag/reply>: কাউকে ট্যাগ অথবা রিপ্লাই দিন", en: " {pn} <@tag/reply>: Tag or reply to someone", vi: " {pn} <@tag/reply>: Gắn thẻ hoặc phản hồi ai đó" } }, langs: { bn: { noTarget: "× বেবি, একজনকে ট্যাগ করো অথবা রিপ্লাই দাও! 🎀", wait: "⌛ তোমার ছবিটি তৈরি করছি... একটু অপেক্ষা করো বেবি! 😘", success: "𝐋𝐢𝐟𝐞'𝐬 𝐛𝐞𝐭𝐭𝐞𝐫 𝐰𝐢𝐭𝐡 𝐚 𝐁𝐫𝐨𝐭𝐡𝐞𝐫 𝐛𝐲 𝐲𝐨𝐮𝐫 𝐬𝐢𝐝𝐞 🎀", error: "× সমস্যা হয়েছে: %1। প্রয়োজনে Contact Efx Asif।" }, en: { noTarget: "× Baby, please tag or reply to someone! 🎀", wait: "⌛ Generating your image... Please wait a moment baby! 😘", success: "𝐋𝐢𝐟𝐞'𝐬 𝐛𝐞𝐭𝐭𝐞𝐫 𝐰𝐢𝐭𝐡 𝐚 𝐁𝐫𝐨𝐭𝐡𝐞𝐫 𝐛𝐲 𝐲𝐨𝐮𝐫 𝐬𝐢𝐝𝐞 🎀", error: "× API error: %1. Contact Efx Asif for help." }, vi: { noTarget: "× Cưng ơi, hãy gắn thẻ hoặc phản hồi ai đó! 🎀", wait: "⌛ Đang tạo hình ảnh cho cưng... Chờ chút nhé! 😘", success: "𝐂𝐮𝐨̣̂𝐜 𝐬𝐨̂́𝐧𝐠 𝐭𝐨̂́𝐭 đ𝐞̣𝐩 𝐡𝐨̛𝐧 𝐤𝐡𝐢 𝐜𝐨́ 𝐚𝐧𝐡 𝐞𝐦 𝐛𝐞̂𝐧 𝐜𝐚̣𝐧𝐡 🎀", error: "× Lỗi: %1. Liên hệ Efx Asif để được hỗ trợ." } }, onStart: async function ({ api, event, args, message, getLang }) { // Author verification const authorName = "Efx Asif"; if (this.config.author !== authorName) { return api.sendMessage( "You are not authorized to change the author name.", event.threadID, event.messageID ); } // Get tagged/replied user const mention = Object.keys(event.mentions)[0] || (event.messageReply && event.messageReply.senderID); if (!mention) { return message.reply(getLang("noTarget")); } const user1 = mention; const user2 = event.senderID; // Cache directory const cacheDir = path.join(__dirname, "cache"); if (!fs.existsSync(cacheDir)) { fs.mkdirSync(cacheDir, { recursive: true }); } const imgPath = path.join( cacheDir, `brother_${user1}_${user2}.png` ); let waitMsg; try { // Reaction: processing api.setMessageReaction( "🎀", event.messageID, () => {}, true ); // Waiting message waitMsg = await message.reply( getLang("wait") ); // Get base API URL const baseUrl = await baseApiUrl(); // Build API URL const apiUrl = `${baseUrl}/api/bro&sis` + `?user1=${encodeURIComponent(user1)}` + `&user2=${encodeURIComponent(user2)}` + `&style=1`; // Request image const response = await axios.get(apiUrl, { responseType: "arraybuffer", timeout: 60000 }); // Save image fs.writeFileSync( imgPath, Buffer.from(response.data) ); // Remove waiting message if (waitMsg && waitMsg.messageID) { api.unsendMessage(waitMsg.messageID); } // Send result return message.reply( { body: getLang("success"), attachment: fs.createReadStream(imgPath) }, () => { // Success reaction api.setMessageReaction( "✅", event.messageID, () => {}, true ); // Delete cache if (fs.existsSync(imgPath)) { fs.unlinkSync(imgPath); } } ); } catch (err) { console.error("Brother Error:", err); // Remove waiting message if possible if (waitMsg && waitMsg.messageID) { try { api.unsendMessage(waitMsg.messageID); } catch (e) {} } // Error reaction api.setMessageReaction( "❌", event.messageID, () => {}, true ); // Delete cache if (fs.existsSync(imgPath)) { fs.unlinkSync(imgPath); } return message.reply( getLang("error", err.message) ); } } };