I can't figure out how to make a set of commands that would allow me to add wins and losses separately. Like !gw adds a win, !gl adds a loss and !gulag returns Wins: 3 Losses:2 or whatever the current count is. Is there such a thing as multiple variables in one set of commands?
Win-Loss / Death-Kill Counters in one command
2 replies
Hey @Spiffy Dolphin!
One way you could do this is by using the quote system API. You'll get your TOKENS by clicking on the second link in the post, in the Manual Installation section, 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. Add the following commands from the dashboard. Don’t use the chat as anyone could monitor it and copy the token, they could then edit your data.
To add wins and losses to the counters:
• !gw
$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=w$(count))
• !gl
$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=l$(count))
Make sure !gw and !gl are for moderators and above only and to add !gulag as an alias to these commands.
For the main command:
• !gulag
$(eval q=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`;w=q.match(/w\d+/g);l=q.match(/l\d+/g);w==null?w=0:w=w.pop().replace(`w`,``);l==null?l=0:l=l.pop().replace(`l`,``);`Wins: ${w} | Losses: ${l}`)
And then to reset the counters:
• !gwreset
!gw -c=0
• !glreset
!gl -c=0
• !gulagreset
$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)