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.
Problema resuelto, gracias. Se trataba de mi pequeño error. Siento molestar...