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

205
Views
Discord.js V13 Establecer botón Enfriamiento

Recientemente creé mi bot de boletos, pero necesito agregar un tiempo de reutilización al botón "cerrar boleto" para evitar que alguien inunde el botón y envíe múltiples mensajes, no he encontrado ninguna forma posible de hacerlo. ¿Cómo agregaría un tiempo de reutilización en un botón específico?

Mi código de botón:

 const row = new client.discord.MessageActionRow() .addComponents( new client.discord.MessageButton() .setCustomId('confirm-close') .setLabel('Fechar o Ticket') .setStyle('DANGER'), new client.discord.MessageButton() .setCustomId('no') .setLabel('Cancelar Fechamento') .setStyle('SECONDARY'), ); const verif = await interaction.reply({ content: 'Tem certeza de que deseja fechar o ticket?', components: [row] });

Para la identificación del usuario, estoy usando interaction.user.id

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

0

En general, puedes hacer algo como esto para un tiempo de reutilización:

 let cooldownTime = 5000; //five seconds let semaphore = true; //green function doSomeStuff() { if (semaphore) { //your logic console.log("GREEN"); semaphore = false; //red setTimeout(() => {semaphore = true;}, cooldownTime); } else { console.log("RED"); } }
 <input type="button" value="CLICK ME!" onclick="doSomeStuff()">

Esto solo afecta la lógica, pero también puede agregarle un botón para deshabilitarlo/habilitarlo.

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!