NightDev Community Forums

Add a counter (I'm confused about the instruction)


#1

Hello!

I am wanting to add a counter. But Ive looked in the previous questions about adding a counter and I feel a little confused due to not understanding which command is a “standard” and which is specific for that post.

Basically, I am wanting to add counter specific for another command. I have a command that’s !kennedy which that says" (user) gave Kennedy lovins." But I want to add command that anyone can put in, to see how many lovins (how many times that command has been typed) for that stream. For instance, someone could type !kennedycount, and it would say “Kennedy has been given 'X” amount of lovins tonight! She’s feeling the love!" I hope I explained it clear enough.

Thank you !!!


#2

@noahofthenorth

This setup uses ehsankia’s quote list CustomAPI - 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: !kennedy with response “$(user) gave Kennedy lovins.”, !kennedycount which returns how many times !kennedy has been used, and !kennedyreset which resets the counter value (mod-only). Either copy and paste these commands into chat OR add these commands through the Nightbot dashboard. Replace publicTokenHere with your public token and privateTokenHere with your private token. Add the commands through chat ONLY if you are sure no one else is there, otherwise they might see your private token!

!addcom -cd=5 !kennedy $(eval a=`$(urlfetch http://twitch.center/customapi/addquote?token=privateTokenHere&data=e)`;`$(user) gave Kennedy lovins.`)
!addcom -cd=5 !kennedycount $(eval a=`$(urlfetch json http://twitch.center/customapi/quote/list?token=publicTokenHere&no_id=1)`;b=a.charAt(0)!=`T`?a.length:`0`;`Kennedy has been given `+b+` amount of lovins tonight! She's feeling the love!`)
!addcom -ul=mod !kennedyreset $(eval a=`$(urlfetch http://twitch.center/customapi/delquote?token=privateTokenHere&clear=1)`;`$(user) has taken away all of Kennedy's love...`)

#3

Thank you FOR THIS!!! Much love to you! It’s work’s like a beauty!!! Much Love!!