Hello!
I need help with a customized !uptime command.
Sometimes the streamer needs to restart the stream (more than once) due to technical difficulties, which makes the time shown with the Twitch !uptime command to reset. So, I would like to have a “special” !uptime command that would work like this:
!uptime N
The command above would return the length/duration of the current livestream added to the sum of the lengths/durations of the “N” latest previous recorded VODs stored on Twitch.
Also, if used normally, without an argument:
!uptime
Only the length/duration of the current livestream would be returned, just like it normally would work.
That way we could use the !uptime command to show the current length/duration of the livestream… or add the number of VODs that happened that day to make the command return the total time since the streamer started to stream.
So far, what I’ve got to start is a code that gave me the number of hours, minutes and seconds of the current livestream in a array “t”:
$(eval u=`$(twitch $(channel) "{{uptimeLength}}")`;t=u.match(/\d+/g);if(t==null){`channel is not live`}else{while(t.length<3){t.unshift(0);}`${t[0]} hours ${t[1]} minutes ${t[2]} seconds`})
Now I need a code able to fetch the duration of the latest VOD in a way that I can also get the number of hours, minutes and seconds of the VOD and add it to the numbers I have in the array “t”. And make it runs for the “previous” VOD from there, recursively, inside a while until the number of times is equal to N, from my first example.
However, I really don’t know how to do this.
If that could be done within Nightbot, or using an external code stored in a Pastebin file, it would also be great.
Is it possible? And if it is, could anyone please help me?