Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -91,6 +91,18 @@ async def count_messages(ctx, channel_name: str):
|
|
91 |
@bot.command()
|
92 |
async def count(ctx):
|
93 |
"""Count messages per user in a specific channel."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
channel = ctx.channel
|
95 |
|
96 |
if not channel:
|
@@ -104,7 +116,11 @@ async def count(ctx):
|
|
104 |
|
105 |
sorted_users = sorted(message_counts.items(), key=lambda x: x[1], reverse=True)
|
106 |
top_list = "\n".join([f"{member.name}: {count}" for member, count in sorted_users])
|
107 |
-
await ctx.send(f"Message count per user:\n{top_list}")
|
|
|
|
|
|
|
|
|
108 |
|
109 |
|
110 |
|
|
|
91 |
@bot.command()
|
92 |
async def count(ctx):
|
93 |
"""Count messages per user in a specific channel."""
|
94 |
+
message_counts = {}
|
95 |
+
|
96 |
+
for channel in ctx.guild.text_channels:
|
97 |
+
async for message in channel.history(limit=None):
|
98 |
+
message_counts[message.author] = message_counts.get(message.author, 0) + 1
|
99 |
+
|
100 |
+
sorted_users = sorted(message_counts.items(), key=lambda x: x[1], reverse=True)
|
101 |
+
top_list = "\n".join([f"{member.name}: {count}" for member, count in sorted_users])
|
102 |
+
await ctx.send(f"Message count per user in all text channels:\n{top_list}")
|
103 |
+
|
104 |
+
|
105 |
+
"""
|
106 |
channel = ctx.channel
|
107 |
|
108 |
if not channel:
|
|
|
116 |
|
117 |
sorted_users = sorted(message_counts.items(), key=lambda x: x[1], reverse=True)
|
118 |
top_list = "\n".join([f"{member.name}: {count}" for member, count in sorted_users])
|
119 |
+
await ctx.send(f"Message count per user:\n{top_list}")
|
120 |
+
|
121 |
+
|
122 |
+
"""
|
123 |
+
|
124 |
|
125 |
|
126 |
|