mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: fetch from REST instead of cache for cross-cluster lookups
This commit is contained in:
parent
d0ad7abb03
commit
ae543b9c18
7 changed files with 80 additions and 19 deletions
|
|
@ -59,14 +59,14 @@ public static class PermissionExtensions
|
|||
}
|
||||
|
||||
public static PermissionSet EveryonePermissions(this Guild guild) =>
|
||||
guild.Roles.FirstOrDefault(r => r.Id == guild.Id)?.Permissions ?? PermissionSet.Dm;
|
||||
guild.Roles.FirstOrDefault(r => r.Id == guild.Id)!.Permissions;
|
||||
|
||||
public static async Task<PermissionSet> EveryonePermissions(this IDiscordCache cache, Channel channel)
|
||||
public static PermissionSet EveryonePermissions(Guild guild, Channel channel)
|
||||
{
|
||||
if (channel.Type == Channel.ChannelType.Dm)
|
||||
return PermissionSet.Dm;
|
||||
|
||||
var defaultPermissions = (await cache.GetGuild(channel.GuildId!.Value)).EveryonePermissions();
|
||||
var defaultPermissions = guild.EveryonePermissions();
|
||||
var overwrite = channel.PermissionOverwrites?.FirstOrDefault(r => r.Id == channel.GuildId);
|
||||
if (overwrite == null)
|
||||
return defaultPermissions;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue