lunarflu HF staff commited on
Commit
9c84949
β€’
1 Parent(s): c7f0e59

fixing some role + total exp for new records

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -394,6 +394,10 @@ async def add_exp(member_id):
394
  print(f"Removed {removable_role} from {member}")
395
  await member.add_roles(current_role)
396
  print(f"Level Up! Gave {member} {current_role}")
 
 
 
 
397
 
398
 
399
  #print(f"{member} Level up! {old_level} -> {current_level}!")
@@ -405,7 +409,7 @@ async def add_exp(member_id):
405
  # send embed
406
  embed = Embed(color=Color.blue())
407
  embed.set_author(name=f"{member}", icon_url=member.avatar.url if member.avatar else bot.user.avatar.url)
408
- embed.title = f"Level Up! `{removable_role.name}` -> `{current_level}`"
409
  msg = f'πŸ€— Congrats {member}! You just leveled up in the Hugging Face Discord server'
410
  embed.description = f"{msg}."
411
  embed.add_field(name="Leaderboard Ranking:", value=f"πŸ‘‘ **{rank}**\n\nhttps://discord.com/channels/879548962464493619/1197143964994773023", inline=True)
@@ -442,7 +446,10 @@ async def add_exp(member_id):
442
  if not member_id.startswith("L") and not member_id.endswith("L"):
443
  member_id = f"L" + str(member_id) + f"L"
444
  member_name = str(member.name)
445
- row_data = [member_id, member_name, xp, current_level]
 
 
 
446
  global_df.loc[len(global_df.index)] = row_data
447
  print(f"------------------------------------------------------------------------")
448
  except Exception as e:
 
394
  print(f"Removed {removable_role} from {member}")
395
  await member.add_roles(current_role)
396
  print(f"Level Up! Gave {member} {current_role}")
397
+ if removable_role:
398
+ removable_role_name = removable_role.name
399
+ else:
400
+ removable_role_name = "🌱"
401
 
402
 
403
  #print(f"{member} Level up! {old_level} -> {current_level}!")
 
409
  # send embed
410
  embed = Embed(color=Color.blue())
411
  embed.set_author(name=f"{member}", icon_url=member.avatar.url if member.avatar else bot.user.avatar.url)
412
+ embed.title = f"Level Up! `{removable_role_name}` -> `{current_level}`"
413
  msg = f'πŸ€— Congrats {member}! You just leveled up in the Hugging Face Discord server'
414
  embed.description = f"{msg}."
415
  embed.add_field(name="Leaderboard Ranking:", value=f"πŸ‘‘ **{rank}**\n\nhttps://discord.com/channels/879548962464493619/1197143964994773023", inline=True)
 
446
  if not member_id.startswith("L") and not member_id.endswith("L"):
447
  member_id = f"L" + str(member_id) + f"L"
448
  member_name = str(member.name)
449
+ hub_user_name = ""
450
+ hub_exp = ""
451
+ total_exp = xp
452
+ row_data = [member_id, member_name, xp, current_level, hub_user_name, hub_exp, total_exp]
453
  global_df.loc[len(global_df.index)] = row_data
454
  print(f"------------------------------------------------------------------------")
455
  except Exception as e: