Show command count, without restricting ul

I’m looking for a way to create a command that shows the value of another command’s $(count) variable without increasing it. I searched the forum and found one such method, but it involves setting the user level to moderator for the counting command, meaning the rest of chat could not increment it.

Is there a way to simply pull the current value of a count with another command?

@tulsaeh

There currently isn’t a way to get the value of a $(count) variable. There exists a workaround although it will take some work on your end to set up. This workaround uses ehsankia’s quote list custom API - read more about it here.

Click this link. It will generate three links and two tokens, a public token (8 characters long) and a private token (16 characters long). The public token is located within the first generated link. The private token is located within both the second and third generated links. The tokens are found after token= and before &data=$(querystring) Copy them and keep them somewhere safe!

We can use this custom API to create a special ‘count variable’. I assume what you want is two commands: A command that displays the current counter value and a command that increments the value. In my setup the former command is !count and the latter is !addcount. Either copy and paste these new commands into chat or add them through the Nightbot dashboard. Add the commands through chat only if you are sure no one else is there, otherwise they might see your private token (which is used to edit the list)! Replace PUBLIC_TOKEN with your public token and PRIVATE_TOKEN with your private token.

!addcom -cd=5 !count The counter value is currently $(eval `$(urlfetch http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.split(`.`).length-1)
!addcom -cd=5 !addcount $(eval a=`$(urlfetch http://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=e)`;` `) $(user) has increased the counter value by 1!

Feel free to change the command responses just as long as the $(eval) variables remain untouched.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.