Predeactor 4453b5653a
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>
2020-10-18 02:07:08 +02:00

16 lines
478 B
Python

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)