Fix [p]cleanup self not working in DMs for non-owners (#4481)

* Fix cleanup self not working in private.

This fix #4408.

* Apply Jack's logic.

* Obviously Black fault.
AGAIN!

* Apply Jack's trick.

* This is not a converter so let's move this to a different file

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Predeactor
2020-10-18 02:07:08 +02:00
committed by GitHub
parent 152ca39719
commit 4453b5653a
2 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
from redbot.core.commands import Context, permissions_check
from redbot.core.utils.mod import is_mod_or_superior, check_permissions
def check_self_permissions():
async def predicate(ctx: Context):
if not ctx.guild:
return True
if await check_permissions(ctx, {"manage_messages": True}) or await is_mod_or_superior(
ctx.bot, ctx.author
):
return True
return False
return permissions_check(predicate)