web vote tool
This commit is contained in:
parent
eb13805d8c
commit
c959c82ab8
10
www/boto.js
10
www/boto.js
|
@ -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;
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue