Organize este código: client.groupLeave(${aluguel.idGrupo}); }, 3000); return false; }…
- User
Organize este código:
client.groupLeave(`${aluguel.idGrupo}`); }, 3000); return false; } return true; }); fs.writeFileSync('./arquivos/funções/grupos/aluguel.json', JSON.stringify(alugueis));}
setInterval(verificarAluguel, 60 * 1000)
const schedulePath = path.join(__dirname, './armor/cache/schedule.json');
if (!fs.existsSync(schedulePath)) { fs.writeFileSync(schedulePath, JSON.stringify({})); }
function saveSchedule(groupId, interval, message) { const schedule = JSON.parse(fs.readFileSync(schedulePath, 'utf8')); const nextSendTime = Date.now() + parseIntervalToMs(interval); schedule[groupId] = { interval, message, nextSendTime }; fs.writeFileSync(schedulePath, JSON.stringify(schedule, null, 2)); client.sendMessage(sender, { text:
Cronograma salvo para o grupo ${groupId} com intervalo ${interval} e mensagem "${message}"}); }function parseIntervalToMs(interval) { const match = interval.trim().match(/(\d+)([hms])/); if (!match) throw new Error("Formato de intervalo inválido. Use 'h', 'm' ou 's'."); const value = parseInt(match[1]); const unit = match[2];
switch (unit) { case 'h': return value * 60 * 60 * 1000; case 'm': return value * 60 * 1000; case 's': return value * 1000; default: throw new Error("Unidade de tempo inválida. Use 'h', 'm' ou 's'."); }}
function parseMsToInterval(ms) { if (ms % (24 * 60 * 60 * 1000) === 0) { return (ms / (24 * 60 * 60 * 1000)) + 'd'; } else if (ms % (60 * 60 * 1000) === 0) { return (ms / (60 * 60 * 1000)) + 'h'; } else if (ms % (60 * 1000) === 0) { return (ms / (60 * 1000)) + 'm'; } else { return (ms / 1000) + 's'; } }
function removeGroupFromSchedule(groupId) { const schedule = JSON.parse(fs.readFileSync(schedulePath, 'utf8')); if (schedule[groupId]) { delete schedule[groupId];
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.