From 77baa06a99b00b50d24398714bce40fcda1fa0c2 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 23 May 2022 11:56:05 -0400 Subject: [PATCH] Fix bug in permission resolution when dealing with timed out members This would lead to timed out members having the read_messages permission set to True instead of False --- discord/abc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/discord/abc.py b/discord/abc.py index 7e7ffedfe..2f78f36d0 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -732,12 +732,6 @@ class GuildChannel: if base.administrator: return Permissions.all() - if obj.is_timed_out(): - # Timeout leads to every permission except VIEW_CHANNEL and READ_MESSAGE_HISTORY - # being explicitly denied - base.value &= Permissions._timeout_mask() - return base - # Apply @everyone allow/deny first since it's special try: maybe_everyone = self._overwrites[0] @@ -779,6 +773,12 @@ class GuildChannel: denied = Permissions.all_channel() base.value &= ~denied.value + if obj.is_timed_out(): + # Timeout leads to every permission except VIEW_CHANNEL and READ_MESSAGE_HISTORY + # being explicitly denied + # N.B.: This *must* come last, because it's a conclusive mask + base.value &= Permissions._timeout_mask() + return base async def delete(self, *, reason: Optional[str] = None) -> None: