From d6b91cf7eb1e6b7508b545a0e83fedd1eaccc338 Mon Sep 17 00:00:00 2001 From: Mateusz <61660055+yoggys@users.noreply.github.com> Date: Thu, 25 Aug 2022 17:39:41 +0200 Subject: [PATCH] commands.has_permissions() return True in DM channels (fix #1576) (#1577) Co-authored-by: Lala Sabathil Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com> --- discord/ext/commands/core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index e3c2b5adfd..053aae3d38 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -2116,8 +2116,9 @@ async def test(ctx): raise TypeError(f"Invalid permission(s): {', '.join(invalid)}") def predicate(ctx: Context) -> bool: - ch = ctx.channel - permissions = ch.permissions_for(ctx.author) # type: ignore + if ctx.channel.type == ChannelType.private: + return True + permissions = ctx.channel.permissions_for(ctx.author) # type: ignore missing = [perm for perm, value in perms.items() if getattr(permissions, perm) != value]