Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
discord.js eliminando roles de miembro que eliminó más de un canal recientemente

Soy un poco nuevo en la codificación de bots, así que me gustaría obtener ayuda con esto,

Entonces, quería que mi bot eliminara todos los permisos de un miembro que tiene la intención de eliminar más de 1 canal en un intervalo de 2 minutos. Hice algo como esto a continuación;

 client.on("channelDelete", async function(channel) { const channelDeleteId = channel.id; // finding all channel deletions in the log channel.guild.fetchAuditLogs({ 'type': 'CHANNEL_DELETE' }) // finding the log entry for this specific channel .then(logs => logs.entries.find(entry => entry.target.id === channelDeleteId)) .then(entry => { // getting the author of the deletion author = entry.executor; if (author.id === "472911936951156740") return console.log("VoiceMaster Bot has deleted a channel."); // dont mind, it's ok console.log(`channel ${channel.name} deleted by ${author}`); let member = channel.guild.members.cache.find(m => m.id === author.id); let deletedRecently = new Set; if (deletedRecently.has(member)) { member.roles.set([]); //member.ban(); } else { deletedRecently.add(member); setTimeout(() => { deletedRecently.delete(member); }, 120000); } }) .catch(error => console.error(error)); });

Cuando lo pruebo, a veces se repite 3 o 4 veces y activa la fila de eliminación de roles.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Problema resuelto, gracias. Se trataba de mi pequeño error. Siento molestar...

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!