!wins Command with Kill Counter


#1

Hi. So I mod for a channel where, whenever they win a game, we !commands edit our !wins command to the total number of wins for the day, plus the number of kills per game (i.e. !wins will output 2 (10K, 14K). I’m trying to find out if there’s a way we can have the win counter go up by doing !addwin then putting the number of kills for that game. For example:

!wins –> 1 (10K)
!addwin 14 –> The command "!wins" has been edited successfully.
!wins –> 2 (10K, 14K)

Is this possible? Please let me know


#2

@thelarkshark

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 3 commands below:
!addwin and !addwinp2 which work in tandem to add a win to the running score and the number of kills per game (mod-only)
!wins which displays the number of wins and kills per game

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 publicTokenHere with your public token and privateTokenHere with your private token.

!addcom -ul=mod !addwin -a=!addwinp2 $(eval a=parseInt(decodeURIComponent(`$(querystring)`));a>=0?`privateTokenHere&data=`+a+`K|`:`foo`)
!addcom -ul=mod !addwinp2 $(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=$(query))`;`$(query)`.includes(`privateTokenHere`)?`$(channel) won another game with `+`$(query)`.split(`&data=`)[1].split(`K`)[0]+` kills!`:`Invalid input!`)
!addcom -cd=5 !wins $(eval a=`$(urlfetch https://twitch.center/customapi/quote/list?token=publicTokenHere&no_id=1)`;a.match(/K/g)!=null?b=a.match(/K/g).length:b=0;a=a.slice(0,a.length-1);b>0?c=`(`+a.split(`|`).join(`, `)+`)`:c=``;`$(channel) has `+b+` wins `+c)

#3

You are a genius. Thanks a ton!


#4

I have a problem with this command, I configure the tokens both private and public and the public command of the chat that says the count, is not modified by the private commands. (sorry for my English I’m still learning)


#5

@Mein

Double check that you copied and paste the commands exactly as they were in my original post, then make sure you replaced all instances of publicTokenHere with your public token and privateTokenHere with your private token.