Automated Chat Poll By Numbers (no affiliate required)

Automated Chat Poll By Numbers (no affiliate required)


This extension automatically registeres when a certain amount of number-containing chat messages have been posted in a certain time.

Streamer asking for the age of their viewers or asking for choosing to vote for answer 1/2/3/4 in an RPG.

If it reaches the treshold (you can customize that one), it creates a poll for a set amount of time that counts the votes for each number, creating a result with the mode, weighted average as well as the median (this is optional).

After half the time there will be an interim result posted to chat. The poll duration gets reset whenever a new vote from a new user is posted. Posting multiple numbers into chat will cause the vote to override. Polls can be manually closed.

Import Code

Automated Chat (16.2 KB)


This extension has made use of the C# Countdown Timer Extension from Rondhi: Countdown Timer in C#. So a special thanks to Rondhi!


  1. Download the import file (Automated Chat and import it into StreamerBot.
    (either drag & drop the file into the import string or open it with any texteditor and copy & paste its content into the import string)

  2. Move to the “Commands” tab and enable all imported commands.
    (Rightclick → Enable)

  3. Continue with Configuration below.


  1. Navigate to the action +++ Settings +++

  2. Edit the Set global "requiredVotes" subaction and type in the required amount of votes to start a poll into the value field. After x numbers from different users have been posted to chat, the poll will start.


  3. Edit the Set global "pollTimeTotal" subaction and type in a number in minutes for the total poll duration. Once a poll is started, this amount of time has to pass until the poll automatically closes. The timer will be reset with new incoming votes (not resetting when the same user posts another number).


  4. Edit the Set global "pollTimerReset" subaction and type in the number in seconds to pass for the poll initiator to reset. This will be the timeframe that counts the “votes” in chat before a poll starts.

    (E. g. if it is set to 60 seconds and the required votes are set to 10, the poll will only start if the 10 votes have been posted within 60 seconds.)

  5. Further down, you can edit the Set global "statisticStats" subaction and type in False, if you don’t want the mode, weighted average and median posted into chat.


  6. For the Set global "interimResult" subaction, you can also set it to False, if you don’t want an interim result posted to chat after half the time of the poll has passed.


  7. Rightclick the Test-Trigger and click on “Test Trigger”. This will apply the settings.


Note: After you change any of those settings again, you will need to click “Test Trigger” again in order for the changes to apply.

  1. Navigate to the action Automated Chat Poll Timer

    Doubleclick the “Execute Code” subaction and click on “Find Refs” on the bottom. Wait for it to load the reference, hit “Compile” and if it says “Compiled successfully”, hit “Save and Compile”.


  2. In the tabs, navigate to Settings → Timed Actions, rightclick and hit “Add”. Create a timed action, name it whatever you want, leave “Enabled” and “Repeat” checked and choose an interval of 3 seconds.

  3. Navigate back to the Actions tab, go to the action Poll Initiator Reset

    Doubleclick the “Timed Actions” trigger and choose the timed action that you have just created

    (if there is no trigger at all for you, add it again with rightclick Core → Timed Actions)

  4. Done!

Commands Description
!end poll End the current poll
!result Post the latest result into chat
1 Like

One “issue” that possibly exists atm is the overwriting of other actions on import. For example I had some actions from rondhis countdown timer in my SB. When importing your action it showed that those actions already exist. So I had to exclude them from being overwriten, with that it will rename the imported actions, that already exist name wise, with “(Copy)” at the end. This in turn will mess up your code as you are using the CPH.RunAction.

A workaround for this to make sure you didn’t just use Rondhis Countdowntimer action, first made a Copy(Duplicate) of it, then rename it to something fitting for the Poll as well. By duplicating the action it will create a unique ID which you can use instead of the name to run an action, this ID will also not change on import. You can then use CPH.RunActionById instead of CPH.RunAction.

Second issue, would be that in the Timer Code action the Execute Code subaction, currently has the Reference of your in place so it will show errors when compiling. You can potentially delete your reference (or leave it in there) but tell the user to also open the subaction, click on Find References and try and compile again. This should fix that issue.

Potentially can get rid of the “The countdown timer has been cancelled!” on line 639 as well when using !endpoll.

Another thing I had noticed was that sometimes after ending a poll then writing 1 and 2 with two specific accounts, the poll won’t start. I’m guessing however this has to do with the pollTimerReset that you are using

1 Like

Thanks for testing!

I updated the post, the actions shouldn’t overwrite now, I added the reference notice, too and got rid of the timer cancel message (guess that one slipped through).

However I can’t really reproduce the last issue of yours. I typed in 1 and 2 right after ending a poll (manually as well as automatically ending) and it always started a new one.

Thanks for that! Although you didn’t use the RunActionById but that’s alright haha
We generally try to have extensions where the user should not have to edit anything in the code itself. Reason being it can be pretty intimidating to go through some code if you never interacted with anything close to it.
So if you got some time to check how you could either use the Set Argument for message or even set the messages via global variable that you call in the code itself that would be awesome, if it’s not avoidable then it’s still fine.

About the “issue” I encountered, realized that it was just the added whitespace character from 7TV which is added to a message if it gets posted twice after another, thus it will not recognize the message as a whole number. Could give you a regex that takes that into account however it shouldn’t really matter in this case as most will either spam the same number anyway and if they change that whitespace character won’t be there either.

1 Like

I gave the duplicated actions a fairly unique name and figured I wouldn’t need to RunActionById anymore :smiley:

Anyways, I updated the post and created a new action that contains all the settings in one place. I added an option to keep the interim result and/or the statistical stats hidden.

I think this worked fine, was hard to test but seemed to work

1 Like