Organize este código: // Recuperar jogos ativos após reiniciar for (const groupId in…
- User
Organize este código:
// Recuperar jogos ativos após reiniciar for (const groupId in akiData) { if (akiData[groupId].timestamp + 3600000 > Date.now()) { jogosAkinator[groupId] = new Akinator({ region: 'pt', childMode: false }); jogosAkinator[groupId].start(); } }
//const fs = require('fs'); //const path = require('path');
// Função para verificar ou criar o JSON do sorteio function verificarOuCriarJsonSorteio(groupId) { const caminhoArquivo =
./sorteios/${groupId}.json; if (!fs.existsSync(caminhoArquivo)) { fs.writeFileSync(caminhoArquivo, JSON.stringify({}, null, 2), 'utf8'); } return JSON.parse(fs.readFileSync(caminhoArquivo, 'utf8')); }// Função para iniciar o sorteio function iniciarSorteio(horario, numGanhadores, maxParticipantes, emoji, groupId, mensagemCitada) { const sorteio = { horario, numGanhadores, maxParticipantes: maxParticipantes.toLowerCase() === 'all' ? 'all' : parseInt(maxParticipantes), emoji, participantes: [], mensagemCitada, }; fs.writeFileSync(
./sorteios/${groupId}.json, JSON.stringify(sorteio, null, 2));codeclient.groupSettingUpdate(groupId, 'announcement').catch(e => { console.log("Erro ao fechar o grupo:", e); }); client.sendMessage(groupId, { text: `🔴 SORTEIO INICIADO 🔴\n\n🕒 Horário: ${horario}\n🏆 Ganhadores: ${numGanhadores}\n👥 Participantes: ${maxParticipantes}\n🔹 Emoji: ${emoji}\n\nReaja com ${emoji} para participar!` });}
// Função para registrar reação function registrarReacao(groupId, sender) { const caminhoArquivo =
./sorteios/${groupId}.json; if (!fs.existsSync(caminhoArquivo)) return;codeconst sorteio = JSON.parse(fs.readFileSync(caminhoArquivo, 'utf8')); if (!sorteio.participantes.includes(sender)) { sorteio.participantes.push(sender); fs.writeFileSync(caminhoArquivo, JSON.stringify(sorteio, null, 2)); }}
// Monitoramento de sorteios function checarSorteios() {
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.