mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
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:
15
redbot/cogs/cleanup/checks.py
Normal file
15
redbot/cogs/cleanup/checks.py
Normal 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)
|
||||
Reference in New Issue
Block a user