const axios = require("axios"); const baseApiUrl = async () => { const base = await axios.get("https://raw.githubusercontent.com/mahmudx7/HINATA/main/baseApiUrl.json"); return base.data.mahmud; }; module.exports = { config: { name: "llama", version: "1.7", author: "ajmaul", countDown: 5, role: 0, description: { bn: "Llama AI এর সাথে বুদ্ধিদীপ্ত আলাপ করুন", en: "Have an intelligent conversation with Llama AI", vi: "Có một cuộc trò chuyện thông minh với Llama AI" }, category: "ai", guide: { bn: ' {pn} <প্রশ্ন>: আপনার প্রশ্নটি লিখুন', en: ' {pn} : Type your question', vi: ' {pn} : Nhập câu hỏi của bạn' } }, langs: { bn: { noInput: "× বেবি, কিছু তো জিজ্ঞাসা করো!", error: "× সমস্যা হয়েছে: %1। প্রয়োজনে Contact Aizen|\n•WhatsApp: 01836298139" }, en: { noInput: "× Baby, please ask something!", error: "× API error: %1. Contact Aizen for help.\n•WhatsApp: 01836298139" }, vi: { noInput: "× Cưng ơi, hãy hỏi điều gì đó!", error: "× Lỗi: %1. Liên hệ Aizen để hỗ trợ.\n•WhatsApp: 01836298139" } }, onStart: async function ({ api, event, args, message, getLang, commandName }) { const prompt = args.join(" "); if (!prompt) return message.reply(getLang("noInput")); return module.exports.handleLlama({ api, event, prompt, getLang, commandName }); }, onReply: async function ({ api, event, Reply, getLang, commandName }) { if (Reply.author !== event.senderID) return; const prompt = event.body; if (!prompt) return; return module.exports.handleLlama({ api, event, prompt, getLang, commandName }); }, handleLlama: async function ({ api, event, prompt, getLang, commandName }) { try { api.setMessageReaction("⏳", event.messageID, () => {}, true); const baseUrl = await baseApiUrl(); const response = await axios.get(`${baseUrl}/api/ai`, { params: { prompt: prompt, ai: "llama" } }); const replyText = response.data.response || "No response received."; api.setMessageReaction("✅", event.messageID, () => {}, true); return api.sendMessage(replyText, event.threadID, (error, info) => { if (!error) { global.GoatBot.onReply.set(info.messageID, { commandName, author: event.senderID }); } }, event.messageID); } catch (err) { console.error("Llama Error:", err); api.setMessageReaction("❌", event.messageID, () => {}, true); const errorMsg = err.response?.data?.error || err.message; return api.sendMessage(getLang("error", errorMsg), event.threadID, event.messageID); } } };