Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
add_exp Error: local variable 'removable_role' referenced before assignment
Browse files
app.py
CHANGED
@@ -387,17 +387,16 @@ async def add_exp(member_id):
|
|
387 |
|
388 |
# remove all level roles then add new role
|
389 |
current_level_roles = [role for level, role in lvls.items() if role in member.roles]
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
|
|
394 |
await member.add_roles(current_role)
|
395 |
print(f"Level Up! Gave {member} {current_role}")
|
396 |
-
if removable_role:
|
397 |
-
removable_role_name = removable_role.name
|
398 |
-
else:
|
399 |
-
removable_role_name = "🌱"
|
400 |
-
|
401 |
|
402 |
#print(f"{member} Level up! {old_level} -> {current_level}!")
|
403 |
if current_role in member.roles: # needs update; reference exp reward for verification
|
|
|
387 |
|
388 |
# remove all level roles then add new role
|
389 |
current_level_roles = [role for level, role in lvls.items() if role in member.roles]
|
390 |
+
if current_level_roles:
|
391 |
+
print(f"current_level_roles for {member}: {current_level_roles}")
|
392 |
+
for removable_role in current_level_roles:
|
393 |
+
await member.remove_roles(removable_role)
|
394 |
+
print(f"Removed {removable_role} from {member}")
|
395 |
+
removable_role_name = removable_role.name
|
396 |
+
else:
|
397 |
+
removable_role_name = "❌"
|
398 |
await member.add_roles(current_role)
|
399 |
print(f"Level Up! Gave {member} {current_role}")
|
|
|
|
|
|
|
|
|
|
|
400 |
|
401 |
#print(f"{member} Level up! {old_level} -> {current_level}!")
|
402 |
if current_role in member.roles: # needs update; reference exp reward for verification
|