bots: minor cleanup for trivia_quiz bot.
This commit is contained in:
parent
0ea49c96ed
commit
ba98220d44
|
@ -38,7 +38,7 @@ class TriviaQuizHandler:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
quiz_payload = get_quiz_from_id(quiz_id, bot_handler)
|
quiz_payload = get_quiz_from_id(quiz_id, bot_handler)
|
||||||
except KeyError:
|
except (KeyError, TypeError):
|
||||||
bot_response = 'Invalid quiz id'
|
bot_response = 'Invalid quiz id'
|
||||||
bot_handler.send_reply(message, bot_response)
|
bot_handler.send_reply(message, bot_response)
|
||||||
return
|
return
|
||||||
|
@ -132,9 +132,7 @@ def get_quiz_from_payload(payload):
|
||||||
def generate_quiz_id(storage) -> str:
|
def generate_quiz_id(storage) -> str:
|
||||||
try:
|
try:
|
||||||
quiz_num = storage.get('quiz_id')
|
quiz_num = storage.get('quiz_id')
|
||||||
except KeyError:
|
except (KeyError, TypeError):
|
||||||
quiz_num = 0
|
|
||||||
except TypeError:
|
|
||||||
quiz_num = 0
|
quiz_num = 0
|
||||||
quiz_num += 1
|
quiz_num += 1
|
||||||
quiz_num = quiz_num % (1000)
|
quiz_num = quiz_num % (1000)
|
||||||
|
|
Loading…
Reference in a new issue