gpt-4o-mini-2024-07-18· OpenAI
WildChat-4.8M (AI2)
Organize este código: tempoRestante = tempoRestante === 1 ? '1 dia' : tempoRestante + '…
- User
Organize este código:
tempoRestante = tempoRestante === 1 ? '1 dia' : tempoRestante + ' dias'; } else if (tempo.endsWith('h')) { tempoRestante = Math.ceil((horaAluguel + parseInt(tempo) * 60 * 60 * 1000 - agora) / (60 * 60 * 1000)); tempoRestante = tempoRestante === 1 ? '1 hora' : tempoRestante + ' horas'; } else if (tempo.endsWith('m')) { tempoRestante = Math.ceil((horaAluguel + parseInt(tempo) * 60 * 1000 - agora) / (60 * 1000)); tempoRestante = tempoRestante === 1 ? '1 minuto' : tempoRestante + ' minutos'; } mensagemLista += `Grupo ${idGrupo}: Tempo restante - ${tempoRestante}\n`; }); reply(mensagemLista);} function verificarAluguel() { const data = fs.readFileSync('./arquivos/funções/grupos/aluguel.json', 'utf8'); let alugueis = JSON.parse(data);
// Verifica se 'alugueis' é um array if (!Array.isArray(alugueis)) { console.error('O conteúdo de aluguel.json não é um array. Definindo alugueis como um array vazio.'); alugueis = []; // ou você pode lançar um erro } const agora = new Date().getTime(); alugueis = alugueis.filter(aluguel => { const horaAluguel = aluguel.horaAluguel; const tempo = aluguel.tempo; let tempoMillis; if (tempo.endsWith('d')) { tempoMillis = parseInt(tempo) * 24 * 60 * 60 * 1000; } else if (tempo.endsWith('h')) { tempoMillis = parseInt(tempo) * 60 * 60 * 1000; } else if (tempo.endsWith('m')) { tempoMillis = parseInt(tempo) * 60 * 1000; } else if (tempo.endsWith('s')) { tempoMillis = parseInt(tempo) * 1000; } if (agora >= horaAluguel + tempoMillis) { reply(`🕒 O tempo de aluguel desse grupo expirou! Se desejar me adicionar novamente, entre em contato com o meu dono usando o comando ${prefix}dono.`); setTimeout(() => { - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.