lunarflu HF staff commited on
Commit
367e21c
1 Parent(s): 7586254

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -58
app.py CHANGED
@@ -73,11 +73,7 @@ async def on_ready():
73
  print(f"csv successfully retrieved: \n {global_df}")
74
  #data.to_csv(csv_file, index=False)
75
 
76
- await remove_huggingfolks()
77
-
78
- @tasks.loop(seconds=5.0, count=5)
79
- async def slow_count():
80
- print(slow_count.current_loop)
81
  print(f"------------------------------------------------------------------------")
82
  except Exception as e:
83
  print(f"on_message Error: {e}")
@@ -324,7 +320,7 @@ async def on_reaction_add(reaction, user):
324
  print(f"on_reaction_add Error: {e}")
325
 
326
 
327
- # non-huggingfolks data
328
  async def remove_huggingfolks():
329
  try:
330
  # remove huggingfolks
@@ -361,58 +357,6 @@ async def remove_huggingfolks():
361
  print(f"remove_huggingfolks Error: {e}")
362
 
363
 
364
- @tasks.loop(minutes=1)
365
- async def update_leaderboard():
366
- try:
367
- # split into clear sections, discord bot only and gspread only
368
- if ctx.author.id == 811235357663297546:
369
-
370
- worksheet = gspread_bot.open("levelbot").sheet1
371
-
372
- # get from global_df
373
- # update second global df
374
- # use both in gradio and discord to present?
375
- names_list = worksheet.col_values(2)[1:]
376
- levels_list = worksheet.col_values(4)[1:]
377
- exp_list = worksheet.col_values(3)[1:]
378
-
379
-
380
- # for 3 lists
381
- combined_list = [list(sublist) for sublist in zip(names_list, levels_list, exp_list)]
382
- combined_list = [[name, int(level), int(exp)] for name, level, exp in combined_list]
383
- combined_list = sorted(combined_list, key=lambda x: x[1], reverse=True)
384
-
385
- print(combined_list)
386
- top_results = combined_list[:num_results]
387
- #print(top_results)
388
-
389
- """
390
- # get position, then find that value in updated_names_list
391
- levels_list = list(map(int, levels_list))
392
- data_pairs = list(zip(names_list, levels_list))
393
- sorted_data_pairs = sorted(data_pairs, key=lambda x: x[1], reverse=True)
394
- top_data_pairs = sorted_data_pairs[:num_results]
395
- """
396
-
397
-
398
- top_results = [r for r in top_results if r[0] not in members_with_role]
399
-
400
- for name, level, xp in top_results:
401
- print(f"Name: {name}, Level: {level}, Exp: {xp}")
402
-
403
-
404
- def xp_required_to_next_level(current_level, current_xp):
405
- level_floor_xp = calculate_xp(current_level)
406
- level_ceiling_xp = calculate_xp(current_level+1)
407
- xp_to_level_up = level_ceiling_xp - current_xp
408
- return (xp_to_level_up)
409
-
410
-
411
-
412
- except Exception as e:
413
- print(f"update_leaderboard Error: {e}")
414
-
415
-
416
  @bot.command(name='xp_help')
417
  async def xp_help(ctx):
418
  try:
 
73
  print(f"csv successfully retrieved: \n {global_df}")
74
  #data.to_csv(csv_file, index=False)
75
 
76
+ remove_huggingfolks.start()
 
 
 
 
77
  print(f"------------------------------------------------------------------------")
78
  except Exception as e:
79
  print(f"on_message Error: {e}")
 
320
  print(f"on_reaction_add Error: {e}")
321
 
322
 
323
+ @tasks.loop(minutes=1)
324
  async def remove_huggingfolks():
325
  try:
326
  # remove huggingfolks
 
357
  print(f"remove_huggingfolks Error: {e}")
358
 
359
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  @bot.command(name='xp_help')
361
  async def xp_help(ctx):
362
  try: