Added check for inactive games.

- Fixes inactive game starts caused by an empty question database
This commit is contained in:
Yizhe Shen 2014-06-20 11:43:12 -04:00
parent c6ac55df9e
commit ea2c936f2a
1 changed files with 4 additions and 2 deletions

View File

@ -275,7 +275,9 @@ class TriviaTime(callbacks.Plugin):
if irc.network not in self.games:
self.games[irc.network] = {}
channelCanonical = ircutils.toLower(channel)
self.games[irc.network][channelCanonical] = self.Game(irc, channel, self)
newGame = self.Game(irc, channel, self)
if newGame.active == True:
self.games[irc.network][channelCanonical] = newGame
def getGame(self, irc, channel):
channelCanonical = ircutils.toLower(channel)
@ -1898,8 +1900,8 @@ class TriviaTime(callbacks.Plugin):
# grab the next q
numQuestion = self.storage.getNumQuestions()
if numQuestion == 0:
self.sendMessage('There are no questions. Stopping. If you are an admin, use the addfile command to add questions to the database.')
self.stop()
self.sendMessage('There are no questions. Stopping. If you are an admin, use the addfile coomand to add questions to the database')
return
numQuestionsLeftInRound = self.storage.getNumQuestionsNotAsked(self.channel, self.roundStartedAt)