Reorganize este código JS mantendo a lógica, mas melhorando a estrutura: // Adicione…
- User
Reorganize este código JS mantendo a lógica, mas melhorando a estrutura:
// Adicione esta função para lidar com erros de node process.on('uncaughtException', (err) => { console.error('Exceção não capturada:', err); });
process.on('unhandledRejection', (reason, promise) => {
}); //[====================] //FUNÇÃO DE BEM-VINDO //[====================]
const welkom_test = JSON.parse(fs.readFileSync('./arquivos/funções/grupos/welkom.json')); const bemvindotexto = JSON.parse(fs.readFileSync('./arquivos/funções/TextoDoBemvindo.json')); const saiu = JSON.parse(fs.readFileSync('./arquivos/funções/saiu.json')); const { getBuffer, getRandom, getExtension } = require('./arquivos/lib/functions.js'); const saiu1 = saiu.texto const trevo = bemvindotexto.texto const welkom = JSON.parse(fs.readFileSync('./arquivos/funções/grupos/welkom.json', 'utf8')); const welkom2 = JSON.parse(fs.readFileSync('./arquivos/funções/usuários/vacilo.json', 'utf8')); client.ev.on('group-participants.update', async (anu) => {
setTimeout(async () => { if(anu.participants[0].startsWith(client.user.id.split(':')[0])) return;
const antifake = true update = anu console.log('group-participants.update', anu); const metadata = await client.groupMetadata(update.id); const participants = update.participants;
for (let participant of participants) { if (update.action === 'remove') { console.log(`${participant} removed from group ${metadata.subject}`); } if (update.action === 'promote') { console.log(`${participant} promoted to admin in group ${metadata.subject}`); } if (update.action === 'demote') { console.log(`${participant} demoted from admin in group ${metadata.subject}`); } if (update.action === 'add_request') { console.log(`${participant} requested to join group ${metadata.subject}`); } }/* if (anu.action == 'add'){ num2 = anu.participants[0]
- Assistant