From c4ffb0537d5a1db28e68730eb4685434d4c9bbe6 Mon Sep 17 00:00:00 2001 From: mlnrDev Date: Sat, 18 Nov 2023 16:10:03 +0100 Subject: [PATCH] fix checking timeouts when calculating permissions --- cache/caches.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cache/caches.go b/cache/caches.go index 32fe5172..dfa05f42 100644 --- a/cache/caches.go +++ b/cache/caches.go @@ -2,6 +2,7 @@ package cache import ( "sync" + "time" "github.com/disgoorg/snowflake/v2" @@ -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 @@ -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 }