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.
Automated Chat Poll.sb (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!
Download the import file (Automated Chat Poll.sb) 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)
Move to the “Commands” tab and enable all imported commands.
(Rightclick → Enable)
Continue with Configuration below.
Navigate to the action
+++ Settings +++
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.
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).
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.)
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.
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.
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.
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”.
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.
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)
|End the current poll
|Post the latest result into chat