diff --git a/lolbot.py b/lolbot.py index 26569cf..5b106b8 100644 --- a/lolbot.py +++ b/lolbot.py @@ -142,6 +142,8 @@ class LolBot(SingleServerIRCBot): if self.quiz_scores[nick] != 1: score += "s" self.connection.notice(self.channel, '%s has %s.' % (nick, score)) + if not len(self.quiz_scores): + self.connection.notice(self.channel, 'So far, nobody has got anything right.') def handle_quiz(self, nick, message): # bail if there's no quiz or unanswered question. @@ -152,8 +154,14 @@ class LolBot(SingleServerIRCBot): if self.question.attempt(message): self.quiz_award_points(nick) self.quiz_check_win(nick) + # if nobody has won, carry on if self.quiz: + + # scores every 10 questions. + if self.quiz % 10 == 0: + self.quiz_scoreboard() + self.quiz_get_next() def do_command(self, e, cmd): @@ -170,7 +178,10 @@ class LolBot(SingleServerIRCBot): c.notice(nick, self.helptext) elif cmd == 'status': - c.notice(nick, "I know %s questions." % len(self.qb)) + c.notice(self.channel, "I know %s questions." % len(self.qb)) + if self.quiz: + c.notice(self.channel, "I am currently running a quiz.") + self.quiz_scoreboard() elif cmd == 'halt' or cmd == 'quit': if self.quiz: @@ -180,6 +191,10 @@ class LolBot(SingleServerIRCBot): else: c.notice(self.channel, "No quiz running.") + elif cmd == 'scores': + if self.quiz: + self.quiz_scoreboard() + elif cmd == 'ask': if self.quiz: c.notice(self.channel, "Quiz is running. Use halt or quit to stop.") @@ -261,4 +276,7 @@ def main(): if __name__ == "__main__": - main() + try: + main() + except KeyboardInterrupt: + pass