NightDev Community Forums

Custom $(count) reset command for word count / emote count

Hej tthere.
I added this command

!commands add VoteYea /me ($(count) Nay)

This works perfectly. I use it as a voting system with both Yea and Nay.

Is there any way i can post a command in chat that resets this command so it can start counting from 0 again after each round of the chat voting?

Any help is thankfull <3

Hey @ImMags!

I’m not quite sure I understand how your voting system work, but if I use the code you gave in your question, this should reset the counter from your command:
!addcom !resetyea -ul=mod -a=!editcom voteyea \-c=0
Also, next time you add your VoteYea command, make sure the cooldown is the shortest possible, as this command can stay indefinitely thanks to the reset command:
!addcom voteyea -cd=5 /me ($(count) Nay)


If you wish to have have a VoteYea and a VoteNay command, both counting the amount of vote each emote get, this should do the job:
!addcom voteyea -cd=5 /me $(count) VoteYea
!addcom votenay -cd=5 /me $(count) VoteNay
In order to reset the counters of both commands, this should work:
!addcom !resetyea -ul=mod -a=!editcom voteyea \-c=0
!addcom !resetnay -ul=mod -a=!editcom votenay \-c=0


Finally, I’ll go crazy on this one, because it’s a really nice idea and so it made me want to make an advanced set of commands, if you want a command that display the total amount of both VoteYea and VoteNay, you can use ehsankia’s quote system.
The idea here is to store the amount of vote for VoteYea and VoteNay in the API, and display it with an unique command: !votes.

!addcom voteyea -cd=5 -a=$yea $(eval a=`$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&data=VoteYea*)`;`$(count)`)
!addcom $yea -cd=5 $(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(query) VoteYea*)`;`/me $(user) voted VoteYea`)
!addcom votenay -cd=5 -a=$nay $(eval a=`$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&data=VoteNay*)`;`$(count)`)
!addcom $nay -cd=5 $(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(query) VoteNay*)`;`/me $(user) voted VoteNay`)
!addcom !votes -cd=5 $(eval a=`$(urlfetch https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`.split(`*`).join(` `);`/me ${a}`;)
!addcom !resetvotes -ul=mod $(eval a=`$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)`;`/me Votes have been cleared!`)
!addcom !resetyea -ul=mod -a=!editcom voteyea \-c=0
!addcom !resetnay -ul=mod -a=!editcom votenay \-c=0

To get your PUBLIC_TOKEN (8 characters) and PRIVATE_TOKEN (16 characters), use the second link in ehsankia’s quote system post. Store your tokens somewhere safe to add them back in case the command is edited by mistake, you don’t want to lose them.
And don’t share your PRIVATE_TOKEN anywhere, that’s why I’d recommend adding VoteYea and VoteNay from your dashboard so you don’t share your PRIVATE_TOKEN in chat, in that case remove !addcom and -cd=5 from the command message, voteyea and votenay would, of course, be the commands names.

1 Like

Sorry for the bad description but i think you nailed it :D! Thanks so much!

And yes this is a really fun voting system that the chat can do :smiley:

Hmm Somehow the mod command does not reset the count on the first code

Yeah the long one isnt quite working either with the proper tokens. But thanks for the effort :smiley:

You’re right, I forgot a simple backslash, sorry, I corrected the mods commands, I’m looking into the ones with the quotes system.

Edit: I looked into the commands using the quotes system, I fixed it as well.

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