NightDev Community Forums

Hey guys... Need help with something

So…

I have a command for !wins that says me have 2 wins (20k, 10k).
Is it possible to add those 2 wins to a totalcounter !totalwins.

So when i !addwin 10 it goes into the !wins with 10kills. But can it also go into a !totalwin counter with only wins, no kills ?

@hardstyle75

I assume you used this forum post to create the !wins command:


I’ve rewritten the commands a little bit. Now they are called !addwin & _!addwin which adds the number of kills and a single win to the counter, and !wins which gathers the number of kills for each game won. 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 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}`)

This is a !totalwins command that only outputs the total number of wins:

!addcom -cd=5 !totalwins $(eval a=`$(urlfetch https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.match(/~\d+K~/g);`$(channel) has ${a?a.length:0} wins`)

yeah i used that post…

But dont i have to !addcom -cd=5 !totalwins? I want a !totalwin command and i also want to add those win
i have now. And then i want when i !addwin it will count in the wins i allready have in !totalwins…
My english isnt that good… i have hard to explain in english :slight_smile: So i hope you understand.

Ah yeah, just replace !wins with !totalwins and that’ll be good.

thx man… ill try that…

and lets say i allready have 300 wins… can i add that somehow and it count it from those wins ?

Let’s see then… I’ll have to edit the code

but when i do that it will add 1 win with 300 kills ?

@hardstyle75

Here’s a new version of !wins with 300 wins already.

!addcom -cd=5 !wins $(eval a=`$(urlfetch 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=``);b+=300;`$(channel) has ${b} wins ${c}`)

Here’s a new version of !totalwins with 300 wins already.

!addcom -cd=5 !totalwins $(eval a=`$(urlfetch https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.match(/~\d+K~/g);`$(channel) has ${(a?a.length:0)+300} wins`)

hmm…

doesnt seems to work… :confused:

when im now typing !addwin 15 it says in !wins 1 win with 15 kills. But it should say in !totalwins 301

There’s a piece of code in the new !wins command:

b+=300;

This should add 300 wins to the total wins count.

I’m not sure why it’s not working. Perhaps try deleting !wins then re-adding it using the new code above.

didnt work…

and now my !wins just shows Nightbot: Right-hand side of ‘instanceof’ is not an object

wtf is that ?

I’ll head over to your channel to see what’s going on.

@hardstyle75

New batch of commands, rewritten so that it keeps track of both a per-stream and all-time number of wins. 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~0~`:``))

!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~\d+~/g);a?(a=a.filter(x=>x.split(`~`)[2]==a[a.length-1].split(`~`)[2]&&x.split(`~`)[1]!=`0K`),b=a.length,c=a.length?`(`+a.map(x=>x.split(`~`)[1]).join(`, `)+`)`:``):(b=0,c=``);`$(channel) has ${b} wins ${c}`)

!addcom -cd=5 !totalwins $(eval a=`$(urlfetch https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.match(/~\d+K~\d+~/g);`$(channel) has ${a?a.filter(x=>x.split(`~`)[1]!=`0K`).length:0} wins`)

!addcom !resetwins -a=!editcom !addwin $(eval `$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=~0K~$(count)~)`;"$"+"(eval a=parseInt(decodeURIComponent(`$"+"(querystring)`),10);`PRIVATE_TOKEN`+(a>=0?`&data=~${a}K~$(count)~`:``))")

Thx man…i cant thank you enough. im really grateful for what you have done.

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