// code from goatstore // api: https://store.agi.bd const axios = require("axios"); const fs = require("fs-extra"); const path = require("path"); module.exports = { config: { name: "মেসি", version: "2.0.0", author: "MrTomXxX", role: 0, shortDescription: { en: "Random Messi image" }, longDescription: { en: "Send a random Lionel Messi image." }, category: "image", guide: { en: "{pn}" }, countDown: 5 }, onStart: async function ({ api, event, message }) { const links = [ "https://i.postimg.cc/SKyn3RW9/images-52.jpg", "https://i.postimg.cc/8crcM6V2/images-51.jpg", "https://i.postimg.cc/8zGdk1Rp/images-50.jpg", "https://i.postimg.cc/Z5jNT6YH/Lionel-Messi-20180626.jpg", "https://i.postimg.cc/zfcRh5gR/images-43.jpg", "https://i.postimg.cc/Y0k2GybW/images-42.jpg", "https://i.postimg.cc/NMvBSzhz/images-41.jpg", "https://i.postimg.cc/9QvhwnfQ/images-40.jpg", "https://i.postimg.cc/WpXcw34K/images-38.jpg", "https://i.postimg.cc/gJjH9Nv3/images-37.jpg", "https://i.postimg.cc/zXrpvS5Y/images-61.jpg", "https://i.postimg.cc/BvXBkm5H/images-60.jpg", "https://i.postimg.cc/BbG58srB/images-59.jpg", "https://i.postimg.cc/tRhtKZ6S/images-58.jpg", "https://i.postimg.cc/pXs8vDLZ/images-57.jpg", "https://i.postimg.cc/cHGthhFs/images-56.jpg", "https://i.postimg.cc/R0KNWf42/images-55.jpg", "https://i.postimg.cc/yxYdpbcz/images-54.jpg", "https://i.postimg.cc/mDT2h5dF/images-63.jpg", "https://i.postimg.cc/RCsVVGwN/images-62.jpg" ]; const randomLink = links[Math.floor(Math.random() * links.length)]; const cacheDir = path.join(__dirname, "cache"); const filePath = path.join(cacheDir, "messi.jpg"); try { // Create cache folder if it doesn't exist await fs.ensureDir(cacheDir); // Download image const response = await axios.get(randomLink, { responseType: "arraybuffer", timeout: 20000 }); // Save image await fs.writeFile(filePath, response.data); // Send image await api.sendMessage( { body: "「 MrTomXxX Messi 」", attachment: fs.createReadStream(filePath) }, event.threadID ); // Delete cache file setTimeout(async () => { try { if (await fs.pathExists(filePath)) { await fs.remove(filePath); } } catch (err) { console.error("Cache delete error:", err); } }, 3000); } catch (error) { console.error("Messi Command Error:", error); return message.reply( "❌ Messi-এর ছবি পাঠাতে সমস্যা হয়েছে।\n" + "🔄 একটু পরে আবার চেষ্টা করুন।" ); } } };