NightDev Community Forums

!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.


#6

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


#7

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

i try !addwin and !addwinp2 nothing happen


#8

Usages:

!addwin [number of kills you had]

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

!wins

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


#9

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:


#10

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


#11

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.


#12

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


#13

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