Answer the question
In order to leave comments, you need to log in
How can a bot display top 5 users from sqlite3?
I have a database with a user id, nickname and number that the bot works with. The bot displays the user's number like this
@dp.message_handler(commands=['number'])
async def number(message: types.Message):
user_id = message.from_user.id
first_name = message.from_user.first_name
username = message.from_user.username
conn = sqlite3.connect('db.db')
cur = conn.cursor()
result = cur.execute("SELECT * FROM users WHERE user_id = ?", (user_id, )).fetchone()
number = result[5]
await message.reply(f'Ваше число: {number}')
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