From 4572fb18eda52c1ed108e4b64784065315a11ac1 Mon Sep 17 00:00:00 2001 From: Ayden Jahola Date: Fri, 6 Sep 2024 00:18:16 +0100 Subject: [PATCH] trivia: maybe true and false wont act up now? idk im dumb somtimes --- commands/fun/trivia.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/commands/fun/trivia.js b/commands/fun/trivia.js index 3658e69..dfcaea7 100644 --- a/commands/fun/trivia.js +++ b/commands/fun/trivia.js @@ -96,7 +96,17 @@ module.exports = { // Handle True/False questions specifically if (triviaQuestion.type === "boolean") { - allAnswers = ["True", "False"]; + // Always keep "True" as option 1 and "False" as option 2 + answerMap = { 1: "True", 2: "False" }; + } else { + // Shuffle answers for other types of questions + allAnswers = allAnswers.sort(() => Math.random() - 0.5); + + // Create a mapping of numbers to answers + answerMap = allAnswers.reduce((map, answer, index) => { + map[index + 1] = answer; + return map; + }, {}); } allAnswers = allAnswers.sort(() => Math.random() - 0.5); // Shuffle answers