Reputation: 15
I'm trying to make my first ever discord bot in python, it's an economy bot but it says that I cannot use the await function and I don't know why.
@bot.command()
async def withdraw(ctx,amount = None):
await open_account(ctx.author)
if amount == None:
await ctx.send("Please enter a valid amount")
return
bal = await update_bank(ctx.author)
amount = int(amount)
if amount>bal[1]:
await ctx.send("You don't have enough potatoes!")
return
if amount<0:
await ctx.send("Can only send positive potatoes! No negative!")
return
await update_bank(ctx.author,amount)
await update_bank(ctx.author,-1*amount, "bank")
await ctx.send(f"You withdrew {amount} potatoes!")
Upvotes: 0
Views: 316
Reputation: 329
ok, so i see 2 problems. The first one is that the @bot.command
has to be aligned with async def
and 2nd you have 6 await functions. Please specify which await function is giving you the error.
Upvotes: 1