Answer the question
In order to leave comments, you need to log in
How to speed up performance?
Good evening. There is a function that reads data from the database for the top and displays (VK bot).
def vkGetFirstName(id):
return vkapi.users.get(user_id=id)[0]['first_name']
def vkGetLastName(id):
return vkapi.users.get(user_id=id)[0]['last_name']
def e_top(chatId):
table.execute("""SELECT user_id, drop_count FROM vkbottable WHERE chat_id = '{}' ORDER BY drop_count DESC""".format(chatId))
text = "Топ еб**ноидов:\n"
for i, row in enumerate(table):
text += "{}. {} {} - {} раз\n".format(i+1, vkGetFirstName(int(row[0])), vkGetLastName(int(row[0])), row[1])
return text
print(e_top(2000000004))
Answer the question
In order to leave comments, you need to log in
text += "{}. {} {} - {} раз\n".format(i+1, vkGetFirstName(int(row[0])), vkGetLastName(int(row[0])), row[1])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question