Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
forum stuff
Browse files
app.py
CHANGED
@@ -200,14 +200,38 @@ async def count_threads(ctx, time: int):
|
|
200 |
thread_message_count = 0
|
201 |
|
202 |
for channel in ctx.guild.text_channels:
|
|
|
203 |
for thread in channel.threads:
|
|
|
204 |
print(thread.name)
|
205 |
async for message in thread.history(limit=None, after=start_date, before=end_date):
|
206 |
thread_message_count += 1
|
|
|
207 |
|
208 |
|
209 |
print(f'Total thread_messages between {start_date} and {end_date}: {thread_message_count}')
|
210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
|
212 |
""""""
|
213 |
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
|
|
|
200 |
thread_message_count = 0
|
201 |
|
202 |
for channel in ctx.guild.text_channels:
|
203 |
+
print(f"CHANNELNAME: {channel.name}")
|
204 |
for thread in channel.threads:
|
205 |
+
print(channel.name)
|
206 |
print(thread.name)
|
207 |
async for message in thread.history(limit=None, after=start_date, before=end_date):
|
208 |
thread_message_count += 1
|
209 |
+
for archived_thread in
|
210 |
|
211 |
|
212 |
print(f'Total thread_messages between {start_date} and {end_date}: {thread_message_count}')
|
213 |
|
214 |
+
|
215 |
+
@bot.command()
|
216 |
+
async def count_forum_threads(ctx, time: int):
|
217 |
+
if ctx.author.id == 811235357663297546:
|
218 |
+
end_date = datetime.datetime.utcnow() # Current date and time
|
219 |
+
start_date = end_date - datetime.timedelta(days=time)
|
220 |
+
forum_thread_message_count = 0
|
221 |
+
|
222 |
+
for forum in ctx.guild.forums:
|
223 |
+
print(f"FORUMNAME: {forum.name}")
|
224 |
+
for thread in forum.threads:
|
225 |
+
print(forum.name)
|
226 |
+
print(thread.name)
|
227 |
+
async for message in thread.history(limit=None, after=start_date, before=end_date):
|
228 |
+
print(f"THREAD NAME: {thread.name}")
|
229 |
+
forum_thread_message_count += 1
|
230 |
+
async for thread in forum.archived_threads(limit=None, after=start_date, before=end_date):
|
231 |
+
print(f"ARCHIVED THREAD NAME: {thread.name}")
|
232 |
+
forum_thread_message_count += 1
|
233 |
+
print(f'Total forum_thread_messages between {start_date} and {end_date}: {forum_thread_message_count}')
|
234 |
+
|
235 |
|
236 |
""""""
|
237 |
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
|