// code from goatstore // api: https://store.agi.bd const A = require("axios"); const B = require("fs-extra"); const C = require("path"); const JSN = "https://raw.githubusercontent.com/aryannix/stuffs/master/raw/apis.json"; module.exports = { config: { name: "sound", version: "0.0.1", author: "MR_FARHAN", countDown: 5, role: 0, category: "media" }, onStart: async function ({ api, event, args }) { const { threadID: t, messageID: m } = event; const q = args.join(" "); if (!q) return api.sendMessage("β€’ Please provide a sound name.", t, m); api.setMessageReaction("⏳", m, () => {}, true); try { const D = await A.get(JSN); const E = D.data.api; const r = await A.get(`${E}/soundmeme?q=${encodeURIComponent(q)}`); const d = r.data.results[0]; if (!d || !d.sound) throw new Error(); const p = C.join(__dirname, "cache", `snd_${Date.now()}.mp3`); await B.ensureDir(C.dirname(p)); const au = await A.get(d.sound, { responseType: "arraybuffer" }); B.writeFileSync(p, Buffer.from(au.data)); api.setMessageReaction("βœ…", m, () => {}, true); await api.sendMessage({ body: `🎡 π—¦π—Όπ˜‚π—»π—±: ${d.title}`, attachment: B.createReadStream(p) }, t, () => B.unlinkSync(p), m); } catch (e) { api.setMessageReaction("❌", m, () => {}, true); return api.sendMessage("β€’ Sound not found.", t, m); } } };