web vote tool

This commit is contained in:
Sarimoko 2022-02-14 20:12:10 -08:00
parent eb13805d8c
commit c959c82ab8
2 changed files with 6 additions and 6 deletions

View File

@ -27,21 +27,21 @@ client.on('message', (wat, tags, message, self) => {
if (self) return; if (self) return;
const { username } = tags; const { username } = tags;
if (username.toLowerCase() === channel.toLowerCase()) { if (username.toLowerCase() === channel.toLowerCase()) {
if (message === '!start') { if (message === '!startvote') {
listeningForCount = true; listeningForCount = true;
} }
else if (message === '!end') { else if (message === '!endvote') {
listeningForCount = false; listeningForCount = false;
// say count out loud. // say count out loud.
const sayCount = new SpeechSynthesisUtterance(Object.keys(users).length); const sayCount = new SpeechSynthesisUtterance(Object.keys(users).length);
window.speechSynthesis.speak(sayCount); window.speechSynthesis.speak(sayCount);
} }
else if (message === '!clear') { else if (message === '!clearvote') {
countElement.textContent = 'Waiting for count...'; countElement.textContent = 'Waiting for votes...';
usersElement.textContent = ''; usersElement.textContent = '';
users = {}; users = {};
} }
} else if (listeningForCount && message === '1') { } else if (listeningForCount && message === '!vote' || message === 'vote') {
users[tags.username] = true; users[tags.username] = true;
// display current count page. // display current count page.
countElement.textContent = Object.keys(users).length; countElement.textContent = Object.keys(users).length;

View File

@ -12,7 +12,7 @@
<marquee><p>Type 1 in the chat!</p></marquee> <marquee><p>Type 1 in the chat!</p></marquee>
<em>(broadcaster only)</em> <em>(broadcaster only)</em>
<br /> <br />
<code>!start | !end | !clear</code> <code>!startvote | !endvote | !clearvote</code>
<br /> <br />
<br /> <br />
</center> </center>