N
N
naivee2021-12-04 13:09:24
Python
naivee, 2021-12-04 13:09:24

Possible reason for the code not working?

@client.command(aliases = ['fbuy', 'fbuyrole'])
async def __funbuy(ctx, rol: discord.Role = None):
    if rol is None:
        await ctx.send(embed = discord.Embed(description = "Вы не указали роль, которую желаете приобрести", color = 0xB4FF1F))
    else:
        if rol in ctx.author.roles:
            await ctx.send(embed = discord.Embed(description = "У Вас уже имеется данная роль", color = 0xB4FF1F))
        elif cursor.execute("SELECT costing FROM funshop WHERE fun_id_role = {}".format(rol.id)).fetchone()[0] > cursor.execute("SELECT cash FROM users WHERE id = {}".format(ctx.author.id)).fetchone()[0]:
            await ctx.send(embed = discord.Embed(description = "У Вас недостаточно средств на балансе", color = 0xB4FF1F))
        else:
            await ctx.author.add_roles(rol)
            cursor.execute("UPDATE users SET cash = cash - {} WHERE id = {}".format(cursor.execute("SELECT costing FROM funshop WHERE fun_id_role = {}".format(rol.id)).fetchone()[0], ctx.author.id))
            await ctx.message.add_reaction("✅")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexbprofit, 2021-12-04
@alexbprofit

Tell you a joke about a student named DROP DATABASE? :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question