// 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: "Shaon Ahmed → GoatBot V2", countDown: 5, role: 0, shortDescription: { en: "Islamic Sura audio" }, longDescription: { en: "Send a random Islamic Sura audio." }, category: "sura", guide: { en: "{pn}" } }, onStart: async function ({ api, event }) { const cacheDir = path.join(__dirname, "cache"); const audioPath = path.join(cacheDir, "26.mp3"); const audioLinks = [ "https://drive.google.com/uc?id=1-9idslRZAmPWrktKMRWywsOGTrhJwufn", "https://drive.google.com/uc?id=1-cSfVhLzFR7-2OEqi_r_h7WPwyztNbX9", "https://drive.google.com/uc?id=1zkzDYqsYys7idKeV3sxtDBO2zYLcce78", "https://drive.google.com/uc?id=1-h4QAwp0fbOuiI02wBWHgnlZ67OcntXh", "https://drive.google.com/uc?id=1-2Npr1WfC5U_vUtX-ocRbs-92WfeO3C4", "https://drive.google.com/uc?id=1zs5vmoljY7MS8pfNf6_HidfucP0-Qvu_", "https://drive.google.com/uc?id=1EkEL_ci9pCAVdqLed23EI-Wk_xem6jnn", "https://drive.google.com/uc?id=1-CIHqFkF6Zj3IJ6u4OuN5Z_rBL02ICba", "https://drive.google.com/uc?id=1-CoomuQjCU0lzpVf87E0zBQrR-S9nHVj" ]; const messages = [ "🌸ইসলামিক || সূরা🍒🐰\nuse headphone for better sound\nCredit: Shaon Ahmed 🐰" ]; try { await fs.ensureDir(cacheDir); // আগের cache file থাকলে মুছে ফেলবে if (fs.existsSync(audioPath)) { await fs.remove(audioPath); } const randomURL = audioLinks[Math.floor(Math.random() * audioLinks.length)]; const randomMessage = messages[Math.floor(Math.random() * messages.length)]; // Google Drive audio download const response = await axios({ method: "GET", url: randomURL, responseType: "arraybuffer", timeout: 60000, maxContentLength: 100 * 1024 * 1024, maxBodyLength: 100 * 1024 * 1024 }); await fs.writeFile(audioPath, Buffer.from(response.data)); // File check if (!fs.existsSync(audioPath)) { throw new Error("Audio file তৈরি করা যায়নি।"); } const stats = await fs.stat(audioPath); if (stats.size < 1000) { throw new Error("Google Drive থেকে সঠিক MP3 পাওয়া যায়নি।"); } return api.sendMessage( { body: `「 ${randomMessage} 」`, attachment: fs.createReadStream(audioPath) }, event.threadID, async () => { try { await fs.remove(audioPath); } catch (e) {} }, event.messageID ); } catch (error) { console.error("SURA COMMAND ERROR:", error); if (fs.existsSync(audioPath)) { try { await fs.remove(audioPath); } catch (e) {} } return api.sendMessage( `╭───〔 ❌ সূরা ERROR 〕───╮ │ │ সূরার অডিও পাঠানো যায়নি। │ │ কারণ: ${error.message} │ ╰────────────────────╯`, event.threadID, event.messageID ); } } };