oops, actually check guild permissions as well in channel EveryonePermissions

This commit is contained in:
spiral 2021-08-15 01:04:04 -04:00
parent 4c97a9daf6
commit 55c56c4e58
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31

View File

@ -43,11 +43,12 @@ namespace Myriad.Extensions
if (channel.Type == Channel.ChannelType.Dm) if (channel.Type == Channel.ChannelType.Dm)
return PermissionSet.Dm; return PermissionSet.Dm;
var defaultPermissions = cache.GetGuild(channel.GuildId!.Value).EveryonePermissions();
var overwrite = channel.PermissionOverwrites?.FirstOrDefault(r => r.Id == channel.GuildId); var overwrite = channel.PermissionOverwrites?.FirstOrDefault(r => r.Id == channel.GuildId);
if (overwrite == null) if (overwrite == null)
return cache.GetGuild(channel.GuildId!.Value).EveryonePermissions(); return defaultPermissions;
var perms = PermissionSet.None; var perms = defaultPermissions;
perms &= ~overwrite.Deny; perms &= ~overwrite.Deny;
perms |= overwrite.Allow; perms |= overwrite.Allow;