#Giveaway ends in "active time changes"

1 messages · Page 1 of 1 (latest)

marble plinth
#

Hello, this is my function to show, when giveaways is ends, but its doesnt works, how i can make this? (first picture)actually

half oracle
#

Hi! It would be great if you could provide a bit more information. If I'm understanding correctly, the first picture is what you want to be displayed, and the second is your code? If so, what is being displayed with your current code?

#

I notice you used {long: false} with the ms function, which might be one of your problems. That will turn the "9 hours, 57 minutes, 20 seconds" you showed into "9h57m20s"

marble plinth
#

and second picture is my code

#

and what i want?

#

I want automaticly updating time in embed message

#

like we can see 9 hours, 57 minutes, 20 seconds, but this time automaticly changing in embed

#

and i dont know how to make it

#

now, if i type for example 1hour, embed for whole time showing 1 hour

#

not 55minutes

#

20minutes

#

etc.

half oracle
#

You should use native discord timestamps (for example, <t:1675011000:R>). You can do this by importing Formatters from discord.js, and then:

const time = interaction.options.getString('time');
const timeInMs = ms(time);

// ...

.setDescription(`This giveaway ends: <t:${Math.floor((Date.now() + timeInMs) / 1000)}:R>`)
#

This will:

  • get the user input
  • use the ms function to convert it to ms (for example, "1 second" will become 1000)
  • create a timestamp by using timestamp syntax (that is: <t:timestamp_in_seconds:R> (the R is for relative)
#

Date.now() is the current time, and if we add timeInMs it will be the time the user wants the giveaway to end at

marble plinth
#

now its show this

#

i think

#

its bug

plain tide
#

no it's not a bug

#

embed footers cannot have formatted text

#

never could have

half oracle
#

that's not a footer

#

I forgot Math.floor

plain tide
#

oh