Skip to content

Commit e052b04

Browse files
correct logic
1 parent 9ebd38a commit e052b04

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

bot.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,17 +352,14 @@ async def on_message(self, message):
352352
if message.content.lower().strip() == answer:
353353
user_progress[user.id] += 1
354354
await message.channel.send(f"Correct, {user.mention}!")
355-
356-
if user_progress[user.id] == len(quiz_questions): # Check if all questions are answered
357-
print(f"{user.mention} has completed the quiz!")
358-
user_progress[user.id] = 0 # Reset the user's progress
359-
print(f"{user.mention}'s progress has been reset.")
360-
else:
361-
await ask_question(message.channel, user) # Ask the next question
362-
355+
await ask_question(message.channel, user) # Ask the next question
363356
else:
364357
await message.channel.send(f"Incorrect, {user.mention}. Please try again.")
365358
await timeout_user(message, user) # Apply a timeout for incorrect answers
359+
else:
360+
print(f"{user.mention} has completed the quiz!")
361+
user_progress[user.id] = 0 # Reset the user's progress
362+
print(f"{user.mention}'s progress has been reset.")
366363

367364
return # Stop further processing if the user is in a quiz
368365

0 commit comments

Comments
 (0)