NightDev Community Forums

Nightbot !time Command

I’m using the !time command like this. $(time US/Eastern “h:mm:ss”) Is it possible to show this time but subtract 30 seconds from the output? Youtube has my livestream on a 30 seconds delay and it would be really nice to be able to do a time callout that is kinda in sync with the real time.

Anyone have an idea?

It would not be possible to subtract time from the time variable. YouTube should have an option for a lower latency mode which is closer to real time.

This is actually possible using the $(eval) variable though not easy use this:

$(eval a="$(time US/Eastern "hh:mm:ss")".split(":");function subtractTime(a) {b=parseInt(a[0]);c=parseInt(a[1]);d=parseInt(a[2]);time="";if(d<30) {e=Math.floor(d-30);f=Math.floor(60+e);if(c<1) {g=59;if(b<2) {i=12} else {i=Math.floor(b-1)}} else {i=b;g=Math.floor(c-1)}} else {i=b;g=c;f=Math.floor(d-30)};if(f<10) {j="0"+f} else {j=f};if(g<10) {k="0"+g} else {k=g};time+=i+":"+k+":"+j;return time};subtractTime(a))

Copy and paste that into the message field wherever you want the time to go.
Note:Add this via nightbot dashboard as it’s to big to send through chat.

Example of adding it:
It’s is currently (copy and paste here) for $(channel).