lunarflu HF staff commited on
Commit
7c420c6
·
1 Parent(s): 029c36b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -21
app.py CHANGED
@@ -47,28 +47,25 @@ async def save_messages(ctx, channel_id: int):
47
 
48
  @bot.command()
49
  async def save_forum(ctx, channel_id: int):
50
- channel = bot.get_channel(channel_id)
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
 
69
- with open("gradio-questions.json", 'rb') as file:
70
- discord_file = discord.File(file)
71
- await ctx.send(file=discord_file)
 
 
 
 
 
 
 
 
72
 
73
 
74
 
 
47
 
48
  @bot.command()
49
  async def save_forum(ctx, channel_id: int):
50
+ if ctx.author.id == 811235357663297546:
51
+ channel = bot.get_channel(channel_id)
52
+ threads = channel.threads
53
+ messages = []
54
+ for thread in threads:
55
+ async for message in thread.history(limit=None):
56
+ messages.append(message)
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ print(messages) # debug
59
+
60
+ with open("gradio-questions.json", 'w', encoding='utf-8') as file:
61
+ for message in messages:
62
+ file.write(f"{message.content}\n")
63
+
64
+ await ctx.send(f"Messages from {channel.name} saved to gradio-questions.json")
65
+
66
+ with open("gradio-questions.json", 'rb') as file:
67
+ discord_file = discord.File(file)
68
+ await ctx.send(file=discord_file)
69
 
70
 
71