File tree 6 files changed +84
-850
lines changed
6 files changed +84
-850
lines changed Original file line number Diff line number Diff line change 1
1
name : hqtrivia
2
- version : 0.2.7
2
+ version : 0.2.8
3
3
4
4
authors :
5
5
-
Taylor Finnell <[email protected] >
6
6
7
- crystal : 0.27.0
7
+ crystal : 0.27.1
8
8
9
9
license : MIT
10
10
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -24,12 +24,14 @@ class WordsBot
24
24
getter round_starts
25
25
getter round_ends
26
26
getter reveals
27
+ getter num_winners
27
28
28
29
def initialize (@show : HqTrivia ::Model ::Show , @coordinator : HqTrivia ::Coordinator )
29
30
super
30
31
@round_starts = 0
31
32
@round_ends = 0
32
33
@reveals = 0
34
+ @num_winners = 0
33
35
end
34
36
35
37
def handle_message (message : HqTrivia ::Model ::StartRound )
@@ -43,6 +45,10 @@ class WordsBot
43
45
def handle_message (message : HqTrivia ::Model ::LetterReveal )
44
46
@reveals += 1
45
47
end
48
+
49
+ def handle_message (message : HqTrivia ::Model ::WordsGameResult )
50
+ @num_winners = message.num_winners
51
+ end
46
52
end
47
53
48
54
module HqTrivia
@@ -70,9 +76,10 @@ module HqTrivia
70
76
bot = WordsBot .new(show, LocalCoordinator .new(" us" ))
71
77
bot.play(connection)
72
78
73
- bot.reveals.should eq(16 )
74
- bot.round_starts.should eq(8 )
75
- bot.round_ends.should eq(8 )
79
+ bot.reveals.should eq(20 )
80
+ bot.round_starts.should eq(10 )
81
+ bot.round_ends.should eq(10 )
82
+ bot.num_winners.should eq(5827 )
76
83
end
77
84
end
78
85
end
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ module HqTrivia
23
23
24
24
private def header_others (country )
25
25
HTTP ::Headers {
26
- " Authorization" => " Bearer #{ token(country) } " ,
26
+ " Authorization" => " Bearer #{ token(country) } " ,
27
27
}
28
28
end
29
29
Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ module HqTrivia
5
5
include WebSocketMessage
6
6
7
7
JSON .mapping({
8
- type: String ,
9
- show_id: {key: " showId" , type: Int32 },
10
- winners: Array (Winner ),
11
- c: Int32 ,
12
- sent: Time ,
8
+ type: String ,
9
+ show_id: {key: " showId" , type: Int32 },
10
+ winners: Array (Winner ),
11
+ num_winners: {key: " numWinners" , type: Int32 },
12
+ c: Int32 ,
13
+ sent: Time ,
13
14
})
14
15
15
16
# Winner information
Original file line number Diff line number Diff line change 1
1
module HqTrivia
2
2
# Current HqTrivia version
3
- VERSION = " 0.2.7 "
3
+ VERSION = " 0.2.8 "
4
4
end
You can’t perform that action at this time.
0 commit comments