aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-09-13 21:37:16 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2019-09-13 21:37:16 +0200
commitf287c5a690a78a886b29363634b0cdc2499dafb4 (patch)
tree055dd2d0c7c80ee2d436089e611fafd3ed16181f
parentFix bugs and inconsistencies in moderation cog (diff)
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
-rw-r--r--bot/cogs/clean.py3
1 files changed, 2 insertions, 1 deletions
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: