Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
How do I add timer in my bot like the other giveaway bots?

What I want is a timer in my bot giveaway embed message which like works when the bot is off and the timer still updates itself without showing that the message was edited.

So I am just showing what I have done in embed:

   const embed = new MessageEmbed();
   embed.setAuthor({
        name: `${message.guild.name} GiveAways!`,
        iconURL: `${message.guild.iconURL({ dynamic: true })}`
   });
   embed.setThumbnail(`${message.guild.iconURL({ dynamic: true })}`);
   embed.setTitle(`${title.toUpperCase()}`);
   embed.setColor("BLURPLE");
   embed.setDescription(
      `
      **React With 🎉 To Enter!**
      **Ends In: ${time} ${}!**
      **Hosted By: ${message.author}!**
      `
   );
   embed.setFooter({
       text: `${winnerCount.toString().slice(0, -1)} Winners | Ends`
   });
   embed.setTimestamp(Date.now() + ms(duration));

   const sentGiveaway = await channel.send({
      content: "||@everyone|| **🥳   GIVEAWAY   🥳**",
      embeds: [embed]
   });
   sentGiveaway.react("🎉");

title - This provide the title for the giveaway. time - This coverts the duration entered by user to the full name. E.g: 4d => 4 Days. winnerCount - This provide how many winners will win the giveaway. duration - This takes the argument from user. Date.now + ms(duration) - This provide the exact time when the giveaway will end.

What is my embed doing - this is my giveaway embed where I am providing the the duration and stuff, The embed.setTimestamp() does not do what I want, it jus tells when will the giveaway end. (I am not providing full code cause some people told me to not to paste full code)

What I want - I want that in the description next to the variable time, I want a automatic time update which people can send and the bots can send but I don't know how to do that, I have seen many bots send the timer in there messages.

This the thing I am talking about, check the highlighted thing you will see that this thing update itself when the bot is switched off. (Click the link to see the image)

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Refer to unix timestamps.

They use seconds instead of milliseconds, so you will need to do the necessary division when working with milliseconds (divide by 1000 & Math.floor() it)

For example:

const timestamp = new Date().getTime() + 600000 // (in 10 minutes)
const timestampInSecs = Math.floor(timestamp / 1000); // Necessary division

// Choose appropriate formatting option - the one GiveawayBot uses is R
const timestampString = `<t:${timestampInSecs}:R>`;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda