// 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: "hot2", version: "2.0.0", author: "MR.NAYAN", role: 0, countDown: 5, shortDescription: { en: "Random hot video" }, longDescription: { en: "Send a random video from the configured video list." }, category: "media", guide: { en: "{pn}" } }, onStart: async function ({ api, event }) { const cacheDir = path.join(__dirname, "cache"); try { // ───────────────────────────── // 📁 Create cache folder // ───────────────────────────── await fs.ensureDir(cacheDir); // ───────────────────────────── // 🎬 Video title // ───────────────────────────── const title = "SHiblu-Bhai-HOT💦-Video-"; // ───────────────────────────── // 🔗 Video links // ───────────────────────────── const links = [ "https://drive.google.com/uc?id=1a7XsNXizFTTlSD_gRQwK4bDA3HPam56W", "https://drive.google.com/uc?id=1aF6H24ILE6wIFGW3M3BGXg8l63ktP8B3", "https://drive.google.com/uc?id=1_ysGMbGZQexheta6tuSBhJQDeAMioXr_", "https://drive.google.com/uc?id=1bTwYfovA2YKCs_kskWyp2GHh7K9XHQN0", "https://drive.google.com/uc?id=1bPdkmq6lKm8BGwxkWaADHe0kutTtEujR", "https://drive.google.com/uc?id=1b_evUu8zmfiPs-CeaZp1DkkArB5zl5x-", "https://drive.google.com/uc?id=1brkBa03NdRCx6lfrjopbWJUCoJupCRYg", "https://drive.google.com/uc?id=1c6SCqToTZamfuiiz5LrckOxDYT9gnJGu", "https://drive.google.com/uc?id=1bv8GL0XDReocf1NfZBMCNoMAsBBwDE1i", "https://drive.google.com/uc?id=1c01XFZFNYRi_harhEbPvf-i25QIo9c0V", "https://drive.google.com/uc?id=1bs5sI8NDRVK_omefR59how1UjZ6TEu91", "https://drive.google.com/uc?id=1bcIoyM9T_wQlaXxar4nVjCXsKHavRmnb", "https://drive.google.com/uc?id=1boVaYpbxIH3RItPY6k0Ld2F98YasHVq9", "https://drive.google.com/uc?id=1c5YXcgK3kOx6bTfVjxNGGMdDYbGmVInC", "https://drive.google.com/uc?id=1c1OHfuq-YBOO-UwO5uybPqO7gOqTwInp", "https://drive.google.com/uc?id=1jsoQ4wuRdN6EP6jOE3C0L6trLZmoPI0L", "https://drive.google.com/uc?id=1jr4YzPNCTOj_lfdOSnauXfTPJkbuqS3f", "https://drive.google.com/uc?id=1tlon-avneE7lQF2rS13GOeiuLWIUEA7J", "https://drive.google.com/uc?id=1tqaCw0vfG2zJDijgsFF2UTlOB-EmI4SZ", "https://drive.google.com/uc?id=1ta1ujBjmcvxSuYVwQ3oEXIJsnPCW2VZO", "https://drive.google.com/uc?id=1svD1h3vEYbwxMeU5v4c2wQPBaU90fcEx", "https://drive.google.com/uc?id=1seUwXvoVFyCzOA5SykF9uxhlwuwLzPn0", "https://drive.google.com/uc?id=1t2oFQmOtw-6V_ahWzYo08v1g2oGnkhPL" ]; // ───────────────────────────── // 🎲 Pick random video // ───────────────────────────── const videoUrl = links[Math.floor(Math.random() * links.length)]; // Unique filename const fileName = `hot_${Date.now()}_${Math.random() .toString(36) .slice(2)}.mp4`; const filePath = path.join(cacheDir, fileName); // ───────────────────────────── // ⬇️ Download video // ───────────────────────────── const response = await axios.get(videoUrl, { responseType: "arraybuffer", timeout: 60000, maxContentLength: Infinity, maxBodyLength: Infinity, headers: { "User-Agent": "Mozilla/5.0" } }); // Check response if (!response.data || response.data.length === 0) { throw new Error("Empty video response"); } await fs.writeFile(filePath, response.data); // ───────────────────────────── // 📤 Send video // ───────────────────────────── await api.sendMessage( { body: `「 ${title} 」`, attachment: fs.createReadStream(filePath) }, event.threadID, event.messageID ); // ───────────────────────────── // 🧹 Remove cache after sending // ───────────────────────────── await fs.remove(filePath); } catch (error) { console.error("HOT command error:", error); // Clean cache if download/send fails try { if (fs.existsSync(cacheDir)) { const files = await fs.readdir(cacheDir); for (const file of files) { if (file.startsWith("hot_")) { await fs.remove(path.join(cacheDir, file)); } } } } catch (cleanupError) { console.error("Cache cleanup error:", cleanupError); } return api.sendMessage( "❌ ভিডিও পাঠানো যায়নি।\nসম্ভবত ভিডিও লিংকটি কাজ করছে না অথবা Google Drive থেকে download করা যাচ্ছে না।", event.threadID, event.messageID ); } } };