Take into consideration member timeouts in permission calculations

This commit is contained in:
Rapptz
2022-04-01 09:32:54 -04:00
parent 25ad5b675c
commit a5f1c2f592
3 changed files with 22 additions and 2 deletions

View File

@@ -538,6 +538,7 @@ class GuildChannel:
- Guild roles
- Channel overrides
- Member overrides
- Member timeout
If a :class:`~discord.Role` is passed, then it checks the permissions
someone with that role would have, which is essentially:
@@ -624,6 +625,12 @@ 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]