Skip to content

Commit

Permalink
fix checking timeouts when calculating permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
mlnrDev committed Nov 18, 2023
1 parent 7e8c825 commit c4ffb05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cache/caches.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cache

import (
"sync"
"time"

"github.com/disgoorg/snowflake/v2"

Expand Down Expand Up @@ -813,7 +814,7 @@ func (c *cachesImpl) MemberPermissions(member discord.Member) discord.Permission
return discord.PermissionsAll
}
}
if member.CommunicationDisabledUntil != nil {
if member.CommunicationDisabledUntil != nil && member.CommunicationDisabledUntil.After(time.Now()) {
permissions &= discord.PermissionViewChannel | discord.PermissionReadMessageHistory
}
return permissions
Expand Down Expand Up @@ -854,7 +855,7 @@ func (c *cachesImpl) MemberPermissionsInChannel(channel discord.GuildChannel, me
permissions &= ^deny
permissions |= allow

if member.CommunicationDisabledUntil != nil {
if member.CommunicationDisabledUntil != nil && member.CommunicationDisabledUntil.After(time.Now()) {
permissions &= discord.PermissionViewChannel | discord.PermissionReadMessageHistory
}

Expand Down

1 comment on commit c4ffb05

@sebm253
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discord doesn't reset this field when the timeout runs out. thanks Discord

Please sign in to comment.