Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -251,21 +251,23 @@ async def top_gradio(ctx, channel_id):
|
|
251 |
|
252 |
|
253 |
@bot.command()
|
254 |
-
async def top_gradio_threads(ctx,
|
255 |
if ctx.author.id == 811235357663297546:
|
256 |
message_counts = {}
|
257 |
|
258 |
-
|
259 |
-
print(
|
260 |
-
threads =
|
261 |
print(threads)
|
262 |
-
|
263 |
-
print(good_threads)
|
264 |
-
|
265 |
-
for thread in good_threads:
|
266 |
print(f"Thread Name: {thread.name}, Thread ID: {thread.id}, Parent ID: {thread.parent_id}")
|
267 |
async for message in thread.history(limit=None):
|
268 |
message_counts[message.author] = message_counts.get(message.author, 0) + 1
|
|
|
|
|
|
|
|
|
|
|
269 |
|
270 |
sorted_users = sorted(message_counts.items(), key=lambda x: x[1], reverse=True)
|
271 |
top_list = "\n".join([f"{member.name}: {count}" for member, count in sorted_users[:50]])
|
|
|
251 |
|
252 |
|
253 |
@bot.command()
|
254 |
+
async def top_gradio_threads(ctx, channel_id):
|
255 |
if ctx.author.id == 811235357663297546:
|
256 |
message_counts = {}
|
257 |
|
258 |
+
channel = await bot.get_channel(channel_id)
|
259 |
+
print(channel)
|
260 |
+
threads = channel.threads
|
261 |
print(threads)
|
262 |
+
for thread in threads:
|
|
|
|
|
|
|
263 |
print(f"Thread Name: {thread.name}, Thread ID: {thread.id}, Parent ID: {thread.parent_id}")
|
264 |
async for message in thread.history(limit=None):
|
265 |
message_counts[message.author] = message_counts.get(message.author, 0) + 1
|
266 |
+
|
267 |
+
async for thread in channel.archived_threads(limit=None):
|
268 |
+
print(f"ARCHIVED Thread Name: {thread.name}, ARCHIVED Thread ID: {thread.id}, Parent ID: {thread.parent_id}")
|
269 |
+
message_counts[message.author] = message_counts.get(message.author, 0) + 1
|
270 |
+
|
271 |
|
272 |
sorted_users = sorted(message_counts.items(), key=lambda x: x[1], reverse=True)
|
273 |
top_list = "\n".join([f"{member.name}: {count}" for member, count in sorted_users[:50]])
|