[V3 Cleanup] Fix cleaning up too many messages (#1864)

Resolves #1863
This commit is contained in:
Michael H 2018-06-25 07:45:43 -04:00 committed by Toby Harradine
parent b557b437a3
commit a175bdc1c7

View File

@ -71,11 +71,11 @@ class Cleanup:
to_delete = []
too_old = False
while not too_old and len(to_delete) - 1 < number:
while not too_old and len(to_delete) < number:
message = None
async for message in channel.history(limit=limit, before=before, after=after):
if (
(not number or len(to_delete) - 1 < number)
(not number or len(to_delete) < number)
and check(message)
and (ctx.message.created_at - message.created_at).days < 14
and (delete_pinned or not message.pinned)