[Custom API] Streak Counter for Individual Viewers Per Stream

Credits

Credits for this idea goes to @Munson and credit for the use of his quote API goes to @ehsankia

Getting tokens for commands

To get the tokens needed for this command please go here https://twitch.center/customapi/quote/generate and find the 8 and 16 digit tokens.
They are after “token=” and before “&data” the 8 digit one is your PUBLIC_TOKEN and is free to share, your 16 digit one is you PRIVATE_TOKEN and should not be shared.

Adding the commands

  • Command one call this whatever you want the main command tone I suggest “!here/!streak” or something along those lines but it’s up to you:
$(eval u=`$(user)`;a=`$(twitch $(channel) "{{uptimeLength}}/{{uptimeAt}}")`.split(`/`);b="$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)".split(",");T=`PRIVATE_TOKEN`;$(urlfetch json https://pastebin.com/raw/VuaxVxUz))

Alias should be set to the next commands name I suggest whatever name yous house for this command with an underscore before it “_here/_streak”

  • This is the alias of the last command so call it whatever you decided for that:
$(eval a=`$(urlfetch https://twitch.center/customapi/$(1))/$(urlfetch https://twitch.center/customapi/$(2))`;u=`$(user)`;c=`$(channel)`;Q=`$(query)`.split(` `);$(urlfetch json https://pastebin.com/raw/wEWEs4Rw))
  • This command is a timer and doesn’t not matter what you name it:
$(eval a=`$(twitch $(channel) "{{uptimeLength}}/{{uptimeAt}}")`.split(`/`);d=a [1].replace(/(\+|\s)/g,``);b="$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)".split(",");c=b[0].split(`|`);T=`PRIVATE_TOKEN`;if(b[0].match(/are\sno/gi)){o=`addquote?token=${T}&data=${d}|0`}else{if(c[0]==d||a[0].match(/live|error/gi)||b[0].match(/live|error/gi)){o=`No`}else{o=`editquote?token=${T}&data=1%20${d}|${parseInt(c[1])+1}`}};o)

Set alias to “ _check” or something similar
Set Chat lines to 2 and Interval to 5

  • Finally the last command this is the alias for the timer so name it whatever you chose before:
$(eval a=`$(urlfetch https://twitch.center/customapi/$(1))`;` `)

Please note this will be silent as to not spam your chat so don’t worry :wink:

Additional Instructions

After you add these commands you’ll want to active the first command atleast once and you should get a message confirming you set it up properly.

Customization

If your looking to customize the outputs of the command feel free to change the outputs in your own pastebin and replace the pastebin of the first alias command with yours

Link to pastebin with responses: Here

You’ll want to replace the words here → O=WORDS YOU WANT TO REPLACE

For any help with this feel free to contact me on my Discord or on this Forum.

Note

I was only able to do limited testing on non-live streams so there may be bugs that I need to fix but we’ll work that out as it’s used.

Also a potential downside is this will count every new stream so if you are to disconnected etc. that will start a “new” streak.

1 Like

I want to test tha command, but the nightbot command message has a limit. And your example is just too long, any hint?
i want to count youtube viewer as well

You should add it through the nightbot dashboard.