const axios = require('axios'); module.exports.config = { name: "chat", version: "1.0.0", hasPermssion: 0, credits: "JARiF", cooldowns: 5, commandCategory: "heda", usePrefix: true, }; module.exports.run = async function({ api, event, args }) { try { const userQuestion = args.join(' '); if (!userQuestion) { return api.sendMessage(`You can't tell me something?`, event.threadID); } const apiUrl = `https://simsimibn.syntax-team-co.repl.co/chat?ques=${encodeURIComponent(userQuestion)}`; const response = await axios.get(apiUrl); const botAnswer = response.data; if (!botAnswer) { return api.sendMessage('What? :)', event.threadID); } else { return api.sendMessage(botAnswer, event.threadID); } } catch (error) { console.error('Error occurred:', error.message); return api.sendMessage('An error occurred.', event.threadID); } };