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

675
Views
¿Cómo puedo eliminar el número decimal en discord.js v13?

Para mi sistema de enfriamiento de comandos, usé este Código:

 if (!cooldowns.has(command.name)) { cooldowns.set(command.name, new Discord.Collection()); } const current_time = Date.now(); const time_stamps = cooldowns.get(command.name); const cooldown_amount = command.cooldown * 1000; if (time_stamps.has(message.author.id)) { const expiration_time = time_stamps.get(message.author.id) + cooldown_amount; if (current_time < expiration_time) { const time_left = (expiration_time - current_time) / 1000; return message.reply(`${time_left.toFixed(1)}s cooldown`).then((msg) => { setTimeout(() => msg.delete(), 3000); }); } } time_stamps.set(message.author.id, current_time); setTimeout(() => time_stamps.delete(message.author.id), cooldown_amount);

Eso, por ejemplo, devuelve: '4.2s cooldown'. Quiero saber cómo puedo eliminar el número decimal: '4s cooldown'.

Notas: estoy usando discord.js v13 y node.js v16

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

0

Para eliminar un número decimal, puede redondear un número que está enviando usando Math.round() o también puede usar Math.trunc() para simplemente eliminarlo como dijo @MZPL.

about 4 years ago · Juan Pablo Isaza Report

0

Cambia lo siguiente

 return message.reply( `${time_left.toFixed(1)}s cooldown`)

a

 return message.reply( `${time_left.toFixed()}s cooldown`)

También puede usar Math.trunc() para lograrlo.

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!