lunarflu HF staff commited on
Commit
8010cdb
1 Parent(s): c16a8f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
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
- channel = bot.get_channel(channel_id)
28
- if not channel:
29
- await ctx.send("Channel not found.")
30
- return
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
- with open("gradio-questions.json", 'rb') as file:
43
- discord_file = discord.File(file)
44
- await ctx.send(file=discord_file)
 
 
 
 
 
 
 
 
 
 
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
  """"""