Browse Source

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
pull/8062/head
Rapptz 3 years ago
parent
commit
77baa06a99
  1. 12
      discord/abc.py

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

Loading…
Cancel
Save