Не работает комманда в игровом боте на Discord py, sql
@client.event
async def on_ready():
cursor.execute("""CREATE TABLE IF NOT EXISTS users (
name TEXT,
id INT,
cash BIGINT,
rep INT,
lvl INT,
upgrade INT
)""")
for guild in client.guilds:
for member in guild.members:
if cursor.execute(F"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cursor.execute(f"INSERT INTO users VALUES ('{member}', {member.id}, 0, 0, 1 , 10)")
connection.commit()
else:
pass
connection.commit()
print('Бот присоеденился')
@client.command()
async def click(ctx,member: discord.Member = None ):
global upgrade
cursor.execute("UPDATE users SET cash = cash + {} WHERE id = {}".format(upgrade, ctx.author.id))
connection.commit()
await ctx.send('+ ' + upgrade + ' cash')
Моя коммандв click не работает. Ошибка :
Traceback (most recent call last):
File "C:\UsersНикитос\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(args, **kwargs)
File "C:\UsersНикитос\Desktop\discordbot.py", line 63, in click
cursor.execute("UPDATE users SET cash = cash + {} WHERE id = {}".format(upgrade, ctx.author.id))
NameError: name 'upgrade' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\UsersНикитос\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "C:\UsersНикитос\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 864, in invoke
await injected(ctx.args, **ctx.kwargs)
File "C:\UsersНикитос\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'upgrade' is not defined```