Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,24 +24,25 @@ async def on_ready():
|
|
| 24 |
|
| 25 |
@bot.command()
|
| 26 |
async def save_messages(ctx, channel_id: int):
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
messages = []
|
| 33 |
-
async for message in channel.history(limit=None):
|
| 34 |
-
messages.append(message)
|
| 35 |
-
|
| 36 |
-
with open("gradio-questions.json", 'w', encoding='utf-8') as file:
|
| 37 |
-
for message in messages:
|
| 38 |
-
file.write(f"{message.content}\n")
|
| 39 |
-
|
| 40 |
-
await ctx.send(f"Messages from {channel.name} saved to gradio-questions.json")
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
""""""
|
|
|
|
| 24 |
|
| 25 |
@bot.command()
|
| 26 |
async def save_messages(ctx, channel_id: int):
|
| 27 |
+
if ctx.author.id == 811235357663297546:
|
| 28 |
+
channel = bot.get_channel(channel_id)
|
| 29 |
+
if not channel:
|
| 30 |
+
await ctx.send("Channel not found.")
|
| 31 |
+
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
messages = []
|
| 34 |
+
async for message in channel.history(limit=None):
|
| 35 |
+
messages.append(message)
|
| 36 |
+
|
| 37 |
+
with open("gradio-questions.json", 'w', encoding='utf-8') as file:
|
| 38 |
+
for message in messages:
|
| 39 |
+
file.write(f"{message.content}\n")
|
| 40 |
+
|
| 41 |
+
await ctx.send(f"Messages from {channel.name} saved to gradio-questions.json")
|
| 42 |
+
|
| 43 |
+
with open("gradio-questions.json", 'rb') as file:
|
| 44 |
+
discord_file = discord.File(file)
|
| 45 |
+
await ctx.send(file=discord_file)
|
| 46 |
|
| 47 |
|
| 48 |
""""""
|