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.
Nightbot !time Command
7 replies
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).
@Plaid Badger this should work for you purposes just copy and paste this where you want the time in the command:
$(eval a="$(time Asia/Oral "hh:mm:ss:a")".split(":");function addTime(a) {Time="";c=parseInt(a[0]);b=parseInt(a[1]);if(b>29) {d=Math.floor(b+30);e=Math.floor(d-60);if(c==12) {f=1;if(a[3]=="am") {g="pm"} else {g="am"}} else {f=Math.floor(c+1);g=a[3]}} else {e=Math.floor(b+30);f=c;g=a[3]};if(e<10) {h="0"+e} else {h=e};Time+=f+":"+h+":"+a[2]+" "+g;return Time};addTime(a))
Hope this helped 🙂
Didn't find your answer? The community is on Discord.
Ask on Discord