0

I want my bot to recognize if the user got the right or wrong answer, but the bot returns the wrong answer message no matter what. Here is my code:

@bot.command()
async def trivia(ctx):
  trivfile = open("questions.txt")
  allines = trivfile.readlines()
  for i in allines:
    qlist.append(i)
  qnum = random.randint(1,len(qlist)-1)
  del qlist[:]
  line = (allines[qnum-1])
  words = line.split()
  embed = discord.Embed(
    title = "Are you ready?",
    description = f"``{questions[qnum-1]}``\n **:regional_indicator_a:{words[0]}\n :regional_indicator_b:{words[1]}\n :regional_indicator_c:{words[2]}\n :regional_indicator_d:{words[3]}\n**",
    color = discord.Colour.red()
  )
  embed.set_thumbnail(url="https://www.budgetbytes.com/wp-content/uploads/2013/07/Creamy-Tomato-and-Spinach-Pasta-skillet-1-500x480.jpg")
  await ctx.send(embed=embed)
  def check(m):
    return m.content == 'a' or 'A' or 'b' or 'B' or 'c' or 'C' or 'd' or 'D'
  answer =  await bot.wait_for('message',check=check)
  if answer == words[4] or answer == words[5]:
    await ctx.send(f"Congrats, {ctx.author.name}! That was the correct answer gg man")
  else:
    await ctx.send(f"Wrong, the correct answer was {words[5]}. smh big noob")

and here is my .txt file containing the answers:

Achgabat Kabul Islamabad Bruhcity a A
1936 1914 1918 1890 b B
Jackson Astley Stalin Mercury b B

Thanks.

Harmon758
  • 5,084
  • 3
  • 22
  • 39

1 Answers1

0

Bot.wait_for returns arguments that mirror the parameters passed to the relevant event handler.
In this case, since you're waiting for a message event, it will return a Message object that's assigned to answer. You'll want to use the Message.content attribute for comparisons.

Harmon758
  • 5,084
  • 3
  • 22
  • 39