1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00

Remove question lock

This commit is contained in:
Steffo 2020-01-17 18:00:28 +01:00
parent 40af5e4415
commit 0e0b88e6e7

View file

@ -29,7 +29,7 @@ class TriviaCommand(rc.Command):
_answer_time = 20 _answer_time = 20
_question_lock: bool = False # _question_lock: bool = False
def __init__(self, interface: rc.CommandInterface): def __init__(self, interface: rc.CommandInterface):
super().__init__(interface) super().__init__(interface)
@ -53,9 +53,9 @@ class TriviaCommand(rc.Command):
f" ({ts.correct_answers}/{ts.total_answers})") f" ({ts.correct_answers}/{ts.total_answers})")
await data.reply("\n".join(strings)) await data.reply("\n".join(strings))
return return
if self._question_lock: # if self._question_lock:
raise rc.CommandError("C'è già un'altra domanda attiva!") # raise rc.CommandError("C'è già un'altra domanda attiva!")
self._question_lock = True # self._question_lock = True
# Fetch the question # Fetch the question
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get("https://opentdb.com/api.php?amount=1") as response: async with session.get("https://opentdb.com/api.php?amount=1") as response:
@ -144,4 +144,4 @@ class TriviaCommand(rc.Command):
await data.reply(results) await data.reply(results)
del self._answerers[question_id] del self._answerers[question_id]
await ru.asyncify(data.session.commit) await ru.asyncify(data.session.commit)
self._question_lock = False # self._question_lock = False