Skip to content

Commit 90f1004

Browse files
committed
Allows to use !vote command on event end
1 parent dd30a4d commit 90f1004

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

config.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
"httpPort": 80,
66
"ircPort": 433
77
},
8-
"debug": {
9-
"twitch": false,
10-
"fakeUsers": false
11-
},
128
"commands": {
139
"prefix": "!",
1410
"notify": true,
@@ -28,5 +24,9 @@
2824
"name": "drawstart",
2925
"admin": true
3026
}
27+
},
28+
"debug": {
29+
"twitch": false,
30+
"fakeUsers": false
3131
}
3232
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "twitch-widgets",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Provides Twitch chat commands and web-widgets for broadcasters",
55
"main": "dist/backend/index.js",
66
"scripts": {

src/backend/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,9 @@ client.on("message", (channel, userState, message, self) => {
154154
break;
155155
}
156156
case config.commands.draw.name: {
157-
if (draw) {
158-
draw.add(username);
157+
if (draw && draw.add(username))
159158
return;
160-
}
159+
161160
if (!isAdmin)
162161
return;
163162

src/backend/src/draw-command.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ export default class Draw {
3333
this.lastWinner = "";
3434
}
3535
add(user: string) {
36-
if (!this.endTimestamp || this.isEnded()) {
36+
if (!this.endTimestamp || this.hasEnded()) {
3737
console.log(`${user} cannot vote now!`);
38-
return;
38+
return false;
3939
}
4040
if (config.debug.fakeUsers)
4141
this.users.add(user + Date.now().toString());
4242
else
4343
this.users.add(user);
44-
return this;
44+
return true;
4545
}
4646
start() {
4747
if (this.endTimestamp)
4848
return;
4949
this.endTimestamp = timestamp() + this.countdownSeconds;
5050
}
51-
isEnded() {
51+
hasEnded() {
5252
return timestamp() > this.endTimestamp;
5353
}
5454
getRandomWinner() {

0 commit comments

Comments
 (0)