Answer the question
In order to leave comments, you need to log in
Where is the mistake. Why is that?
The .lb command is the leader of the board, it shows the one who has the most money, that is, he is in first place, but for some reason it only shows the bot with a balance of 0. Why?
@client.command(aliases= ['leaderboard', 'lb'])
async def __leaderboard(ctx):
embed = discord.Embed(title= 'Топ 10 сервера')
counter = 0
for row in cursor.execute("SELECT name, cash FROM users WHERE server_id = {} ORDER BY cash DESC LIMIT 10".format(ctx.guild.id)):
counter += 1
embed.add_field(
name = f'# {counter} | {row[0]}',
value = f'Баланс: {row[1]}',
inline = False
)
connection.commit()
await ctx.send(embed= embed)
ТАБЛИЦА:
@client.event
async def on_ready():
cursor.execute("""CREATE TABLE IF NOT EXISTS users (
name TEXT,
id INT,
cash BIGINT,
rep INT,
lvl INT,
server_id INT
)""")
connection.commit()
cursor.execute("""CREATE TABLE IF NOT EXISTS shop(
role_id INT,
id INT,
cost BIGINT
)""")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question