Не выдаёт значения после выполнения комманды. discord.py+sqlite

При выполнение комманды в @bot.commands не работает cursor.execute. Ничего не выдаёт при print

@bot.command() 
async def ans(ctx, useranswer):
    if useranswer == answer:
        status = 0
        await ctx.send("Correct! +100points")
        author_id = str(message.author.id)
        cursor.execute(f"select points from profiles where userid = {author_id}")
        amount = cursor.fetchall()
        print(amount) #ничего не выдаёт скорее всего не работает cursor.execute с @bot.commands. C if message.content == он работает и выдаёт значения.
        if amount == author_id:
            pass
        with open('amount2.txt', 'w') as f:
            f.write(str(amount))
        with open('amount2.txt') as f:
            amount2txt = f.read()
        amount2 = amount2txt.strip("[(',)]")
        amount3 = amount2 + 15
        cursor.execute(f"UPDATE profiles SET points = {amount3} where userid = {author_id}")
        db.commit()
    else:
        await ctx.send("Incorrect! -100points!")  

Ответы (1 шт):

Автор решения: RAINGM

message -> ctx

@bot.command() 
async def ans(ctx, useranswer):
    if useranswer == answer:
        status = 0
        await ctx.send("Correct! +100points")
        author_id = str(ctx.author.id)
        cursor.execute(f"select points from profiles where userid = {author_id}")
        amount = cursor.fetchall()
        print(amount) #ничего не выдаёт скорее всего не работает cursor.execute с @bot.commands. C if message.content == он работает и выдаёт значения.
        if amount == author_id:
            pass
        with open('amount2.txt', 'w') as f:
            f.write(str(amount))
        with open('amount2.txt') as f:
            amount2txt = f.read()
        amount2 = amount2txt.strip("[(',)]")
        amount3 = amount2 + 15
        cursor.execute(f"UPDATE profiles SET points = {amount3} where userid = {author_id}")
        db.commit()
    else:
        await ctx.send("Incorrect! -100points!")  
→ Ссылка