Skip to content

Commit

Permalink
commands.has_permissions() return True in DM channels (fix #1576) (#1577
Browse files Browse the repository at this point in the history
)


Co-authored-by: Lala Sabathil <lala@pycord.dev>
Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 25, 2022
1 parent 3b1a281 commit d6b91cf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions discord/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit d6b91cf

Please sign in to comment.