Hey @qwertyuiop!
Yes, you can have something like this by using the Quote API. You’ll get your tokens by clicking on the second link in the post, 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.
First you’ll have to update your RNG command:
Check the update bellow.
The command generates a random number between 0 and 999,999,999 (you can update this part with yours), then fetches the last maximum number that has been drawn, compare the new number to the current maximum number, if the new number is equal or greater than the current maximum number, it stores the new number as the new maximum number along with the user who drawn it, otherwise it simply replies the user which number they’ve drawn.
Now, for your !leaderboard
command, here’s how to do it:
$(eval a=`$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=-1&no_id=1)`; b=a.split(` `).shift(); b==`There`?a=0:``; `The current maximum amount of points drawn is ${a}. You can consult the evolution of the leaderboard here: https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN`)
If you wish to start the leaderboard over because it reached its maximum, you can use !resetleaderboard
, make sure this command is for mods or owner only:
$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)