Hey @JenKnee!
There’s no simple way to do this, the simplest and cheapest solution to do this is to have the mods manually edit the command in the dashboard.
Or you could also use the Quote API to store the latest date for the $(countup)
, and use that to display the amount of time:
You’ll get your TOKENS
by clicking on the second link in the post, in the Manual Instalation
part, use these in the commands I wrote. To know where to look for your PUBLIC_TOKEN
and PRIVATE_TOKEN
, look at the field bellow:
$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=$(querystring))
$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(querystring))
$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&data=$(querystring))
Keep your PRIVATE_TOKEN
secret, don’t share it anywhere. To add a command containing your PRIVATE_TOKEN
do it from the dashboard. Don’t use the chat as anyone could monitor it and copy the token, they could then edit your data.
For the command to set and reset the date, we’ll add a quote with the date in the correct format using $(time)
:
$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(time TIMEZONE "MM DD YYYY HH:mm:ss TIMEZONE"))
You have to replace both TIMEZONE
with the same value, you can find a list of supported timezones here. Add it from the dashboard, make sure it’s a moderator command.
And next, for the command to display the amount of elapsed time, we’ll use the last quote in $(countup)
:
!addcom !howlong It has been $(countup $(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=-1)) since $(channel) said SOMETHING
Don’t forget to replace PRIVATE_TOKEN
and PUBLIC_TOKEN
in the commands’ code, and feel free to rename them to your liking.
Regarding the highscore, there would be a solution since we store all the dates in the Quote API, it’d be to take two consecutive dates, measure the amount of time between the two, repeat that for every set of dates, and then take the highest time difference, however, there’s not really a compact solution for this, so for Nightbot that’ll be a bit much to compute, the Quote API is already quite expensive for this use, let’s not add more.