Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,29 +57,35 @@ def calculate_xp(level):
|
|
| 57 |
# check discord_user_id is verified
|
| 58 |
# do add_exp for hub?
|
| 59 |
@bot.command(name='add_exp_hub')
|
| 60 |
-
async def add_exp_hub(ctx
|
| 61 |
try:
|
| 62 |
-
|
| 63 |
-
if
|
| 64 |
-
#
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
except Exception as e:
|
| 85 |
print(f"add_exp_hub Error: {e}")
|
|
|
|
| 57 |
# check discord_user_id is verified
|
| 58 |
# do add_exp for hub?
|
| 59 |
@bot.command(name='add_exp_hub')
|
| 60 |
+
async def add_exp_hub(ctx):
|
| 61 |
try:
|
| 62 |
+
role = discord.utils.get(guild.roles, id=900063512829755413)
|
| 63 |
+
if role:
|
| 64 |
+
# Get members with the specified role
|
| 65 |
+
members_with_role = [member.id for member in guild.members if role in member.roles]
|
| 66 |
+
for member_id in members_with_role:
|
| 67 |
+
|
| 68 |
+
cell = worksheet2.find(str(member_id))
|
| 69 |
+
if cell.col == 5:
|
| 70 |
+
# find hub_user_name
|
| 71 |
+
hf_user_name = worksheet2.cell(cell.row, cell.col-2).value
|
| 72 |
+
if hf_user_name:
|
| 73 |
+
# check likes
|
| 74 |
+
likes = list_liked_repos(f"{hf_user_name}")
|
| 75 |
+
hf_likes_new = likes.total
|
| 76 |
+
hf_likes_old = worksheet2.cell(cell.row, cell.col+2).value
|
| 77 |
+
if hf_likes_old:
|
| 78 |
+
hf_likes_old = int(hf_likes_old)
|
| 79 |
+
difference = hf_likes_new - hf_likes_old
|
| 80 |
+
if difference > 0:
|
| 81 |
+
worksheet2.update(f'G{cell.row}', f'{hf_likes_new}')
|
| 82 |
+
"""
|
| 83 |
+
for i in range(difference):
|
| 84 |
+
await add_exp(discord_user_id)
|
| 85 |
+
"""
|
| 86 |
+
|
| 87 |
+
else:
|
| 88 |
+
worksheet2.update(f'G{cell.row}', f'{hf_likes_new}')
|
| 89 |
|
| 90 |
except Exception as e:
|
| 91 |
print(f"add_exp_hub Error: {e}")
|