Create a counting command

Hello Guys,

Happy new year !
I have a question, I haven’t find any answer on the internet :
I want to add a counting command for my chat, to see how many times everyone used this command since the beginning of the stream. How do I do that please ?

The message would be : [x-command] has been used [x-time] time

Thanks !

@Stan

Happy 2019!


This method uses ehsankia’s quote list CustomAPI - 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 down and keep them somewhere safe!

Below I have set up 3 commands: !command which is some generic command that you can customize to display whatever response you want, !used which shows how many times !command has been used, and !resetused (mod-only) which resets the count. Either copy and paste these commands into chat or add these commands 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 manage the list we’ll be using for these commands)! Replace PUBLIC_TOKEN with your public token and PRIVATE_TOKEN with your private token.

!addcom -cd=5 !command $(eval a=`$(urlfetch http://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=e)`;` `) [YOUR_COMMAND_RESPONSE]
!addcom -cd=5 !used The [COMMAND_NAME] command has been used $(eval `$(urlfetch http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.split(`.`).length-1) times.
!addcom -cd=5 !resetused $(eval a=`$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)`;` `) $(user) has reset the command usage counter!

In the setup for !command:
1: You can change the command name, !command, to whatever you want.
2: Replace [YOUR_COMMAND_RESPONSE] with whatever command response you’d like.

In the setup for !used:
Replace [COMMAND_NAME] with your new command name from the setup for !command.

1 Like

Thanks for your answer, I just forget to precise, I m streaming on Youtube, not Twitch, does it still work?

This should work on both Twitch and YouTube.

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