mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-10 05:08:55 -05:00
Prevents error in case of inexistant trivia list
This commit is contained in:
parent
72fa9c2166
commit
4767666ad3
@ -176,15 +176,17 @@ class TriviaSession():
|
|||||||
await trivia_manager.bot.say(t)
|
await trivia_manager.bot.say(t)
|
||||||
|
|
||||||
async def check_answer(self, message):
|
async def check_answer(self, message):
|
||||||
self.timeout = time.perf_counter()
|
if message.author.id != trivia_manager.bot.user.id:
|
||||||
for answer in self.current_q["ANSWERS"]:
|
self.timeout = time.perf_counter()
|
||||||
if answer in message.content.lower():
|
if self.current_q is not None:
|
||||||
self.current_q["ANSWERS"] = []
|
for answer in self.current_q["ANSWERS"]:
|
||||||
self.status = "correct answer"
|
if answer in message.content.lower():
|
||||||
self.add_point(message.author.name)
|
self.current_q["ANSWERS"] = []
|
||||||
await trivia_manager.bot.send_message(message.channel, "You got it {}! **+1** to you!".format(message.author.name))
|
self.status = "correct answer"
|
||||||
await trivia_manager.bot.send_typing(self.channel)
|
self.add_point(message.author.name)
|
||||||
return True
|
await trivia_manager.bot.send_message(message.channel, "You got it {}! **+1** to you!".format(message.author.name))
|
||||||
|
await trivia_manager.bot.send_typing(self.channel)
|
||||||
|
return True
|
||||||
|
|
||||||
def add_point(self, user):
|
def add_point(self, user):
|
||||||
if user in self.score_list:
|
if user in self.score_list:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user