L
L
LirikDEV2022-03-14 13:37:27
Python
LirikDEV, 2022-03-14 13:37:27

Database not working for Discord bot Python?

I have a bot, it should give out the top by reputation, but it writes only the first one, then the for stops.
No errors are written.

@client.command()
async def top_rep(ctx):
    embed = discord.Embed(title = 'Топ сервера')
    numb = 0
    for row in cursor.execute("SELECT name, rep From users WHERE server_id = {} ORDER BY rep DESC LIMIT 5".format(ctx.guild.id)):
        numb += 1
        embed.add_field(name = f'# {numb} | {row[0]} ',value = f'Репутация: {row[1]}', inline = False)

    await ctx.reply(embed=embed)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alan Gibizov, 2022-03-14
@phaggi

Database not working for Discord bot Python?

Works.

Y
Yanis07, 2022-03-24
@Yanis07

embed = embed.add_field(name = f'# {numb} | {row[0]} ',value = f'Reputation: {row[1]}', inline = False)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question