Hey @dreibaby!
We’ll use the quote system API. You’ll get your TOKENS
by clicking on the second link in the post, in the Manual Installation section, 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. Add the following commands from the dashboard. Don’t use the chat as anyone could monitor it and copy the token, they could then edit your data.
The believe command is in two parts:
• !believe
:
$(eval d=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`.split(`|`); if(d.indexOf(`$(user)`)>=0){`r`}else{`PRIVATE_TOKEN&data=$(user)|`})
• _believe
: alias of !believe
so type _believe
is the alias field of !believe
.
$(eval a=$(urlfetch https://twitch.center/customapi/addquote?token=$(query)); d=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`.split(`|`); q=`$(query)`; q==`r`?`There are ${d.length} believers in chat.`:q.includes(`PRIVATE_TOKEN`)?`$(user) believes! There are now ${d.length} believers in chat.`:`ERROR`;)
To reset the counter every 30 minutes, use a timer with the following settings:
• Interval: every 30 minutes
• Chat Lines: 2 lines
• Message:
$(eval a=$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1); `Believers counter reset. Who believes? Type !believe`)
I haven’t had time to test it, but I’ve written similar commands in the past, so it should work.
Only possible issue I can think of at the moment is the counter being off by one when a new user calls the command. In which case, adjust the second/last ${d.length}
in _believe
with either ${d.length+1}
or ${d.length-1}
accordingly.