I hope what I am about say makes sense, but I am trying to make a command like the following:
!word
"Streamer has said [word] x times this stream. That makes y times in total.
I currently have:
!word
Streamer has said said word $(count) times.
Where obviously everytime the !word command is used, the above increases by one. I want the “y” times in total to also increase by 1 when this is used, however, I want to be able to reset the first part of the command each stream without erasing the second “total times overall” part.
Is that a thing I can do?
If anyone knows I would greatly appreciate it! Thank you so much.
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!
I have set up 2 commands below, !word which increases both a per-stream counter and a total counter, and !resetcount which resets the per-stream counter. Copy and paste the command setups into chat one by one to add the commands. Replace PUBLIC_TOKEN with your public token and PRIVATE_TOKEN with your private token.
!addcom -cd=5 !word @$(user) Use !resetcount first
!addcom !resetcount -a=!editcom !word $(eval c=$(count);"$"+"(eval `$"+"(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=~"+c+"~)`;a=`$"+"(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.match(/~\\d+~/g);`$"+"(channel) has said word ${a.filter(z=>z==`~"+c+"~`).length} times this stream. That makes ${a.length} times in total.`)")
Use !resetcount after every stream to reset the per-stream counter. Use !resetcount at least one time before using !word
For some reason I cannot get this to work (I must be doing something wrong).
I copied this exactly as you have it above and replaced the tokens but the following is happening:
When using !word:
Nightbot: Use !resetcount first
When using !resetcount:
Nightbot: -> There was an error editing the command. Error: command does not exist
When using !delcom !resetcount:
Nightbot: -> There was an error deleting the command. Error: command does not exist
However if I try to add !resetcount:
Nightbot: -> There was an error adding the command. Error: command name already exists
Am I making sense?
I’m trying to figure this out but I’m not sure what exactly the issue is. Any ideas?
I made a small mistake in the command code. Here it is revised (also revised in my first post). Delete !resetcount and add it again using the new code.
!addcom -cd=5 !word @$(user) Use !resetcount first
!addcom !resetcount -a=!editcom !word $(eval c=$(count);"$"+"(eval `$"+"(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=~"+c+"~)`;a=`$"+"(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.match(/~\\d+~/g);`$"+"(channel) has said word ${a.filter(z=>z==`~"+c+"~`).length} times this stream. That makes ${a.length} times in total.`)")