Explorar el Código

Add last sent hint

isundil hace 6 años
padre
commit
e89d76ae65
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      quizz.js

+ 4 - 1
quizz.js

@@ -159,6 +159,7 @@ QuizzBot.prototype.init = function(bot, chanName) {
     this.init = false;
     this.users = {};
     this.activeUsers = {};
+    this.sentHint = null;
 
     if (previousData) {
         for (var i in previousData.scores) {
@@ -227,6 +228,7 @@ QuizzBot.prototype.stop = function() {
     this.timer = null;
     this.currentQuestion = null;
     this.currentHint = 0;
+    this.sentHint = null;
 }
 
 QuizzBot.prototype.onTick = function() {
@@ -249,7 +251,8 @@ QuizzBot.prototype.resetTimer = function() {
 }
 
 QuizzBot.prototype.sendNextHint = function(resetTimer) {
-    this.bot.sendMsg(this.room, this.currentQuestion.getHint(this.currentHint));
+    this.sentHint = this.currentQuestion.getHint(this.currentHint);
+    this.bot.sendMsg(this.room, this.sentHint);
     ++this.currentHint;
     this.lastHint = Date.now();
     resetTimer !== false && this.resetTimer();