Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Synced repo using 'sync_with_huggingface' Github Action
Browse files
app.py
CHANGED
|
@@ -140,15 +140,26 @@ def calculate_level(xp):
|
|
| 140 |
async def level(ctx):
|
| 141 |
if ctx.author.id == 811235357663297546:
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
-
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
"""
|
| 153 |
if author_id in xp_data:
|
| 154 |
xp = xp_data[author_id]
|
|
|
|
| 140 |
async def level(ctx):
|
| 141 |
if ctx.author.id == 811235357663297546:
|
| 142 |
|
| 143 |
+
try:
|
| 144 |
+
user_data = []
|
| 145 |
+
|
| 146 |
+
for author_id_str, xp_value in xp_data.items():
|
| 147 |
+
try:
|
| 148 |
+
current_level = calculate_level(xp_value)
|
| 149 |
+
author_id = int(author_id_str)
|
| 150 |
+
user = bot.get_user(author_id)
|
| 151 |
+
user_data.append((user, xp_value, current_level))
|
| 152 |
|
| 153 |
+
except Exception as e:
|
| 154 |
+
print(f"Error for user {author_id}: {e}")
|
| 155 |
+
|
| 156 |
+
sorted_user_data = sorted(user_data, key=lambda x: x[2], reverse=True)
|
| 157 |
+
|
| 158 |
+
for user, xp, level in sorted_user_data:
|
| 159 |
+
print(f"user: {user} | xp: {xp} | level: {level}")
|
| 160 |
+
|
| 161 |
+
except Exception as e:
|
| 162 |
+
print(f"Error: {e}")
|
| 163 |
"""
|
| 164 |
if author_id in xp_data:
|
| 165 |
xp = xp_data[author_id]
|