How to get user input in discord.py

  discord.py, python
@client.command()
async def blackjack(ctx):
  y= random.choice(deck)
  x=random.choice(deck)
  z=random.choice(deck)
  a=random.choice(deck)
  await ctx.send(f'{x, y}')
  await ctx.send(f'{a, z}')
  m = await client.wait_for("message", check=None)
  
  if m == "Stand":
    B = x+y
    S = a+z
    if S < B:
      while S < B or S < 21: 
       await ctx.send(S= a+z+random.choice(deck))
      if S > 21:
        ctx.send("You win")
      else:
        ctx.send("You Lose")
    else:
      ctx.send("You Lose")

This is a snippet of my code where I’m trying to get user input on whether he wants to stand or draw another card. I have not yet implemented a draw feature as the stand feature does not seem to work. My deck is properly defined as numbers and.

I think the problem is in the user input as I’m not very familiar with input in discord.py

if the program would work it would wait for the user’s response if they want to stand and draw cards until it has over 21 or has more than the player and print out whether the player has lost or won.

Any help would be appreciated

Source: Python Questions

LEAVE A COMMENT