!wins Command with Kill Counter

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


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 _!addwin 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, and !resetwins which clears the kill and win counters.

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=mod !addwin -a=_!addwin $(eval a=parseInt(decodeURIComponent(`$(querystring)`),10);`PRIVATE_TOKEN`+(a>=0?`&data=~${a}K~`:``))

!addcom -ul=mod _!addwin $(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=$(query))`;b=decodeURIComponent(`$(querystring)`);b.includes(`PRIVATE_TOKEN`)?(a.includes(`Successfully added entry`)?`$(channel) won another game with ${b.split(`~`)[1].split(`K`)[0]} kills!`:`Invalid input!`):`Use !addwin`)

!addcom -cd=5 !wins $(eval a=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.match(/~\d+K~/g);a?(b=a.length,c=`(`+a.map(x=>x.slice(1,x.length-1)).join(`, `)+`)`):(b=0,c=``);`$(channel) has ${b} wins ${c}`)

!addcom -ul=mod !resetwins $(eval `$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)`.includes(`All entries have been deleted`)?`Wins have been reset.`:`Try again later...`)
1 Like

You are a genius. Thanks a ton!

1 Like

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)


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.

how i count the wins and kills? what i have to put in my chat to add the values?

when i try they said Invalid Input

how do u show the kills and wins o the command? i dont understand

i try !addwin and !addwinp2 nothing happen


!addwin [number of kills you had]

This will log one game in your wins list with the corresponding number of kills in each game.


This will show how many games you won with how many kills you got in each winning game.

1 Like

still the same, invalid input, I put the tokens correctly, however I continue with invalid input

i am editing this right now, if u can come here to see:

Hi! What is a token, i dnt understand the !addwin command

The !addwin command was created in response to a user looking for a command to keep a list of games they won and the number of kills they got in each game. The tokens referred to in this topic are like the keys to that list. There’s a public token which allows Nightbot to view and extract info from the list and a private token which allows Nightbot to edit the list.

There’s also a !resetwins command:
!addcom -ul=mod !resetwins $(eval a=`$(urlfetch http://twitch.center/customapi/delquote?token=privateTokenHere&clear=1)`;` `) Wins have been reset

1 Like

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