mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: gateway service
This commit is contained in:
parent
1118d8bdf8
commit
e4ed354536
50 changed files with 1737 additions and 545 deletions
|
|
@ -100,15 +100,18 @@ public static class DiscordCacheExtensions
|
|||
await cache.SaveChannel(thread);
|
||||
}
|
||||
|
||||
public static async Task<PermissionSet> BotPermissionsIn(this IDiscordCache cache, ulong channelId)
|
||||
public static async Task<PermissionSet> BotPermissionsIn(this IDiscordCache cache, ulong guildId, ulong channelId)
|
||||
{
|
||||
var channel = await cache.GetRootChannel(channelId);
|
||||
if (cache is HttpDiscordCache)
|
||||
return await ((HttpDiscordCache)cache).BotPermissions(guildId, channelId);
|
||||
|
||||
var channel = await cache.GetRootChannel(guildId, channelId);
|
||||
|
||||
if (channel.GuildId != null)
|
||||
{
|
||||
var userId = cache.GetOwnUser();
|
||||
var member = await cache.TryGetSelfMember(channel.GuildId.Value);
|
||||
return await cache.PermissionsFor2(channelId, userId, member);
|
||||
return await cache.PermissionsFor2(guildId, channelId, userId, member);
|
||||
}
|
||||
|
||||
return PermissionSet.Dm;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue