From f287c5a690a78a886b29363634b0cdc2499dafb4 Mon Sep 17 00:00:00 2001 From: Sebastiaan Zeeff <33516116+SebastiaanZ@users.noreply.github.com> Date: Fri, 13 Sep 2019 21:37:16 +0200 Subject: Fix one-off error in the !clean command https://github.com/python-discord/bot/issues/413 The message indexing phase of the `!clean` did not account for the presence of the invocation message, resulting in a one-off error in the amount of messages being indexed. Fixed it by adding one to the amount of messages we index from the message history. Closes #413 --- bot/cogs/clean.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/cogs/clean.py b/bot/cogs/clean.py index e7b6bac85..1f3e1caa9 100644 --- a/bot/cogs/clean.py +++ b/bot/cogs/clean.py @@ -133,7 +133,8 @@ class Clean: self.cleaning = True invocation_deleted = False - async for message in ctx.channel.history(limit=amount): + # To account for the invocation message, we index `amount + 1` messages. + async for message in ctx.channel.history(limit=amount + 1): # If at any point the cancel command is invoked, we should stop. if not self.cleaning: -- cgit v1.2.3