Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
slicing top_list by 50
Browse files
app.py
CHANGED
@@ -68,7 +68,7 @@ async def level(ctx):
|
|
68 |
await ctx.send(f'You are at level {level} with {xp} XP.')
|
69 |
else:
|
70 |
await ctx.send('You have not earned any XP yet.')
|
71 |
-
|
72 |
|
73 |
@bot.command()
|
74 |
async def count(ctx):
|
@@ -82,11 +82,13 @@ async def count(ctx):
|
|
82 |
message_counts[message.author] = message_counts.get(message.author, 0) + 1
|
83 |
except discord.Forbidden:
|
84 |
# Handle the Forbidden error
|
85 |
-
await ctx.send(f"Missing access to read messages in {channel.name}")
|
|
|
86 |
|
87 |
sorted_users = sorted(message_counts.items(), key=lambda x: x[1], reverse=True)
|
88 |
-
top_list = "\n".join([f"{member.name}: {count}" for member, count in sorted_users])
|
89 |
-
await ctx.send(f"Message count per user in all text channels:\n{top_list}")
|
|
|
90 |
|
91 |
|
92 |
""""""
|
|
|
68 |
await ctx.send(f'You are at level {level} with {xp} XP.')
|
69 |
else:
|
70 |
await ctx.send('You have not earned any XP yet.')
|
71 |
+
# show top users by level / exp
|
72 |
|
73 |
@bot.command()
|
74 |
async def count(ctx):
|
|
|
82 |
message_counts[message.author] = message_counts.get(message.author, 0) + 1
|
83 |
except discord.Forbidden:
|
84 |
# Handle the Forbidden error
|
85 |
+
#await ctx.send(f"Missing access to read messages in {channel.name}")
|
86 |
+
print(f"Missing access to read messages in {channel.name}")
|
87 |
|
88 |
sorted_users = sorted(message_counts.items(), key=lambda x: x[1], reverse=True)
|
89 |
+
top_list = "\n".join([f"{member.name}: {count}" for member, count in sorted_users[:50]])
|
90 |
+
#await ctx.send(f"Message count per user in all text channels:\n{top_list}")
|
91 |
+
print(f"Message count per user in all text channels:\n{top_list}")
|
92 |
|
93 |
|
94 |
""""""
|