Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
async def count_threads(ctx, time: int):
Browse files
app.py
CHANGED
@@ -191,7 +191,22 @@ async def count_messages(ctx, time: int):
|
|
191 |
print(f'Total messages between {start_date} and {end_date}: {message_count}')
|
192 |
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
|
|
|
|
195 |
|
196 |
|
197 |
""""""
|
|
|
191 |
print(f'Total messages between {start_date} and {end_date}: {message_count}')
|
192 |
|
193 |
|
194 |
+
@bot.command()
|
195 |
+
async def count_threads(ctx, time: int):
|
196 |
+
if ctx.author.id == 811235357663297546:
|
197 |
+
|
198 |
+
end_date = datetime.datetime.utcnow() # Current date and time
|
199 |
+
start_date = end_date - datetime.timedelta(days=time)
|
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):
|
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 |
""""""
|