Skip to content

Commit 19f7f1b

Browse files
committed
Bot no-longer reads C or D for true/false questions
1 parent 6a27adc commit 19f7f1b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

discord-trivia-func.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ exports.parse = function(str, msg) {
3737
}
3838
}
3939

40-
// TODO: Don't count if "C" or "D" is entered on a True/False question.
41-
if(game[id].inProgress && (str == "A" || str == "B" || str == "C" || str == "D"))
40+
if(game[id].inProgress && (str == "A" || str == "B" || game[id].isTrueFalse != 1 && (str == "C"|| str == "D")))
4241
game[id].participants.push(msg.author.id);
4342
}
4443
};
@@ -53,7 +52,6 @@ function doTriviaQuestion(msg) {
5352
https.get("https://opentdb.com/api.php?amount=1", (res) => {
5453
res.on('data', function(data) {
5554
var json = JSON.parse(data.toString());
56-
// TODO: Catch errors from server
5755

5856
var answers = [];
5957

@@ -66,6 +64,9 @@ function doTriviaQuestion(msg) {
6664

6765
answers = answers.concat(json.results[0].incorrect_answers);
6866

67+
if(json.results[0].incorrect_answers.length == 1)
68+
game[id].isTrueFalse = 1;
69+
6970
var color = 3447003;
7071
switch(json.results[0].difficulty) {
7172
case "easy":

0 commit comments

Comments
 (0)