const axios = require("axios"); const fs = require("fs"); const path = require("path"); module.exports = { config: { name: "emoji_voice", version: "2.4.79", author: "Hasib ", countDown: 5, role: 0, shortDescription: "Emoji দিলে কিউট মেয়ের ভয়েস পাঠাবে 😍", longDescription: "Send specific emojis to get cute girl voice audios", category: "noprefix", guide: { en: "Just send an emoji like 😘 🥰 😍 etc." } }, // === Emoji to Voice Map === emojiAudioMap: { "🥱": "https://files.catbox.moe/9pou40.mp3", "😁": "https://files.catbox.moe/60cwcg.mp3", "😌": "https://files.catbox.moe/epqwbx.mp3", "🥺": "https://files.catbox.moe/wc17iq.mp3", "🤭": "https://files.catbox.moe/cu0mpy.mp3", "😅": "https://files.catbox.moe/jl3pzb.mp3", "😏": "https://files.catbox.moe/z9e52r.mp3", "😞": "https://files.catbox.moe/tdimtx.mp3", "🤫": "https://files.catbox.moe/0uii99.mp3", "🍼": "https://files.catbox.moe/p6ht91.mp3", "🤔": "https://files.catbox.moe/hy6m6w.mp3", "🥰": "https://files.catbox.moe/dv9why.mp3", "🤦": "https://files.catbox.moe/ivlvoq.mp3", "😘": "https://files.catbox.moe/sbws0w.mp3", "😑": "https://files.catbox.moe/p78xfw.mp3", "😢": "https://files.catbox.moe/shxwj1.mp3", "🙊": "https://files.catbox.moe/3bejxv.mp3", "🤨": "https://files.catbox.moe/4aci0r.mp3", "😡": "https://files.catbox.moe/shxwj1.mp3", "🙈": "https://files.catbox.moe/3qc90y.mp3", "😍": "https://files.catbox.moe/qjfk1b.mp3", "😭": "https://files.catbox.moe/itm4g0.mp3", "😱": "https://files.catbox.moe/mu0kka.mp3", "😻": "https://files.catbox.moe/y8ul2j.mp3", "😿": "https://files.catbox.moe/tqxemm.mp3", "💔": "https://files.catbox.moe/6yanv3.mp3", "🤣": "https://files.catbox.moe/2sweut.mp3", "🥹": "https://files.catbox.moe/jf85xe.mp3", "😩": "https://files.catbox.moe/b4m5aj.mp3", "🫣": "https://files.catbox.moe/ttb6hi.mp3", "🐸": "https://files.catbox.moe/utl83s.mp3" }, // === Runs only when emoji matches (no prefix needed) === onChat: async function ({ api, event }) { const { threadID, messageID, body } = event; if (!body || body.length > 2) return; const emoji = body.trim(); const audioUrl = this.emojiAudioMap[emoji]; if (!audioUrl) return; const cacheDir = path.join(__dirname, "cache"); if (!fs.existsSync(cacheDir)) fs.mkdirSync(cacheDir); const filePath = path.join(cacheDir, `${encodeURIComponent(emoji)}.mp3`); try { const response = await axios({ method: "GET", url: audioUrl, responseType: "stream" }); const writer = fs.createWriteStream(filePath); response.data.pipe(writer); writer.on("finish", () => { api.sendMessage( { attachment: fs.createReadStream(filePath) }, threadID, () => fs.unlink(filePath, () => {}), messageID ); }); writer.on("error", (err) => { console.error("File write error:", err); api.sendMessage("ইমুজি দিয়ে লাভ নাই\nযাও মুড়ি খাও জান😘", threadID, messageID); }); } catch (error) { console.error("Download error:", error); api.sendMessage("ইমুজি দিয়ে লাভ নাই\nযাও মুড়ি খাও জান😘", threadID, messageID); } }, onStart: async function () { // Not needed for noprefix, but kept for framework consistency } };