Hey @shanearchy!
Yeah, the $(counter)
variable is for the whole command, it can’t be user-specific, however, you can leverage existing tools to achieve what you’re looking for.
We’ll use the Quote API, get your tokens by following the Manual Installation link.
Refer to the following to identify your PUBLIC_TOKEN
and PRIVATE_TOKEN
:
$(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))
Copy them and store them somewhere safe, never share your PRIVATE_TOKEN
, anyone could then manage your list, that’s why the code I’ll write won’t contain command calls to add the new commands through the chat, add the new commands through the dashboard.
And here are the commands…
…for your mods:
-
!addwin
:$(eval a = `$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(touser))`; '$(touser)|' + a;)
Set this command’s userlevel to
Moderator
, and its alias to_addwin
Syntax:!addwin username
-
_addwin
:$(eval q = `$(query)`.split('|'); l = `$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`; re = new RegExp(q[0], 'gi'); n = l.match(re).length; q[1].includes('Successfully') ? `${q[0]} has won ${n} games of ceelo!` : 'There was an error, try again.';)
Set this command’s userlevel to
Moderator
Don’t call this command, it’ll automatically be
…for everyone:
-
!wins
:$(eval u = '$(touser)'; l = `$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`; re = new RegExp(u, 'gi'); n = l.match(re)?.length || 0; `${u} has won ${n} games of ceelo!`)
Syntax:
!wins username_optional
And in case you want to reset the counters:
-
!resetwins
$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)
Set this command’s userlevel to
Moderator
Syntax:!resetwins
This is an update to an older topic: Help with $(count) - #3 by Emily