Update the next command (untested)

This commit is contained in:
Oliver-Akins 2021-12-24 03:43:36 -07:00
parent 3ed62264b3
commit f95063274f

View file

@ -4,7 +4,7 @@ import {
commands,
question_index,
user_answers,
correct_answers,
questions,
user_right_count,
reset_users
} from "../main";
@ -19,12 +19,12 @@ function next_command(_: string[]) {
// count users who got it right
let users_correct = Object.values(user_answers)
.filter(x => x == correct_answers[question_index])
.filter(x => x == questions[question_index])
.length;
let correct_users: string[] = [];
for (var user in user_answers) {
if (user_answers[user] == correct_answers[question_index]) {
if (user_answers[user] == questions[question_index]) {
correct_users.push(user);
if (user_right_count[user] == null) {
user_right_count[user] = 1;
@ -47,7 +47,7 @@ ${correct_users.join(", ")}
)
// Check if the quiz has hit the end
if (question_index == correct_answers.length - 1) {
if (question_index == questions.length - 1) {
// Send message in Discord for record-keeping
axios.post(