So i am starting a trivia game show and i want my viewers to play along, is there a way for me to add a counter for the chatters so that A i can add/take away a point for each right answer, B that they can individually check their right answer points? and C a way to reset it every week
This is possible using Ehsan’s quote API: [CustomAPI] Quote system
Click this link. It will generate three links and two tokens, a public token (8 characters long) and a private token (16 characters long). The public token is located within the first generated link. The private token is located within both the second and third generated links. The tokens are found after token=
and before &data=$(querystring)
Copy them and keep them somewhere safe!
I’ve set up 4 commands below, !givepoint and _!givepoint (both owner-only but you can set these up to be mod-only if you wish) which work in tandem to increment a certain user’s score (only !givepoint is meant to be used directly), !points which checks how many points a user has, and !resetpoints which wipes every user’s score (owner-only). Either copy and paste these commands into chat or add them through the Nightbot dashboard. Add the commands through chat only if you are sure no one else is there, otherwise they might see your private token. Replace PUBLIC_TOKEN
with your public token and PRIVATE_TOKEN
with your private token.
!addcom -ul=owner !givepoint -a=_!givepoint $(eval a=decodeURIComponent(`$(querystring)`);a&&`$(twitch $(query))`!=`Unknown Twitch Channel`?`PRIVATE_TOKEN&data=~${a}~`:`PRIVATE_TOKEN`)
!addcom -ul=owner _!givepoint $(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=$(query))`;b=decodeURIComponent(`$(querystring)`);b.includes(`PRIVATE_TOKEN`)?(a.includes(`Successfully added entry`)?`Successfully awarded one point to ${b.split(`&data=`)[1].replace(/~/g,``)}!`:`That is an invalid Twitch name!`):` `)
!addcom -cd=5 !points $(eval u=decodeURIComponent(`$(querystring $(touser))`);r=new RegExp(`~${u}~`,`gi`);a=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.match(r);b=a?a.length:0;`${u} currently has ${b} points.`)
!addcom -ul=owner !resetpoints $(eval `$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)`==`All entries have been deleted`?`All scores have been reset!`:`Try again...`)
Command usages:
!givepoint [username]
!points [username to search OR leave blank to get your own score]
!resetpoints
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.