Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ async def save_messages(ctx, channel_id: int):
|
|
46 |
|
47 |
|
48 |
@bot.command()
|
49 |
-
async def save_forum(ctx, channel_id: int
|
50 |
channel = bot.get_channel(channel_id)
|
51 |
if not channel:
|
52 |
await ctx.send("Channel not found.")
|
@@ -60,7 +60,7 @@ async def save_forum(ctx, channel_id: int, file_name: str):
|
|
60 |
threads[thread_id] = []
|
61 |
threads[thread_id].append(message)
|
62 |
|
63 |
-
with open(
|
64 |
for thread_id, messages in threads.items():
|
65 |
file.write(f"Thread ID: {thread_id}\n")
|
66 |
for message in messages:
|
@@ -69,7 +69,7 @@ async def save_forum(ctx, channel_id: int, file_name: str):
|
|
69 |
|
70 |
await ctx.send(f"Forum messages from {channel.name} saved to file")
|
71 |
|
72 |
-
with open(
|
73 |
discord_file = discord.File(file)
|
74 |
await ctx.send(file=discord_file)
|
75 |
|
|
|
46 |
|
47 |
|
48 |
@bot.command()
|
49 |
+
async def save_forum(ctx, channel_id: int):
|
50 |
channel = bot.get_channel(channel_id)
|
51 |
if not channel:
|
52 |
await ctx.send("Channel not found.")
|
|
|
60 |
threads[thread_id] = []
|
61 |
threads[thread_id].append(message)
|
62 |
|
63 |
+
with open("gradio-questions.json", 'w', encoding='utf-8') as file:
|
64 |
for thread_id, messages in threads.items():
|
65 |
file.write(f"Thread ID: {thread_id}\n")
|
66 |
for message in messages:
|
|
|
69 |
|
70 |
await ctx.send(f"Forum messages from {channel.name} saved to file")
|
71 |
|
72 |
+
with open("gradio-questions.json", 'rb') as file:
|
73 |
discord_file = discord.File(file)
|
74 |
await ctx.send(file=discord_file)
|
75 |
|