Browse Source

Refs #31 invalid date on second !report list

isundil 6 years ago
parent
commit
b71955f008
1 changed files with 9 additions and 5 deletions
  1. 9 5
      quizz.js

+ 9 - 5
quizz.js

@@ -487,11 +487,15 @@ QuizzBot.prototype.onMessageInternal = function(username, user, msg) {
     }
     else if (lmsg.startsWith("!report list")) {
         if (user.admin) {
-            var questions = Cache.getReportedQuestions();
-            for (var i in questions)
-                for (var j in questions[i])
-                    questions[i][j] = (new Date(questions[i][j])).toLocaleString();
-            this.bot.sendNotice(username, JSON.stringify(questions));
+            var questions = Cache.getReportedQuestions(),
+                questionObj = {};
+
+            for (var questionId in questions) {
+                questionObj[questionId] = {};
+                for (var username in questions[questionId])
+                    questionObj[questionId][username] = new Date(questions[questionId][username]).toLocaleString();
+            }
+            this.bot.sendNotice(username, JSON.stringify(questionObj));
         }
         else
             this.bot.sendMsg(this.room, "Must be channel operator");