Command to display multiple $(count) results

Hi there!
I am looking to see if there is a way to set up a command that would display multiple “count” commands at once.
Example: streamer wants to keep track of wins, losses, draws, etc…
I have seen plenty of threads about how to separate commands to !addwin and then !win to display the amount of wins.
But is there a way to set up like !addwin !addloss !adddraw (for mod+ use only) and then have one command like !score that would show something like : Streamer has had 10 wins, 3 losses, 2 draws?
Any help would be greatly appreciated!!
Right now they are just editing the command after every match, so I am trying to find a way to make the process easier.

Thanks!!

@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

Thank you so much!! This is exactly what I needed! I really really appreciate it!!

@RokettoJanpu One more question if you don’t mind! Is it also possible to add a !reset type command to bring everything back to 0? And is it possible to start the count at an existing number. Like if the streamer already has 10 wins etc…?

Thanks again!

@mand0lyn
This is the setup for a !reset command (mod-only). Replace privateTokenHere with your private token:

!addcom -ul=moderator !reset $(eval a=`$(urlfetch http://twitch.center/customapi/delquote?token=privateTokenHere&clear=1)`;` `) The score has been reset!

Delete the !score command if you already added it. Copy and paste this new !score command that allows for a preset score. Replace publicTokenHere with your public token. There is a line of code towards the end of this command that reads:

w+=presetWins,l+=presetLosses,d+=presetDraws;

Replace presetWins/presetLosses/presetDraws with the numbers you want to start at (otherwise replace them with 0).

!addcom -cd=5 !score $(channel) has $(eval a=`$(urlfetch json http://twitch.center/customapi/quote/list?token=publicTokenHere)`;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+=presetWins,l+=presetLosses,d+=presetDraws;w+` wins, `+l+` losses, and `+d+` draws.`)
1 Like

@RokettoJanpu

Hello there Roketto, I am trying to achieve the same thing, only not on Twitch but on Youtube. Here’s the situation: I want to enable a command which shows the viewers the beer-count, pee-count and joint-count at the same time. Any advice on that? Thanks in advance, Tonystonem

@tonystonem The custom API used in those commands (http://twitch.center/customapi…) should work no matter what platform you’re streaming on.

I’ve set up 5 commands below:

!addbeer which adds 1 to the current beer count (mod-only)
!addpee which adds 1 to the current pee count (mod-only)
!addjoint which adds 1 to the current joint count (mod-only)
!total which displays the number of beers/pee/joints
!reset which clears all counts (mod-only)


Follow the instructions given in my first post to get your public and private tokens, but instead of adding the commands I setup in that post, copy and paste the ones I set up below into chat (or add them through the Nightbot dashboard). Replace publicTokenHere with your public token and privateTokenHere with your private token:

!addcom -ul=moderator !addbeer $(eval a=`$(urlfetch http://twitch.center/customapi/addquote?token=privateTokenHere&data=beer)`;` `) $(channel) has chugged another beer! rooSip
!addcom -ul=moderator !addpee $(eval a=`$(urlfetch http://twitch.center/customapi/addquote?token=privateTokenHere&data=pee)`;` `) $(channel) has gone to take a piss. rooNya
!addcom -ul=moderator !addjoint $(eval a=`$(urlfetch http://twitch.center/customapi/addquote?token=privateTokenHere&data=joint)`;` `) $(channel) has smoked another joint. rooVV
!addcom -cd=5 !total $(eval a=`$(urlfetch json http://twitch.center/customapi/quote/list?token=publicTokenHere)`;a.match(/beer/g)!=null?b=a.match(/beer/g).length:b=0;a.match(/pee/g)!=null?p=a.match(/pee/g).length:p=0;a.match(/joint/g)!=null?j=a.match(/joint/g).length:j=0;`$(channel) has chugged `+b+` beers, taken a piss `+p+` times, and smoked `+j+` joints.`)
!addcom -ul=moderator !reset $(eval a=`$(urlfetch http://twitch.center/customapi/delquote?token=privateTokenHere&clear=1)`;` `) All counts have been reset!

Similar to what I said in my first post, feel free to change the command names and responses of !addbeer, !addpee, !addjoint, and !reset just as long as the $(eval) variables remain untouched!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.