Help with $(count)

Asked Apr 13, 2020·2 replies·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.

hi, is there anyway i can get count to count how many times someone has been mentioned inside a command?

as an example (user) blames (touser) for everything wrong in the world, (touser) has been blamed for this (count) times

but the counter would count specifically how many times the user in the command, not just the command

2 replies

This isn't possible currently with the count variable (since it only retains a global count of usage per command).

Hey @Sparkly Chipmunk!

I have a workaround, for that we'll use 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 would have the following commands:
!blame

$(eval `$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(touser)|)`; `$(user) blames $(touser) for everything wrong in the world, $(touser) has been blamed for this`)

_blame (add this command as an alias of !blame)

$(eval q=`$(query)`; t=q.split(` `)[2]; l=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`.split(`|`); n=l.filter(t).length; `${q} ${n} times.`)

And in case you'd like to reset the counters:
!resetblame

$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)

This topic has an update here: /t/a-counter-for-an-individual/1534647709128982689#m1534647710978674718