Spaces:
Running on CPU Upgrade

lunarflu HF staff commited on
Commit
9dc4da6
·
verified ·
1 Parent(s): acd0e33
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -233,12 +233,10 @@ async def update_leaderboard(ctx):
233
  levels_list = worksheet.col_values(4)[1:]
234
  names_list = worksheet.col_values(2)[1:]
235
 
236
-
237
  channel = bot.get_channel(1197143964994773023)
238
  message = await channel.fetch_message(1197148293164187678)
239
 
240
-
241
-
242
  levels_list = list(map(int, levels_list))
243
  data_pairs = list(zip(names_list, levels_list))
244
  sorted_data_pairs = sorted(data_pairs, key=lambda x: x[1], reverse=True)
@@ -247,13 +245,9 @@ async def update_leaderboard(ctx):
247
  for name, level in top_10_data_pairs:
248
  print(f"Name: {name}, Level: {level}")
249
 
250
- # get position, then find that value in names_list
251
-
252
  # put into message / leaderboard
253
-
254
- new_leaderboard_data = [("User 1", 120), ("User 2", 90), ("User 3", 70)]
255
- new_table = tabulate(new_leaderboard_data, headers=["User", "Score"], tablefmt="plain")
256
-
257
  await message.edit(content=f"Updated Leaderboard:\n```\n{new_table}\n```")
258
 
259
 
 
233
  levels_list = worksheet.col_values(4)[1:]
234
  names_list = worksheet.col_values(2)[1:]
235
 
 
236
  channel = bot.get_channel(1197143964994773023)
237
  message = await channel.fetch_message(1197148293164187678)
238
 
239
+ # get position, then find that value in names_list
 
240
  levels_list = list(map(int, levels_list))
241
  data_pairs = list(zip(names_list, levels_list))
242
  sorted_data_pairs = sorted(data_pairs, key=lambda x: x[1], reverse=True)
 
245
  for name, level in top_10_data_pairs:
246
  print(f"Name: {name}, Level: {level}")
247
 
 
 
248
  # put into message / leaderboard
249
+ new_leaderboard_data = [(f"Name: {name}", f"Level: {level}") for name, level in top_10_data_pairs]
250
+ new_table = tabulate(new_leaderboard_data, headers=["Name", "Level"], tablefmt="plain")
 
 
251
  await message.edit(content=f"Updated Leaderboard:\n```\n{new_table}\n```")
252
 
253