'Discord.py lock

I am trying to make a fun little game where a user can try to crack the code to the bot to get the access code to a VRchat world here is the code so far.

@client.command()
async def test(ctx):
  await ctx.send('```-------------\n|[1] [2] [3]|\n|[4] [5] [6]|\n|[7] [8] [9]|\n|    [0]    |\n-------------```')
  try:
    async def check(m):
      return ctx.author == m.author 
      Q = await client.wait_for('message', timeout=60.0, check=check)
      if Q.content.lower() == "6842":
        await ctx.send("Yay! you got it. The code for the VRchat secrect room is ****")
      else: 
        await ctx.send("Wrong try again\n```-------------\n|[1] [2] [3]|\n|[4] [5] [6]|\n|[7] [8] [9]|\n|    [0]    |\n-------------```")
  except:
    pass

it won't send the message nor will it take inputs.



Solution 1:[1]

Doing some research i figured out that i was doing some correct but i just needed to use my brain to figure it out aka youtube plus adding some stuff i knew from just working with python

@client.command()
async def test(ctx):
  await ctx.send('```-------------\n|[1] [2] [3]|\n|[4] [5] [6]|\n|[7] [8] [9]|\n|    [0]    |\n-------------```')
  while True:
    def check(m):
      return ctx.author == m.author and ctx.channel == m.channel
    message = await client.wait_for('message', check=check)
    if message.content.lower() == "7592":
      await ctx.send("Yay! you got it. The code for the VRchat secrect room is ```8451```")
      break
    else: 
      await ctx.send("Wrong try again\n```-------------\n|[1] [2] [3]|\n|[4] [5] [6]|\n|[7] [8] [9]|\n|    [0]    |\n-------------```")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CodingSap