lunarflu HF staff commited on
Commit
c53ef67
1 Parent(s): a75ac21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -35
app.py CHANGED
@@ -215,11 +215,29 @@ async def add_exp(member_id):
215
  await member.remove_roles(lvls[current_level-1])
216
  print(f"Removed {lvls[current_level-1]} from {member}")
217
  #print(f"{member} Level up! {current_level-1} -> {current_level}!")
218
- #if current_role in member.roles: # needs update; reference exp reward for verification
219
  #await member.send(f"Level up! {current_level-1} -> {current_level}!")
220
-
221
-
222
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
 
224
 
225
  #Review the leaderboard at <link>
@@ -284,37 +302,7 @@ async def on_reaction_add(reaction, user):
284
 
285
 
286
 
287
-
288
- @bot.command()
289
- async def send_embed_test(ctx, member_id):
290
- try:
291
- # spot on leaderboard
292
- guild = bot.get_guild(879548962464493619)
293
- member = guild.get_member(member_id)
294
- row = global_df[global_df['discord_id'] == member_id]
295
- if not row.empty:
296
- target_exp = row['discord_exp'].values[0]
297
- rank = (global_df['discord_exp'] > target_exp).sum() + 1
298
- print(f"The rank for discord_id {member_id} based on discord_exp is: {rank}")
299
- else:
300
- print(f"Discord ID {member_id} not found in the DataFrame.")
301
-
302
- # send embed
303
- msg = 'Congrats! You just leveled up in the Hugging Face Discord server from'
304
- msg2 = "Continue leveling up by:"
305
- msg3 = "Being active on the Hugging Face Hub (you can verify here to link your Hub + Discord accounts!)"
306
- verification_link = "https://discord.com/channels/879548962464493619/900125909984624713"
307
- embed = Embed(color=Color.blue())
308
- embed.set_author(name=f"{member}", icon_url=member.avatar.url if member.avatar else bot.user.avatar.url)
309
- embed.title = "Level Up!"
310
- embed.description = f"{msg} {current_level-1} -> {current_level}. \n Your leaderboard ranking is {rank} {msg2} \n - Posting \n - Reacting \n - {msg3} {verification_link}"
311
-
312
-
313
- lunar = guild.get_member(811235357663297546)
314
- await lunar.send(embed=embed)
315
-
316
- except Exception as e:
317
- print(f"on_message Error: {e}")
318
 
319
 
320
  @bot.command(name='update_leaderboard')
 
215
  await member.remove_roles(lvls[current_level-1])
216
  print(f"Removed {lvls[current_level-1]} from {member}")
217
  #print(f"{member} Level up! {current_level-1} -> {current_level}!")
218
+ if current_role in member.roles: # needs update; reference exp reward for verification
219
  #await member.send(f"Level up! {current_level-1} -> {current_level}!")
220
+ if member_id == 811235357663297546:
221
+ row = global_df[global_df['discord_user_id'] == member_id]
222
+ if not row.empty:
223
+ target_exp = row['discord_exp'].values[0]
224
+ rank = (global_df['discord_exp'] > target_exp).sum() + 1
225
+ print(f"The rank for discord_id {member_id} based on discord_exp is: {rank}")
226
+ else:
227
+ print(f"Discord ID {member_id} not found in the DataFrame.")
228
+
229
+ # send embed
230
+ msg = 'Congrats! You just leveled up in the Hugging Face Discord server from'
231
+ msg2 = "Continue leveling up by:"
232
+ msg3 = "Being active on the Hugging Face Hub (you can verify here to link your Hub + Discord accounts!)"
233
+ verification_link = "https://discord.com/channels/879548962464493619/900125909984624713"
234
+ embed = Embed(color=Color.blue())
235
+ embed.set_author(name=f"{member}", icon_url=member.avatar.url if member.avatar else bot.user.avatar.url)
236
+ embed.title = "Level Up!"
237
+ embed.description = f"{msg} {current_level-1} -> {current_level}. \n Your leaderboard ranking is {rank} {msg2} \n - Posting \n - Reacting \n - {msg3} {verification_link}"
238
+
239
+ lunar = guild.get_member(811235357663297546)
240
+ await lunar.send(embed=embed)
241
 
242
 
243
  #Review the leaderboard at <link>
 
302
 
303
 
304
 
305
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
 
307
 
308
  @bot.command(name='update_leaderboard')