Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
testing hugging exclusion from shown rank, emoji, potential leaderboard rank in verify cap embed
Browse files
app.py
CHANGED
@@ -82,6 +82,7 @@ async def on_ready():
|
|
82 |
print(worksheet2_df.dtypes)
|
83 |
|
84 |
# updates both leaderboards
|
|
|
85 |
remove_huggingfolks.start()
|
86 |
#await periodic_api_test()
|
87 |
print(f"------------------------------------------------------------------------")
|
@@ -237,36 +238,46 @@ async def add_exp(member_id):
|
|
237 |
current_role = lvls[current_level]
|
238 |
if current_role not in member.roles: # if we leveled up
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
# temporary fix: remove ~100 exp when not verified, send embed on "levelup" prompting to verify
|
241 |
# if level 3 -> then send embed, remove some exp
|
242 |
if current_level >= 3: # could change to 4 maybe
|
243 |
if verified_role not in member.roles:
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
|
|
267 |
|
268 |
-
|
269 |
-
|
270 |
|
271 |
# increment the old level value (better to replace outright)
|
272 |
# only increment level column if you are lvl2 or 3+ with verified role
|
@@ -281,14 +292,7 @@ async def add_exp(member_id):
|
|
281 |
#await member.send(f"Level up! {current_level-1} -> {current_level}!")
|
282 |
#if member_id == 811235357663297546:
|
283 |
|
284 |
-
|
285 |
-
if not row.empty:
|
286 |
-
target_exp = row['discord_exp'].values[0]
|
287 |
-
rank = (global_df['discord_exp'] > target_exp).sum() + 1
|
288 |
-
print(f"The rank for discord_id {member_id} based on discord_exp is: {rank}")
|
289 |
-
else:
|
290 |
-
print(f"Discord ID {member_id} not found in the DataFrame.")
|
291 |
-
|
292 |
# send embed
|
293 |
embed = Embed(color=Color.blue())
|
294 |
embed.set_author(name=f"{member}", icon_url=member.avatar.url if member.avatar else bot.user.avatar.url)
|
@@ -308,8 +312,8 @@ async def add_exp(member_id):
|
|
308 |
verification_link = "https://discord.com/channels/879548962464493619/900125909984624713"
|
309 |
embed.add_field(name="Verify Here:", value=verification_link, inline=True)
|
310 |
|
311 |
-
|
312 |
-
await
|
313 |
print(f"Sent levelup embed to {member}")
|
314 |
#You can verify your account to earn 100 points! To verify, do A.
|
315 |
|
|
|
82 |
print(worksheet2_df.dtypes)
|
83 |
|
84 |
# updates both leaderboards
|
85 |
+
await remove_huggingfolks() # to initialize
|
86 |
remove_huggingfolks.start()
|
87 |
#await periodic_api_test()
|
88 |
print(f"------------------------------------------------------------------------")
|
|
|
238 |
current_role = lvls[current_level]
|
239 |
if current_role not in member.roles: # if we leveled up
|
240 |
|
241 |
+
# finding leaderboard rank
|
242 |
+
rank = "🤗" # for huggingfolks
|
243 |
+
row = community_global_df[community_global_df['discord_user_id'] == str(member_id)] # does this need to be string?
|
244 |
+
if not row.empty:
|
245 |
+
target_exp = row['discord_exp'].values[0]
|
246 |
+
rank = (community_global_df['discord_exp'] > target_exp).sum() + 1
|
247 |
+
print(f"The rank for discord_id {member_id} based on discord_exp is: {rank}")
|
248 |
+
else:
|
249 |
+
print(f"Discord ID {member_id} not found in the DataFrame.")
|
250 |
+
rank = "🤗"
|
251 |
+
|
252 |
# temporary fix: remove ~100 exp when not verified, send embed on "levelup" prompting to verify
|
253 |
# if level 3 -> then send embed, remove some exp
|
254 |
if current_level >= 3: # could change to 4 maybe
|
255 |
if verified_role not in member.roles:
|
256 |
+
if new_xp % 10 == 0: # staggers messages so we don't send one every time exp is earned
|
257 |
+
# claim exp (-30 for level 3, but +100 as bonus exp. This scales infinitely until the member verifies,
|
258 |
+
# so they can continue earning exp, it just won't translate to levels and the leaderboard.
|
259 |
+
# This way they can claim at any time and get a big boost in levels!
|
260 |
+
claim_exp = new_xp + 70
|
261 |
+
|
262 |
+
# send embed
|
263 |
+
embed = Embed(color=Color.red())
|
264 |
+
embed.set_author(name=f"{member}", icon_url=member.avatar.url if member.avatar else bot.user.avatar.url)
|
265 |
+
embed.title = f"⚠️Your account is not Verified! Unable to level up `{current_level-1}` -> `{current_level}` ❌"
|
266 |
+
msg = f'🤗 Hey {member}! You can continue leveling up in the Hugging Face Discord server by Verifying your account, and claim `{claim_exp}` bonus exp points, climbing to rank {rank} !'
|
267 |
+
embed.description = f"{msg}"
|
268 |
+
verification_link = "https://discord.com/channels/879548962464493619/900125909984624713"
|
269 |
+
embed.add_field(name="Verify Here:", value=verification_link, inline=True)
|
270 |
+
u_1 = f"👑 Earn exp for activity on Discord and HF and climb the leaderboard !"
|
271 |
+
u_2 = f"🌎 Feature your content in weekly news and increase its visibility!"
|
272 |
+
u_3 = f"🚀 Early access to Beta features!"
|
273 |
+
u_4 = f"🛡️ Secure your progress, and restore if needed!"
|
274 |
+
embed.add_field(name="You can Unlock:", value=f"{u_1}\n{u_2}\n{u_3}\n{u_4}", inline=True)
|
275 |
+
embed.set_image(url='https://cdn.discordapp.com/attachments/1150399343912833024/1205537451242688573/download_1.png?ex=65d8bb3e&is=65c6463e&hm=042fe7dd3521887db0bd48eeb846de1cc7c75194f9e95215c23512ff61ea3475&')
|
276 |
+
|
277 |
+
lunar = bot.get_user(811235357663297546)
|
278 |
+
await lunar.send(embed=embed)
|
279 |
+
return
|
280 |
|
|
|
|
|
281 |
|
282 |
# increment the old level value (better to replace outright)
|
283 |
# only increment level column if you are lvl2 or 3+ with verified role
|
|
|
292 |
#await member.send(f"Level up! {current_level-1} -> {current_level}!")
|
293 |
#if member_id == 811235357663297546:
|
294 |
|
295 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
# send embed
|
297 |
embed = Embed(color=Color.blue())
|
298 |
embed.set_author(name=f"{member}", icon_url=member.avatar.url if member.avatar else bot.user.avatar.url)
|
|
|
312 |
verification_link = "https://discord.com/channels/879548962464493619/900125909984624713"
|
313 |
embed.add_field(name="Verify Here:", value=verification_link, inline=True)
|
314 |
|
315 |
+
lunar = bot.get_user(811235357663297546)
|
316 |
+
await lunar.send(embed=embed)
|
317 |
print(f"Sent levelup embed to {member}")
|
318 |
#You can verify your account to earn 100 points! To verify, do A.
|
319 |
|