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
This commit is contained in:
Rapptz 2022-05-23 11:56:05 -04:00
parent 3dddddc8f9
commit 77baa06a99

View File

@ -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: