Uptime for Twitch

One of my other, minor projects utilizing the Twitch API and was mainly done as practice. It’s inspired by Nightdev’s uptime tool, and is meant to be used in conjunction with Nightbot’s custom API variable.

Append ?channel=CHANNELNAME, replace “CHANNELNAME” with the channel you want to check the uptime for (must be live) and it will return hours and/or minutes.

https://decapi.me/twitch/uptime?channel=decicus – This would return either “This channel is not live”, or something like “1 hour, 3 minutes” or just “3 minutes” depending on if I’m live or not.

Nightbot command:
If you want to add this as a Nightbot command, you just have to put the command result as: $(customapi https://decapi.me/twitch/uptime?channel=CHANNELNAME).
Once again, you replace “CHANNELNAME” with the appropriate channel.
You can, of course, add custom text/variables before and after $(customapi), but it has to be before the dollar sign and after the closing parenthesis.

If you found some use out of this, I would recommend my post about custom APIs, which covers this and many more scripts that might be useful to have in your bot.

Uptime for Twitch