const http = require("https"); module.exports = { name: 'code', aliases: [], description: 'Génére du code.', category: 'utils', emote: '📌', utilisation: 'code ', async execute(message, args) { const lenguage = args[0] const prompt = args.slice(1).join(' '); const options = { "method": "POST", "hostname": "api.textcortex.com", "port": null, "path": "/v1/codes", "headers": { "Content-Type": "application/json", "Authorization": "Bearer gAAAAABl8hnwXg-FXY1t5PNCTcEGvcN86UaaXycbse_6ZhdlEt_lBbkieBh3QTxjxu5ii1rs--YeoSu-GIh4GwLx2ADp5WtHX867wedEEkYji3kdInL-qgyeayGEODhUQyYd-x8XESZq" } }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); const response = JSON.parse(body.toString()); if (response.status === "success") { const output = response.data.outputs[0].text; message.reply(`\`\`\`${lenguage}\n${output}\`\`\``); } else { console.log("Error: Request failed with API"); message.reply("Erreur lors de l'execution de l'API.\n le premier parametre est le lengage de pregramation exemple : python, javascript, php, java...") } }); }); req.write(JSON.stringify({ max_tokens: 2048, mode: lenguage, model: 'icortex-1', n: 1, temperature: 0, text: prompt })); req.end(); } };