Command to display multiple $(count) results

@mand0lyn This is possible using ehsankia’s quote custom API - read more about it here.

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:
!addwin which adds a win to the running score (mod-only)
!addloss which adds a loss to the running score (mod-only)
!adddraw which adds a draw to the running score (mod-only)
!score which displays the numbers of wins/losses/draws

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 (which is used to edit the list)! Replace PUBLIC_TOKEN with your public token and PRIVATE_TOKEN with your private token.

!addcom -ul=moderator !addwin $(eval a=`$(urlfetch http://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=win)`;` `) $(channel) just won! rooPog
!addcom -ul=moderator !addloss $(eval a=`$(urlfetch http://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=loss)`;` `) $(channel) just lost! rooCry
!addcom -ul=moderator !adddraw $(eval a=`$(urlfetch http://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=draw)`;` `) $(channel)'s game ended in a draw! rooBlank
!addcom -cd=5 !score $(channel) has $(eval a=`$(urlfetch json http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`;a.match(/win/g)!=null?w=a.match(/win/g).length:w=0;a.match(/loss/g)!=null?l=a.match(/loss/g).length:l=0;a.match(/draw/g)!=null?d=a.match(/draw/g).length:d=0;w+` wins, `+l+` losses, and `+d+` draws.`)

Feel free to change the responses of !addwin, !addloss, and !adddraw just as long as the $(eval) variables remain untouched!

1 Like