mirror of
https://github.com/BluemediaGER/discord-cleanup-bot.git
synced 2024-11-23 00:05:29 +01:00
Don't use filter syntax
This commit is contained in:
parent
a356cf8db4
commit
8d01e6ff5a
2
bot.py
2
bot.py
|
@ -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.')
|
||||||
|
|
Loading…
Reference in a new issue