bots: Add proper error handling for trivia bot.

This commit is contained in:
Rhea Parekh 2018-06-04 16:19:50 +05:30 committed by showell
parent f276e46890
commit e638cdd4a9

View file

@ -134,6 +134,8 @@ def generate_quiz_id(storage) -> str:
quiz_num = storage.get('quiz_id') quiz_num = storage.get('quiz_id')
except KeyError: except KeyError:
quiz_num = 0 quiz_num = 0
except TypeError:
quiz_num = 0
quiz_num += 1 quiz_num += 1
quiz_num = quiz_num % (1000) quiz_num = quiz_num % (1000)
storage.put('quiz_id', quiz_num) storage.put('quiz_id', quiz_num)