toluschr / BetterDiscord-Animated-Status

Animate your Discord Status with this BetterDiscord Plugin
MIT License
254 stars 490 forks source link

Can it Countdown to a date or time #154

Open AcesGamingUK opened 8 months ago

AcesGamingUK commented 8 months ago

Notice taken

Plugin Version

0.13.2

What do you need help with?

is it possible to have it countdown to a specific time and/or date

Examplex

Gaming Session starts in {Countdown till 12:00pm 01/01/2023}

countdown til birthday {Countdown till 12:00am 01/01/2023}

(im not great at this stuff)

Kolobok125040 commented 7 months ago

Yes you can do that Use Date.now() and set the final time as timestamp. A little math and it's done.

but you need to stop it....

so i here it is

eval let targetT=1701134460; let nowT=Math.floor(Date.now()/1000);let f=t=>(t<nowT?'NOW':targetT-nowT);`${f(targetT)}`

Set your time in targetT, here 'NOW' write the message that will be displayed when the timer expires. By default it displays seconds until the timer expires.