Nightbot Counter

Hello, I could need some advice.
I know that there is a counter command. I have an idea which Im not able to implement yet.

These are the functions Id like to have:
!pushups [will show how many pushups have been made]

!pushupadd1 !pushupadd5 !pushupadd10
[will add 1/5/10 to the counter]

Is this possible in any way?
Thanks in advance for the help <3

I would suggest using @ehsankia’s Quote API

You can generate you tokens through this link https://twitch.center/customapi/quote/generate
The 8 digit token is your Public one and is fine to share.
The 16 digit token is your Private token and should not be shared.
(They both come after “token=“ And end before “&data”)

Here are the commands:

!addcom !pushup $(channel) has done $(eval a="$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)".replace(/([0-9]+\.[ ])/g,"").split(",");b=0;for(i=0;i<Math.floor(a.length-1);i++){c=Math.floor(b+parseInt(a[i]));b=c};b) pushups.
!addcom !pushupadd -ul=moderator $(eval a="$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(1),)";"$(1) pushups added.")
!addcom !pushupreset -ul=moderator $(eval a="$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&data=&clear=1)";"!Pushup command has been reset to 0.")

Only change the PUBLIC_TOKEN and PRIVATE_TOKEN in the commands for adding you just type any number to add to the total a few !pushupadd.

If there are any issues please let me know.

1 Like

Thank you very much. Worked just fine :slight_smile:

actually, the last command doesnt seem to be working i just realized…09351628fe4f977f508f8e4186f75035

i replaced private_token with my token like the first two commands. dont know what could be wrong

greets

Sorry about that I forgot to put a “)” at the end. I edited the command it should work now. Just edit over the command with the new command.

1 Like

Thank you very much! No everything is fine :smiley: eb70cdc23fc64cd3609762901e884587

Will be fun :stuck_out_tongue:

1 Like

Sorry if I’m hijacking this, but really quickly - I modified this for something I wanted to do, and it works, but I’d prefer if Nightbot would not post any kind of message in chat when adding/clearing the “pushups”… is there any way to prevent the response? (changing the response to an empty string results in “[Error Connecting To WebEval Service]” …)

Change the response to " " this should make it not reply with anything.

1 Like

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