Don't use filter syntax

This commit is contained in:
Oliver Traber 2023-06-25 01:31:43 +02:00
parent a356cf8db4
commit 8d01e6ff5a
Signed by: Bluemedia
GPG key ID: C0674B105057136C

2
bot.py
View file

@ -50,7 +50,7 @@ class BotClient(discord.Client):
before = now - timedelta(hours=persisted_channel.retention_hours) before = now - timedelta(hours=persisted_channel.retention_hours)
after = now - timedelta(days=14) after = now - timedelta(days=14)
messages = [message async for message in channel.history(before=before, after=after)] messages = [message async for message in channel.history(before=before, after=after)]
filtered_messages = filter(lambda message: message.pinned == False, messages) filtered_messages = [m for m in messages if m.pinned == False]
message_chunks = divide_chunks(filtered_messages, 100) message_chunks = divide_chunks(filtered_messages, 100)
for chunk in message_chunks: for chunk in message_chunks:
await channel.delete_messages(chunk, reason='Configured retention period expired.') await channel.delete_messages(chunk, reason='Configured retention period expired.')