T
T
TanderOFF2021-03-04 18:03:50
Python
TanderOFF, 2021-03-04 18:03:50

Python SQL3 how to make pages?

Hello, there is a balance leaderboard, and I'm trying to make pagination (pages), but it turns out that there is a report from 1 person to 10, how to make a report from 11 to 21

Here is the code:

@client.command(aliases = ['leaderboard', 'lb', 'топ-10', 'таблица-лидеров', 'топ', 'lbcash','побалансу','topcash'])
async def __leaderboard(ctx):
  embed1 = discord.Embed(title = 'Топ 10 лидеров по балансу на\n [Æ]  ΛTMOSFΞRA', color=0xa697ff)
  counter = 0

  for row in cursor.execute("SELECT name, cash, rep FROM users WHERE server_id = {} ORDER BY cash DESC LIMIT {}".format(ctx.guild.id, 10)):
    counter += 1
    embed1.add_field(
      name = f'#{counter}:trophy: | {row[0]}',
      value = f'Баланс: {row[1]} <a:y_star:791077278309285908>\nЛайков: {row[2]} <a:713135182789607609:800469168687677462>',
      inline = False).set_thumbnail(url="https://thumbs.gfycat.com/EasygoingPinkDobermanpinscher-small.gif").set_image(url="https://media.discordapp.net/attachments/694437953727889469/810997289434873856/b2283e6d158413b61d8c690b54c65f27.gif")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-03-04
@TanderOFF

... ORDER BY cash DESC LIMIT 10 OFFSET 10
https://sqlite.org/lang_select.html#limitoffset

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question