// code from goatstore // api: https://store.agi.bd const fs = require("fs"); const path = require("path"); const axios = require("axios"); const os = require("os"); module.exports.config = { name: "emojivoice", version: "6.0.0", author: "SAJU", role: 0, countDown: 1, category: "chat", shortDescription: "Emoji Voice ON/OFF", guide: "{pn} on | off | status" }; // Default state: ON let enabled = true; const busyThreads = new Set(); const voices = { "๐Ÿ™‚": "https://files.catbox.moe/k2n3ym.mp4", "๐Ÿค”": "https://files.catbox.moe/m1equb.mp3", "โ˜บ๏ธ": "https://files.catbox.moe/p2mi4u.mp3", "๐Ÿ˜Š": "https://files.catbox.moe/p2mi4u.mp3", "๐ŸŒš": "https://files.catbox.moe/ze3wu1.mp3", "๐ŸŒ": "https://files.catbox.moe/ze3wu1.mp3", "๐Ÿธ": "https://files.catbox.moe/9u1857.mp3", "๐Ÿ‘€": "https://files.catbox.moe/372kl0.mp3", "๐Ÿ–•": "https://files.catbox.moe/372kl0.mp3", "๐Ÿ˜": "https://files.catbox.moe/ef6me4.mp3", "๐Ÿคฃ": "https://files.catbox.moe/ipihl6.mp3", "๐Ÿ˜†": "https://files.catbox.moe/r4unub.mp3", "๐Ÿ˜‘": "https://files.catbox.moe/z1evci.mp3", "๐Ÿ˜…": "https://files.catbox.moe/7hvdo6.mp3", "๐Ÿ˜": "https://files.catbox.moe/r13v24.mp3", "๐Ÿ˜’": "https://files.catbox.moe/ww8yts.mp3", "๐Ÿ’‹": "https://files.catbox.moe/hd0zfr.mp3", "๐Ÿ˜˜": "https://files.catbox.moe/hd0zfr.mp3", "๐Ÿ˜ก": "https://files.catbox.moe/b5y405.mp3", "๐Ÿคฌ": "https://files.catbox.moe/b5y405.mp3", "๐Ÿ˜ฉ": "https://files.catbox.moe/vb01zl.mp3", "๐Ÿ˜ญ": "https://files.catbox.moe/d9w35v.mp3", "๐Ÿ™": "https://files.catbox.moe/2aw07b.mp3", "๐Ÿ˜‚": "https://files.catbox.moe/vknlt2.mp3", "๐Ÿคญ": "https://files.catbox.moe/5s606f.mp3", "๐Ÿฅฐ": "https://files.catbox.moe/1ojauw.mp3", "๐Ÿฅฑ": "https://files.catbox.moe/088yxs.mp3", "๐Ÿฅต": "https://files.catbox.moe/c0odmp.mp3", "๐Ÿฅบ": "https://files.catbox.moe/458umf.mp3", "๐Ÿฅน": "https://files.catbox.moe/cj6ny7.mp3", "๐Ÿซถ": "https://files.catbox.moe/hyo82t.mp3", "๐Ÿซฃ": "https://files.catbox.moe/2qjfwl.mp3", "๐Ÿผ": "https://files.catbox.moe/gvrvkh.mp3", "๐Ÿ‘": "https://files.catbox.moe/t24ebx.mp3" }; function cleanEmoji(text) { return String(text || "").trim().replace(/[\uFE0E\uFE0F]/g, ""); } const voiceMap = new Map( Object.entries(voices).map(([emoji, url]) => [ cleanEmoji(emoji), url ]) ); module.exports.onStart = async function ({ api, event, args }) { const action = String(args[0] || "").toLowerCase(); if (action === "on") { enabled = true; return api.sendMessage( "โ•ญโ”โ”โ”ใ€” โŒ›๐Ÿ–ค ใ€•โ”โ”โ”โ•ฎ\nโ”ƒ โœ… Status : ON\nโ”ƒ โšก Emoji voice เฆšเฆพเฆฒเง เฆนเงŸเง‡เฆ›เง‡!\nโ•ฐโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•ฏ", event.threadID ); } if (action === "off") { enabled = false; return api.sendMessage( "โ•ญโ”โ”โ”ใ€” ๐Ÿ–คโŒ› ใ€•โ”โ”โ”โ•ฎ\nโ”ƒ ๐Ÿ”ด Status : OFF\nโ”ƒ ๐Ÿ”• Emoji voice เฆฌเฆจเงเฆง เฆนเงŸเง‡เฆ›เง‡!\nโ•ฐโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•ฏ", event.threadID ); } if (action === "status") { return api.sendMessage( `๐Ÿ’— SAJU EMOJIVOICE\nStatus: ${enabled ? "โœ… ON" : "๐Ÿ”ด OFF"}`, event.threadID ); } return api.sendMessage( "๐Ÿ’— EmojiVoice Control\n\nโžค emojivoice on\nโžค emojivoice off\nโžค emojivoice status", event.threadID ); }; module.exports.onChat = async function ({ api, event }) { if (!enabled || !event?.body || !event?.threadID) return; let botID; try { botID = api.getCurrentUserID?.(); } catch (_) {} if (botID && event.senderID === botID) return; const url = voiceMap.get(cleanEmoji(event.body)); if (!url || busyThreads.has(event.threadID)) return; busyThreads.add(event.threadID); let filePath; try { const ext = path.extname(new URL(url).pathname) || ".mp3"; filePath = path.join( os.tmpdir(), `saju_voice_${Date.now()}${ext}` ); const response = await axios.get(url, { responseType: "arraybuffer", timeout: 15000 }); await fs.promises.writeFile(filePath, Buffer.from(response.data)); await new Promise((resolve, reject) => { api.sendMessage( { attachment: fs.createReadStream(filePath) }, event.threadID, error => error ? reject(error) : resolve() ); }); } catch (error) { console.error("[SAJU EMOJIVOICE]", error.message); } finally { if (filePath) { try { await fs.promises.unlink(filePath); } catch (_) {} } busyThreads.delete(event.threadID); } };