// code from goatstore // api: https://store.agi.bd module.exports = { config: { name: "eval", version: "1.0.0", author: "—͞𝐏ʀɪᴍᴇ́", countDown: 2, role: 2, description: { en: "Execute JavaScript code." }, category: "owner", guide: { en: "{pn} " } }, onStart: async function ({ api, args, event }) { const code = args.join(" "); if (!code) return api.sendMessage( "❌ Enter code.", event.threadID, event.messageID ); const logs = []; const oldLog = console.log; console.log = (...data) => { logs.push( data .map(x => typeof x === "object" ? JSON.stringify(x, null, 2) : String(x) ) .join(" ") ); }; try { const result = await eval( `(async () => { ${code} })()` ); console.log = oldLog; const output = [ ...logs, result !== undefined ? typeof result === "object" ? JSON.stringify(result, null, 2) : String(result) : "" ] .filter(Boolean) .join("\n"); if (output) return api.sendMessage( output, event.threadID, event.messageID ); } catch (error) { console.log = oldLog; return api.sendMessage( `❌ ${error.message}`, event.threadID, event.messageID ); } } };