Basic hint support, for questions that have them.

This commit is contained in:
Jonathan Harker 2015-11-23 23:15:56 +13:00
parent bf2da99ce6
commit bbcd5b224d

View file

@ -211,10 +211,18 @@ class LolBot(SingleServerIRCBot):
def quiz_get_next(self):
self.quiz += 1
self.tip = 0
self.question = random.choice(self.qb)
print(str(self.question.question))
self.connection.notice(self.channel, "Question %s: %s" % (self.quiz, str(self.question.question)))
def quiz_tip(self):
if len(self.question.tip) > self.tip:
self.connection.notice(self.channel, "Tip: %s" % self.question.tip[self.tip])
self.tip += 1
else:
self.connection.notice(self.channel, "No more tips.")
def quiz_award_points(self, nick):
if nick not in self.quiz_scores.keys():
self.quiz_scores[nick] = 0
@ -300,6 +308,10 @@ class LolBot(SingleServerIRCBot):
if self.quiz:
self.quiz_scoreboard()
elif cmd == 'tip' or cmd == 'hint':
if self.quiz:
self.quiz_tip()
elif cmd == 'ask':
if self.quiz:
c.notice(self.channel, "Quiz is running. Use halt or quit to stop.")