Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -51,21 +51,18 @@ async def save_forum(ctx, channel_id: int):
|
|
51 |
threads = channel.threads
|
52 |
|
53 |
|
54 |
-
|
55 |
-
|
|
|
56 |
for thread in threads:
|
57 |
-
async for message in thread.history(limit=None):
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
"timestamp": message.created_at.isoformat()
|
62 |
-
}
|
63 |
-
messages_data.append(message_data)
|
64 |
|
65 |
-
|
66 |
-
print(messages_data)
|
67 |
with open("gradio-questions.json", 'w', encoding='utf-8') as file:
|
68 |
-
|
|
|
69 |
|
70 |
await ctx.send(f"Messages from {channel.name} saved to gradio-questions.json")
|
71 |
|
|
|
51 |
threads = channel.threads
|
52 |
|
53 |
|
54 |
+
|
55 |
+
|
56 |
+
messages = []
|
57 |
for thread in threads:
|
58 |
+
async for message in thread.history(limit=None):
|
59 |
+
messages.append(message)
|
60 |
+
|
61 |
+
print(messages) # debug
|
|
|
|
|
|
|
62 |
|
|
|
|
|
63 |
with open("gradio-questions.json", 'w', encoding='utf-8') as file:
|
64 |
+
for message in messages:
|
65 |
+
file.write(f"{message.content}\n")
|
66 |
|
67 |
await ctx.send(f"Messages from {channel.name} saved to gradio-questions.json")
|
68 |
|