The title already explains my idea pretty well. There is this ongoing rivalry in the stream and we want to keep track of the score each time those two guys play against each other. I want basically two seperate commands, one that displays the current score and one that increases the score on either side (by one) which should only be available for moderators. However, I couldn’t quite figure out how to work with the variables, especially across two different commands.
Thank you for your time! (Also, if you can recommend a good guide on how to create Nightbot commands or the programming language they use, please let me know!)
Hey so first to add this command you gonna want to generate tokens at this link. https://twitch.center/customapi/quote/generate
The tokens come in between “token=“ and “&data=“
The 16 digit one is your private token and the 8 digit on Is you public token.
Command to view the counters.
$(eval a=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`.split(`,`);A=0;B=0;for(x=0;x<a.length;x++){if(a[x]==`A`){A++}else if(a[x]==`B`){B++}};`message that you want here.`)
Note: put ${A} in the message where you want the first counter and ${B} where you want the second counter.
Second command to increment counters.
Command1
$(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=A)`;`message you want it to say when count is increased`)
Set userlevel to moderator.
Command2
$(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=B)`;`message you want it to say when count is increased`)
Thank you very much for your help!
I followed your instructions and everything worked for the most part. Using the two commands adds either an “A” or “B” to the token. That works fine. When I first tested the Command to view the counters it worked too and displayed a 1:0. But then I used Command2 and since then the counter always shows 0:0. I double-checked the tokens and the Command to view the counters, but couldn’t find an error.
Do you have an idea what might went wrong?