Can someone help me to create a custom command

Asked Apr 18, 2020·1 reply·Last activity 6 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

I need help creating a command that tracks how many follows you have gotten that stream... can someone please help 🙂 i need a version i can !addcom into chat

slight_smile.png

1 reply

Hey @Zesty Bison!

One way you could do this is by using the quote system API. You'll get your TOKENS by clicking on the second link in the post, use these in the commands I wrote. To know where to look for your PUBLIC_TOKEN and PRIVATE_TOKEN, look at the field bellow:

$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=$(querystring))
$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(querystring))
$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&data=$(querystring))

Keep your PRIVATE_TOKEN secret, don’t share it anywhere. To add a command containing your PRIVATE_TOKEN do it from the dashboard. Don’t use the chat as anyone could monitor it and copy the token, they could then edit your data.

Then you'd have to run this command at the beginning of the stream, it'll store the number of followers at the start of the stream to a quote:
• !resetfollowers

$(eval r=`$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(twitch $(channel) "{{followers}}"))`; `Number of new followers reset.`)

Make sure !resetfollowers is for moderators and above only.

And then run this command at the end of the stream, it'll compare the number of followers at the start and at the end of the stream and compute how many you've gained:
• !followers

$(eval start=`$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=-1)`; end=`$(twitch $(channel) "{{followers}}")`; `$(channel) has gained ${end-start} followers.`