import axios from "axios"; import te from "../../src/lib/ourin-error.js"; const pluginConfig = { name: "dracin", alias: ["dracin-tts", "ttsdracin"], category: "tools", description: "Text to Speech Dracin AI", usage: ".dracin ", example: ".dracin halo dunia", isOwner: false, isPremium: false, isGroup: false, isPrivate: false, cooldown: 10, energi: 1, isEnabled: true, }; async function dracinTTS(text) { const url = `https://api.nexray.eu.cc/ai/dracin-tts?text=${encodeURIComponent(text)}&speed=1.0&volume=0.5&music=false`; const res = await axios.get(url, { timeout: 120000, headers: { "user-agent": "Mozilla/5.0", accept: "application/json", }, }); if (!res.data?.status || !res.data?.result) { throw new Error("Dracin TTS gagal"); } return res.data.result; } async function handler(m, { sock, text }) { if (!text) { return m.reply( `🎙️ *DRACIN TTS*\n\nMasukkan teks yang ingin diubah menjadi suara\n\nContoh:\n\`${m.prefix}dracin halo dunia\``, ); } m.react("🕕"); try { const audioUrl = await dracinTTS(text); m.react("✅"); await sock.sendMedia( m.chat, audioUrl, null, m, { type: "audio", }, ); } catch (error) { console.log(error); m.react("☢"); m.reply(te(m.prefix, m.command, m.pushName)); } } export { pluginConfig as config, handler };