Added a check for when purge tries to delte messages too far back
This commit is contained in:
parent
afb8b5b34f
commit
c294c29b3b
1 changed files with 5 additions and 1 deletions
|
@ -381,7 +381,11 @@ class Mod:
|
||||||
if not ctx.message.channel.permissions_for(ctx.message.server.me).manage_messages:
|
if not ctx.message.channel.permissions_for(ctx.message.server.me).manage_messages:
|
||||||
await self.bot.say("I do not have permission to delete messages...")
|
await self.bot.say("I do not have permission to delete messages...")
|
||||||
return
|
return
|
||||||
await self.bot.purge_from(ctx.message.channel, limit=limit)
|
try:
|
||||||
|
await self.bot.purge_from(ctx.message.channel, limit=limit)
|
||||||
|
except discord.HTTPException:
|
||||||
|
await self.bot.send_message(ctx.message.channel, "Detected messages that are too far back for me to delete;" \
|
||||||
|
" I can only bulk delete messages that are under 14 days old.")
|
||||||
|
|
||||||
@commands.command(pass_context=True, no_pm=True)
|
@commands.command(pass_context=True, no_pm=True)
|
||||||
@checks.custom_perms(manage_messages=True)
|
@checks.custom_perms(manage_messages=True)
|
||||||
|
|
Loading…
Reference in a new issue